diff options
author | jim <jim@13f79535-47bb-0310-9956-ffa450edef68> | 2014-04-28 12:08:38 +0000 |
---|---|---|
committer | jim <jim@13f79535-47bb-0310-9956-ffa450edef68> | 2014-04-28 12:08:38 +0000 |
commit | 1da8496097d269c59f0c92a8b06f55fa54e54790 (patch) | |
tree | a42a98c2692192ad8d600448dd9718e1b9e9770e /threadproc | |
parent | 566132d9403322179882441c34bdbb9d0e5f791c (diff) | |
download | libapr-1da8496097d269c59f0c92a8b06f55fa54e54790.tar.gz |
Merge r741862, r741866 from trunk:
Add object perms set macros and implement them for shm and mutex
Submitted by: mturk, rpluem
Reviewed/backported by: jim
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.6.x@1590617 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc')
-rw-r--r-- | threadproc/beos/proc.c | 8 | ||||
-rw-r--r-- | threadproc/netware/proc.c | 8 | ||||
-rw-r--r-- | threadproc/os2/proc.c | 8 | ||||
-rw-r--r-- | threadproc/unix/proc.c | 30 | ||||
-rw-r--r-- | threadproc/win32/proc.c | 8 |
5 files changed, 61 insertions, 1 deletions
diff --git a/threadproc/beos/proc.c b/threadproc/beos/proc.c index 97c05a70a..e3698082f 100644 --- a/threadproc/beos/proc.c +++ b/threadproc/beos/proc.c @@ -444,3 +444,11 @@ APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr, { return APR_ENOTIMPL; } + +APR_DECLARE(apr_status_t) apr_procattr_perms_set_register(apr_procattr_t *attr, + apr_perms_setfn_t *perms_set_fn, + void *data, + apr_fileperms_t perms) +{ + return APR_ENOTIMPL; +} diff --git a/threadproc/netware/proc.c b/threadproc/netware/proc.c index d2404a821..e5306f9d8 100644 --- a/threadproc/netware/proc.c +++ b/threadproc/netware/proc.c @@ -505,3 +505,11 @@ APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr, /* Always return SUCCESS because NetWare threads don't run within a group */ return APR_SUCCESS; } + +APR_DECLARE(apr_status_t) apr_procattr_perms_set_register(apr_procattr_t *attr, + apr_perms_setfn_t *perms_set_fn, + void *data, + apr_fileperms_t perms) +{ + return APR_ENOTIMPL; +} diff --git a/threadproc/os2/proc.c b/threadproc/os2/proc.c index bae2785f0..96f76d699 100644 --- a/threadproc/os2/proc.c +++ b/threadproc/os2/proc.c @@ -662,3 +662,11 @@ APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr, { return APR_ENOTIMPL; } + +APR_DECLARE(apr_status_t) apr_procattr_perms_set_register(apr_procattr_t *attr, + apr_perms_setfn_t *perms_set_fn, + void *data, + apr_fileperms_t perms) +{ + return APR_ENOTIMPL; +} diff --git a/threadproc/unix/proc.c b/threadproc/unix/proc.c index 3588a86b0..591db7900 100644 --- a/threadproc/unix/proc.c +++ b/threadproc/unix/proc.c @@ -461,7 +461,19 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, _exit(-1); /* We have big problems, the child should exit. */ } } - + if (!geteuid()) { + apr_procattr_pscb_t *c = attr->perms_set_callbacks; + + while (c) { + apr_status_t r; + r = (*c->perms_set_fn)((void *)c->data, c->perms, + attr->uid, attr->gid); + if (r != APR_SUCCESS || r != APR_ENOTIMPL) { + _exit(-1); + } + c = c->next; + } + } /* Only try to switch if we are running as root */ if (attr->gid != -1 && !geteuid()) { if (setgid(attr->gid)) { @@ -709,3 +721,19 @@ APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, } #endif /* APR_HAVE_STRUCT_RLIMIT */ +APR_DECLARE(apr_status_t) apr_procattr_perms_set_register(apr_procattr_t *attr, + apr_perms_setfn_t *perms_set_fn, + void *data, + apr_fileperms_t perms) +{ + apr_procattr_pscb_t *c; + + c = apr_palloc(attr->pool, sizeof(apr_procattr_pscb_t)); + c->data = data; + c->perms = perms; + c->perms_set_fn = perms_set_fn; + c->next = attr->perms_set_callbacks; + attr->perms_set_callbacks = c; + + return APR_SUCCESS; +} diff --git a/threadproc/win32/proc.c b/threadproc/win32/proc.c index f9893f679..c9fa4dd92 100644 --- a/threadproc/win32/proc.c +++ b/threadproc/win32/proc.c @@ -1148,3 +1148,11 @@ APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize) { return APR_ENOTIMPL; } + +APR_DECLARE(apr_status_t) apr_procattr_perms_set_register(apr_procattr_t *attr, + apr_perms_setfn_t *perms_set_fn, + void *data, + apr_fileperms_t perms) +{ + return APR_ENOTIMPL; +} |