PageRenderTime 34ms CodeModel.GetById 11ms app.highlight 21ms RepoModel.GetById 0ms app.codeStats 0ms

/packages/httpd20/src/apr/apr_user.inc

https://github.com/slibre/freepascal
Pascal | 197 lines | 31 code | 25 blank | 141 comment | 0 complexity | a059efc575360662a27797991c309dde MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
  1{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
  2 * applicable.
  3 *
  4 * Licensed under the Apache License, Version 2.0 (the "License");
  5 * you may not use this file except in compliance with the License.
  6 * 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{
 18 * @file apr_user.h
 19 * @brief APR User ID Services 
 20 }
 21
 22{#include "apr.h"
 23#include "apr_errno.h"
 24#include "apr_pools.h"}
 25
 26{
 27 * @defgroup apr_user User and Group ID Services
 28 * @ingroup APR 
 29 }
 30
 31{
 32 * Structure for determining user ownership.
 33 }
 34type
 35{$ifdef WINDOWS}
 36  apr_uid_t = PSID;
 37{$else}
 38  apr_uid_t = uid_t;
 39{$endif}
 40
 41  Papr_uid_t = ^apr_uid_t;
 42
 43{
 44 * Structure for determining group ownership.
 45 }
 46{$ifdef WINDOWS}
 47  apr_gid_t = PSID;
 48{$else}
 49  apr_gid_t = gid_t;
 50{$endif}
 51
 52  Papr_gid_t = ^apr_gid_t;
 53
 54{$define APR_HAS_USER}
 55
 56{$ifdef APR_HAS_USER}
 57
 58{
 59 * Get the userid (and groupid) of the calling process
 60 * @param userid   Returns the user id
 61 * @param groupid  Returns the user's group id
 62 * @param p The pool from which to allocate working space
 63 * @remark This function is available only if APR_HAS_USER is defined.
 64 }
 65function apr_uid_current(userid: Papr_uid_t; groupid: Papr_gid_t;
 66 p: Papr_pool_t): apr_status_t;
 67 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 68 external LibAPR name LibNamePrefix + 'apr_uid_current' + LibSuff12;
 69
 70{ @deprecated @see apr_uid_current }
 71{APR_DECLARE(apr_status_t) apr_current_userid(apr_uid_t *userid,
 72                                             apr_gid_t *groupid,
 73                                             apr_pool_t *p);}
 74{
 75 * Get the user name for a specified userid
 76 * @param username Pointer to new string containing user name (on output)
 77 * @param userid The userid
 78 * @param p The pool from which to allocate the string
 79 * @remark This function is available only if APR_HAS_USER is defined.
 80 }
 81function apr_uid_name_get(username: PPChar; userid: apr_uid_t;
 82 p: Papr_pool_t): apr_status_t;
 83 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 84 external LibAPR name LibNamePrefix + 'apr_uid_name_get' + LibSuff12;
 85
 86{ @deprecated @see apr_uid_name_get }
 87{APR_DECLARE(apr_status_t) apr_get_username(char **username, apr_uid_t userid,
 88                                           apr_pool_t *p);}
 89{
 90 * Get the userid (and groupid) for the specified username
 91 * @param userid   Returns the user id
 92 * @param groupid  Returns the user's group id
 93 * @param username The username to lookup
 94 * @param p The pool from which to allocate working space
 95 * @remark This function is available only if APR_HAS_USER is defined.
 96 }
 97function apr_uid_get(userid: Papr_uid_t; groupid: Papr_gid_t;
 98 const username: PChar; p: Papr_pool_t): apr_status_t;
 99 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
100 external LibAPR name LibNamePrefix + 'apr_uid_get' + LibSuff16;
101
102{ @deprecated @see apr_uid_get }
103{APR_DECLARE(apr_status_t) apr_get_userid(apr_uid_t *userid, apr_gid_t *groupid,
104                                         const char *username, apr_pool_t *p);}
105
106{
107 * Get the home directory for the named user
108 * @param dirname Pointer to new string containing directory name (on output)
109 * @param username The named user
110 * @param p The pool from which to allocate the string
111 * @remark This function is available only if APR_HAS_USER is defined.
112 }
113function apr_uid_homepath_get(dirname: PPChar; const username: PChar;
114 p: Papr_pool_t): apr_status_t;
115 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
116 external LibAPR name LibNamePrefix + 'apr_uid_homepath_get' + LibSuff12;
117
118{ @deprecated @see apr_uid_homepath_get }
119{APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname,
120                                                 const char *username,
121                                                 apr_pool_t *p);}
122
123{
124 * Compare two user identifiers for equality.
125 * @param left One uid to test
126 * @param right Another uid to test
127 * @return APR_SUCCESS if the apr_uid_t strutures identify the same user,
128 * APR_EMISMATCH if not, APR_BADARG if an apr_uid_t is invalid.
129 * @remark This function is available only if APR_HAS_USER is defined.
130 }
131{$ifdef WINDOWS}
132//APR_DECLARE(apr_status_t) apr_uid_compare(apr_uid_t left, apr_uid_t right);
133
134{ @deprecated @see apr_uid_compare }
135//APR_DECLARE(apr_status_t) apr_compare_users(apr_uid_t left, apr_uid_t right);
136{$else}
137//#define apr_uid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
138{ @deprecated @see apr_uid_compare }
139//#define apr_compare_users(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
140{$endif}
141
142{
143 * Get the group name for a specified groupid
144 * @param groupname Pointer to new string containing group name (on output)
145 * @param groupid The groupid
146 * @param p The pool from which to allocate the string
147 * @remark This function is available only if APR_HAS_USER is defined.
148 }
149function apr_gid_name_get(groupname: PPChar; groupid: apr_gid_t;
150 p: Papr_pool_t): apr_status_t;
151 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
152 external LibAPR name LibNamePrefix + 'apr_gid_name_get' + LibSuff12;
153
154{ @deprecated @see apr_gid_name_get }
155{APR_DECLARE(apr_status_t) apr_group_name_get(char **groupname,
156                                             apr_gid_t groupid, apr_pool_t *p);}
157
158{ @deprecated @see apr_gid_name_get }
159{APR_DECLARE(apr_status_t) apr_get_groupname(char **groupname,
160                                            apr_gid_t groupid, apr_pool_t *p);}
161
162{
163 * Get the groupid for a specified group name
164 * @param groupid Pointer to the group id (on output)
165 * @param groupname The group name to look up
166 * @param p The pool from which to allocate the string
167 * @remark This function is available only if APR_HAS_USER is defined.
168 }
169function apr_gid_get(groupid: Papr_gid_t; const groupname: PChar;
170 p: Papr_pool_t): apr_status_t;
171 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
172 external LibAPR name LibNamePrefix + 'apr_gid_get' + LibSuff12;
173
174{ @deprecated @see apr_gid_get }
175{APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *groupid,
176                                          const char *groupname, apr_pool_t *p);}
177
178{
179 * Compare two group identifiers for equality.
180 * @param left One gid to test
181 * @param right Another gid to test
182 * @return APR_SUCCESS if the apr_gid_t strutures identify the same group,
183 * APR_EMISMATCH if not, APR_BADARG if an apr_gid_t is invalid.
184 * @remark This function is available only if APR_HAS_USER is defined.
185 }
186{$ifdef WINDOWS}
187//APR_DECLARE(apr_status_t) apr_gid_compare(apr_gid_t left, apr_gid_t right);
188{ @deprecated @see apr_gid_compare }
189//APR_DECLARE(apr_status_t) apr_compare_groups(apr_gid_t left, apr_gid_t right);
190{$else}
191//#define apr_gid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
192{ @deprecated @see apr_gid_compare }
193//#define apr_compare_groups(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
194{$endif}
195
196{$endif}  { ! APR_HAS_USER }
197