Commit 1c328aa9 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Minor typedef and other clean ups

parent f6a1c05b
......@@ -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;
}
......
......@@ -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 <access> */
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 <access> 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" );
......
......@@ -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",
......
......@@ -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 );
}
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment