More acl parsing fixes... and print fixes.

This commit is contained in:
Kurt Zeilenga 1999-10-21 18:44:26 +00:00
parent 9c5b7aa29d
commit 873c8f213b

View File

@ -357,7 +357,7 @@ parse_acl(
if( i == argc || ( strcasecmp( left, "stop" ) == 0 )) { if( i == argc || ( strcasecmp( left, "stop" ) == 0 )) {
/* out of arguments or plain stop */ /* out of arguments or plain stop */
ACL_PRIV_ASSIGN(b->a_mask, ACL_NONE); ACL_PRIV_ASSIGN(b->a_mask, ACL_PRIV_ADDITIVE);
b->a_type = ACL_STOP; b->a_type = ACL_STOP;
access_append( &a->acl_access, b ); access_append( &a->acl_access, b );
@ -367,7 +367,7 @@ parse_acl(
if( strcasecmp( left, "continue" ) == 0 ) { if( strcasecmp( left, "continue" ) == 0 ) {
/* plain continue */ /* plain continue */
ACL_PRIV_ASSIGN(b->a_mask, ACL_NONE); ACL_PRIV_ASSIGN(b->a_mask, ACL_PRIV_ADDITIVE);
b->a_type = ACL_CONTINUE; b->a_type = ACL_CONTINUE;
access_append( &a->acl_access, b ); access_append( &a->acl_access, b );
@ -377,7 +377,7 @@ parse_acl(
if( strcasecmp( left, "break" ) == 0 ) { if( strcasecmp( left, "break" ) == 0 ) {
/* plain continue */ /* plain continue */
ACL_PRIV_ASSIGN(b->a_mask, ACL_NONE); ACL_PRIV_ASSIGN(b->a_mask, ACL_PRIV_ADDITIVE);
b->a_type = ACL_BREAK; b->a_type = ACL_BREAK;
access_append( &a->acl_access, b ); access_append( &a->acl_access, b );
@ -387,7 +387,7 @@ parse_acl(
if ( strcasecmp( left, "by" ) == 0 ) { if ( strcasecmp( left, "by" ) == 0 ) {
/* we've gone too far */ /* we've gone too far */
--i; --i;
ACL_PRIV_ASSIGN(b->a_mask, ACL_NONE); ACL_PRIV_ASSIGN(b->a_mask, ACL_PRIV_ADDITIVE);
b->a_type = ACL_STOP; b->a_type = ACL_STOP;
access_append( &a->acl_access, b ); access_append( &a->acl_access, b );
@ -541,9 +541,14 @@ accessmask2str( slap_access_mask_t mask )
} }
if ( none && ACL_PRIV_ISSET(mask, ACL_PRIV_NONE) ) { if ( none && ACL_PRIV_ISSET(mask, ACL_PRIV_NONE) ) {
strcat( buf, "0" ); none = 0;
strcat( buf, "n" );
} }
if ( none ) {
strcat( buf, "0" );
}
if ( ACL_IS_LEVEL( mask ) ) { if ( ACL_IS_LEVEL( mask ) ) {
strcat(buf, ")"); strcat(buf, ")");
} }
@ -588,7 +593,7 @@ str2accessmask( const char *str )
} else if( TOLOWER(str[i]) == 'x' ) { } else if( TOLOWER(str[i]) == 'x' ) {
ACL_PRIV_SET(mask, ACL_PRIV_AUTH); ACL_PRIV_SET(mask, ACL_PRIV_AUTH);
} else { } else if( str[i] != '0' ) {
ACL_INVALIDATE(mask); ACL_INVALIDATE(mask);
return mask; return mask;
} }
@ -740,6 +745,16 @@ print_access( Access *b )
b->a_dn_self ? "self" : "", b->a_dn_self ? "self" : "",
accessmask2str( b->a_mask ) ); accessmask2str( b->a_mask ) );
if( b->a_type == ACL_BREAK ) {
fprintf( stderr, " break" );
} else if( b->a_type == ACL_CONTINUE ) {
fprintf( stderr, " continue" );
} else if( b->a_type != ACL_STOP ) {
fprintf( stderr, " unknown-control" );
}
fprintf( stderr, "\n" ); fprintf( stderr, "\n" );
} }