svn commit: samba r12320 - in branches/SAMBA_4_0/source/lib/cmdline: .

abartlet at samba.org abartlet at samba.org
Sun Dec 18 21:44:44 GMT 2005


Author: abartlet
Date: 2005-12-18 21:44:43 +0000 (Sun, 18 Dec 2005)
New Revision: 12320

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

Log:
Add command-line processing hooks for simple bind DN, and password callback.

We may change this in future.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/lib/cmdline/credentials.c
   branches/SAMBA_4_0/source/lib/cmdline/popt_common.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/cmdline/credentials.c
===================================================================
--- branches/SAMBA_4_0/source/lib/cmdline/credentials.c	2005-12-18 21:44:13 UTC (rev 12319)
+++ branches/SAMBA_4_0/source/lib/cmdline/credentials.c	2005-12-18 21:44:43 UTC (rev 12320)
@@ -32,13 +32,20 @@
 	const char *username;
 	TALLOC_CTX *mem_ctx = talloc_new(NULL);
 
-	cli_credentials_get_ntlm_username_domain(credentials, mem_ctx, &username, &domain);
-	if (domain && domain[0]) {
-		prompt = talloc_asprintf(mem_ctx, "Password for [%s\\%s]:", 
-					 domain, username);
+	const char *bind_dn = cli_credentials_get_bind_dn(credentials);
+	
+	if (bind_dn) {
+		prompt = talloc_asprintf(mem_ctx, "Password for [%s]:", 
+					 bind_dn);
 	} else {
-		prompt = talloc_asprintf(mem_ctx, "Password for [%s]:", 
-					 username);
+		cli_credentials_get_ntlm_username_domain(credentials, mem_ctx, &username, &domain);
+		if (domain && domain[0]) {
+			prompt = talloc_asprintf(mem_ctx, "Password for [%s\\%s]:", 
+						 domain, username);
+		} else {
+			prompt = talloc_asprintf(mem_ctx, "Password for [%s]:", 
+						 username);
+		}
 	}
 
 	ret = getpass(prompt);

Modified: branches/SAMBA_4_0/source/lib/cmdline/popt_common.c
===================================================================
--- branches/SAMBA_4_0/source/lib/cmdline/popt_common.c	2005-12-18 21:44:13 UTC (rev 12319)
+++ branches/SAMBA_4_0/source/lib/cmdline/popt_common.c	2005-12-18 21:44:43 UTC (rev 12320)
@@ -37,7 +37,7 @@
  *		-i,--scope
  */
 
-enum {OPT_OPTION=1,OPT_LEAK_REPORT,OPT_LEAK_REPORT_FULL, OPT_DEBUG_STDERR};
+enum {OPT_OPTION=1,OPT_LEAK_REPORT,OPT_LEAK_REPORT_FULL, OPT_DEBUG_STDERR, OPT_SIMPLE_BIND_DN};
 
 struct cli_credentials *cmdline_credentials = NULL;
 
@@ -242,6 +242,9 @@
 		
 		/* machine accounts only work with kerberos (fall though)*/
 		break;
+	case OPT_SIMPLE_BIND_DN:
+		cli_credentials_set_bind_dn(cmdline_credentials, arg);
+		break;
 	}
 }
 
@@ -254,5 +257,6 @@
 	{ "authentication-file", 'A', POPT_ARG_STRING, NULL, 'A', "Get the credentials from a file", "FILE" },
 	{ "signing", 'S', POPT_ARG_STRING, NULL, 'S', "Set the client signing state", "on|off|required" },
 	{ "machine-pass", 'P', POPT_ARG_NONE, NULL, 'P', "Use stored machine account password (implies -k)" },
+	{ "simple-bind-dn", 0, POPT_ARG_STRING, NULL, OPT_SIMPLE_BIND_DN, "DN to use for a simple bind" },
 	POPT_TABLEEND
 };



More information about the samba-cvs mailing list