Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Dec 2008 16:15:19 +0000 (UTC)
From:      Ken Smith <kensmith@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r186183 - head/usr.sbin/sysinstall
Message-ID:  <200812161615.mBGGFJjm041873@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kensmith
Date: Tue Dec 16 16:15:19 2008
New Revision: 186183
URL: http://svn.freebsd.org/changeset/base/186183

Log:
  Add confirmation of the password that got entered.
  
  PR:		29893 (among others)

Modified:
  head/usr.sbin/sysinstall/user.c

Modified: head/usr.sbin/sysinstall/user.c
==============================================================================
--- head/usr.sbin/sysinstall/user.c	Tue Dec 16 16:04:40 2008	(r186182)
+++ head/usr.sbin/sysinstall/user.c	Tue Dec 16 16:15:19 2008	(r186183)
@@ -63,6 +63,7 @@ static char gname[GNAME_FIELD_LEN],
 	gmemb[GMEMB_FIELD_LEN],
 	uname[UT_NAMESIZE + 1],
         passwd[PASSWD_FIELD_LEN],
+        confpasswd[PASSWD_FIELD_LEN],
 	uid[UID_FIELD_LEN],
 	ugroup[UGROUP_FIELD_LEN],
 	gecos[GECOS_FIELD_LEN],
@@ -78,7 +79,7 @@ static int	okbutton, cancelbutton;
 #define USER_DIALOG_Y		0
 #define USER_DIALOG_X		8
 #define USER_DIALOG_WIDTH	COLS - 16
-#define USER_DIALOG_HEIGHT	LINES - 2
+#define USER_DIALOG_HEIGHT	LINES - 1
 
 /* The group configuration menu. */
 static Layout groupLayout[] = {
@@ -108,42 +109,46 @@ static Layout groupLayout[] = {
 /* The user configuration menu. */
 static Layout userLayout[] = {
 #define LAYOUT_UNAME		0
-    { 3, 6, UT_NAMESIZE, UT_NAMESIZE + 1,
+    { 2, 6, UT_NAMESIZE, UT_NAMESIZE + 1,
       "Login ID:", "The login name of the new user (mandatory)",
       uname, STRINGOBJ, NULL },
 #define LAYOUT_UID		1
-    { 3, 23, 8, UID_FIELD_LEN - 1,
+    { 2, 23, 8, UID_FIELD_LEN - 1,
       "UID:", "The numerical ID for this user (leave blank for automatic choice)",
       uid, STRINGOBJ, NULL },
 #define LAYOUT_UGROUP		2
-    { 3, 33, 8, UGROUP_FIELD_LEN - 1,
+    { 2, 33, 8, UGROUP_FIELD_LEN - 1,
       "Group:", "The login group name for this user (leave blank for automatic choice)",
       ugroup, STRINGOBJ, NULL },
 #define LAYOUT_PASSWD		3
-    { 3, 43, 15, PASSWD_FIELD_LEN - 1,
+    { 6, 6, 20, PASSWD_FIELD_LEN - 1,
       "Password:", "The password for this user (enter this field with care!)",
       passwd, NO_ECHO_OBJ(STRINGOBJ), NULL },
-#define LAYOUT_GECOS		4
-    { 8, 6, 33, GECOS_FIELD_LEN - 1,
+#define LAYOUT_CONFPASSWD	4
+    { 6, 28, 20, PASSWD_FIELD_LEN - 1,
+      "Confirm Password:", "Confirm what you typed for the password",
+      confpasswd, NO_ECHO_OBJ(STRINGOBJ), NULL },
+#define LAYOUT_GECOS		5
+    { 10, 6, 33, GECOS_FIELD_LEN - 1,
       "Full name:", "The user's full name (comment)",
       gecos, STRINGOBJ, NULL },
-#define LAYOUT_UMEMB		5
-    { 8, 43, 15, UMEMB_FIELD_LEN - 1,
+#define LAYOUT_UMEMB		6
+    { 10, 43, 15, UMEMB_FIELD_LEN - 1,
       "Member groups:", "The groups this user belongs to (i.e. gets access rights for)",
       umemb, STRINGOBJ, NULL },
-#define LAYOUT_HOMEDIR		6
-    { 13, 6, 20, HOMEDIR_FIELD_LEN - 1,
+#define LAYOUT_HOMEDIR		7
+    { 14, 6, 20, HOMEDIR_FIELD_LEN - 1,
       "Home directory:", "The user's home directory (leave blank for default)",
       homedir, STRINGOBJ, NULL },
-#define LAYOUT_SHELL		7
-    { 13, 29, 29, SHELL_FIELD_LEN - 1,
+#define LAYOUT_SHELL		8
+    { 14, 29, 29, SHELL_FIELD_LEN - 1,
       "Login shell:", "The user's login shell (leave blank for default)",
       shell, STRINGOBJ, NULL },
-#define LAYOUT_U_OKBUTTON	8
+#define LAYOUT_U_OKBUTTON	9
     { 18, 15, 0, 0,
       "OK", "Select this if you are happy with these settings",
 	&okbutton, BUTTONOBJ, NULL },
-#define LAYOUT_U_CANCELBUTTON	9
+#define LAYOUT_U_CANCELBUTTON	10
     { 18, 35, 0, 0,
       "CANCEL", "Select this if you wish to cancel this screen",
       &cancelbutton, BUTTONOBJ, NULL },
@@ -421,6 +426,10 @@ verifyUserSettings(WINDOW *ds_win)
 	    return 0;
 	}
     }
+    if (strcmp(passwd, confpasswd)) {
+	feepout("Passwords don't match");
+	return 0;
+    }
     if ((homedir[0]!=0) && (homedir[0]!='/')) {
 	feepout("The pathname for home directories must begin with a '/'.");
 	return 0;
@@ -682,7 +691,7 @@ userAddUser(dialogMenuItem *self)
     draw_box(ds_win, USER_DIALOG_Y + 1, USER_DIALOG_X + 3, USER_DIALOG_HEIGHT - 6,
 	     USER_DIALOG_WIDTH - 6, dialog_attr, border_attr);
     wattrset(ds_win, dialog_attr);
-    mvwaddstr(ds_win, USER_DIALOG_Y + 1, USER_DIALOG_X + 22, " Add a new user ");
+    mvwaddstr(ds_win, USER_DIALOG_Y + 1, USER_DIALOG_X + 24, " Add a new user ");
 
     CLEAR(uname);
     CLEAR(uid);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812161615.mBGGFJjm041873>