samba-tng-alpha.2.6.rpm

Andrew Klaassen ak at dkp.com
Tue Sep 19 01:52:42 GMT 2000


On Tue, Sep 19, 2000 at 08:28:13AM +0930, 
Matthew Geddes wrote:

> Andrew Klaassen wrote:

> > Is there a way to have samedit prompt me for the password
> > when creating users, rather than having to type the password
> > plaintext on the console after the "-p" option?

> Not that I know of. You can use the samuserset command, when
> you type the password, it won't be seen, but it will print it
> to the screen after. ;-)

> You could probably change this.

Indeed.  I'm no programmer, but a couple of minutes of cutting
and pasting in rpcclient/cmd_samr.c seemed to get me what I
wanted.

> Perhaps the Samba team would accept this as a patch?

Hmm.  Unfortunately, I've got no idea how to go about submitting
the patch, and am not sure I've got the time to learn right
now.(?) In any event, I've attached my diff against cmd_samr.c
(from a cvs fetch of SAMBA_TNG_2_5_GOOD a couple of weeks ago). 
It prompts for the password if `*' is supplied as the argument
for the `-p' option.  (Anyone remember `net user /add'?) I've
got no idea what other effects it might have.

Andrew Klaassen


------


--- cmd_samr.c.orig	Mon Sep 18 20:13:03 2000
+++ cmd_samr.c	Mon Sep 18 21:23:37 2000
@@ -1004,6 +1004,10 @@
 ****************************************************************************/
 void cmd_sam_create_dom_user(struct client_info *info, int argc, char *argv[])
 {
+	char *pwd;
+	fstring new_passwd;
+	fstring new_passwd2;
+	
 	fstring domain;
 	fstring acct_name;
 	fstring sec_name;
@@ -1207,6 +1211,34 @@
 
 	if (use_ascii_pwd)
 	{
+		if (strequal(ascii_pwd, "*"))
+		{
+			do
+			{
+				pwd = (char *)getpass("New Password: ");
+				ZERO_STRUCT(new_passwd);
+				if (pwd != NULL)
+				{
+					fstrcpy(new_passwd, pwd);
+				}
+
+				pwd = (char *)getpass("retype: ");
+				ZERO_STRUCT(new_passwd2);
+				if (pwd != NULL)
+				{
+					fstrcpy(new_passwd2, pwd);
+				}
+
+				if (!strequal(new_passwd, new_passwd2))
+				{
+					report(out_hnd, "Passwords differ.  Try again.\n");
+				}
+			} while (!strequal(new_passwd, new_passwd2));
+
+			safe_strcpy(ascii_pwd, new_passwd, sizeof(new_passwd) - 1);
+
+		}
+
 		make_unistr2(&upw, ascii_pwd, strlen(ascii_pwd));
 		ascii_to_unibuf(upwb, ascii_pwd, strlen(ascii_pwd) * 2);
 		password = upwb;





More information about the samba-ntdom mailing list