Misc cleanup, lint removal, and minor optimizations

This commit is contained in:
Kurt Zeilenga 2002-01-13 05:00:59 +00:00
parent 4298f5d991
commit ce2d8ebc7e
7 changed files with 54 additions and 48 deletions

View File

@ -461,7 +461,7 @@ ber_get_next(
while (ber->ber_rwptr > (char *)&ber->ber_tag && ber->ber_rwptr < while (ber->ber_rwptr > (char *)&ber->ber_tag && ber->ber_rwptr <
(char *)(&ber->ber_usertag + 1)) { (char *)(&ber->ber_usertag + 1)) {
int i; ber_slen_t i;
char buf[sizeof(ber->ber_len)-1]; char buf[sizeof(ber->ber_len)-1];
ber_len_t tlen = 0; ber_len_t tlen = 0;
@ -563,7 +563,7 @@ ber_get_next(
} }
ber->ber_ptr = ber->ber_buf; ber->ber_ptr = ber->ber_buf;
ber->ber_usertag = 0; ber->ber_usertag = 0;
if (i == ber->ber_len) { if ((ber_len_t)i == ber->ber_len) {
goto done; goto done;
} }
ber->ber_rwptr = ber->ber_buf + i; ber->ber_rwptr = ber->ber_buf + i;

View File

@ -728,14 +728,7 @@ parse_acl(
} }
} else { } else {
rc = slap_str2ad( SLAPD_ACI_ATTR, &b->a_aci_at, &text ); b->a_aci_at = slap_schema.si_ad_aci;
if( rc != LDAP_SUCCESS ) {
fprintf( stderr,
"%s: line %d: aci \"%s\": %s\n",
fname, lineno, SLAPD_ACI_ATTR, text );
acl_usage();
}
} }
if( !is_at_syntax( b->a_aci_at->ad_type, if( !is_at_syntax( b->a_aci_at->ad_type,

View File

@ -41,7 +41,9 @@ slap_operational_hasSubordinate( int hs )
a->a_desc = slap_schema.si_ad_hasSubordinates; a->a_desc = slap_schema.si_ad_hasSubordinates;
a->a_vals = ch_malloc( 2 * sizeof( struct berval ) ); a->a_vals = ch_malloc( 2 * sizeof( struct berval ) );
ber_str2bv( hs ? "TRUE" : "FALSE", 0, 1, a->a_vals ); ber_str2bv( hs ? "TRUE" : "FALSE",
hs ? sizeof("TRUE")-1 : sizeof("FALSE")-1,
1, a->a_vals );
a->a_vals[1].bv_val = NULL; a->a_vals[1].bv_val = NULL;
a->a_next = NULL; a->a_next = NULL;

View File

@ -142,7 +142,6 @@ static long send_ldap_ber(
err, sock_errstr(err), 0 ); err, sock_errstr(err), 0 );
#endif #endif
if ( err != EWOULDBLOCK && err != EAGAIN ) { if ( err != EWOULDBLOCK && err != EAGAIN ) {
connection_closing( conn ); connection_closing( conn );
@ -208,7 +207,6 @@ send_ldap_response(
(long) msgid, (long) tag, (long) err ); (long) msgid, (long) tag, (long) err );
#endif #endif
if( ref ) { if( ref ) {
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS, LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,

View File

@ -69,8 +69,8 @@ entry_schema_check(
} }
if( !collective && is_at_collective( a->a_desc->ad_type ) ) { if( !collective && is_at_collective( a->a_desc->ad_type ) ) {
snprintf( textbuf, textlen, "attribute '%s' " snprintf( textbuf, textlen,
"may only appear in collectiveAttributes subentry", "'%s' can only appear in collectiveAttributes subentry",
type ); type );
return LDAP_OBJECT_CLASS_VIOLATION; return LDAP_OBJECT_CLASS_VIOLATION;
} }
@ -226,6 +226,7 @@ entry_schema_check(
return rc; return rc;
} }
} }
if ( oc->soc_kind == LDAP_SCHEMA_ABSTRACT ) { if ( oc->soc_kind == LDAP_SCHEMA_ABSTRACT ) {
/* object class is abstract */ /* object class is abstract */
if ( oc != slap_schema.si_oc_top && if ( oc != slap_schema.si_oc_top &&

View File

@ -138,8 +138,6 @@ LDAP_BEGIN_DECL
#define SLAPD_ROLE_CLASS "organizationalRole" #define SLAPD_ROLE_CLASS "organizationalRole"
#define SLAPD_ACI_SYNTAX "1.3.6.1.4.1.4203.666.2.1" #define SLAPD_ACI_SYNTAX "1.3.6.1.4.1.4203.666.2.1"
#define SLAPD_ACI_ATTR "OpenLDAPaci"
#define SLAPD_OCTETSTRING_SYNTAX "1.3.6.1.4.1.1466.115.121.1.40" #define SLAPD_OCTETSTRING_SYNTAX "1.3.6.1.4.1.1466.115.121.1.40"
/* change this to "OpenLDAPset" */ /* change this to "OpenLDAPset" */
@ -483,6 +481,27 @@ typedef struct slap_object_class {
#define soc_extensions soc_oclass.oc_extensions #define soc_extensions soc_oclass.oc_extensions
} ObjectClass; } ObjectClass;
#ifdef LDAP_DIT_CONTENT_RULES
/*
* DIT content rule
*/
typedef struct slap_content_rule {
LDAPContentRule scr_crule;
ObjectClass *scr_sclass;
ObjectClass **scr_auxiliaries; /* optional */
AttributeType **scr_required; /* optional */
AttributeType **scr_allowed; /* optional */
AttributeType **scr_precluded; /* optional */
#define scr_oid scr_crule.cr_oid
#define scr_names scr_crule.cr_names
#define scr_desc scr_crule.cr_desc
#define scr_obsolete soc_oclass.cr_obsolete
#define scr_cr_oids_aux soc_oclass.cr_oc_oids_aux
#define scr_cr_oids_must soc_oclass.cr_at_oids_must
#define scr_cr_oids_may soc_oclass.cr_at_oids_may
#define scr_cr_oids_not soc_oclass.cr_at_oids_not
} ContentRule;
#endif
/* /*
* represents a recognized attribute description ( type + options ) * represents a recognized attribute description ( type + options )
@ -1347,41 +1366,36 @@ typedef void (slap_sresult)( struct slap_conn *, struct slap_op *,
typedef struct slap_op { typedef struct slap_op {
ber_int_t o_opid; /* id of this operation */ ber_int_t o_opid; /* id of this operation */
ber_int_t o_msgid; /* msgid of the request */ ber_int_t o_msgid; /* msgid of the request */
#ifdef LDAP_CONNECTIONLESS ber_int_t o_protocol; /* version of the LDAP protocol used by client */
Sockaddr o_peeraddr; /* UDP peer address */
#endif
ldap_pvt_thread_t o_tid; /* thread handling this op */
BerElement *o_ber; /* ber of the request */
ber_tag_t o_tag; /* tag of the request */ ber_tag_t o_tag; /* tag of the request */
time_t o_time; /* time op was initiated */ time_t o_time; /* time op was initiated */
AuthorizationInformation o_authz;
ber_int_t o_protocol; /* version of the LDAP protocol used by client */
LDAPControl **o_ctrls; /* controls */
unsigned long o_connid; /* id of conn initiating this op */ unsigned long o_connid; /* id of conn initiating this op */
ldap_pvt_thread_t o_tid; /* thread handling this op */
ldap_pvt_thread_mutex_t o_abandonmutex; /* protects o_abandon */
int o_abandon; /* abandon flag */
slap_response *o_response; /* callback function */
slap_sresult *o_sresult; /* search result callback */
LDAP_STAILQ_ENTRY(slap_op) o_next; /* next operation in list */
void *o_private; /* anything the backend needs */
void *o_glue; /* for the glue backend */
#define SLAP_NO_CONTROL 0 #define SLAP_NO_CONTROL 0
#define SLAP_NONCRITICAL_CONTROL 1 #define SLAP_NONCRITICAL_CONTROL 1
#define SLAP_CRITICAL_CONTROL 2 #define SLAP_CRITICAL_CONTROL 2
char o_managedsait; char o_managedsait;
char o_subentries; char o_subentries;
char o_subentries_visibility; char o_subentries_visibility;
int o_abandon; /* abandon flag */
ldap_pvt_thread_mutex_t o_abandonmutex; /* protects o_abandon */
#ifdef LDAP_CONNECTIONLESS
Sockaddr o_peeraddr; /* UDP peer address */
#endif
AuthorizationInformation o_authz;
BerElement *o_ber; /* ber of the request */
slap_response *o_response; /* callback function */
slap_sresult *o_sresult; /* search result callback */
LDAPControl **o_ctrls; /* controls */
void *o_glue; /* for the glue backend */
void *o_private; /* anything the backend needs */
LDAP_STAILQ_ENTRY(slap_op) o_next; /* next operation in list */
} Operation; } Operation;
#define get_manageDSAit(op) ((int)(op)->o_managedsait) #define get_manageDSAit(op) ((int)(op)->o_managedsait)

View File

@ -22,7 +22,7 @@
int int
main( int argc, char **argv ) main( int argc, char **argv )
{ {
char *buf; char *buf = NULL;
int lineno; int lineno;
int lmax; int lmax;
int rc = EXIT_SUCCESS; int rc = EXIT_SUCCESS;
@ -42,7 +42,6 @@ main( int argc, char **argv )
exit( EXIT_FAILURE ); exit( EXIT_FAILURE );
} }
buf = NULL;
lmax = 0; lmax = 0;
lineno = 0; lineno = 0;
@ -55,7 +54,6 @@ main( int argc, char **argv )
while( ldif_read_record( ldiffp, &lineno, &buf, &lmax ) ) { while( ldif_read_record( ldiffp, &lineno, &buf, &lmax ) ) {
ID id; ID id;
Entry *e = str2entry( buf ); Entry *e = str2entry( buf );
char buf[1024];
struct berval bvtext = { textlen, textbuf }; struct berval bvtext = { textlen, textbuf };
if( e == NULL ) { if( e == NULL ) {