00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00025 #ifndef UNIXD_H
00026 #define UNIXD_H
00027
00028 #include "httpd.h"
00029 #include "http_config.h"
00030 #include "ap_listen.h"
00031 #ifdef HAVE_SYS_TIME_H
00032 #include <sys/time.h>
00033 #endif
00034 #ifdef HAVE_SYS_RESOURCE_H
00035 #include <sys/resource.h>
00036 #endif
00037 #include "apr_hooks.h"
00038 #include "apr_thread_proc.h"
00039 #include "apr_proc_mutex.h"
00040 #include "apr_global_mutex.h"
00041
00042 #include <pwd.h>
00043 #include <grp.h>
00044 #ifdef APR_HAVE_SYS_TYPES_H
00045 #include <sys/types.h>
00046 #endif
00047 #ifdef HAVE_SYS_IPC_H
00048 #include <sys/ipc.h>
00049 #endif
00050
00051 typedef struct {
00052 uid_t uid;
00053 gid_t gid;
00054 int userdir;
00055 } ap_unix_identity_t;
00056
00057 AP_DECLARE_HOOK(ap_unix_identity_t *, get_suexec_identity,(const request_rec *r))
00058
00059
00060
00061
00062
00063 #ifndef DEFAULT_USER
00064 #define DEFAULT_USER "#-1"
00065 #endif
00066 #ifndef DEFAULT_GROUP
00067 #define DEFAULT_GROUP "#-1"
00068 #endif
00069
00070 typedef struct {
00071 const char *user_name;
00072 uid_t user_id;
00073 gid_t group_id;
00074 int suexec_enabled;
00075 } unixd_config_rec;
00076 AP_DECLARE_DATA extern unixd_config_rec unixd_config;
00077
00078 AP_DECLARE(int) unixd_setup_child(void);
00079 AP_DECLARE(void) unixd_pre_config(apr_pool_t *ptemp);
00080 AP_DECLARE(const char *) unixd_set_user(cmd_parms *cmd, void *dummy,
00081 const char *arg);
00082 AP_DECLARE(const char *) unixd_set_group(cmd_parms *cmd, void *dummy,
00083 const char *arg);
00084 #if defined(RLIMIT_CPU) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_NPROC) || defined(RLIMIT_AS)
00085 AP_DECLARE(void) unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit,
00086 const char *arg, const char * arg2, int type);
00087 #endif
00088
00098 AP_DECLARE(apr_status_t) unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex);
00099 AP_DECLARE(apr_status_t) unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex);
00100 AP_DECLARE(apr_status_t) unixd_accept(void **accepted, ap_listen_rec *lr, apr_pool_t *ptrans);
00101
00102 #ifdef HAVE_KILLPG
00103 #define unixd_killpg(x, y) (killpg ((x), (y)))
00104 #define ap_os_killpg(x, y) (killpg ((x), (y)))
00105 #else
00106 #define unixd_killpg(x, y) (kill (-(x), (y)))
00107 #define ap_os_killpg(x, y) (kill (-(x), (y)))
00108 #endif
00109
00110 #define UNIX_DAEMON_COMMANDS \
00111 AP_INIT_TAKE1("User", unixd_set_user, NULL, RSRC_CONF, \
00112 "Effective user id for this server"), \
00113 AP_INIT_TAKE1("Group", unixd_set_group, NULL, RSRC_CONF, \
00114 "Effective group id for this server")
00115
00116 #endif
00117