From 12f481d657676b2eadf632b8dcd77f5d77e4a383 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sun, 18 Jul 1999 00:33:30 +0000 Subject: [PATCH] Import patches mistakenly applied to OPENLDAP_DEVEL_REFERRALS. ldap_modify: delete of last attribute value should delete attribute (ITS#229) thr_nt: use sleep to yield --- libraries/libldap_r/thr_nt.c | 1 + servers/slapd/back-bdb2/modify.c | 11 +++++++++++ servers/slapd/back-ldbm/modify.c | 11 +++++++++++ 3 files changed, 23 insertions(+) diff --git a/libraries/libldap_r/thr_nt.c b/libraries/libldap_r/thr_nt.c index 8d79a5e2a8..21f13991b4 100644 --- a/libraries/libldap_r/thr_nt.c +++ b/libraries/libldap_r/thr_nt.c @@ -65,6 +65,7 @@ ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo ) int ldap_pvt_thread_yield( void ) { + Sleep( 0 ); return 0; } diff --git a/servers/slapd/back-bdb2/modify.c b/servers/slapd/back-bdb2/modify.c index 6dee5eeace..ab38573dc2 100644 --- a/servers/slapd/back-bdb2/modify.c +++ b/servers/slapd/back-bdb2/modify.c @@ -355,6 +355,17 @@ bdb2i_delete_values( a->a_vals[k - 1] = a->a_vals[k]; } a->a_vals[k - 1] = NULL; + + /* delete the entire attribute, if no values remain */ + if ( a->a_vals[0] == NULL) { + Debug( LDAP_DEBUG_ARGS, + "removing entire attribute %s\n", + mod->mod_type, 0, 0 ); + if ( attr_delete( &e->e_attrs, mod->mod_type ) ) { + return LDAP_NO_SUCH_ATTRIBUTE; + } + } + break; } diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c index d9e9b8ed4c..b5fc2c19a9 100644 --- a/servers/slapd/back-ldbm/modify.c +++ b/servers/slapd/back-ldbm/modify.c @@ -367,6 +367,17 @@ delete_values( a->a_vals[k - 1] = a->a_vals[k]; } a->a_vals[k - 1] = NULL; + + /* delete the entire attribute, if no values remain */ + if ( a->a_vals[0] == NULL) { + Debug( LDAP_DEBUG_ARGS, + "removing entire attribute %s\n", + mod->mod_type, 0, 0 ); + if ( attr_delete( &e->e_attrs, mod->mod_type ) ) { + return LDAP_NO_SUCH_ATTRIBUTE; + } + } + break; } -- 2.39.5