svn commit: samba r17446 - in branches/SAMBA_3_0/source/utils: .

vlendec at samba.org vlendec at samba.org
Mon Aug 7 20:15:31 GMT 2006


Author: vlendec
Date: 2006-08-07 20:15:31 +0000 (Mon, 07 Aug 2006)
New Revision: 17446

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

Log:
Fix some C++ warnings and two memleaks found by Coverity, IDs 304 and 305.

Volker
Modified:
   branches/SAMBA_3_0/source/utils/ntlm_auth.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/ntlm_auth.c
===================================================================
--- branches/SAMBA_3_0/source/utils/ntlm_auth.c	2006-08-07 18:55:42 UTC (rev 17445)
+++ branches/SAMBA_3_0/source/utils/ntlm_auth.c	2006-08-07 20:15:31 UTC (rev 17446)
@@ -676,10 +676,13 @@
 		return;
 	} else if (strncmp(buf, "GK", 2) == 0) {
 		DEBUG(10, ("Requested NTLMSSP session key\n"));
-		if(have_session_key)
-			x_fprintf(x_stdout, "GK %s\n", base64_encode_data_blob(session_key));
-		else
+		if(have_session_key) {
+			char *key64 = base64_encode_data_blob(session_key);
+			x_fprintf(x_stdout, "GK %s\n", key64?key64:"<NULL>");
+			SAFE_FREE(key64);
+		} else {
 			x_fprintf(x_stdout, "BH\n");
+		}
 			
 		data_blob_free(&request);
 		return;
@@ -803,7 +806,9 @@
 		DEBUG(10, ("Requested session key\n"));
 
 		if(have_session_key) {
-			x_fprintf(x_stdout, "GK %s\n", base64_encode_data_blob(session_key));
+			char *key64 = base64_encode_data_blob(session_key);
+			x_fprintf(x_stdout, "GK %s\n", key64?key64:"<NULL>");
+			SAFE_FREE(key64);
 		}
 		else {
 			x_fprintf(x_stdout, "BH\n");
@@ -873,7 +878,7 @@
 	char *user, *pass;	
 	user=buf;
 	
-	pass=memchr(buf,' ',length);
+	pass=(char *)memchr(buf,' ',length);
 	if (!pass) {
 		DEBUG(2, ("Password not found. Denying access\n"));
 		x_fprintf(x_stdout, "ERR\n");
@@ -1318,7 +1323,8 @@
 		return False;
 	}
 
-	principal = SMB_MALLOC(spnego.negTokenInit.mechListMIC.length+1);
+	principal = (char *)SMB_MALLOC(
+		spnego.negTokenInit.mechListMIC.length+1);
 
 	if (principal == NULL) {
 		DEBUG(1, ("Could not malloc principal\n"));
@@ -1963,7 +1969,7 @@
 		exit(0);
 	}
     
-	c=memchr(buf,'\n',sizeof(buf)-1);
+	c=(char *)memchr(buf,'\n',sizeof(buf)-1);
 	if (c) {
 		*c = '\0';
 		length = c-buf;



More information about the samba-cvs mailing list