/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

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