summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-05-12 00:18:45 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-05-12 00:18:45 +0000
commit80f402837f83477cf34496a68699bb77a3206666 (patch)
treee29c461f1a502bd2ca55dd8424e48cb8ec83027b /source3/utils
parentca40b71686236ca1b3a219abe8ca36a0895f798a (diff)
downloadsamba-80f402837f83477cf34496a68699bb77a3206666.tar.gz
samba-80f402837f83477cf34496a68699bb77a3206666.tar.bz2
samba-80f402837f83477cf34496a68699bb77a3206666.zip
Give up on the idea of avoiding lp_load() in ntlm_auth....
Also, we might be given a 0 length challenge, so don't smb_panic() for smb_xmalloc() of zero size. Andrew Bartlett (This used to be commit 4842de04cf2e1528e726dfad070dfe3a82f46fa2)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/ntlm_auth.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index a713f3aa2d..cb6d053541 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -409,6 +409,8 @@ static BOOL check_auth_crap(void)
char *hex_nt_key;
char *error_string;
+ x_setbuf(x_stdout, NULL);
+
static uint8 zeros[16];
if (request_lm_key)
@@ -428,9 +430,9 @@ static BOOL check_auth_crap(void)
&error_string);
if (!NT_STATUS_IS_OK(nt_status)) {
- d_printf("%s (0x%x)\n",
- error_string,
- NT_STATUS_V(nt_status));
+ x_fprintf(x_stdout, "%s (0x%x)\n",
+ error_string,
+ NT_STATUS_V(nt_status));
SAFE_FREE(error_string);
return False;
}
@@ -441,7 +443,7 @@ static BOOL check_auth_crap(void)
hex_encode(lm_key,
sizeof(lm_key),
&hex_lm_key);
- d_printf("LM_KEY: %s\n", hex_lm_key);
+ x_fprintf(x_stdout, "LM_KEY: %s\n", hex_lm_key);
SAFE_FREE(hex_lm_key);
}
if (request_nt_key
@@ -450,7 +452,7 @@ static BOOL check_auth_crap(void)
hex_encode(nt_key,
sizeof(nt_key),
&hex_nt_key);
- d_printf("NT_KEY: %s\n", hex_nt_key);
+ x_fprintf(x_stdout, "NT_KEY: %s\n", hex_nt_key);
SAFE_FREE(hex_nt_key);
}
@@ -1263,6 +1265,14 @@ enum {
dbf = x_stderr;
+ /* Samba client initialisation */
+
+ if (!lp_load(dyn_CONFIGFILE, True, False, False)) {
+ d_fprintf(stderr, "wbinfo: error opening config file %s. Error was %s\n",
+ dyn_CONFIGFILE, strerror(errno));
+ exit(1);
+ }
+
/* Parse options */
pc = poptGetContext("ntlm_auth", argc, argv, long_options, 0);
@@ -1280,7 +1290,7 @@ enum {
while((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
case OPT_CHALLENGE:
- challenge = smb_xmalloc((strlen(hex_challenge)+1)/2);
+ challenge = smb_xmalloc((strlen(hex_challenge))/2+1);
if ((challenge_len = strhex_to_str(challenge,
strlen(hex_challenge),
hex_challenge)) != 8) {
@@ -1292,7 +1302,7 @@ enum {
SAFE_FREE(challenge);
break;
case OPT_LM:
- lm_response = smb_xmalloc((strlen(hex_lm_response)+1)/2);
+ lm_response = smb_xmalloc((strlen(hex_lm_response))/2+1);
lm_response_len = strhex_to_str(lm_response,
strlen(hex_lm_response),
hex_lm_response);
@@ -1304,7 +1314,7 @@ enum {
SAFE_FREE(lm_response);
break;
case OPT_NT:
- nt_response = smb_xmalloc((strlen(hex_nt_response)+1)/2);
+ nt_response = smb_xmalloc((strlen(hex_nt_response)+2)/2+1);
nt_response_len = strhex_to_str(nt_response,
strlen(hex_nt_response),
hex_nt_response);