Apache HTTPD
fileacc.c
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
17#include "apr_strings.h"
18#include "apr_arch_file_io.h"
19
20/* A file to put ALL of the accessor functions for apr_file_t types. */
21
28
33
34#if !defined(OS2) && !defined(WIN32)
36{
37 mode_t mode = 0;
38
39 if (perms & APR_USETID)
40 mode |= S_ISUID;
41 if (perms & APR_UREAD)
42 mode |= S_IRUSR;
43 if (perms & APR_UWRITE)
44 mode |= S_IWUSR;
45 if (perms & APR_UEXECUTE)
46 mode |= S_IXUSR;
47
48 if (perms & APR_GSETID)
49 mode |= S_ISGID;
50 if (perms & APR_GREAD)
51 mode |= S_IRGRP;
52 if (perms & APR_GWRITE)
53 mode |= S_IWGRP;
54 if (perms & APR_GEXECUTE)
55 mode |= S_IXGRP;
56
57#ifdef S_ISVTX
58 if (perms & APR_WSTICKY)
59 mode |= S_ISVTX;
60#endif
61 if (perms & APR_WREAD)
62 mode |= S_IROTH;
63 if (perms & APR_WWRITE)
64 mode |= S_IWOTH;
65 if (perms & APR_WEXECUTE)
66 mode |= S_IXOTH;
67
68 return mode;
69}
70
72{
74
75 if (mode & S_ISUID)
77 if (mode & S_IRUSR)
79 if (mode & S_IWUSR)
81 if (mode & S_IXUSR)
83
84 if (mode & S_ISGID)
86 if (mode & S_IRGRP)
88 if (mode & S_IWGRP)
90 if (mode & S_IXGRP)
92
93#ifdef S_ISVTX
94 if (mode & S_ISVTX)
96#endif
97 if (mode & S_IROTH)
99 if (mode & S_IWOTH)
100 perms |= APR_WWRITE;
101 if (mode & S_IXOTH)
103
104 return perms;
105}
106#endif
107
110{
112}
113
115 const char *key,
116 apr_status_t (*cleanup)(void *))
117{
119}
mode_t
Definition aplibtool.c:31
APR Strings library.
apr_file_t * f
apr_dbd_transaction_t int mode
Definition apr_dbd.h:261
const void apr_status_t(*) apr_status_t(* APR_DECLARE)(void) apr_pool_pre_cleanup_register(apr_pool_t *p
Definition apr_pools.h:646
apr_size_t size
#define APR_SUCCESS
Definition apr_errno.h:225
int apr_status_t
Definition apr_errno.h:44
apr_int32_t apr_fileperms_t
apr_file_t * thefile
const char * key
const char apr_fileperms_t perms
void * data
const char apr_file_t * file
void const char apr_status_t(* cleanup)(void *))
#define APR_GREAD
#define APR_UEXECUTE
#define APR_GSETID
#define APR_UWRITE
#define APR_UREAD
#define APR_WREAD
#define APR_GWRITE
#define APR_GEXECUTE
#define APR_WWRITE
#define APR_WEXECUTE
#define APR_WSTICKY
#define APR_USETID
const char * fname
apr_int32_t flags
apr_pool_t * pool
mode_t apr_unix_perms2mode(apr_fileperms_t perms)
Definition fileacc.c:35
apr_fileperms_t apr_unix_mode2perms(mode_t mode)
Definition fileacc.c:71