]> git.sur5r.net Git - openldap/commitdiff
don't care about empty matched/text #ifdef LDAP_NULL_IS_NULL
authorPierangelo Masarati <ando@openldap.org>
Sun, 20 Nov 2005 01:59:26 +0000 (01:59 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sun, 20 Nov 2005 01:59:26 +0000 (01:59 +0000)
servers/slapd/back-ldap/bind.c
servers/slapd/back-ldap/extended.c
servers/slapd/back-ldap/search.c
servers/slapd/back-meta/search.c

index 266136dc3f4a413059689abf97875ecb5aa82e80..6d7899e44dde4efe40c57c67cd7012e1cecc03ac 100644 (file)
@@ -866,6 +866,16 @@ retry:;
                default:
                        rc = ldap_parse_result( lc->lc_ld, res, &rs->sr_err,
                                        &match, &text, NULL, NULL, 1 );
+#ifndef LDAP_NULL_IS_NULL
+                       if ( match != NULL && match[ 0 ] == '\0' ) {
+                               ldap_memfree( match );
+                               match = NULL;
+                       }
+                       if ( text != NULL && text[ 0 ] == '\0' ) {
+                               ldap_memfree( text );
+                               text = NULL;
+                       }
+#endif /* LDAP_NULL_IS_NULL */
                        rs->sr_text = text;
                        if ( rc != LDAP_SUCCESS ) {
                                rs->sr_err = rc;
index 8eef4d317e5089e19ba2acac7c9ccb218b1f776b..dae58547f0a4ecb339a406c3d759e66ece8f6215 100644 (file)
@@ -135,6 +135,7 @@ retry:
                                        (char **)&rs->sr_matched,
                                        (char **)&rs->sr_text,
                                        NULL, NULL, 0 );
+#ifndef LDAP_NULL_IS_NULL
                        if ( rs->sr_matched && rs->sr_matched[ 0 ] == '\0' ) {
                                free( (char *)rs->sr_matched );
                                rs->sr_matched = NULL;
@@ -143,6 +144,7 @@ retry:
                                free( (char *)rs->sr_text );
                                rs->sr_text = NULL;
                        }
+#endif /* LDAP_NULL_IS_NULL */
                        if ( rc == LDAP_SUCCESS ) {
                                if ( rs->sr_err == LDAP_SUCCESS ) {
                                        struct berval   newpw;
index 510a4bba98ccbe0ca3d9a5d7f4fac3dd9204e32a..e1a88800860ed110c88f5ffa43f288d2cc833e3c 100644 (file)
@@ -402,13 +402,22 @@ retry:
                        }
 
                        if ( match.bv_val != NULL ) {
+#ifndef LDAP_NULL_IS_NULL
                                if ( match.bv_val[ 0 ] == '\0' ) {
                                        LDAP_FREE( match.bv_val );
                                        BER_BVZERO( &match );
-                               } else {
+                               } else
+#endif /* LDAP_NULL_IS_NULL */
+                               {
                                        match.bv_len = strlen( match.bv_val );
                                }
                        }
+#ifndef LDAP_NULL_IS_NULL
+                       if ( rs->sr_text != NULL && rs->sr_text[ 0 ] == '\0' ) {
+                               LDAP_FREE( (char *)rs->sr_text );
+                               rs->sr_text = NULL;
+                       }
+#endif /* LDAP_NULL_IS_NULL */
 
                        /* cleanup */
                        if ( references ) {
index dbcab08c8b7007f546f74fd7ce72ab70152f5cdf..fb0c813c6068c4506b716f5d3bf5d33fb5f58673 100644 (file)
@@ -595,11 +595,14 @@ really_bad:;
 
                                /* massage matchedDN if need be */
                                if ( candidates[ i ].sr_matched != NULL ) {
+#ifndef LDAP_NULL_IS_NULL
                                        if ( candidates[ i ].sr_matched[ 0 ] == '\0' ) {
                                                ldap_memfree( (char *)candidates[ i ].sr_matched );
                                                candidates[ i ].sr_matched = NULL;
 
-                                       } else {
+                                       } else
+#endif /* LDAP_NULL_IS_NULL */
+                                       {
                                                struct berval   match, mmatch;
 
                                                ber_str2bv( candidates[ i ].sr_matched,
@@ -622,12 +625,14 @@ really_bad:;
                                        }
                                }
 
+#ifndef LDAP_NULL_IS_NULL
                                /* just get rid of the error message, if any */
                                if ( candidates[ i ].sr_text && candidates[ i ].sr_text[ 0 ] == '\0' )
                                {
                                        ldap_memfree( (char *)candidates[ i ].sr_text );
                                        candidates[ i ].sr_text = NULL;
                                }
+#endif /* LDAP_NULL_IS_NULL */
 
                                /* add references to array */
                                if ( references ) {