[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-1079-gb31f0de

Kai Blin kai at samba.org
Tue Aug 18 12:28:32 MDT 2009


The branch, master has been updated
       via  b31f0de4675a1f43ec9597b13625c50dbd7a75e8 (commit)
       via  7cafb65387f50a58172acb1d0e8e5962e615a522 (commit)
       via  bc0e0a4c69d11fbdb61b1edc1e8d088090807249 (commit)
       via  19855ca2bb13c515c5ee1ec495dac7b41b6b1878 (commit)
       via  182c667b176834a19338fb3e1ea392d5e7320d06 (commit)
       via  a7128709d208b9ef7f4e4e7038bf6102189c4518 (commit)
       via  afb8f8eaa5370bb171979578031bcd596ee95fe8 (commit)
       via  ab818cdf8b78fd727c5b704dad65d524bc902b63 (commit)
       via  6d4fd3e0a285cc0f0fe46dd2c96a1ac36bc84f3f (commit)
       via  0dae6f541f32a09748c69187c8dcfb25281bbab0 (commit)
       via  b6ea2ece0929b875582d1cae184f9cf00abb5742 (commit)
       via  90b6e41b83cc206935a702f599694fccd0b223c1 (commit)
       via  fa7d7a49b8de543cd6ac60ed5ae175a4becc598e (commit)
       via  49d1eec8ea02519ed9851812f96f4675abdf34b6 (commit)
       via  004494b84ca0c28b002b29a5056d93acfcf3e0a5 (commit)
       via  f27bda63cdcbc0c4f8c291d0714b50e18bb316a2 (commit)
      from  61d4f8be6080d1793040c94b431bd4529e8c6aac (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b31f0de4675a1f43ec9597b13625c50dbd7a75e8
Author: Kai Blin <kai at samba.org>
Date:   Thu Aug 13 09:43:40 2009 +0200

    s4 winbind: Silence compile warning by adding new commands to the list

commit 7cafb65387f50a58172acb1d0e8e5962e615a522
Author: Kai Blin <kai at samba.org>
Date:   Thu Aug 13 09:42:14 2009 +0200

    s4 winbind: Implement a stubbed out version of WINBINDD_DOMAIN_INFO

commit bc0e0a4c69d11fbdb61b1edc1e8d088090807249
Author: Kai Blin <kai at samba.org>
Date:   Wed Aug 12 17:50:04 2009 +0200

    wbinfo: Use one codebase for Samba3 and Samba4.
    
    There can be only one....wbinfo that is.

commit 19855ca2bb13c515c5ee1ec495dac7b41b6b1878
Author: Kai Blin <kai at samba.org>
Date:   Wed Aug 12 17:47:12 2009 +0200

    s3 wbinfo: Only call afs_settoken_str if compiled with WITH_FAKE_KASERVER

commit 182c667b176834a19338fb3e1ea392d5e7320d06
Author: Kai Blin <kai at samba.org>
Date:   Wed Aug 12 17:43:40 2009 +0200

    s3 wbinfo: use wbcSidTypeString instead of sid_type_lookup

commit a7128709d208b9ef7f4e4e7038bf6102189c4518
Author: Kai Blin <kai at samba.org>
Date:   Wed Aug 12 17:41:23 2009 +0200

    libwbclient: Add wbcSidTypeString function.

commit afb8f8eaa5370bb171979578031bcd596ee95fe8
Author: Kai Blin <kai at samba.org>
Date:   Wed Aug 12 17:27:05 2009 +0200

    s3 wbinfo: Remove unused functions, use C99-types

commit ab818cdf8b78fd727c5b704dad65d524bc902b63
Author: Kai Blin <kai at samba.org>
Date:   Wed Aug 12 17:25:46 2009 +0200

    s3 wbinfo: Explicitly include popt header, remove unused common options.

commit 6d4fd3e0a285cc0f0fe46dd2c96a1ac36bc84f3f
Author: Kai Blin <kai at samba.org>
Date:   Wed Aug 12 17:25:14 2009 +0200

    s3 wbinfo: Use talloc_strdup instead of SMB_STRDUP

commit 0dae6f541f32a09748c69187c8dcfb25281bbab0
Author: Kai Blin <kai at samba.org>
Date:   Wed Aug 12 17:24:19 2009 +0200

    s3 wbinfo: Don't use global_myname()

commit b6ea2ece0929b875582d1cae184f9cf00abb5742
Author: Kai Blin <kai at samba.org>
Date:   Wed Aug 12 16:18:54 2009 +0200

    s3 wbinfo: Avoid ADD_TO_ARRAY macro.

commit 90b6e41b83cc206935a702f599694fccd0b223c1
Author: Kai Blin <kai at samba.org>
Date:   Wed Aug 12 15:59:14 2009 +0200

    s3 wbinfo: Use uint32_t instead of uint32

commit fa7d7a49b8de543cd6ac60ed5ae175a4becc598e
Author: Kai Blin <kai at samba.org>
Date:   Wed Aug 12 23:41:32 2009 +0200

    s3 wbinfo: remove --get-auth-user and --set-auth-user functionality
    
    Point to the corresponding commands in "net" instead.

commit 49d1eec8ea02519ed9851812f96f4675abdf34b6
Author: Kai Blin <kai at samba.org>
Date:   Wed Aug 12 23:40:05 2009 +0200

    s3 net: Add getauthuser/setauthuser commands.
    
    These replace the functionality of wbinfo --get-auth-user/--set-auth-user

commit 004494b84ca0c28b002b29a5056d93acfcf3e0a5
Author: Kai Blin <kai at samba.org>
Date:   Wed Aug 12 15:51:20 2009 +0200

    s3 wbinfo: Get rid of lp_ functions
    
    This commit also fixes a lot of line lengths to make the file more readable.

commit f27bda63cdcbc0c4f8c291d0714b50e18bb316a2
Author: Kai Blin <kai at samba.org>
Date:   Thu Aug 13 09:40:43 2009 +0200

    s4 ctags: Stop *_proto.h files from cluttering up the tags

-----------------------------------------------------------------------

Summary of changes:
 nsswitch/config.mk                   |    2 +-
 nsswitch/libwbclient/wbc_sid.c       |   17 +
 nsswitch/libwbclient/wbclient.h      |   12 +-
 nsswitch/wbinfo.c                    |  448 ++++++------
 nsswitch/wbinfo4.c                   | 1331 ----------------------------------
 source3/samba4.mk                    |    2 +-
 source3/utils/net.c                  |  124 ++++
 source4/build/make/rules.mk          |    2 +-
 source4/winbind/wb_samba3_cmd.c      |   16 +
 source4/winbind/wb_samba3_protocol.c |    7 +-
 10 files changed, 405 insertions(+), 1556 deletions(-)
 delete mode 100644 nsswitch/wbinfo4.c


Changeset truncated at 500 lines:

diff --git a/nsswitch/config.mk b/nsswitch/config.mk
index 9a04f3b..a85939c 100644
--- a/nsswitch/config.mk
+++ b/nsswitch/config.mk
@@ -36,4 +36,4 @@ PRIVATE_DEPENDENCIES = \
 #################################
 
 wbinfo_OBJ_FILES = \
-		$(nsswitchsrcdir)/wbinfo4.o
+		$(nsswitchsrcdir)/wbinfo.o
diff --git a/nsswitch/libwbclient/wbc_sid.c b/nsswitch/libwbclient/wbc_sid.c
index aa32e83..b1ecba3 100644
--- a/nsswitch/libwbclient/wbc_sid.c
+++ b/nsswitch/libwbclient/wbc_sid.c
@@ -810,3 +810,20 @@ wbcErr wbcGetDisplayName(const struct wbcDomainSid *sid,
 
 	return wbc_status;
 }
+
+const char* wbcSidTypeString(enum wbcSidType type)
+{
+	switch (type) {
+	case WBC_SID_NAME_USE_NONE: return "SID_NONE";
+	case WBC_SID_NAME_USER:     return "SID_USER";
+	case WBC_SID_NAME_DOM_GRP:  return "SID_DOM_GROUP";
+	case WBC_SID_NAME_DOMAIN:   return "SID_DOMAIN";
+	case WBC_SID_NAME_ALIAS:    return "SID_ALIAS";
+	case WBC_SID_NAME_WKN_GRP:  return "SID_WKN_GROUP";
+	case WBC_SID_NAME_DELETED:  return "SID_DELETED";
+	case WBC_SID_NAME_INVALID:  return "SID_INVALID";
+	case WBC_SID_NAME_UNKNOWN:  return "SID_UNKNOWN";
+	case WBC_SID_NAME_COMPUTER: return "SID_COMPUTER";
+	default:                    return "Unknown type";
+	}
+}
diff --git a/nsswitch/libwbclient/wbclient.h b/nsswitch/libwbclient/wbclient.h
index d3c1b63..a87cad3 100644
--- a/nsswitch/libwbclient/wbclient.h
+++ b/nsswitch/libwbclient/wbclient.h
@@ -62,9 +62,10 @@ const char *wbcErrorString(wbcErr error);
  *       Added wbcRemoveGidMapping()
  *  0.3: Added wbcGetpwsid()
  *	 Added wbcGetSidAliases()
+ *  0.4: Added wbcSidTypeString()
  **/
 #define WBCLIENT_MAJOR_VERSION 0
-#define WBCLIENT_MINOR_VERSION 3
+#define WBCLIENT_MINOR_VERSION 4
 #define WBCLIENT_VENDOR_VERSION "Samba libwbclient"
 struct wbcLibraryDetails {
 	uint16_t major_version;
@@ -507,6 +508,15 @@ void wbcFreeMemory(void*);
  */
 
 /**
+ * @brief Get a string representation of the SID type
+ *
+ * @param type		type of the SID
+ *
+ * @return string representation of the SID type
+ */
+const char* wbcSidTypeString(enum wbcSidType type);
+
+/**
  * @brief Convert a binary SID to a character string
  *
  * @param sid           Binary Security Identifier
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index ac5b4c4..813846f 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
@@ -4,7 +4,7 @@
    Winbind status program.
 
    Copyright (C) Tim Potter      2000-2003
-   Copyright (C) Andrew Bartlett 2002
+   Copyright (C) Andrew Bartlett 2002-2007
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -23,10 +23,16 @@
 #include "includes.h"
 #include "winbind_client.h"
 #include "libwbclient/wbclient.h"
+#include "lib/popt/popt.h"
 #include "../libcli/auth/libcli_auth.h"
+#if !(_SAMBA_VERSION_) < 4
+#include "lib/cmdline/popt_common.h"
+#endif
 
+#ifdef DBGC_CLASS
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
+#endif
 
 static struct wbcInterfaceDetails *init_interface_details(void)
 {
@@ -39,13 +45,14 @@ static struct wbcInterfaceDetails *init_interface_details(void)
 
 	wbc_status = wbcInterfaceDetails(&details);
 	if (!WBC_ERROR_IS_OK(wbc_status)) {
-		d_fprintf(stderr, "could not obtain winbind interface details!\n");
+		d_fprintf(stderr, "could not obtain winbind interface "
+				  "details!\n");
 	}
 
 	return details;
 }
 
-static char winbind_separator_int(bool strict)
+static char winbind_separator(void)
 {
 	struct wbcInterfaceDetails *details;
 	static bool got_sep;
@@ -58,11 +65,7 @@ static char winbind_separator_int(bool strict)
 
 	if (!details) {
 		d_fprintf(stderr, "could not obtain winbind separator!\n");
-		if (strict) {
-			return 0;
-		}
-		/* HACK: (this module should not call lp_ funtions) */
-		return *lp_winbind_separator();
+		return 0;
 	}
 
 	sep = details->winbind_separator;
@@ -70,21 +73,12 @@ static char winbind_separator_int(bool strict)
 
 	if (!sep) {
 		d_fprintf(stderr, "winbind separator was NULL!\n");
-		if (strict) {
-			return 0;
-		}
-		/* HACK: (this module should not call lp_ funtions) */
-		sep = *lp_winbind_separator();
+		return 0;
 	}
 
 	return sep;
 }
 
-static char winbind_separator(void)
-{
-	return winbind_separator_int(false);
-}
-
 static const char *get_winbind_domain(void)
 {
 	static struct wbcInterfaceDetails *details;
@@ -93,14 +87,26 @@ static const char *get_winbind_domain(void)
 
 	if (!details) {
 		d_fprintf(stderr, "could not obtain winbind domain name!\n");
-
-		/* HACK: (this module should not call lp_ functions) */
-		return lp_workgroup();
+		return 0;
 	}
 
 	return details->netbios_domain;
 }
 
+static const char *get_winbind_netbios_name(void)
+{
+	static struct wbcInterfaceDetails *details;
+
+	details = init_interface_details();
+
+	if (!details) {
+		d_fprintf(stderr, "could not obtain winbind netbios name!\n");
+		return 0;
+	}
+
+	return details->netbios_name;
+}
+
 /* Copy of parse_domain_user from winbindd_util.c.  Parse a string of the
    form DOMAIN/user into a domain and a user */
 
@@ -566,7 +572,8 @@ static bool wbinfo_list_own_domain(void)
 /* show sequence numbers */
 static bool wbinfo_show_sequence(const char *domain)
 {
-	d_printf("This command has been deprecated.  Please use the --online-status option instead.\n");
+	d_printf("This command has been deprecated.  Please use the "
+		 "--online-status option instead.\n");
 	return false;
 }
 
@@ -592,7 +599,8 @@ static bool wbinfo_show_onlinestatus(const char *domain)
 			}
 		}
 
-		is_offline = (domain_list[i].domain_flags & WBC_DOMINFO_DOMAIN_OFFLINE);
+		is_offline = (domain_list[i].domain_flags &
+			      WBC_DOMINFO_DOMAIN_OFFLINE);
 
 		d_printf("%s : %s\n",
 			 domain_list[i].short_name,
@@ -611,7 +619,7 @@ static bool wbinfo_domain_info(const char *domain)
 	struct wbcDomainInfo *dinfo = NULL;
 	char *sid_str = NULL;
 
-	if ((domain == NULL) || (strequal(domain, ".")) || (domain[0] == '\0')) {
+	if ((domain == NULL) || (strequal(domain, ".")) || (domain[0] == '\0')){
 		domain = get_winbind_domain();
 	}
 
@@ -638,10 +646,12 @@ static bool wbinfo_domain_info(const char *domain)
 	d_printf("Active Directory  : %s\n",
 		 (dinfo->domain_flags & WBC_DOMINFO_DOMAIN_AD) ? "Yes" : "No");
 	d_printf("Native            : %s\n",
-		 (dinfo->domain_flags & WBC_DOMINFO_DOMAIN_NATIVE) ? "Yes" : "No");
+		 (dinfo->domain_flags & WBC_DOMINFO_DOMAIN_NATIVE) ?
+		 "Yes" : "No");
 
 	d_printf("Primary           : %s\n",
-		 (dinfo->domain_flags & WBC_DOMINFO_DOMAIN_PRIMARY) ? "Yes" : "No");
+		 (dinfo->domain_flags & WBC_DOMINFO_DOMAIN_PRIMARY) ?
+		 "Yes" : "No");
 
 	wbcFreeMemory(sid_str);
 	wbcFreeMemory(dinfo);
@@ -662,9 +672,9 @@ static bool wbinfo_getdcname(const char *domain_name)
 
 	/* Send request */
 
-	if (winbindd_request_response(WINBINDD_GETDCNAME, &request, &response) !=
-	    NSS_STATUS_SUCCESS) {
-		d_fprintf(stderr, "Could not get dc name for %s\n", domain_name);
+	if (winbindd_request_response(WINBINDD_GETDCNAME, &request,
+				      &response) != NSS_STATUS_SUCCESS) {
+		d_fprintf(stderr, "Could not get dc name for %s\n",domain_name);
 		return false;
 	}
 
@@ -691,8 +701,8 @@ static bool wbinfo_dsgetdcname(const char *domain_name, uint32_t flags)
 
 	/* Send request */
 
-	if (winbindd_request_response(WINBINDD_DSGETDCNAME, &request, &response) !=
-	    NSS_STATUS_SUCCESS) {
+	if (winbindd_request_response(WINBINDD_DSGETDCNAME, &request,
+				      &response) != NSS_STATUS_SUCCESS) {
 		d_fprintf(stderr, "Could not find dc for %s\n", domain_name);
 		return false;
 	}
@@ -1055,13 +1065,13 @@ static bool wbinfo_lookuprids(const char *domain, const char *arg)
 	enum wbcSidType *types = NULL;
 	size_t i;
 	int num_rids;
-	uint32 *rids = NULL;
+	uint32_t *rids = NULL;
 	const char *p;
 	char *ridstr;
 	TALLOC_CTX *mem_ctx = NULL;
 	bool ret = false;
 
-	if ((domain == NULL) || (strequal(domain, ".")) || (domain[0] == '\0')) {
+	if ((domain == NULL) || (strequal(domain, ".")) || (domain[0] == '\0')){
 		domain = get_winbind_domain();
 	}
 
@@ -1085,8 +1095,13 @@ static bool wbinfo_lookuprids(const char *domain, const char *arg)
 	p = arg;
 
 	while (next_token_talloc(mem_ctx, &p, &ridstr, " ,\n")) {
-		uint32 rid = strtoul(ridstr, NULL, 10);
-		ADD_TO_ARRAY(mem_ctx, uint32, rid, &rids, &num_rids);
+		uint32_t rid = strtoul(ridstr, NULL, 10);
+		rids = talloc_realloc(mem_ctx, rids, uint32_t, num_rids + 1);
+		if (rids == NULL) {
+			d_printf("talloc_realloc failed\n");
+		}
+		rids[num_rids] = rid;
+		num_rids += 1;
 	}
 
 	if (rids == NULL) {
@@ -1106,7 +1121,7 @@ static bool wbinfo_lookuprids(const char *domain, const char *arg)
 
 	for (i=0; i<num_rids; i++) {
 		d_printf("%8d: %s (%s)\n", rids[i], names[i],
-			 sid_type_lookup(types[i]));
+			 wbcSidTypeString(types[i]));
 	}
 
 	ret = true;
@@ -1156,20 +1171,21 @@ static bool wbinfo_lookupname(const char *full_name)
 
 	/* Display response */
 
-	d_printf("%s %s (%d)\n", sid_str, sid_type_lookup(type), type);
+	d_printf("%s %s (%d)\n", sid_str, wbcSidTypeString(type), type);
 
 	wbcFreeMemory(sid_str);
 
 	return true;
 }
 
-static char *wbinfo_prompt_pass(const char *prefix,
+static char *wbinfo_prompt_pass(TALLOC_CTX *mem_ctx,
+				const char *prefix,
 				const char *username)
 {
 	char *prompt;
 	const char *ret = NULL;
 
-	prompt = talloc_asprintf(talloc_tos(), "Enter %s's ", username);
+	prompt = talloc_asprintf(mem_ctx, "Enter %s's ", username);
 	if (!prompt) {
 		return NULL;
 	}
@@ -1187,36 +1203,40 @@ static char *wbinfo_prompt_pass(const char *prefix,
 	ret = getpass(prompt);
 	TALLOC_FREE(prompt);
 
-	return SMB_STRDUP(ret);
+	return talloc_strdup(mem_ctx, ret);
 }
 
 /* Authenticate a user with a plaintext password */
 
-static bool wbinfo_auth_krb5(char *username, const char *cctype, uint32 flags)
+static bool wbinfo_auth_krb5(char *username, const char *cctype, uint32_t flags)
 {
 	wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
 	char *s = NULL;
 	char *p = NULL;
 	char *password = NULL;
 	char *name = NULL;
+	char *local_cctype = NULL;
 	uid_t uid;
 	struct wbcLogonUserParams params;
 	struct wbcLogonUserInfo *info;
 	struct wbcAuthErrorInfo *error;
 	struct wbcUserPasswordPolicyInfo *policy;
+	TALLOC_CTX *frame = talloc_tos();
 
-	if ((s = SMB_STRDUP(username)) == NULL) {
+	if ((s = talloc_strdup(frame, username)) == NULL) {
 		return false;
 	}
 
 	if ((p = strchr(s, '%')) != NULL) {
 		*p = 0;
 		p++;
-		password = SMB_STRDUP(p);
+		password = talloc_strdup(frame, p);
 	} else {
-		password = wbinfo_prompt_pass(NULL, username);
+		password = wbinfo_prompt_pass(frame, NULL, username);
 	}
 
+	local_cctype = talloc_strdup(frame, cctype);
+
 	name = s;
 
 	uid = geteuid();
@@ -1250,7 +1270,7 @@ static bool wbinfo_auth_krb5(char *username, const char *cctype, uint32 flags)
 				     &params.blobs,
 				     "krb5_cc_type",
 				     0,
-				     (uint8_t *)cctype,
+				     (uint8_t *)local_cctype,
 				     strlen(cctype)+1);
 	if (!WBC_ERROR_IS_OK(wbc_status)) {
 		goto done;
@@ -1258,11 +1278,14 @@ static bool wbinfo_auth_krb5(char *username, const char *cctype, uint32 flags)
 
 	wbc_status = wbcLogonUser(&params, &info, &error, &policy);
 
-	d_printf("plaintext kerberos password authentication for [%s] %s (requesting cctype: %s)\n",
-		 username, WBC_ERROR_IS_OK(wbc_status) ? "succeeded" : "failed", cctype);
+	d_printf("plaintext kerberos password authentication for [%s] %s "
+		 "(requesting cctype: %s)\n",
+		 username, WBC_ERROR_IS_OK(wbc_status) ? "succeeded" : "failed",
+		 cctype);
 
 	if (error) {
-		d_fprintf(stderr, "error code was %s (0x%x)\nerror messsage was: %s\n",
+		d_fprintf(stderr,
+			 "error code was %s (0x%x)\nerror messsage was: %s\n",
 			 error->nt_string,
 			 error->nt_status,
 			 error->display_string);
@@ -1270,17 +1293,22 @@ static bool wbinfo_auth_krb5(char *username, const char *cctype, uint32 flags)
 
 	if (WBC_ERROR_IS_OK(wbc_status)) {
 		if (flags & WBFLAG_PAM_INFO3_TEXT) {
-			if (info && info->info && info->info->user_flags & NETLOGON_CACHED_ACCOUNT) {
-				d_printf("user_flgs: NETLOGON_CACHED_ACCOUNT\n");
+			if (info && info->info && info->info->user_flags &
+			    NETLOGON_CACHED_ACCOUNT) {
+				d_printf("user_flgs: "
+					 "NETLOGON_CACHED_ACCOUNT\n");
 			}
 		}
 
 		if (info) {
 			int i;
 			for (i=0; i < info->num_blobs; i++) {
-				if (strequal(info->blobs[i].name, "krb5ccname")) {
-					d_printf("credentials were put in: %s\n",
-						(const char *)info->blobs[i].blob.data);
+				if (strequal(info->blobs[i].name,
+					     "krb5ccname")) {
+					d_printf("credentials were put "
+						 "in: %s\n",
+						(const char *)
+						      info->blobs[i].blob.data);
 					break;
 				}
 			}
@@ -1290,8 +1318,7 @@ static bool wbinfo_auth_krb5(char *username, const char *cctype, uint32 flags)
 	}
  done:
 
-	SAFE_FREE(s);
-	SAFE_FREE(password);
+	TALLOC_FREE(frame);
 	wbcFreeMemory(params.blobs);
 
 	return WBC_ERROR_IS_OK(wbc_status);
@@ -1306,17 +1333,18 @@ static bool wbinfo_auth(char *username)
 	char *p = NULL;
 	char *password = NULL;
 	char *name = NULL;
+	TALLOC_CTX *frame = talloc_tos();
 
-	if ((s = SMB_STRDUP(username)) == NULL) {
+	if ((s = talloc_strdup(frame, username)) == NULL) {
 		return false;
 	}
 
 	if ((p = strchr(s, '%')) != NULL) {
 		*p = 0;
 		p++;
-		password = SMB_STRDUP(p);
+		password = talloc_strdup(frame, p);
 	} else {
-		password = wbinfo_prompt_pass(NULL, username);
+		password = wbinfo_prompt_pass(frame, NULL, username);
 	}
 
 	name = s;
@@ -1328,21 +1356,21 @@ static bool wbinfo_auth(char *username)
 
 #if 0
 	if (response.data.auth.nt_status)
-		d_fprintf(stderr, "error code was %s (0x%x)\nerror messsage was: %s\n",
+		d_fprintf(stderr,
+			 "error code was %s (0x%x)\nerror messsage was: %s\n",
 			 response.data.auth.nt_status_string,
 			 response.data.auth.nt_status,
 			 response.data.auth.error_string);
 #endif
 
-	SAFE_FREE(s);
-	SAFE_FREE(password);
+	TALLOC_FREE(frame);
 
 	return WBC_ERROR_IS_OK(wbc_status);
 }
 
 /* Authenticate a user with a challenge/response */
 
-static bool wbinfo_auth_crap(char *username)
+static bool wbinfo_auth_crap(char *username, bool use_ntlmv2, bool use_lanman)
 {
 	wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
 	struct wbcAuthUserParams params;
@@ -1354,14 +1382,15 @@ static bool wbinfo_auth_crap(char *username)
 	fstring name_domain;
 	char *pass;
 	char *p;
+	TALLOC_CTX *frame = talloc_tos();
 
 	p = strchr(username, '%');
 
 	if (p) {
 		*p = 0;
-		pass = SMB_STRDUP(p + 1);
+		pass = talloc_strdup(frame, p + 1);
 	} else {
-		pass = wbinfo_prompt_pass(NULL, username);
+		pass = wbinfo_prompt_pass(frame, NULL, username);
 	}
 
 	parse_wbinfo_domain_user(username, name_domain, name_user);
@@ -1378,16 +1407,19 @@ static bool wbinfo_auth_crap(char *username)
 
 	generate_random_buffer(params.password.response.challenge, 8);
 
-	if (lp_client_ntlmv2_auth()) {
+	if (use_ntlmv2) {
 		DATA_BLOB server_chal;
 		DATA_BLOB names_blob;
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list