home *** CD-ROM | disk | FTP | other *** search
- /* ====================================================================
- * Copyright (c) 1995-1997 The Apache Group. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * apache@apache.org.
- *
- * 5. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Group and was originally based
- * on public domain software written at the National Center for
- * Supercomputing Applications, University of Illinois, Urbana-Champaign.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- */
-
- #include "httpd.h"
- #include "http_config.h"
- #include "http_log.h"
-
- #include <sys/types.h>
- #include <login_cap.h>
-
- typedef struct {
- char *class;
- } process_class_rec;
-
- module MODULE_VAR_EXPORT setclass_module;
-
- static void *create_class_store(pool *p, server_rec *dummy)
- {
- process_class_rec *new =
- (process_class_rec *) ap_palloc(p, sizeof(process_class_rec));
- new->class = NULL;
- return new;
- }
-
- static void set_freebsd_class(server_rec *s, pool *p)
- {
- int err;
- process_class_rec *class_rec =
- ap_get_module_config(s->module_config, &setclass_module);
- if (class_rec->class) {
- err = setclasscontext(class_rec->class, LOGIN_SETRESOURCES);
- if (err == -1) ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, s,
- "Failed to set loginclass to: %s", class_rec->class);
-
- }
- }
-
- static const char *remember_class(cmd_parms *cmd, void *dconf, char *class)
- {
- process_class_rec *class_rec = ap_get_module_config(cmd->server->module_config, &setclass_module);
- class_rec->class = ap_pstrdup(cmd->pool, class);
- /* ap_aplog_error(APLOG_MARK, APLOG_NOTICE|APLOG_NOERRNO, cmd->server,
- "loginclass will be set to '%s' for each child; see syslog for errors", class);
- */
- return NULL;
- }
-
- static command_rec class_cmds[] =
- {
- {"LoginClass", remember_class, NULL, RSRC_CONF, TAKE1,
- "a login class name"},
- {NULL}
- };
-
- module MODULE_VAR_EXPORT setclass_module =
- {
- STANDARD_MODULE_STUFF,
- NULL, /* initializer */
- NULL, /* dir config creater */
- NULL, /* dir merger --- default is to override */
- create_class_store, /* server config */
- NULL, /* merge server configs */
- class_cmds, /* command table */
- NULL, /* handlers */
- NULL, /* filename translation */
- NULL, /* check_user_id */
- NULL, /* check auth */
- NULL, /* check access */
- NULL, /* type_checker */
- NULL, /* fixups */
- NULL, /* logger */
- NULL, /* header parser */
- set_freebsd_class, /* child_init */
- NULL, /* child_exit */
- NULL /* post read-request */
- };
-