diff options
| author | mturk <mturk@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-07 09:05:54 +0000 |
|---|---|---|
| committer | mturk <mturk@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-07 09:05:54 +0000 |
| commit | f7bb349f452a437ce25a6f28e2a697ee778be019 (patch) | |
| tree | 72195709836055ff4c591d5f9716fbe183e463e6 /threadproc/unix | |
| parent | ab3d0e19572d404272244af8600a9d865b201719 (diff) | |
| download | libapr-f7bb349f452a437ce25a6f28e2a697ee778be019.tar.gz | |
Add object perms set macros and implement them for shm and mutex
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@741862 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc/unix')
| -rw-r--r-- | threadproc/unix/proc.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/threadproc/unix/proc.c b/threadproc/unix/proc.c index d07540138..36c57b602 100644 --- a/threadproc/unix/proc.c +++ b/threadproc/unix/proc.c @@ -463,7 +463,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 ((status = setgid(attr->gid))) { @@ -708,3 +720,20 @@ APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, 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) +{ + 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; +} |
