| 33 | #include "mod_md_os.h" |
| 34 | |
| 35 | apr_status_t md_try_chown(const char *fname, unsigned int uid, int gid, apr_pool_t *p) |
| 36 | { |
| 37 | #if AP_NEED_SET_MUTEX_PERMS && HAVE_UNISTD_H |
| 38 | /* Since we only switch user when running as root, we only need to chown directories |
| 39 | * in that case. Otherwise, the server will ignore any "user/group" directives and |
| 40 | * child processes have the same privileges as the parent. |
| 41 | */ |
| 42 | if (!geteuid()) { |
| 43 | if (-1 == chown(fname, (uid_t)uid, (gid_t)gid)) { |
| 44 | apr_status_t rv = APR_FROM_OS_ERROR(errno); |
| 45 | if (!APR_STATUS_IS_ENOENT(rv)) { |
| 46 | ap_log_perror(APLOG_MARK, APLOG_ERR, rv, p, APLOGNO(10082) |
| 47 | "Can't change owner of %s", fname); |
| 48 | } |
| 49 | return rv; |
| 50 | } |
| 51 | } |
| 52 | return APR_SUCCESS; |
| 53 | #else |
| 54 | return APR_ENOTIMPL; |
| 55 | #endif |
| 56 | } |
| 57 | |
| 58 | apr_status_t md_make_worker_accessible(const char *fname, apr_pool_t *p) |
| 59 | { |
no outgoing calls
no test coverage detected