[389-commits] Branch 'Directory_Server_8_2_Branch' - 2 commits - ldap/servers

Richard Allen Megginson rmeggins at fedoraproject.org
Fri Feb 26 18:25:59 UTC 2010


 ldap/servers/plugins/syntaxes/string.c |    6 +++---
 ldap/servers/slapd/entrywsi.c          |    4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 6191492dbbbead39747ef39da3f6843bfb3509d0
Author: Rich Megginson <rmeggins at redhat.com>
Date:   Thu Feb 25 19:07:25 2010 -0700

    389 DS segfaults on libsyntax-plugin.so - part 2
    
    https://bugzilla.redhat.com/show_bug.cgi?id=516611
    Resolves: bug 516611
    Bug Description: 389 DS segfaults on libsyntax-plugin.so - part 2
    Reviewed by: nkinder (Thanks!)
    Branch: Directory_Server_8_2_Branch
    Fix Description: If there is an empty mod/replace of a non-existent attribute
    following a real modify operation, the server will allow it, and the code in
    entry_delete_present_values_wsi() would create an empty Slapi_Attr.  LDAP
    says that an empty mod/replace of a non-existent attribute should be ignored,
    as it is in the non-repl case.
    Platforms tested: RHEL5 x86_64
    Flag Day: no
    Doc impact: no
    (cherry picked from commit 38d13f961c0d8033aa3dd3e5a3a8f32bc1650691)

diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c
index 5fcb30d..14ff163 100644
--- a/ldap/servers/slapd/entrywsi.c
+++ b/ldap/servers/slapd/entrywsi.c
@@ -646,7 +646,9 @@ entry_delete_present_values_wsi(Slapi_Entry *e, const char *type, struct berval
 			LDAPDebug( LDAP_DEBUG_ARGS, "could not find attribute %s\n", type, 0, 0 );
 		}
 		retVal= LDAP_NO_SUCH_ATTRIBUTE;
-		if (LDAP_MOD_REPLACE == mod_op)
+		/* NOTE: LDAP says that a MOD REPLACE with no vals of a non-existent
+		   attribute is a no-op - MOD REPLACE with some vals will add the attribute */
+		if ((LDAP_MOD_REPLACE == mod_op) && vals && vals[0])
 		{
 			/* Create a new attribute and set the adcsn */
 			Slapi_Attr *a = slapi_attr_new();


commit 9f7731b8b6569d754e63fdbdd08647f9f908e15d
Author: Rich Megginson <rmeggins at redhat.com>
Date:   Thu Feb 25 10:03:52 2010 -0700

    389 DS segfaults on libsyntax-plugin.so - part 1
    
    https://bugzilla.redhat.com/show_bug.cgi?id=516611
    Resolves: bug 516611
    Bug Description: 389 DS segfaults on libsyntax-plugin.so - part 1
    Reviewed by: nkinder (Thanks!)
    Branch: Directory_Server_8_2_Branch
    Fix Description: Check for NULL bvals in the string syntax filter functions
    ava, sub, and key generation
    Platforms tested: RHEL5 x86_64
    Flag Day: no
    Doc impact: no
    (cherry picked from commit ea0cdc6ce1cf1c9a690acab443e6df11b3e0fe15)

diff --git a/ldap/servers/plugins/syntaxes/string.c b/ldap/servers/plugins/syntaxes/string.c
index c2f0fa6..ad607dc 100644
--- a/ldap/servers/plugins/syntaxes/string.c
+++ b/ldap/servers/plugins/syntaxes/string.c
@@ -77,7 +77,7 @@ string_filter_ava( struct berval *bvfilter, Slapi_Value **bvals, int syntax,
 	value_normalize( bvfilter_norm.bv_val, syntax, 1 /* trim leading blanks */ );
 	bvfilter_norm.bv_len = strlen(bvfilter_norm.bv_val);
 
-	for ( i = 0; bvals[i] != NULL; i++ ) {
+	for ( i = 0; (bvals != NULL) && (bvals[i] != NULL); i++ ) {
 		rc = value_cmp( (struct berval*)slapi_value_get_berval(bvals[i]), &bvfilter_norm, syntax, 1/* Normalise the first value only */ );
                 switch ( ftype ) {
                 case LDAP_FILTER_GE:
@@ -135,7 +135,7 @@ string_filter_approx( struct berval *bvfilter, Slapi_Value **bvals,
 	if(retVal) {
 		*retVal = NULL;
 	}
-	for ( i = 0; bvals[i] != NULL; i++ ) {
+	for ( i = 0; (bvals != NULL) && (bvals[i] != NULL); i++ ) {
 		w2 = (char*)slapi_value_get_string(bvals[i]); /* JCM cast */
 		ava_wordcount = 0;
 		/* for each word in the filter value */
@@ -310,7 +310,7 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final,
 	rc = -1;
 	tmpbuf = NULL;
 	tmpbufsize = 0;
-	for ( j = 0; bvals[j] != NULL; j++ ) {
+	for ( j = 0; (bvals != NULL) && (bvals[j] != NULL); j++ ) {
 		int	tmprc;
 		size_t	len;
 		const struct berval *bvp = slapi_value_get_berval(bvals[j]);




More information about the 389-commits mailing list