svn commit: samba r14147 - branches/SAMBA_3_0/source/utils trunk/source/utils

jmcd at samba.org jmcd at samba.org
Fri Mar 10 13:33:03 GMT 2006


Author: jmcd
Date: 2006-03-10 13:33:02 +0000 (Fri, 10 Mar 2006)
New Revision: 14147

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14147

Log:
Fix coverity #119.  alloc'ed memory returned not saved, so not freed.
Need to go back and correct the assumption that an "ldap xxx suffix"
parm must have an OU.

Modified:
   branches/SAMBA_3_0/source/utils/net_rpc_samsync.c
   trunk/source/utils/net_rpc_samsync.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/net_rpc_samsync.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_rpc_samsync.c	2006-03-10 13:14:01 UTC (rev 14146)
+++ branches/SAMBA_3_0/source/utils/net_rpc_samsync.c	2006-03-10 13:33:02 UTC (rev 14147)
@@ -1076,11 +1076,15 @@
 	if (machine_suffix && *machine_suffix && 
 	    strcmp(machine_suffix, user_suffix) &&
 	    strcmp(machine_suffix, suffix)) {
-		fprintf(add_fd, "# %s\n", lp_ldap_machine_suffix());
-		fprintf(add_fd, "dn: %s\n", lp_ldap_machine_suffix());
+		char *machine_ou = NULL;
+		fprintf(add_fd, "# %s\n", machine_suffix);
+		fprintf(add_fd, "dn: %s\n", machine_suffix);
 		fprintf(add_fd, "objectClass: organizationalUnit\n");
-		fprintf(add_fd, "ou: %s\n", 
-			sstring_sub(lp_ldap_machine_suffix(), '=', ','));
+		/* this isn't totally correct as it assumes that
+		   there _must_ be an ou. just fixing memleak now. jmcd */
+		machine_ou = sstring_sub(lp_ldap_machine_suffix(), '=', ',');
+		fprintf(add_fd, "ou: %s\n", machine_ou);
+		SAFE_FREE(machine_ou);
 		fprintf(add_fd, "\n");
 		fflush(add_fd);
 	}

Modified: trunk/source/utils/net_rpc_samsync.c
===================================================================
--- trunk/source/utils/net_rpc_samsync.c	2006-03-10 13:14:01 UTC (rev 14146)
+++ trunk/source/utils/net_rpc_samsync.c	2006-03-10 13:33:02 UTC (rev 14147)
@@ -1076,11 +1076,15 @@
 	if (machine_suffix && *machine_suffix && 
 	    strcmp(machine_suffix, user_suffix) &&
 	    strcmp(machine_suffix, suffix)) {
-		fprintf(add_fd, "# %s\n", lp_ldap_machine_suffix());
-		fprintf(add_fd, "dn: %s\n", lp_ldap_machine_suffix());
+		char *machine_ou = NULL;
+		fprintf(add_fd, "# %s\n", machine_suffix);
+		fprintf(add_fd, "dn: %s\n", machine_suffix);
 		fprintf(add_fd, "objectClass: organizationalUnit\n");
-		fprintf(add_fd, "ou: %s\n", 
-			sstring_sub(lp_ldap_machine_suffix(), '=', ','));
+		/* this isn't totally correct as it assumes that
+		   there _must_ be an ou. just fixing memleak now. jmcd */
+		machine_ou = sstring_sub(lp_ldap_machine_suffix(), '=', ',');
+		fprintf(add_fd, "ou: %s\n", machine_ou);
+		SAFE_FREE(machine_ou);
 		fprintf(add_fd, "\n");
 		fflush(add_fd);
 	}



More information about the samba-cvs mailing list