From 1c328aa9c7e83a42af1bbf6eaaa49a1f50436bd1 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sat, 26 Aug 2000 01:14:05 +0000 Subject: [PATCH] Minor typedef and other clean ups --- servers/slapd/acl.c | 16 ++++++++-------- servers/slapd/aclparse.c | 24 ++++++++++++------------ servers/slapd/bind.c | 2 +- servers/slapd/connection.c | 6 +++--- servers/slapd/daemon.c | 2 +- servers/slapd/proto-slap.h | 10 +++++----- servers/slapd/sasl.c | 6 +++--- servers/slapd/slap.h | 9 +++++---- 8 files changed, 38 insertions(+), 37 deletions(-) diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index 2e74071b31..f5dbbcd75f 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -24,7 +24,7 @@ static AccessControl * acl_get( int nmatches, regmatch_t *matches ); static slap_control_t acl_mask( - AccessControl *ac, slap_access_mask_t *mask, + AccessControl *ac, slap_mask_t *mask, Backend *be, Connection *conn, Operation *op, Entry *e, AttributeDescription *desc, @@ -85,7 +85,7 @@ access_allowed( #ifdef LDAP_DEBUG char accessmaskbuf[ACCESSMASK_MAXLEN]; #endif - slap_access_mask_t mask; + slap_mask_t mask; slap_control_t control; const char *attr = desc ? desc->ad_cname->bv_val : NULL; @@ -341,7 +341,7 @@ acl_get( static slap_control_t acl_mask( AccessControl *a, - slap_access_mask_t *mask, + slap_mask_t *mask, Backend *be, Connection *conn, Operation *op, @@ -372,7 +372,7 @@ acl_mask( accessmask2str( *mask, accessmaskbuf ) ); for ( i = 1, b = a->acl_access; b != NULL; b = b->a_next, i++ ) { - slap_access_mask_t oldmask, modmask; + slap_mask_t oldmask, modmask; ACL_INVALIDATE( modmask ); @@ -643,7 +643,7 @@ acl_mask( /* this case works different from the others above. * since aci's themselves give permissions, we need - * to first check b->a_mask, the ACL's access level. + * to first check b->a_access_mask, the ACL's access level. */ if( op->o_ndn == NULL || op->o_ndn[0] == '\0' ) { @@ -657,7 +657,7 @@ acl_mask( /* first check if the right being requested * is allowed by the ACL clause. */ - if ( ! ACL_GRANT( b->a_mask, *mask ) ) { + if ( ! ACL_GRANT( b->a_access_mask, *mask ) ) { continue; } @@ -686,7 +686,7 @@ acl_mask( } /* remove anything that the ACL clause does not allow */ - tgrant &= b->a_mask & ACL_PRIV_MASK; + tgrant &= b->a_access_mask & ACL_PRIV_MASK; tdeny &= ACL_PRIV_MASK; /* see if we have anything to contribute */ @@ -715,7 +715,7 @@ acl_mask( } else #endif { - modmask = b->a_mask; + modmask = b->a_access_mask; } diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index ce8641d93c..ea8f6b9eed 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -258,7 +258,7 @@ parse_acl( b = (Access *) ch_calloc( 1, sizeof(Access) ); - ACL_INVALIDATE( b->a_mask ); + ACL_INVALIDATE( b->a_access_mask ); if ( ++i == argc ) { fprintf( stderr, @@ -682,7 +682,7 @@ parse_acl( if( i == argc || ( strcasecmp( left, "stop" ) == 0 )) { /* out of arguments or plain stop */ - ACL_PRIV_ASSIGN(b->a_mask, ACL_PRIV_ADDITIVE); + ACL_PRIV_ASSIGN(b->a_access_mask, ACL_PRIV_ADDITIVE); b->a_type = ACL_STOP; access_append( &a->acl_access, b ); @@ -692,7 +692,7 @@ parse_acl( if( strcasecmp( left, "continue" ) == 0 ) { /* plain continue */ - ACL_PRIV_ASSIGN(b->a_mask, ACL_PRIV_ADDITIVE); + ACL_PRIV_ASSIGN(b->a_access_mask, ACL_PRIV_ADDITIVE); b->a_type = ACL_CONTINUE; access_append( &a->acl_access, b ); @@ -702,7 +702,7 @@ parse_acl( if( strcasecmp( left, "break" ) == 0 ) { /* plain continue */ - ACL_PRIV_ASSIGN(b->a_mask, ACL_PRIV_ADDITIVE); + ACL_PRIV_ASSIGN(b->a_access_mask, ACL_PRIV_ADDITIVE); b->a_type = ACL_BREAK; access_append( &a->acl_access, b ); @@ -712,7 +712,7 @@ parse_acl( if ( strcasecmp( left, "by" ) == 0 ) { /* we've gone too far */ --i; - ACL_PRIV_ASSIGN(b->a_mask, ACL_PRIV_ADDITIVE); + ACL_PRIV_ASSIGN(b->a_access_mask, ACL_PRIV_ADDITIVE); b->a_type = ACL_STOP; access_append( &a->acl_access, b ); @@ -722,13 +722,13 @@ parse_acl( /* get */ if( strncasecmp( left, "self", 4 ) == 0 ) { b->a_dn_self = 1; - ACL_PRIV_ASSIGN( b->a_mask, str2accessmask( &left[4] ) ); + ACL_PRIV_ASSIGN( b->a_access_mask, str2accessmask( &left[4] ) ); } else { - ACL_PRIV_ASSIGN( b->a_mask, str2accessmask( left ) ); + ACL_PRIV_ASSIGN( b->a_access_mask, str2accessmask( left ) ); } - if( ACL_IS_INVALID( b->a_mask ) ) { + if( ACL_IS_INVALID( b->a_access_mask ) ) { fprintf( stderr, "%s: line %d: expecting got \"%s\"\n", fname, lineno, left ); @@ -793,7 +793,7 @@ parse_acl( } char * -accessmask2str( slap_access_mask_t mask, char *buf ) +accessmask2str( slap_mask_t mask, char *buf ) { int none=1; @@ -880,10 +880,10 @@ accessmask2str( slap_access_mask_t mask, char *buf ) return buf; } -slap_access_mask_t +slap_mask_t str2accessmask( const char *str ) { - slap_access_mask_t mask; + slap_mask_t mask; if( !ASCII_ALPHA(str[0]) ) { int i; @@ -1131,7 +1131,7 @@ print_access( Access *b ) fprintf( stderr, " %s%s", b->a_dn_self ? "self" : "", - accessmask2str( b->a_mask, maskbuf ) ); + accessmask2str( b->a_access_mask, maskbuf ) ); if( b->a_type == ACL_BREAK ) { fprintf( stderr, " break" ); diff --git a/servers/slapd/bind.c b/servers/slapd/bind.c index b78d96504d..294c851ce7 100644 --- a/servers/slapd/bind.c +++ b/servers/slapd/bind.c @@ -186,7 +186,7 @@ do_bind( if ( method == LDAP_AUTH_SASL ) { char *edn; - unsigned long ssf = 0; + slap_ssf_t ssf = 0; if ( version < LDAP_VERSION3 ) { Debug( LDAP_DEBUG_ANY, "do_bind: sasl with LDAPv%ld\n", diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index d76c7df89c..4d2c62ef2e 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -291,7 +291,7 @@ long connection_init( const char* peername, const char* sockname, int use_tls, - unsigned ssf, + slap_ssf_t ssf, char *authid ) { unsigned long id; @@ -922,14 +922,14 @@ int connection_read(ber_socket_t s) } else if ( rc == 0 ) { void *ssl; - unsigned ssf; + slap_ssf_t ssf; char *authid; c->c_needs_tls_accept = 0; /* we need to let SASL know */ ssl = (void *)ldap_pvt_tls_sb_handle( c->c_sb ); - ssf = (unsigned)ldap_pvt_tls_get_strength( ssl ); + ssf = (slap_ssf_t) ldap_pvt_tls_get_strength( ssl ); authid = (char *)ldap_pvt_tls_get_peer( ssl ); slap_sasl_external( c, ssf, authid ); } diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 9c961d607d..fb0b70f1e2 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -829,7 +829,7 @@ slapd_daemon_task( ber_int_t s; socklen_t len = sizeof(from); long id; - unsigned ssf = 0; + slap_ssf_t ssf = 0; char *authid = NULL; char *dnsname; diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 55927d4d63..8ae6be8c85 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -77,8 +77,8 @@ LDAP_SLAPD_F (char *) access2str LDAP_P(( slap_access_t access )); LDAP_SLAPD_F (slap_access_t) str2access LDAP_P(( const char *str )); #define ACCESSMASK_MAXLEN sizeof("unknown (+wrscan)") -LDAP_SLAPD_F (char *) accessmask2str LDAP_P(( slap_access_mask_t mask, char* )); -LDAP_SLAPD_F (slap_access_mask_t) str2accessmask LDAP_P(( const char *str )); +LDAP_SLAPD_F (char *) accessmask2str LDAP_P(( slap_mask_t mask, char* )); +LDAP_SLAPD_F (slap_mask_t) str2accessmask LDAP_P(( const char *str )); /* * at.c @@ -269,7 +269,7 @@ LDAP_SLAPD_F (long) connection_init LDAP_P(( const char* peername, const char* sockname, int use_tls, - unsigned ssf, + slap_ssf_t ssf, char *id )); LDAP_SLAPD_F (void) connection_closing LDAP_P(( Connection *c )); @@ -537,7 +537,7 @@ LDAP_SLAPD_F (int) slap_sasl_open( Connection *c ); LDAP_SLAPD_F (char **) slap_sasl_mechs( Connection *c ); LDAP_SLAPD_F (int) slap_sasl_external( Connection *c, - unsigned ssf, /* relative strength of external security */ + slap_ssf_t ssf, /* relative strength of external security */ char *authid ); /* asserted authenication id */ LDAP_SLAPD_F (int) slap_sasl_reset( Connection *c ); @@ -547,7 +547,7 @@ LDAP_SLAPD_F (int) slap_sasl_bind LDAP_P(( Connection *conn, Operation *op, const char *dn, const char *ndn, const char *mech, struct berval *cred, - char **edn, unsigned long *ssf )); + char **edn, slap_ssf_t *ssf )); /* oc.c */ LDAP_SLAPD_F (int) oc_schema_info( Entry *e ); diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c index 9d509ba9f9..7363716c92 100644 --- a/servers/slapd/sasl.c +++ b/servers/slapd/sasl.c @@ -290,7 +290,7 @@ int slap_sasl_open( Connection *conn ) int slap_sasl_external( Connection *conn, - unsigned ssf, + slap_ssf_t ssf, char *auth_id ) { #ifdef HAVE_CYRUS_SASL @@ -302,7 +302,7 @@ int slap_sasl_external( return LDAP_UNAVAILABLE; } - memset( &extprops, 0L, sizeof(extprops) ); + memset( &extprops, '\0', sizeof(extprops) ); extprops.ssf = ssf; extprops.auth_id = auth_id; @@ -385,7 +385,7 @@ int slap_sasl_bind( const char *mech, struct berval *cred, char **edn, - unsigned long *ssfp ) + slap_ssf_t *ssfp ) { int rc = 1; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 9c262ec3cb..c43b882b54 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -114,6 +114,10 @@ LDAP_BEGIN_DECL LDAP_SLAPD_F (int) slap_debug; +typedef unsigned slap_ssf_t; +typedef unsigned long slap_mask_t; + + /* * Index types */ @@ -150,8 +154,6 @@ LDAP_SLAPD_F (int) slap_debug; #define SLAP_INDEX_LANG 0x4000UL /* use index with lang subtypes */ #define SLAP_INDEX_AUTO_LANG 0x8000UL /* use mask with lang subtypes */ -typedef unsigned long slap_mask_t; - /* * there is a single index for each attribute. these prefixes ensure * that there is no collision among keys. @@ -618,7 +620,6 @@ typedef enum slap_style_e { ACL_STYLE_EXACT = ACL_STYLE_BASE } slap_style_t; -typedef unsigned long slap_access_mask_t; /* the "by" part */ typedef struct slap_access { @@ -681,7 +682,7 @@ typedef struct slap_access { #define ACL_LVL_ASSIGN_READ(m) ACL_PRIV_ASSIGN((m),ACL_LVL_READ) #define ACL_LVL_ASSIGN_WRITE(m) ACL_PRIV_ASSIGN((m),ACL_LVL_WRITE) - slap_access_mask_t a_mask; + slap_mask_t a_access_mask; slap_style_t a_dn_style; char *a_dn_pat; -- 2.39.5