Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
unixd.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
25 #ifndef UNIXD_H
26 #define UNIXD_H
27 
28 #include "httpd.h"
29 #include "http_config.h"
30 #include "ap_listen.h"
31 #ifdef HAVE_SYS_TIME_H
32 #include <sys/time.h>
33 #endif
34 #ifdef HAVE_SYS_RESOURCE_H
35 #include <sys/resource.h>
36 #endif
37 #include "apr_hooks.h"
38 #include "apr_thread_proc.h"
39 #include "apr_proc_mutex.h"
40 #include "apr_global_mutex.h"
41 
42 #include <pwd.h>
43 #include <grp.h>
44 #if APR_HAVE_SYS_TYPES_H
45 #include <sys/types.h>
46 #endif
47 #ifdef HAVE_SYS_IPC_H
48 #include <sys/ipc.h>
49 #endif
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 typedef struct {
56  uid_t uid;
57  gid_t gid;
58  int userdir;
60 
62 
63 
64 /* Default user name and group name. These may be specified as numbers by
65  * placing a # before a number */
66 
67 #ifndef DEFAULT_USER
68 #define DEFAULT_USER "#-1"
69 #endif
70 #ifndef DEFAULT_GROUP
71 #define DEFAULT_GROUP "#-1"
72 #endif
73 
74 typedef struct {
75  const char *user_name;
76  const char *group_name;
77  uid_t user_id;
78  gid_t group_id;
80  const char *chroot_dir;
81  const char *suexec_disabled_reason; /* suitable msg if !suexec_enabled */
84 
85 #if defined(RLIMIT_CPU) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_NPROC) || defined(RLIMIT_AS)
86 AP_DECLARE(void) ap_unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit,
87  const char *arg,
88  const char * arg2, int type);
89 #endif
90 
102 AP_DECLARE(apr_status_t) ap_unixd_accept(void **accepted, ap_listen_rec *lr, apr_pool_t *ptrans);
103 
104 #ifdef HAVE_KILLPG
105 #define ap_unixd_killpg(x, y) (killpg ((x), (y)))
106 #define ap_os_killpg(x, y) (killpg ((x), (y)))
107 #else /* HAVE_KILLPG */
108 #define ap_unixd_killpg(x, y) (kill (-(x), (y)))
109 #define ap_os_killpg(x, y) (kill (-(x), (y)))
110 #endif /* HAVE_KILLPG */
111 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif
117 
Apache Configuration.
uid_t user_id
Definition: unixd.h:77
int userdir
Definition: unixd.h:58
Definition: unixd.h:74
#define AP_DECLARE(x)
Definition: macros.h:1
uid_t uid
Definition: unixd.h:56
Definition: apr_arch_proc_mutex.h:27
Apache Listeners Library.
apr_status_t ap_unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex)
AP_DECLARE_DATA unixd_config_rec ap_unixd_config
Apache's listeners record.
Definition: ap_listen.h:47
apr_status_t ap_unixd_accept(void **accepted, ap_listen_rec *lr, apr_pool_t *ptrans)
Definition: apr_arch_global_mutex.h:23
Definition: unixd.h:55
#define AP_DECLARE_HOOK(ret, name, args)
Definition: ap_hooks.h:74
Definition: http_config.h:295
APR Global Locking Routines.
const char * group_name
Definition: unixd.h:76
HTTP Daemon routines.
Apache hook functions.
const char * chroot_dir
Definition: unixd.h:80
const char * suexec_disabled_reason
Definition: unixd.h:81
gid_t gid
Definition: unixd.h:57
const char * user_name
Definition: unixd.h:75
ap_unix_identity_t * get_suexec_identity(const request_rec *r)
APR Process Locking Routines.
APR Thread and Process Library.
gid_t group_id
Definition: unixd.h:78
A structure that represents the current request.
Definition: httpd.h:805
int suexec_enabled
Definition: unixd.h:79
#define AP_DECLARE_DATA
Definition: macros.h:15
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
int apr_status_t
Definition: apr_errno.h:44
request_rec * r
Definition: mod_dav.h:519
apr_status_t ap_unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex)