]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/aclparse.c
Remove lint
[openldap] / servers / slapd / aclparse.c
index 1784fbbcb42b689efb54d381345b650ad1ea4a31..0a2a573184ce71c1cc381b21bc203b6826b3e42b 100644 (file)
@@ -136,9 +136,9 @@ parse_acl(
                                split( argv[i], '=', &left, &right );
                                split( left, '.', &left, &style );
 
-                               if ( right == NULL || *right == '\0' ) {
+                               if ( right == NULL ) {
                                        fprintf( stderr,
-       "%s: line %d: missing \"=\" in (or value after) \"%s\" in to clause\n",
+       "%s: line %d: missing \"=\" in \"%s\" in to clause\n",
                                            fname, lineno, left );
                                        acl_usage();
                                }
@@ -375,6 +375,13 @@ parse_acl(
                                }
 
                                if ( strcasecmp( left, "dnattr" ) == 0 ) {
+                                       if ( right == NULL || right[ 0 ] == '\0' ) {
+                                               fprintf( stderr,
+                                                       "%s: line %d: missing \"=\" in (or value after) \"%s\" in by clause\n",
+                                                       fname, lineno, left );
+                                               acl_usage();
+                                       }
+
                                        if( b->a_dn_at != NULL ) {
                                                fprintf( stderr,
                                                        "%s: line %d: dnattr already specified.\n",
@@ -393,7 +400,9 @@ parse_acl(
 
 
                                        if( !is_at_syntax( b->a_dn_at->ad_type,
-                                               SLAPD_DN_SYNTAX ) )
+                                               SLAPD_DN_SYNTAX ) &&
+                                               !is_at_syntax( b->a_dn_at->ad_type,
+                                               SLAPD_NAMEUID_SYNTAX ))
                                        {
                                                fprintf( stderr,
                                                        "%s: line %d: dnattr \"%s\": "
@@ -417,6 +426,13 @@ parse_acl(
                                        char *name = NULL;
                                        char *value = NULL;
 
+                                       if ( right == NULL || right[ 0 ] == '\0' ) {
+                                               fprintf( stderr,
+                                                       "%s: line %d: missing \"=\" in (or value after) \"%s\" in by clause\n",
+                                                       fname, lineno, left );
+                                               acl_usage();
+                                       }
+
                                        if( b->a_group_pat != NULL ) {
                                                fprintf( stderr,
                                                        "%s: line %d: group pattern already specified.\n",
@@ -537,7 +553,7 @@ parse_acl(
                                                        fprintf( stderr,
                                                                "%s: line %d: group: \"%s\" not allowed by \"%s\"\n",
                                                                fname, lineno,
-                                                               b->a_group_at->ad_cname->bv_val,
+                                                               b->a_group_at->ad_cname.bv_val,
                                                                b->a_group_oc->soc_oid );
                                                        acl_usage();
                                                }
@@ -546,6 +562,13 @@ parse_acl(
                                }
 
                                if ( strcasecmp( left, "peername" ) == 0 ) {
+                                       if ( right == NULL || right[ 0 ] == '\0' ) {
+                                               fprintf( stderr,
+                                                       "%s: line %d: missing \"=\" in (or value after) \"%s\" in by clause\n",
+                                                       fname, lineno, left );
+                                               acl_usage();
+                                       }
+
                                        if( b->a_peername_pat != NULL ) {
                                                fprintf( stderr,
                                                        "%s: line %d: peername pattern already specified.\n",
@@ -562,6 +585,13 @@ parse_acl(
                                }
 
                                if ( strcasecmp( left, "sockname" ) == 0 ) {
+                                       if ( right == NULL || right[ 0 ] == '\0' ) {
+                                               fprintf( stderr,
+                                                       "%s: line %d: missing \"=\" in (or value after) \"%s\" in by clause\n",
+                                                       fname, lineno, left );
+                                               acl_usage();
+                                       }
+
                                        if( b->a_sockname_pat != NULL ) {
                                                fprintf( stderr,
                                                        "%s: line %d: sockname pattern already specified.\n",
@@ -578,6 +608,13 @@ parse_acl(
                                }
 
                                if ( strcasecmp( left, "domain" ) == 0 ) {
+                                       if ( right == NULL || right[ 0 ] == '\0' ) {
+                                               fprintf( stderr,
+                                                       "%s: line %d: missing \"=\" in (or value after) \"%s\" in by clause\n",
+                                                       fname, lineno, left );
+                                               acl_usage();
+                                       }
+
                                        if( b->a_domain_pat != NULL ) {
                                                fprintf( stderr,
                                                        "%s: line %d: domain pattern already specified.\n",
@@ -594,6 +631,13 @@ parse_acl(
                                }
 
                                if ( strcasecmp( left, "sockurl" ) == 0 ) {
+                                       if ( right == NULL || right[ 0 ] == '\0' ) {
+                                               fprintf( stderr,
+                                                       "%s: line %d: missing \"=\" in (or value after) \"%s\" in by clause\n",
+                                                       fname, lineno, left );
+                                               acl_usage();
+                                       }
+
                                        if( b->a_sockurl_pat != NULL ) {
                                                fprintf( stderr,
                                                        "%s: line %d: sockurl pattern already specified.\n",
@@ -1063,19 +1107,22 @@ acl_usage( void )
 {
        fprintf( stderr, "\n"
                "<access clause> ::= access to <what> "
-                               "[ by <who> <access> <control> ]+ \n"
-               "<what> ::= * | [dn=<regex>] [filter=<ldapfilter>] [attrs=<attrlist>]\n"
+                               "[ by <who> <access> [ <control> ] ]+ \n"
+               "<what> ::= * | [dn[.<dnstyle>]=<regex>] [filter=<ldapfilter>] [attrs=<attrlist>]\n"
                "<attrlist> ::= <attr> | <attr> , <attrlist>\n"
                "<attr> ::= <attrname> | entry | children\n"
-               "<who> ::= [ * | anonymous | users | self | dn=<regex> ]\n"
+               "<who> ::= [ * | anonymous | users | self | dn[.<dnstyle>]=<regex> ]\n"
                        "\t[dnattr=<attrname>]\n"
-                       "\t[group[/<objectclass>[/<attrname>]]=<regex>]\n"
-                       "\t[peername=<regex>] [sockname=<regex>]\n"
-                       "\t[domain=<regex>] [sockurl=<regex>]\n"
+                       "\t[group[/<objectclass>[/<attrname>]][.<style>]=<regex>]\n"
+                       "\t[peername[.<style>]=<regex>] [sockname[.<style>]=<regex>]\n"
+                       "\t[domain[.<style>]=<regex>] [sockurl[.<style>]=<regex>]\n"
 #ifdef SLAPD_ACI_ENABLED
                        "\t[aci=<attrname>]\n"
 #endif
                        "\t[ssf=<n>] [transport_ssf=<n>] [tls_ssf=<n>] [sasl_ssf=<n>]\n"
+               "<dnstyle> ::= regex | base | exact (alias of base) | one | sub | children\n"
+               "<style> ::= regex | base | exact (alias of base)\n"
+               "<groupflags> ::= R\n"
                "<access> ::= [self]{<level>|<priv>}\n"
                "<level> ::= none | auth | compare | search | read | write\n"
                "<priv> ::= {=|+|-}{w|r|s|c|x}+\n"
@@ -1198,7 +1245,7 @@ print_access( Access *b )
        }
 
        if ( b->a_dn_at != NULL ) {
-               fprintf( stderr, " dnattr=%s", b->a_dn_at->ad_cname->bv_val );
+               fprintf( stderr, " dnattr=%s", b->a_dn_at->ad_cname.bv_val );
        }
 
        if ( b->a_group_pat != NULL ) {
@@ -1209,7 +1256,7 @@ print_access( Access *b )
                                b->a_group_oc->soc_oclass.oc_oid );
 
                        if ( b->a_group_at ) {
-                               fprintf( stderr, " attributeType: %s", b->a_group_at->ad_cname->bv_val );
+                               fprintf( stderr, " attributeType: %s", b->a_group_at->ad_cname.bv_val );
                        }
                }
     }
@@ -1232,7 +1279,7 @@ print_access( Access *b )
 
 #ifdef SLAPD_ACI_ENABLED
        if ( b->a_aci_at != NULL ) {
-               fprintf( stderr, " aci=%s", b->a_aci_at->ad_cname->bv_val );
+               fprintf( stderr, " aci=%s", b->a_aci_at->ad_cname.bv_val );
        }
 #endif