apr_user.inc 6.6 KB

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