Commit ce2d8ebc authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Misc cleanup, lint removal, and minor optimizations

parent 4298f5d9
......@@ -461,7 +461,7 @@ ber_get_next(
while (ber->ber_rwptr > (char *)&ber->ber_tag && ber->ber_rwptr <
(char *)(&ber->ber_usertag + 1)) {
int i;
ber_slen_t i;
char buf[sizeof(ber->ber_len)-1];
ber_len_t tlen = 0;
......@@ -563,7 +563,7 @@ ber_get_next(
}
ber->ber_ptr = ber->ber_buf;
ber->ber_usertag = 0;
if (i == ber->ber_len) {
if ((ber_len_t)i == ber->ber_len) {
goto done;
}
ber->ber_rwptr = ber->ber_buf + i;
......@@ -596,8 +596,8 @@ done:
if ( ber->ber_debug ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "liblber", LDAP_LEVEL_DETAIL1,
"ber_get_next: tag 0x%lx len %ld\n",
ber->ber_tag, ber->ber_len ));
"ber_get_next: tag 0x%lx len %ld\n",
ber->ber_tag, ber->ber_len ));
BER_DUMP(( "liblber", LDAP_LEVEL_DETAIL2, ber, 1 ));
#else
ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
......
......@@ -728,14 +728,7 @@ parse_acl(
}
} else {
rc = slap_str2ad( SLAPD_ACI_ATTR, &b->a_aci_at, &text );
if( rc != LDAP_SUCCESS ) {
fprintf( stderr,
"%s: line %d: aci \"%s\": %s\n",
fname, lineno, SLAPD_ACI_ATTR, text );
acl_usage();
}
b->a_aci_at = slap_schema.si_ad_aci;
}
if( !is_at_syntax( b->a_aci_at->ad_type,
......
......@@ -41,7 +41,9 @@ slap_operational_hasSubordinate( int hs )
a->a_desc = slap_schema.si_ad_hasSubordinates;
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_next = NULL;
......
......@@ -142,7 +142,6 @@ static long send_ldap_ber(
err, sock_errstr(err), 0 );
#endif
if ( err != EWOULDBLOCK && err != EAGAIN ) {
connection_closing( conn );
......@@ -208,7 +207,6 @@ send_ldap_response(
(long) msgid, (long) tag, (long) err );
#endif
if( ref ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
......
......@@ -69,8 +69,8 @@ entry_schema_check(
}
if( !collective && is_at_collective( a->a_desc->ad_type ) ) {
snprintf( textbuf, textlen, "attribute '%s' "
"may only appear in collectiveAttributes subentry",
snprintf( textbuf, textlen,
"'%s' can only appear in collectiveAttributes subentry",
type );
return LDAP_OBJECT_CLASS_VIOLATION;
}
......@@ -226,6 +226,7 @@ entry_schema_check(
return rc;
}
}
if ( oc->soc_kind == LDAP_SCHEMA_ABSTRACT ) {
/* object class is abstract */
if ( oc != slap_schema.si_oc_top &&
......
......@@ -138,8 +138,6 @@ LDAP_BEGIN_DECL
#define SLAPD_ROLE_CLASS "organizationalRole"
#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"
/* change this to "OpenLDAPset" */
......@@ -483,6 +481,27 @@ typedef struct slap_object_class {
#define soc_extensions soc_oclass.oc_extensions
} 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 )
......@@ -1347,41 +1366,36 @@ typedef void (slap_sresult)( struct slap_conn *, struct slap_op *,
typedef struct slap_op {
ber_int_t o_opid; /* id of this operation */
ber_int_t o_msgid; /* msgid of the request */
#ifdef LDAP_CONNECTIONLESS
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_int_t o_protocol; /* version of the LDAP protocol used by client */
ber_tag_t o_tag; /* tag of the request */
time_t o_time; /* time op was initiated */
unsigned long o_connid; /* id of conn initiating this op */
ldap_pvt_thread_t o_tid; /* thread handling this op */
AuthorizationInformation o_authz;
ber_int_t o_protocol; /* version of the LDAP protocol used by client */
#define SLAP_NO_CONTROL 0
#define SLAP_NONCRITICAL_CONTROL 1
#define SLAP_CRITICAL_CONTROL 2
char o_managedsait;
char o_subentries;
char o_subentries_visibility;
LDAPControl **o_ctrls; /* controls */
int o_abandon; /* abandon flag */
ldap_pvt_thread_mutex_t o_abandonmutex; /* protects o_abandon */
unsigned long o_connid; /* id of conn initiating this op */
#ifdef LDAP_CONNECTIONLESS
Sockaddr o_peeraddr; /* UDP peer address */
#endif
AuthorizationInformation o_authz;
ldap_pvt_thread_mutex_t o_abandonmutex; /* protects o_abandon */
int o_abandon; /* abandon flag */
BerElement *o_ber; /* ber of the request */
slap_response *o_response; /* callback function */
slap_sresult *o_sresult; /* search result callback */
LDAPControl **o_ctrls; /* controls */
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 */
void *o_private; /* anything the backend needs */
#define SLAP_NO_CONTROL 0
#define SLAP_NONCRITICAL_CONTROL 1
#define SLAP_CRITICAL_CONTROL 2
char o_managedsait;
char o_subentries;
char o_subentries_visibility;
LDAP_STAILQ_ENTRY(slap_op) o_next; /* next operation in list */
} Operation;
#define get_manageDSAit(op) ((int)(op)->o_managedsait)
......@@ -1510,7 +1524,7 @@ typedef struct slap_listener {
#ifdef LDAP_CONNECTIONLESS
int sl_is_udp; /* UDP listener is also data port */
#endif
ber_socket_t sl_sd;
ber_socket_t sl_sd;
Sockaddr sl_sa;
#define sl_addr sl_sa.sa_in_addr
} Listener;
......
......@@ -22,7 +22,7 @@
int
main( int argc, char **argv )
{
char *buf;
char *buf = NULL;
int lineno;
int lmax;
int rc = EXIT_SUCCESS;
......@@ -42,7 +42,6 @@ main( int argc, char **argv )
exit( EXIT_FAILURE );
}
buf = NULL;
lmax = 0;
lineno = 0;
......@@ -55,7 +54,6 @@ main( int argc, char **argv )
while( ldif_read_record( ldiffp, &lineno, &buf, &lmax ) ) {
ID id;
Entry *e = str2entry( buf );
char buf[1024];
struct berval bvtext = { textlen, textbuf };
if( e == NULL ) {
......
Supports Markdown
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