1 /* aclparse.c - routines to parse and check acl's */
4 * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
14 #include <ac/socket.h>
15 #include <ac/string.h>
16 #include <ac/unistd.h>
20 static void split(char *line, int splitchar, char **left, char **right);
21 static void access_append(Access **l, Access *a);
22 static void acl_usage(void) LDAP_GCCATTR((noreturn));
25 static void print_acl(Backend *be, AccessControl *a);
26 static void print_access(Access *b);
30 regtest(const char *fname, int lineno, char *pat) {
46 for (size = 0, flag = 0; (size < sizeof(buf)) && *sp; sp++) {
48 if (*sp == '$'|| (*sp >= '0' && *sp <= '9')) {
65 if ( size >= (sizeof(buf)-1) ) {
67 "%s: line %d: regular expression \"%s\" too large\n",
72 if ((e = regcomp(&re, buf, REG_EXTENDED|REG_ICASE))) {
74 regerror(e, &re, error, sizeof(error));
76 "%s: line %d: regular expression \"%s\" bad because of %s\n",
77 fname, lineno, pat, error );
95 char *left, *right, *style;
102 for ( i = 1; i < argc; i++ ) {
103 /* to clause - select which entries are protected */
104 if ( strcasecmp( argv[i], "to" ) == 0 ) {
107 "%s: line %d: only one to clause allowed in access line\n",
111 a = (AccessControl *) ch_calloc( 1, sizeof(AccessControl) );
112 a->acl_filter = NULL;
113 a->acl_dn_pat = NULL;
115 a->acl_access = NULL;
117 for ( ++i; i < argc; i++ ) {
118 if ( strcasecmp( argv[i], "by" ) == 0 ) {
123 if ( strcasecmp( argv[i], "*" ) == 0 ) {
124 if( a->acl_dn_pat != NULL ) {
126 "%s: line %d: dn pattern"
127 " already specified in to clause.\n",
132 a->acl_dn_pat = ch_strdup( "*" );
136 split( argv[i], '=', &left, &right );
137 split( left, '.', &left, &style );
139 if ( right == NULL || *right == '\0' ) {
141 "%s: line %d: missing \"=\" in (or value after) \"%s\" in to clause\n",
142 fname, lineno, left );
146 if ( strcasecmp( left, "dn" ) == 0 ) {
147 if( a->acl_dn_pat != NULL ) {
149 "%s: line %d: dn pattern"
150 " already specified in to clause.\n",
155 if ( style == NULL || *style == '\0'
156 || strcasecmp( style, "regex" ) == 0 )
158 a->acl_dn_style = ACL_STYLE_REGEX;
159 if ( strcmp(right, "*") == 0
160 || strcmp(right, ".*") == 0
161 || strcmp(right, ".*$") == 0
162 || strcmp(right, "^.*") == 0
163 || strcmp(right, "^.*$$") == 0
164 || strcmp(right, ".*$$") == 0
165 || strcmp(right, "^.*$$") == 0 )
167 a->acl_dn_pat = ch_strdup( "*" );
170 a->acl_dn_pat = ch_strdup( right );
172 } else if ( strcasecmp( style, "base" ) == 0 ) {
173 a->acl_dn_style = ACL_STYLE_BASE;
174 a->acl_dn_pat = ch_strdup( right );
176 } else if ( strcasecmp( style, "one" ) == 0 ) {
177 a->acl_dn_style = ACL_STYLE_ONE;
178 a->acl_dn_pat = ch_strdup( right );
180 } else if ( strcasecmp( style, "subtree" ) == 0 ) {
181 a->acl_dn_style = ACL_STYLE_SUBTREE;
182 a->acl_dn_pat = ch_strdup( right );
184 } else if ( strcasecmp( style, "children" ) == 0 ) {
185 a->acl_dn_style = ACL_STYLE_CHILDREN;
186 a->acl_dn_pat = ch_strdup( right );
190 "%s: line %d: unknown dn style \"%s\" in to clause\n",
191 fname, lineno, style );
198 if ( strcasecmp( left, "filter" ) == 0 ) {
199 if ( (a->acl_filter = str2filter(
202 "%s: line %d: bad filter \"%s\" in to clause\n",
203 fname, lineno, right );
207 } else if ( strncasecmp( left, "attr", 4 ) == 0 ) {
210 alist = str2charray( right, "," );
211 charray_merge( &a->acl_attrs, alist );
212 charray_free( alist );
216 "%s: line %d: expecting <what> got \"%s\"\n",
217 fname, lineno, left );
222 if ( a->acl_dn_pat != NULL && strcmp(a->acl_dn_pat, "*") == 0) {
223 free( a->acl_dn_pat );
224 a->acl_dn_pat = NULL;
227 if( a->acl_dn_pat != NULL ) {
228 if ( a->acl_dn_style != ACL_STYLE_REGEX )
230 dn_normalize(a->acl_dn_pat);
233 int e = regcomp( &a->acl_dn_re, a->acl_dn_pat,
234 REG_EXTENDED | REG_ICASE );
237 regerror( e, &a->acl_dn_re, buf, sizeof(buf) );
239 "%s: line %d: regular expression \"%s\" bad because of %s\n",
240 fname, lineno, right, buf );
246 /* by clause - select who has what access to entries */
247 } else if ( strcasecmp( argv[i], "by" ) == 0 ) {
250 "%s: line %d: to clause required before by clause in access line\n",
256 * by clause consists of <who> and <access>
259 b = (Access *) ch_calloc( 1, sizeof(Access) );
261 ACL_INVALIDATE( b->a_mask );
265 "%s: line %d: premature eol: expecting <who>\n",
271 for ( ; i < argc; i++ ) {
273 slap_style_t sty = ACL_STYLE_REGEX;
275 split( argv[i], '=', &left, &right );
276 split( left, '.', &left, &style );
277 if ( style == NULL || *style == '\0'
278 || strcasecmp( style, "regex" ) == 0 )
280 sty = ACL_STYLE_REGEX;
281 } else if ( strcasecmp( style, "exact" ) == 0 ) {
282 sty = ACL_STYLE_EXACT;
283 } else if ( strcasecmp( style, "base" ) == 0 ) {
284 sty = ACL_STYLE_BASE;
285 } else if ( strcasecmp( style, "one" ) == 0 ) {
287 } else if ( strcasecmp( style, "subtree" ) == 0 ) {
288 sty = ACL_STYLE_SUBTREE;
289 } else if ( strcasecmp( style, "children" ) == 0 ) {
290 sty = ACL_STYLE_CHILDREN;
293 "%s: line %d: unknown style \"%s\" in by clause\n",
294 fname, lineno, style );
298 if ( strcasecmp( argv[i], "*" ) == 0 ) {
299 pat = ch_strdup( "*" );
301 } else if ( strcasecmp( argv[i], "anonymous" ) == 0 ) {
302 pat = ch_strdup( "anonymous" );
304 } else if ( strcasecmp( argv[i], "self" ) == 0 ) {
305 pat = ch_strdup( "self" );
307 } else if ( strcasecmp( argv[i], "users" ) == 0 ) {
308 pat = ch_strdup( "users" );
310 } else if ( strcasecmp( left, "dn" ) == 0 ) {
311 if ( sty == ACL_STYLE_REGEX ) {
312 b->a_dn_style = ACL_STYLE_REGEX;
313 if( right == NULL ) {
315 pat = ch_strdup( "users" );
317 } else if (*right == '\0' ) {
319 pat = ch_strdup( "anonymous" );
321 } else if ( strcmp( right, "*" ) == 0 ) {
323 /* any or users? users for now */
324 pat = ch_strdup( "users" );
326 } else if ( strcmp( right, ".+" ) == 0
327 || strcmp( right, "^.+" ) == 0
328 || strcmp( right, ".+$" ) == 0
329 || strcmp( right, "^.+$" ) == 0
330 || strcmp( right, ".+$$" ) == 0
331 || strcmp( right, "^.+$$" ) == 0 )
333 pat = ch_strdup( "users" );
335 } else if ( strcmp( right, ".*" ) == 0
336 || strcmp( right, "^.*" ) == 0
337 || strcmp( right, ".*$" ) == 0
338 || strcmp( right, "^.*$" ) == 0
339 || strcmp( right, ".*$$" ) == 0
340 || strcmp( right, "^.*$$" ) == 0 )
342 pat = ch_strdup( "*" );
345 regtest(fname, lineno, right);
346 pat = ch_strdup( right );
348 } else if ( right == NULL || *right == '\0' ) {
350 "%s: line %d: missing \"=\" in (or value after) \"%s\" in by clause\n",
351 fname, lineno, left );
355 pat = ch_strdup( right );
363 if( b->a_dn_pat != NULL ) {
365 "%s: line %d: dn pattern already specified.\n",
372 if ( sty != ACL_STYLE_REGEX )
377 if ( strcasecmp( left, "dnattr" ) == 0 ) {
378 if( b->a_dn_at != NULL ) {
380 "%s: line %d: dnattr already specified.\n",
385 rc = slap_str2ad( right, &b->a_dn_at, &text );
387 if( rc != LDAP_SUCCESS ) {
389 "%s: line %d: dnattr \"%s\": %s\n",
390 fname, lineno, right, text );
395 if( !is_at_syntax( b->a_dn_at->ad_type,
399 "%s: line %d: dnattr \"%s\": "
400 "inappropriate syntax: %s\n",
401 fname, lineno, right,
402 b->a_dn_at->ad_type->sat_syntax_oid );
409 if (sty != ACL_STYLE_REGEX && sty != ACL_STYLE_BASE) {
411 "%s: line %d: inappropriate style \"%s\" in by clause\n",
412 fname, lineno, style );
416 if ( strncasecmp( left, "group", sizeof("group")-1 ) == 0 ) {
420 if( b->a_group_pat != NULL ) {
422 "%s: line %d: group pattern already specified.\n",
427 /* format of string is "group/objectClassValue/groupAttrName" */
428 if ((value = strchr(left, '/')) != NULL) {
431 && (name = strchr(value, '/')) != NULL)
437 b->a_group_style = sty;
438 if (sty == ACL_STYLE_REGEX) {
439 regtest(fname, lineno, right);
440 b->a_group_pat = ch_strdup( right );
442 b->a_group_pat = ch_strdup( right );
443 dn_normalize(b->a_group_pat);
446 if (value && *value) {
447 b->a_group_oc = oc_find( value );
450 if( b->a_group_oc == NULL ) {
452 "%s: line %d: group objectclass "
454 fname, lineno, value );
458 b->a_group_oc = oc_find(SLAPD_GROUP_CLASS);
460 if( b->a_group_oc == NULL ) {
462 "%s: line %d: group default objectclass "
464 fname, lineno, SLAPD_GROUP_CLASS );
469 if( is_object_subclass( b->a_group_oc,
470 slap_schema.si_oc_referral ) )
473 "%s: line %d: group objectclass \"%s\" "
474 "is subclass of referral\n",
475 fname, lineno, value );
479 if( is_object_subclass( b->a_group_oc,
480 slap_schema.si_oc_alias ) )
483 "%s: line %d: group objectclass \"%s\" "
484 "is subclass of alias\n",
485 fname, lineno, value );
490 rc = slap_str2ad( right, &b->a_group_at, &text );
492 if( rc != LDAP_SUCCESS ) {
494 "%s: line %d: group \"%s\": %s\n",
495 fname, lineno, right, text );
500 rc = slap_str2ad( SLAPD_GROUP_ATTR, &b->a_group_at, &text );
502 if( rc != LDAP_SUCCESS ) {
504 "%s: line %d: group \"%s\": %s\n",
505 fname, lineno, SLAPD_GROUP_ATTR, text );
510 if( !is_at_syntax( b->a_group_at->ad_type,
514 "%s: line %d: group \"%s\": inappropriate syntax: %s\n",
515 fname, lineno, right,
516 b->a_group_at->ad_type->sat_syntax_oid );
524 struct berval *vals[2];
526 val.bv_val = b->a_group_oc->soc_oid;
527 val.bv_len = strlen(val.bv_val);
532 rc = oc_check_allowed( b->a_group_at->ad_type, vals );
536 "%s: line %d: group: \"%s\" not allowed by \"%s\"\n",
538 b->a_group_at->ad_cname->bv_val,
539 b->a_group_oc->soc_oid );
546 if ( strcasecmp( left, "peername" ) == 0 ) {
547 if( b->a_peername_pat != NULL ) {
549 "%s: line %d: peername pattern already specified.\n",
554 b->a_peername_style = sty;
555 if (sty == ACL_STYLE_REGEX) {
556 regtest(fname, lineno, right);
558 b->a_peername_pat = ch_strdup( right );
562 if ( strcasecmp( left, "sockname" ) == 0 ) {
563 if( b->a_sockname_pat != NULL ) {
565 "%s: line %d: sockname pattern already specified.\n",
570 b->a_sockname_style = sty;
571 if (sty == ACL_STYLE_REGEX) {
572 regtest(fname, lineno, right);
574 b->a_sockname_pat = ch_strdup( right );
578 if ( strcasecmp( left, "domain" ) == 0 ) {
579 if( b->a_domain_pat != NULL ) {
581 "%s: line %d: domain pattern already specified.\n",
586 b->a_domain_style = sty;
587 if (sty == ACL_STYLE_REGEX) {
588 regtest(fname, lineno, right);
590 b->a_domain_pat = ch_strdup( right );
594 if ( strcasecmp( left, "sockurl" ) == 0 ) {
595 if( b->a_sockurl_pat != NULL ) {
597 "%s: line %d: sockurl pattern already specified.\n",
602 b->a_sockurl_style = sty;
603 if (sty == ACL_STYLE_REGEX) {
604 regtest(fname, lineno, right);
606 b->a_sockurl_pat = ch_strdup( right );
610 if ( strcasecmp( left, "set" ) == 0 ) {
611 if( b->a_set_pat != NULL ) {
613 "%s: line %d: set attribute already specified.\n",
618 if ( right == NULL || *right == '\0' ) {
620 "%s: line %d: no set is defined\n",
625 b->a_set_style = sty;
626 b->a_set_pat = ch_strdup(right);
631 #ifdef SLAPD_ACI_ENABLED
632 if ( strcasecmp( left, "aci" ) == 0 ) {
633 if( b->a_aci_at != NULL ) {
635 "%s: line %d: aci attribute already specified.\n",
640 if ( right != NULL && *right != '\0' ) {
641 rc = slap_str2ad( right, &b->a_aci_at, &text );
643 if( rc != LDAP_SUCCESS ) {
645 "%s: line %d: aci \"%s\": %s\n",
646 fname, lineno, right, text );
651 rc = slap_str2ad( SLAPD_ACI_ATTR, &b->a_aci_at, &text );
653 if( rc != LDAP_SUCCESS ) {
655 "%s: line %d: aci \"%s\": %s\n",
656 fname, lineno, SLAPD_ACI_ATTR, text );
661 if( !is_at_syntax( b->a_aci_at->ad_type,
665 "%s: line %d: aci \"%s\": inappropriate syntax: %s\n",
666 fname, lineno, right,
667 b->a_aci_at->ad_type->sat_syntax_oid );
673 #endif /* SLAPD_ACI_ENABLED */
675 if( right != NULL ) {
682 if( i == argc || ( strcasecmp( left, "stop" ) == 0 )) {
683 /* out of arguments or plain stop */
685 ACL_PRIV_ASSIGN(b->a_mask, ACL_PRIV_ADDITIVE);
686 b->a_type = ACL_STOP;
688 access_append( &a->acl_access, b );
692 if( strcasecmp( left, "continue" ) == 0 ) {
695 ACL_PRIV_ASSIGN(b->a_mask, ACL_PRIV_ADDITIVE);
696 b->a_type = ACL_CONTINUE;
698 access_append( &a->acl_access, b );
702 if( strcasecmp( left, "break" ) == 0 ) {
705 ACL_PRIV_ASSIGN(b->a_mask, ACL_PRIV_ADDITIVE);
706 b->a_type = ACL_BREAK;
708 access_append( &a->acl_access, b );
712 if ( strcasecmp( left, "by" ) == 0 ) {
713 /* we've gone too far */
715 ACL_PRIV_ASSIGN(b->a_mask, ACL_PRIV_ADDITIVE);
716 b->a_type = ACL_STOP;
718 access_append( &a->acl_access, b );
723 if( strncasecmp( left, "self", 4 ) == 0 ) {
725 ACL_PRIV_ASSIGN( b->a_mask, str2accessmask( &left[4] ) );
728 ACL_PRIV_ASSIGN( b->a_mask, str2accessmask( left ) );
731 if( ACL_IS_INVALID( b->a_mask ) ) {
733 "%s: line %d: expecting <access> got \"%s\"\n",
734 fname, lineno, left );
738 b->a_type = ACL_STOP;
741 /* out of arguments or plain stop */
742 access_append( &a->acl_access, b );
746 if( strcasecmp( argv[i], "continue" ) == 0 ) {
748 b->a_type = ACL_CONTINUE;
750 } else if( strcasecmp( argv[i], "break" ) == 0 ) {
752 b->a_type = ACL_BREAK;
754 } else if ( strcasecmp( argv[i], "stop" ) != 0 ) {
759 access_append( &a->acl_access, b );
763 "%s: line %d: expecting \"to\" or \"by\" got \"%s\"\n",
764 fname, lineno, argv[i] );
769 /* if we have no real access clause, complain and do nothing */
772 "%s: line %d: warning: no access clause(s) specified in access line\n",
777 if (ldap_debug & LDAP_DEBUG_ACL)
781 if ( a->acl_access == NULL ) {
783 "%s: line %d: warning: no by clause(s) specified in access line\n",
788 acl_append( &be->be_acl, a );
790 acl_append( &global_acl, a );
796 accessmask2str( slap_access_mask_t mask, char *buf )
800 assert( buf != NULL );
802 if ( ACL_IS_INVALID( mask ) ) {
808 if ( ACL_IS_LEVEL( mask ) ) {
809 if ( ACL_LVL_IS_NONE(mask) ) {
810 strcat( buf, "none" );
812 } else if ( ACL_LVL_IS_AUTH(mask) ) {
813 strcat( buf, "auth" );
815 } else if ( ACL_LVL_IS_COMPARE(mask) ) {
816 strcat( buf, "compare" );
818 } else if ( ACL_LVL_IS_SEARCH(mask) ) {
819 strcat( buf, "search" );
821 } else if ( ACL_LVL_IS_READ(mask) ) {
822 strcat( buf, "read" );
824 } else if ( ACL_LVL_IS_WRITE(mask) ) {
825 strcat( buf, "write" );
827 strcat( buf, "unknown" );
833 if( ACL_IS_ADDITIVE( mask ) ) {
836 } else if( ACL_IS_SUBTRACTIVE( mask ) ) {
843 if ( ACL_PRIV_ISSET(mask, ACL_PRIV_WRITE) ) {
848 if ( ACL_PRIV_ISSET(mask, ACL_PRIV_READ) ) {
853 if ( ACL_PRIV_ISSET(mask, ACL_PRIV_SEARCH) ) {
858 if ( ACL_PRIV_ISSET(mask, ACL_PRIV_COMPARE) ) {
863 if ( ACL_PRIV_ISSET(mask, ACL_PRIV_AUTH) ) {
868 if ( none && ACL_PRIV_ISSET(mask, ACL_PRIV_NONE) ) {
877 if ( ACL_IS_LEVEL( mask ) ) {
884 str2accessmask( const char *str )
886 slap_access_mask_t mask;
888 if( !ASCII_ALPHA(str[0]) ) {
891 if ( str[0] == '=' ) {
894 } else if( str[0] == '+' ) {
895 ACL_PRIV_ASSIGN(mask, ACL_PRIV_ADDITIVE);
897 } else if( str[0] == '-' ) {
898 ACL_PRIV_ASSIGN(mask, ACL_PRIV_SUBSTRACTIVE);
901 ACL_INVALIDATE(mask);
905 for( i=1; str[i] != '\0'; i++ ) {
906 if( TOLOWER(str[i]) == 'w' ) {
907 ACL_PRIV_SET(mask, ACL_PRIV_WRITE);
909 } else if( TOLOWER(str[i]) == 'r' ) {
910 ACL_PRIV_SET(mask, ACL_PRIV_READ);
912 } else if( TOLOWER(str[i]) == 's' ) {
913 ACL_PRIV_SET(mask, ACL_PRIV_SEARCH);
915 } else if( TOLOWER(str[i]) == 'c' ) {
916 ACL_PRIV_SET(mask, ACL_PRIV_COMPARE);
918 } else if( TOLOWER(str[i]) == 'x' ) {
919 ACL_PRIV_SET(mask, ACL_PRIV_AUTH);
921 } else if( str[i] != '0' ) {
922 ACL_INVALIDATE(mask);
930 if ( strcasecmp( str, "none" ) == 0 ) {
931 ACL_LVL_ASSIGN_NONE(mask);
933 } else if ( strcasecmp( str, "auth" ) == 0 ) {
934 ACL_LVL_ASSIGN_AUTH(mask);
936 } else if ( strcasecmp( str, "compare" ) == 0 ) {
937 ACL_LVL_ASSIGN_COMPARE(mask);
939 } else if ( strcasecmp( str, "search" ) == 0 ) {
940 ACL_LVL_ASSIGN_SEARCH(mask);
942 } else if ( strcasecmp( str, "read" ) == 0 ) {
943 ACL_LVL_ASSIGN_READ(mask);
945 } else if ( strcasecmp( str, "write" ) == 0 ) {
946 ACL_LVL_ASSIGN_WRITE(mask);
949 ACL_INVALIDATE( mask );
958 fprintf( stderr, "\n"
959 "<access clause> ::= access to <what> "
960 "[ by <who> <access> <control> ]+ \n"
961 "<what> ::= * | [dn=<regex>] [filter=<ldapfilter>] [attrs=<attrlist>]\n"
962 "<attrlist> ::= <attr> | <attr> , <attrlist>\n"
963 "<attr> ::= <attrname> | entry | children\n"
964 "<who> ::= [ * | anonymous | users | self | dn=<regex> ]\n"
965 "\t[dnattr=<attrname>]\n"
966 "\t[group[/<objectclass>[/<attrname>]]=<regex>]\n"
967 "\t[peername=<regex>] [sockname=<regex>]\n"
968 "\t[domain=<regex>] [sockurl=<regex>]\n"
969 #ifdef SLAPD_ACI_ENABLED
970 "\t[aci=<attrname>]\n"
972 "<access> ::= [self]{<level>|<priv>}\n"
973 "<level> ::= none | auth | compare | search | read | write\n"
974 "<priv> ::= {=|+|-}{w|r|s|c|x}+\n"
975 "<control> ::= [ stop | continue | break ]\n"
977 exit( EXIT_FAILURE );
989 if ( (*right = strchr( line, splitchar )) != NULL ) {
990 *((*right)++) = '\0';
995 access_append( Access **l, Access *a )
997 for ( ; *l != NULL; l = &(*l)->a_next )
1004 acl_append( AccessControl **l, AccessControl *a )
1006 for ( ; *l != NULL; l = &(*l)->acl_next )
1013 access2str( slap_access_t access )
1015 if ( access == ACL_NONE ) {
1018 } else if ( access == ACL_AUTH ) {
1021 } else if ( access == ACL_COMPARE ) {
1024 } else if ( access == ACL_SEARCH ) {
1027 } else if ( access == ACL_READ ) {
1030 } else if ( access == ACL_WRITE ) {
1038 str2access( const char *str )
1040 if ( strcasecmp( str, "none" ) == 0 ) {
1043 } else if ( strcasecmp( str, "auth" ) == 0 ) {
1046 } else if ( strcasecmp( str, "compare" ) == 0 ) {
1049 } else if ( strcasecmp( str, "search" ) == 0 ) {
1052 } else if ( strcasecmp( str, "read" ) == 0 ) {
1055 } else if ( strcasecmp( str, "write" ) == 0 ) {
1059 return( ACL_INVALID_ACCESS );
1064 static char *style_strings[5] = {
1074 print_access( Access *b )
1076 char maskbuf[ACCESSMASK_MAXLEN];
1078 fprintf( stderr, "\tby" );
1080 if ( b->a_dn_pat != NULL ) {
1081 if( strcmp(b->a_dn_pat, "*") == 0
1082 || strcmp(b->a_dn_pat, "users") == 0
1083 || strcmp(b->a_dn_pat, "anonymous") == 0
1084 || strcmp(b->a_dn_pat, "self") == 0 )
1086 fprintf( stderr, " %s", b->a_dn_pat );
1089 fprintf( stderr, " dn.%s=%s", style_strings[b->a_dn_style], b->a_dn_pat );
1093 if ( b->a_dn_at != NULL ) {
1094 fprintf( stderr, " dnattr=%s", b->a_dn_at->ad_cname->bv_val );
1097 if ( b->a_group_pat != NULL ) {
1098 fprintf( stderr, " group=%s", b->a_group_pat );
1100 if ( b->a_group_oc ) {
1101 fprintf( stderr, " objectClass: %s",
1102 b->a_group_oc->soc_oclass.oc_oid );
1104 if ( b->a_group_at ) {
1105 fprintf( stderr, " attributeType: %s", b->a_group_at->ad_cname->bv_val );
1110 if ( b->a_peername_pat != NULL ) {
1111 fprintf( stderr, " peername=%s", b->a_peername_pat );
1114 if ( b->a_sockname_pat != NULL ) {
1115 fprintf( stderr, " sockname=%s", b->a_sockname_pat );
1118 if ( b->a_domain_pat != NULL ) {
1119 fprintf( stderr, " domain=%s", b->a_domain_pat );
1122 if ( b->a_sockurl_pat != NULL ) {
1123 fprintf( stderr, " sockurl=%s", b->a_sockurl_pat );
1126 #ifdef SLAPD_ACI_ENABLED
1127 if ( b->a_aci_at != NULL ) {
1128 fprintf( stderr, " aci=%s", b->a_aci_at->ad_cname->bv_val );
1132 fprintf( stderr, " %s%s",
1133 b->a_dn_self ? "self" : "",
1134 accessmask2str( b->a_mask, maskbuf ) );
1136 if( b->a_type == ACL_BREAK ) {
1137 fprintf( stderr, " break" );
1139 } else if( b->a_type == ACL_CONTINUE ) {
1140 fprintf( stderr, " continue" );
1142 } else if( b->a_type != ACL_STOP ) {
1143 fprintf( stderr, " unknown-control" );
1146 fprintf( stderr, "\n" );
1151 print_acl( Backend *be, AccessControl *a )
1156 fprintf( stderr, "%s ACL: access to",
1157 be == NULL ? "Global" : "Backend" );
1159 if ( a->acl_dn_pat != NULL ) {
1161 fprintf( stderr, " dn.%s=%s\n",
1162 style_strings[a->acl_dn_style], a->acl_dn_pat );
1165 if ( a->acl_filter != NULL ) {
1167 fprintf( stderr, " filter=" );
1168 filter_print( a->acl_filter );
1169 fprintf( stderr, "\n" );
1172 if ( a->acl_attrs != NULL ) {
1176 fprintf( stderr, " attrs=" );
1177 for ( i = 0; a->acl_attrs[i] != NULL; i++ ) {
1179 fprintf( stderr, "," );
1181 fprintf( stderr, a->acl_attrs[i] );
1184 fprintf( stderr, "\n" );
1188 fprintf( stderr, " *\n" );
1191 for ( b = a->acl_access; b != NULL; b = b->a_next ) {
1195 fprintf( stderr, "\n" );
1198 #endif /* LDAP_DEBUG */