aclproto.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /** BEGIN COPYRIGHT BLOCK
  2. * This Program is free software; you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation; version 2 of the License.
  5. *
  6. * This Program is distributed in the hope that it will be useful, but WITHOUT
  7. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. *
  10. * You should have received a copy of the GNU General Public License along with
  11. * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  12. * Place, Suite 330, Boston, MA 02111-1307 USA.
  13. *
  14. * In addition, as a special exception, Red Hat, Inc. gives You the additional
  15. * right to link the code of this Program with code not covered under the GNU
  16. * General Public License ("Non-GPL Code") and to distribute linked combinations
  17. * including the two, subject to the limitations in this paragraph. Non-GPL Code
  18. * permitted under this exception must only link to the code of this Program
  19. * through those well defined interfaces identified in the file named EXCEPTION
  20. * found in the source code files (the "Approved Interfaces"). The files of
  21. * Non-GPL Code may instantiate templates or use macros or inline functions from
  22. * the Approved Interfaces without causing the resulting work to be covered by
  23. * the GNU General Public License. Only Red Hat, Inc. may make changes or
  24. * additions to the list of Approved Interfaces. You must obey the GNU General
  25. * Public License in all respects for all of the Program code and other code used
  26. * in conjunction with the Program except the Non-GPL Code covered by this
  27. * exception. If you modify this file, you may extend this exception to your
  28. * version of the file, but you are not obligated to do so. If you do not wish to
  29. * provide this exception without modification, you must delete this exception
  30. * statement from your version and license this file solely under the GPL without
  31. * exception.
  32. *
  33. *
  34. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  35. * Copyright (C) 2005 Red Hat, Inc.
  36. * All rights reserved.
  37. * END COPYRIGHT BLOCK **/
  38. #ifdef HAVE_CONFIG_H
  39. # include <config.h>
  40. #endif
  41. #ifndef ACL_PROTO_HEADER
  42. #define ACL_PROTO_HEADER
  43. #ifndef NOINTNSACL
  44. #define INTNSACL
  45. #endif /* !NOINTNSACL */
  46. #ifndef PUBLIC_NSACL_ACLDEF_H
  47. #include "public/nsacl/acldef.h"
  48. #endif /* !PUBLIC_NSACL_ACLDEF_H */
  49. #ifdef INTNSACL
  50. NSPR_BEGIN_EXTERN_C
  51. /*********************************************************************
  52. * ACL language and file interfaces
  53. *********************************************************************/
  54. NSAPI_PUBLIC ACLListHandle_t * ACL_ParseString(NSErr_t *errp, char *buffer);
  55. /*********************************************************************
  56. * ACL Expression construction interfaces
  57. *********************************************************************/
  58. NSAPI_PUBLIC ACLExprHandle_t *ACL_ExprNew(const ACLExprType_t expr_type);
  59. NSAPI_PUBLIC void ACL_ExprDestroy(ACLExprHandle_t *expr);
  60. NSAPI_PUBLIC int ACL_ExprSetPFlags(NSErr_t *errp, ACLExprHandle_t *expr, PFlags_t flags);
  61. NSAPI_PUBLIC int ACL_ExprClearPFlags(NSErr_t *errp, ACLExprHandle_t *expr);
  62. NSAPI_PUBLIC int ACL_ExprTerm(NSErr_t *errp, ACLExprHandle_t *acl_expr, const char *attr_name, CmpOp_t cmp, char *attr_pattern);
  63. NSAPI_PUBLIC int ACL_ExprNot(NSErr_t *errp, ACLExprHandle_t *acl_expr);
  64. NSAPI_PUBLIC int ACL_ExprAnd(NSErr_t *errp, ACLExprHandle_t *acl_expr);
  65. NSAPI_PUBLIC int ACL_ExprOr(NSErr_t *errp, ACLExprHandle_t *acl_expr);
  66. NSAPI_PUBLIC int ACL_ExprAddAuthInfo(ACLExprHandle_t *expr, PList_t auth_info);
  67. NSAPI_PUBLIC int ACL_ExprAddArg(NSErr_t *errp, ACLExprHandle_t *expr, const char *arg);
  68. NSAPI_PUBLIC int ACL_ExprSetDenyWith(NSErr_t *errp, ACLExprHandle_t *expr, char *deny_type, char *deny_response);
  69. NSAPI_PUBLIC int ACL_ExprGetDenyWith(NSErr_t *errp, ACLExprHandle_t *expr, char **deny_type, char **deny_response);
  70. /*********************************************************************
  71. * ACL manipulation
  72. *********************************************************************/
  73. NSAPI_PUBLIC ACLHandle_t * ACL_AclNew(NSErr_t *errp, char *tag);
  74. NSAPI_PUBLIC void ACL_AclDestroy(NSErr_t *errp, ACLHandle_t *acl);
  75. NSAPI_PUBLIC int ACL_ExprAppend(NSErr_t *errp, ACLHandle_t *acl, ACLExprHandle_t *expr);
  76. NSAPI_PUBLIC const char *ACL_AclGetTag(ACLHandle_t *acl);
  77. /*********************************************************************
  78. * ACL list manipulation
  79. *********************************************************************/
  80. NSAPI_PUBLIC ACLListHandle_t * ACL_ListNew(NSErr_t *errp);
  81. NSAPI_PUBLIC int ACL_ListConcat(NSErr_t *errp, ACLListHandle_t *acl_list1, ACLListHandle_t *acl_list2, int flags);
  82. NSAPI_PUBLIC int ACL_ListAppend(NSErr_t *errp, ACLListHandle_t *acllist, ACLHandle_t *acl, int flags);
  83. NSAPI_PUBLIC void ACL_ListDestroy(NSErr_t *errp, ACLListHandle_t *acllist);
  84. NSAPI_PUBLIC ACLHandle_t * ACL_ListFind(NSErr_t *errp, ACLListHandle_t *acllist, char *aclname, int flags);
  85. NSAPI_PUBLIC int ACL_ListAclDelete(NSErr_t *errp, ACLListHandle_t *acl_list, char *acl_name, int flags);
  86. NSAPI_PUBLIC int ACL_ListGetNameList(NSErr_t *errp, ACLListHandle_t *acl_list, char ***name_list);
  87. NSAPI_PUBLIC int ACL_NameListDestroy(NSErr_t *errp, char **name_list);
  88. NSAPI_PUBLIC ACLHandle_t *ACL_ListGetFirst(ACLListHandle_t *acl_list,
  89. ACLListEnum_t *acl_enum);
  90. NSAPI_PUBLIC ACLHandle_t *ACL_ListGetNext(ACLListHandle_t *acl_list,
  91. ACLListEnum_t *acl_enum);
  92. /* Only used for asserts. Probably shouldn't be publicly advertized */
  93. extern int ACL_AssertAcllist( ACLListHandle_t *acllist );
  94. /* Need to be ACL_LIB_INTERNAL */
  95. NSAPI_PUBLIC int ACL_ListPostParseForAuth(NSErr_t *errp, ACLListHandle_t *acl_list);
  96. /*********************************************************************
  97. * ACL evaluation
  98. *********************************************************************/
  99. NSAPI_PUBLIC int ACL_EvalTestRights(NSErr_t *errp, ACLEvalHandle_t *acleval, const char **rights, const char **map_generic, char **deny_type, char **deny_response, char **acl_tag, int *expr_num);
  100. NSAPI_PUBLIC int ACL_CachableAclList(ACLListHandle_t *acllist);
  101. NSAPI_PUBLIC ACLEvalHandle_t * ACL_EvalNew(NSErr_t *errp, pool_handle_t *pool);
  102. NSAPI_PUBLIC void ACL_EvalDestroy(NSErr_t *errp, pool_handle_t *pool, ACLEvalHandle_t *acleval);
  103. NSAPI_PUBLIC void ACL_EvalDestroyNoDecrement(NSErr_t *errp, pool_handle_t *pool, ACLEvalHandle_t *acleval);
  104. NSAPI_PUBLIC int ACL_ListDecrement(NSErr_t *errp, ACLListHandle_t *acllist);
  105. NSAPI_PUBLIC int ACL_EvalSetACL(NSErr_t *errp, ACLEvalHandle_t *acleval, ACLListHandle_t *acllist);
  106. NSAPI_PUBLIC PList_t ACL_EvalGetSubject(NSErr_t *errp, ACLEvalHandle_t *acleval);
  107. NSAPI_PUBLIC int ACL_EvalSetSubject(NSErr_t *errp, ACLEvalHandle_t *acleval, PList_t subject);
  108. NSAPI_PUBLIC PList_t ACL_EvalGetResource(NSErr_t *errp, ACLEvalHandle_t *acleval);
  109. NSAPI_PUBLIC int ACL_EvalSetResource(NSErr_t *errp, ACLEvalHandle_t *acleval, PList_t resource);
  110. /*
  111. * The following entities are only meant to be called by whole server
  112. * products that include libaccess. E.g. the HTTP server, the Directory
  113. * server etc. They should not be called by ACL callers, LASs etc.
  114. */
  115. /*********************************************************************
  116. * ACL misc routines
  117. *********************************************************************/
  118. NSAPI_PUBLIC int ACL_Init(void);
  119. NSAPI_PUBLIC int ACL_InitPostMagnus(void);
  120. NSAPI_PUBLIC int ACL_LateInitPostMagnus(void);
  121. NSAPI_PUBLIC void ACL_ListHashUpdate(ACLListHandle_t **acllistp);
  122. NSAPI_PUBLIC int ACL_MethodNamesGet(NSErr_t *errp, char ***names, int *count);
  123. NSAPI_PUBLIC int ACL_MethodNamesFree(NSErr_t *errp, char **names, int count);
  124. NSAPI_PUBLIC int ACL_DatabaseNamesGet(NSErr_t *errp, char ***names, int *count);
  125. NSAPI_PUBLIC int ACL_DatabaseNamesFree(NSErr_t *errp, char **names, int count);
  126. NSAPI_PUBLIC int ACL_InitAttr2Index(void);
  127. NSAPI_PUBLIC int ACL_Attr2Index(const char *attrname);
  128. NSAPI_PUBLIC void ACL_Attr2IndexListDestroy();
  129. NSAPI_PUBLIC void ACL_AttrGetterHashDestroy(void);
  130. NSAPI_PUBLIC void ACL_Destroy(void);
  131. NSAPI_PUBLIC void ACL_DestroyPools(void);
  132. /*********************************************************************
  133. * ACL cache and flush utility
  134. *********************************************************************/
  135. NSAPI_PUBLIC int ACL_CacheCheck(char *uri, ACLListHandle_t **acllist_p);
  136. NSAPI_PUBLIC int ACL_CacheCheckGet(char *uri, ACLListHandle_t **acllist_p);
  137. NSAPI_PUBLIC void ACL_CacheEnter(char *uri, ACLListHandle_t **acllist_p);
  138. NSAPI_PUBLIC void ACL_CacheEnterGet(char *uri, ACLListHandle_t **acllist_p);
  139. NSAPI_PUBLIC int ACL_ListHashCheck(ACLListHandle_t **acllist_p);
  140. NSAPI_PUBLIC void ACL_ListHashEnter(ACLListHandle_t **acllist_p);
  141. NSAPI_PUBLIC int ACL_CacheFlush(void);
  142. NSAPI_PUBLIC void ACL_Restart(void *clntData);
  143. NSAPI_PUBLIC void ACL_CritEnter(void);
  144. NSAPI_PUBLIC void ACL_CritExit(void);
  145. /*********************************************************************
  146. * ACL CGI routines
  147. *********************************************************************/
  148. NSAPI_PUBLIC void ACL_OutputSelector(char *name, char **item);
  149. NSPR_END_EXTERN_C
  150. #endif /* INTNSACL */
  151. #endif