aclproto.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  3. * Copyright (C) 2005 Red Hat, Inc.
  4. * All rights reserved.
  5. *
  6. * License: GPL (version 3 or any later version).
  7. * See LICENSE for details.
  8. * END COPYRIGHT BLOCK **/
  9. #ifdef HAVE_CONFIG_H
  10. # include <config.h>
  11. #endif
  12. #ifndef ACL_PROTO_HEADER
  13. #define ACL_PROTO_HEADER
  14. #ifndef NOINTNSACL
  15. #define INTNSACL
  16. #endif /* !NOINTNSACL */
  17. #ifndef PUBLIC_NSACL_ACLDEF_H
  18. #include "public/nsacl/acldef.h"
  19. #endif /* !PUBLIC_NSACL_ACLDEF_H */
  20. #ifdef INTNSACL
  21. NSPR_BEGIN_EXTERN_C
  22. /*********************************************************************
  23. * ACL language and file interfaces
  24. *********************************************************************/
  25. NSAPI_PUBLIC ACLListHandle_t * ACL_ParseString(NSErr_t *errp, char *buffer);
  26. /*********************************************************************
  27. * ACL Expression construction interfaces
  28. *********************************************************************/
  29. NSAPI_PUBLIC ACLExprHandle_t *ACL_ExprNew(const ACLExprType_t expr_type);
  30. NSAPI_PUBLIC void ACL_ExprDestroy(ACLExprHandle_t *expr);
  31. NSAPI_PUBLIC int ACL_ExprSetPFlags(NSErr_t *errp, ACLExprHandle_t *expr, PFlags_t flags);
  32. NSAPI_PUBLIC int ACL_ExprClearPFlags(NSErr_t *errp, ACLExprHandle_t *expr);
  33. NSAPI_PUBLIC int ACL_ExprTerm(NSErr_t *errp, ACLExprHandle_t *acl_expr, const char *attr_name, CmpOp_t cmp, char *attr_pattern);
  34. NSAPI_PUBLIC int ACL_ExprNot(NSErr_t *errp, ACLExprHandle_t *acl_expr);
  35. NSAPI_PUBLIC int ACL_ExprAnd(NSErr_t *errp, ACLExprHandle_t *acl_expr);
  36. NSAPI_PUBLIC int ACL_ExprOr(NSErr_t *errp, ACLExprHandle_t *acl_expr);
  37. NSAPI_PUBLIC int ACL_ExprAddAuthInfo(ACLExprHandle_t *expr, PList_t auth_info);
  38. NSAPI_PUBLIC int ACL_ExprAddArg(NSErr_t *errp, ACLExprHandle_t *expr, const char *arg);
  39. NSAPI_PUBLIC int ACL_ExprSetDenyWith(NSErr_t *errp, ACLExprHandle_t *expr, char *deny_type, char *deny_response);
  40. NSAPI_PUBLIC int ACL_ExprGetDenyWith(NSErr_t *errp, ACLExprHandle_t *expr, char **deny_type, char **deny_response);
  41. /*********************************************************************
  42. * ACL manipulation
  43. *********************************************************************/
  44. NSAPI_PUBLIC ACLHandle_t * ACL_AclNew(NSErr_t *errp, char *tag);
  45. NSAPI_PUBLIC void ACL_AclDestroy(NSErr_t *errp, ACLHandle_t *acl);
  46. NSAPI_PUBLIC int ACL_ExprAppend(NSErr_t *errp, ACLHandle_t *acl, ACLExprHandle_t *expr);
  47. NSAPI_PUBLIC const char *ACL_AclGetTag(ACLHandle_t *acl);
  48. /*********************************************************************
  49. * ACL list manipulation
  50. *********************************************************************/
  51. NSAPI_PUBLIC ACLListHandle_t * ACL_ListNew(NSErr_t *errp);
  52. NSAPI_PUBLIC int ACL_ListConcat(NSErr_t *errp, ACLListHandle_t *acl_list1, ACLListHandle_t *acl_list2, int flags);
  53. NSAPI_PUBLIC int ACL_ListAppend(NSErr_t *errp, ACLListHandle_t *acllist, ACLHandle_t *acl, int flags);
  54. NSAPI_PUBLIC void ACL_ListDestroy(NSErr_t *errp, ACLListHandle_t *acllist);
  55. NSAPI_PUBLIC ACLHandle_t * ACL_ListFind(NSErr_t *errp, ACLListHandle_t *acllist, char *aclname, int flags);
  56. NSAPI_PUBLIC int ACL_ListAclDelete(NSErr_t *errp, ACLListHandle_t *acl_list, char *acl_name, int flags);
  57. NSAPI_PUBLIC int ACL_ListGetNameList(NSErr_t *errp, ACLListHandle_t *acl_list, char ***name_list);
  58. NSAPI_PUBLIC int ACL_NameListDestroy(NSErr_t *errp, char **name_list);
  59. NSAPI_PUBLIC ACLHandle_t *ACL_ListGetFirst(ACLListHandle_t *acl_list,
  60. ACLListEnum_t *acl_enum);
  61. NSAPI_PUBLIC ACLHandle_t *ACL_ListGetNext(ACLListHandle_t *acl_list,
  62. ACLListEnum_t *acl_enum);
  63. /* Only used for asserts. Probably shouldn't be publicly advertized */
  64. extern int ACL_AssertAcllist( ACLListHandle_t *acllist );
  65. /* Need to be ACL_LIB_INTERNAL */
  66. NSAPI_PUBLIC int ACL_ListPostParseForAuth(NSErr_t *errp, ACLListHandle_t *acl_list);
  67. /*********************************************************************
  68. * ACL evaluation
  69. *********************************************************************/
  70. 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);
  71. NSAPI_PUBLIC int ACL_CachableAclList(ACLListHandle_t *acllist);
  72. NSAPI_PUBLIC ACLEvalHandle_t * ACL_EvalNew(NSErr_t *errp, pool_handle_t *pool);
  73. NSAPI_PUBLIC void ACL_EvalDestroy(NSErr_t *errp, pool_handle_t *pool, ACLEvalHandle_t *acleval);
  74. NSAPI_PUBLIC void ACL_EvalDestroyNoDecrement(NSErr_t *errp, pool_handle_t *pool, ACLEvalHandle_t *acleval);
  75. NSAPI_PUBLIC int ACL_ListDecrement(NSErr_t *errp, ACLListHandle_t *acllist);
  76. NSAPI_PUBLIC int ACL_EvalSetACL(NSErr_t *errp, ACLEvalHandle_t *acleval, ACLListHandle_t *acllist);
  77. NSAPI_PUBLIC PList_t ACL_EvalGetSubject(NSErr_t *errp, ACLEvalHandle_t *acleval);
  78. NSAPI_PUBLIC int ACL_EvalSetSubject(NSErr_t *errp, ACLEvalHandle_t *acleval, PList_t subject);
  79. NSAPI_PUBLIC PList_t ACL_EvalGetResource(NSErr_t *errp, ACLEvalHandle_t *acleval);
  80. NSAPI_PUBLIC int ACL_EvalSetResource(NSErr_t *errp, ACLEvalHandle_t *acleval, PList_t resource);
  81. /*
  82. * The following entities are only meant to be called by whole server
  83. * products that include libaccess. E.g. the HTTP server, the Directory
  84. * server etc. They should not be called by ACL callers, LASs etc.
  85. */
  86. /*********************************************************************
  87. * ACL misc routines
  88. *********************************************************************/
  89. NSAPI_PUBLIC int ACL_Init(void);
  90. NSAPI_PUBLIC int ACL_InitPostMagnus(void);
  91. NSAPI_PUBLIC int ACL_LateInitPostMagnus(void);
  92. NSAPI_PUBLIC void ACL_ListHashUpdate(ACLListHandle_t **acllistp);
  93. NSAPI_PUBLIC int ACL_MethodNamesGet(NSErr_t *errp, char ***names, int *count);
  94. NSAPI_PUBLIC int ACL_MethodNamesFree(NSErr_t *errp, char **names, int count);
  95. NSAPI_PUBLIC int ACL_DatabaseNamesGet(NSErr_t *errp, char ***names, int *count);
  96. NSAPI_PUBLIC int ACL_DatabaseNamesFree(NSErr_t *errp, char **names, int count);
  97. NSAPI_PUBLIC int ACL_InitAttr2Index(void);
  98. NSAPI_PUBLIC int ACL_Attr2Index(const char *attrname);
  99. NSAPI_PUBLIC void ACL_Attr2IndexListDestroy(void);
  100. NSAPI_PUBLIC void ACL_AttrGetterHashDestroy(void);
  101. NSAPI_PUBLIC void ACL_Destroy(void);
  102. NSAPI_PUBLIC void ACL_DestroyPools(void);
  103. /*********************************************************************
  104. * ACL cache and flush utility
  105. *********************************************************************/
  106. NSAPI_PUBLIC int ACL_CacheCheck(char *uri, ACLListHandle_t **acllist_p);
  107. NSAPI_PUBLIC int ACL_CacheCheckGet(char *uri, ACLListHandle_t **acllist_p);
  108. NSAPI_PUBLIC void ACL_CacheEnter(char *uri, ACLListHandle_t **acllist_p);
  109. NSAPI_PUBLIC void ACL_CacheEnterGet(char *uri, ACLListHandle_t **acllist_p);
  110. NSAPI_PUBLIC int ACL_ListHashCheck(ACLListHandle_t **acllist_p);
  111. NSAPI_PUBLIC void ACL_ListHashEnter(ACLListHandle_t **acllist_p);
  112. NSAPI_PUBLIC int ACL_CacheFlush(void);
  113. NSAPI_PUBLIC void ACL_Restart(void *clntData);
  114. NSAPI_PUBLIC void ACL_CritEnter(void);
  115. NSAPI_PUBLIC void ACL_CritExit(void);
  116. /*********************************************************************
  117. * ACL CGI routines
  118. *********************************************************************/
  119. NSAPI_PUBLIC void ACL_OutputSelector(char *name, char **item);
  120. NSPR_END_EXTERN_C
  121. #endif /* INTNSACL */
  122. #endif