summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-08-07 20:15:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:38:34 -0500
commit175aa92e9e2fa4aa9d0c2fc9d7001ce4fae61a14 (patch)
tree0d48376e89db76db74cb97a31de11d6317b062b4 /source3/utils
parent38eceb12c2a7389164b7c023be282211a5e8d398 (diff)
downloadsamba-175aa92e9e2fa4aa9d0c2fc9d7001ce4fae61a14.tar.gz
samba-175aa92e9e2fa4aa9d0c2fc9d7001ce4fae61a14.tar.bz2
samba-175aa92e9e2fa4aa9d0c2fc9d7001ce4fae61a14.zip
r17446: Fix some C++ warnings and two memleaks found by Coverity, IDs 304 and 305.
Volker (This used to be commit 4f6605a4880f54f2c7d1f3c7554408d893bc623c)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/ntlm_auth.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index c33ab9f8ac..f53b226fbb 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -676,10 +676,13 @@ static void manage_squid_ntlmssp_request(enum stdio_helper_mode stdio_helper_mod
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 @@ static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mo
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 @@ static void manage_squid_basic_request(enum stdio_helper_mode stdio_helper_mode,
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 @@ static BOOL manage_client_krb5_init(SPNEGO_DATA spnego)
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 @@ static void manage_squid_request(enum stdio_helper_mode helper_mode, stdio_helpe
exit(0);
}
- c=memchr(buf,'\n',sizeof(buf)-1);
+ c=(char *)memchr(buf,'\n',sizeof(buf)-1);
if (c) {
*c = '\0';
length = c-buf;