From 08ff231888a22c15cc9fc82e6abcf9325ee7e75f Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Mon, 29 Oct 2001 08:14:12 +0000 Subject: [PATCH] fixes assertion fault when the clauses's argument does not have a = inside --- servers/slapd/aclparse.c | 57 +++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index c18f36e27f..0a2a573184 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -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", @@ -419,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", @@ -548,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", @@ -564,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", @@ -580,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", @@ -596,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", @@ -1065,19 +1107,22 @@ acl_usage( void ) { fprintf( stderr, "\n" " ::= access to " - "[ by ]+ \n" - " ::= * | [dn=] [filter=] [attrs=]\n" + "[ by [ ] ]+ \n" + " ::= * | [dn[.]=] [filter=] [attrs=]\n" " ::= | , \n" " ::= | entry | children\n" - " ::= [ * | anonymous | users | self | dn= ]\n" + " ::= [ * | anonymous | users | self | dn[.]= ]\n" "\t[dnattr=]\n" - "\t[group[/[/]]=]\n" - "\t[peername=] [sockname=]\n" - "\t[domain=] [sockurl=]\n" + "\t[group[/[/]][.