[Fedora-directory-commits] ldapserver/ldap/servers/slapd entry.c, 1.12, 1.13 fedse.c, 1.9, 1.10

Noriko Hosoi (nhosoi) fedora-directory-commits at redhat.com
Mon Jun 11 17:22:40 UTC 2007


Author: nhosoi

Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv11857/ldap/servers/slapd

Modified Files:
	entry.c fedse.c 
Log Message:
Resolves: #243488
Summary: Use mozldap6 ldif_parse_line API 
Changes:
1) Removed ldif.h from the DS tree.
2) Eliminated the 5-th arg of ldif_parse_line (errmsg) and the errmsg related
code. 



Index: entry.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/entry.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- entry.c	10 Nov 2006 23:45:40 -0000	1.12
+++ entry.c	11 Jun 2007 17:22:37 -0000	1.13
@@ -203,27 +203,17 @@
 		int maxvals;
 		int del_maxvals;
 		char *type;
-		char *errmsg = NULL;
 
 		if ( *s == '\n' || *s == '\0' ) {
 			break;
 		}
 
-		if ( (retmalloc = ldif_parse_line( s, &type, &valuecharptr, &valuelen, &errmsg )) < 0 ) {
-			if ( errmsg != NULL ) {
-			         LDAPDebug( LDAP_DEBUG_PARSE, "%s", errmsg, 0, 0 );
-				 /* the memory below was not allocated by the slapi_ch_ functions */
-				 PR_smprintf_free(errmsg );
-			}
+		if ( (retmalloc = ldif_parse_line( s, &type, &valuecharptr, &valuelen )) < 0 ) {
 			LDAPDebug( LDAP_DEBUG_TRACE,
 			    "<= str2entry_fast NULL (parse_line)\n", 0, 0, 0 );
 			continue;
 		}
 
-		/* We don't use errmsg anywhere later. free it to avoid leaking... */
-		/* the memory below was not allocated by the slapi_ch_ functions */
-		slapi_ch_free( (void**)&errmsg );
-
 		/*
 		 * Extract the attribute and value CSNs from the attribute type.
 		 */		
@@ -581,7 +571,6 @@
     int i, j;
     char *next=NULL;
     char *valuecharptr=NULL;
-    char *errmsg = NULL;
     int retmalloc = 0;
     int rc;
 	int fast_dup_check = 0;
@@ -617,21 +606,12 @@
 		    break;
 		}
 
-		if ( (retmalloc = ldif_parse_line( s, &type, &valuecharptr, &valuelen, &errmsg )) < 0 ) {
-		    if ( errmsg != NULL ) {
-		             LDAPDebug( LDAP_DEBUG_PARSE, "%s", errmsg, 0, 0 );
-			     /* the memory below was not allocated by the slapi_ch_ functions */
-			     PR_smprintf_free(errmsg );
-		    }
+		if ( (retmalloc = ldif_parse_line( s, &type, &valuecharptr, &valuelen )) < 0 ) {
 		    LDAPDebug( LDAP_DEBUG_TRACE,
 			    "<= slapi_str2entry NULL (parse_line)\n", 0, 0, 0 );
 		    continue;
 		}
 
-		/* We don't use errmsg anywhere later. free it to avoid leaking... */
-		/* the memory below was not allocated by the slapi_ch_ functions */
-		slapi_ch_free( (void**)&errmsg );
-
 		/*
 		 * Extract the attribute and value CSNs from the attribute type.
 		 */		


Index: fedse.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/fedse.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- fedse.c	10 Nov 2006 23:45:40 -0000	1.9
+++ fedse.c	11 Jun 2007 17:22:37 -0000	1.10
@@ -1735,7 +1735,6 @@
     {
 		static int twiddle= -1;
 		char *type, *value, *copy;
-		char *errmsg = NULL;
 		int vlen;
 		struct berval bv;
 		struct berval *bvals[2];
@@ -1745,12 +1744,7 @@
 		bvals[0] = &bv;
 		bvals[1] = NULL;
 		copy= slapi_ch_strdup(easter_egg_photos[twiddle%NUM_EASTER_EGG_PHOTOS]);
-		if ( (retmalloc = ldif_parse_line(copy, &type, &value, &vlen, &errmsg)) < 0 ) {
-		    if ( errmsg != NULL ) {
-		             slapi_log_error( SLAPI_LOG_PARSE, "dse", "%s", errmsg );
-			     /* the memory below was not allocated by the slapi_ch_ functions */
-			     PR_smprintf_free(errmsg );
-		    }
+		if ( (retmalloc = ldif_parse_line(copy, &type, &value, &vlen)) < 0 ) {
 		    return SLAPI_DSE_CALLBACK_ERROR;
 		}
 		bv.bv_val = value;
@@ -1760,7 +1754,6 @@
 		slapi_ch_free((void**)&copy);
 		twiddle++;
 		/* the memory below was not allocated by the slapi_ch_ functions */
-		slapi_ch_free( (void**)&errmsg );
 		if (retmalloc) slapi_ch_free( (void**)&value );
         return SLAPI_DSE_CALLBACK_OK;
     }




More information about the Fedora-directory-commits mailing list