From b6c16f861ef328afaf5de0d41836d2a7c25b97ab Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Mon, 8 Mar 1999 00:39:46 +0000 Subject: [PATCH] Align with code changes in liblber/libldap: Replace LDAPMod with a new struct LDAPModList. Rename lber_debug to lber_int_debug. --- servers/ldapd/common.h | 11 ++++++++++- servers/ldapd/main.c | 2 +- servers/ldapd/modify.c | 29 +++++++++++++++-------------- servers/ldapd/proto-ldapd.h | 2 +- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/servers/ldapd/common.h b/servers/ldapd/common.h index b5ea74af0e..9c7f567d61 100644 --- a/servers/ldapd/common.h +++ b/servers/ldapd/common.h @@ -31,6 +31,15 @@ struct conn { struct conn *c_next; }; +/* + * This structure represents a sequence of LDAPMod elements. + */ +typedef struct LDAPModList { + LDAPMod m; + struct LDAPModList *mod_next; +} LDAPModList; + + /* * This structure represents an outstanding request. There is one of * these for each client request for which we have not yet received a @@ -41,7 +50,7 @@ struct msg { int m_msgid; /* the message id */ int m_uniqid; /* unique id for this message */ int m_msgtype; /* the ldap operation type */ - LDAPMod *m_mods; /* for modify operations only */ + LDAPModList *m_mods; /* for modify operations only */ BerElement *m_ber; /* the unparsed ber for the op */ struct conn *m_conn; /* connection structure */ #ifdef LDAP_CONNECTIONLESS diff --git a/servers/ldapd/main.c b/servers/ldapd/main.c index 95430ea99a..5e91ec6ea3 100644 --- a/servers/ldapd/main.c +++ b/servers/ldapd/main.c @@ -154,7 +154,7 @@ main( int argc, char **argv ) #ifdef LDAP_DEBUG ldap_debug = atoi( optarg ); if ( ldap_debug & LDAP_DEBUG_PACKETS ) - lber_debug = ldap_debug; + lber_int_debug = ldap_debug; #else fprintf( stderr, "Not compiled with -DLDAP_DEBUG!\n" ); #endif diff --git a/servers/ldapd/modify.c b/servers/ldapd/modify.c index 11a22a1028..2c86978ee2 100644 --- a/servers/ldapd/modify.c +++ b/servers/ldapd/modify.c @@ -51,7 +51,7 @@ do_modify( char *last; int rc; unsigned long tag, len; - LDAPMod *mods, *modtail; + LDAPModList *mods, *modtail; struct ds_read_arg ra; Debug( LDAP_DEBUG_TRACE, "do_modify\n", 0, 0, 0 ); @@ -108,17 +108,17 @@ do_modify( mods = modtail = NULL; for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT; tag = ber_next_element( ber, &len, last ) ) { - LDAPMod *tmp; + LDAPModList *tmp; - if ( (tmp = (LDAPMod *) calloc( 1, sizeof(LDAPMod) )) + if ( (tmp = (LDAPModList *) calloc( 1, sizeof(LDAPModList) )) == NULL ) { send_ldap_msgresult( clientsb, MODTAG, m, LDAP_OPERATIONS_ERROR, NULL, "Malloc error" ); return( 0 ); } - if ( ber_scanf( ber, "{i{a[V]}}", &tmp->mod_op, &tmp->mod_type, - &tmp->mod_bvalues ) == LBER_ERROR ) { + if ( ber_scanf( ber, "{i{a[V]}}", &tmp->m.mod_op, + &tmp->m.mod_type, &tmp->m.mod_bvalues ) == LBER_ERROR ) { send_ldap_msgresult( clientsb, MODTAG, m, LDAP_PROTOCOL_ERROR, NULL, "" ); return( 0 ); @@ -157,7 +157,7 @@ do_modify2( struct ds_modifyentry_arg ma; struct entrymod *changetail = NULLMOD; int rc; - LDAPMod *mods; + LDAPModList *mods; Debug( LDAP_DEBUG_TRACE, "do_modify2\n", 0, 0, 0 ); @@ -181,7 +181,7 @@ do_modify2( em->em_next = NULLMOD; if ( (new = get_as( clientsb, MODTAG, m, - mods->mod_type, mods->mod_bvalues )) == NULLATTR ) + mods->m.mod_type, mods->m.mod_bvalues )) == NULLATTR ) return( 0 ); em->em_what = new; @@ -192,13 +192,13 @@ do_modify2( } if ( new->attr_value == NULLAV && - mods->mod_op != LDAP_MOD_DELETE ) { + mods->m.mod_op != LDAP_MOD_DELETE ) { send_ldap_msgresult( clientsb, MODTAG, m, LDAP_INVALID_SYNTAX, NULL, "No values specified" ); return( 0 ); } - switch ( mods->mod_op ) { + switch ( mods->m.mod_op ) { case LDAP_MOD_ADD: Debug( LDAP_DEBUG_ARGS, "ADD:\n", 0, 0, 0 ); @@ -490,14 +490,15 @@ modify_result( Sockbuf *sb, struct msg *m ) } void -modlist_free( LDAPMod *mods ) +modlist_free( LDAPModList *mods ) { - LDAPMod *next = NULL; + LDAPModList *next; for ( ; mods != NULL; mods = next ) { - free( mods->mod_type ); - if ( mods->mod_bvalues != NULL ) - ber_bvecfree( mods->mod_bvalues ); + free( mods->m.mod_type ); + if ( mods->m.mod_bvalues != NULL ) + ber_bvecfree( mods->m.mod_bvalues ); + next = mods->mod_next; free( mods ); } } diff --git a/servers/ldapd/proto-ldapd.h b/servers/ldapd/proto-ldapd.h index 57ac601696..61f575f31e 100644 --- a/servers/ldapd/proto-ldapd.h +++ b/servers/ldapd/proto-ldapd.h @@ -109,7 +109,7 @@ int do_modify2 LDAP_P((Sockbuf *sb, struct msg *m, struct ds_read_result *rr)); Attr_Sequence get_as LDAP_P(( Sockbuf *clientsb, unsigned long op, struct msg *m, char *type, struct berval **bvals )); void modify_result LDAP_P(( Sockbuf *sb, struct msg *m )); -void modlist_free LDAP_P(( LDAPMod *mods )); +void modlist_free LDAP_P(( LDAPModList *mods )); /* * modrdn.c -- 2.39.5