]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/install+setup/setup/passwords.c
Increase length of the password dialog to 50 chars.
[ipfire-2.x.git] / src / install+setup / setup / passwords.c
index 37e855cc519857896de8e91125071a42ea2ee138..31d559d76c93bd1ccd3967beba02108e530dd7cc 100644 (file)
-/* SmoothWall setup program.\r
- *\r
- * This program is distributed under the terms of the GNU General Public\r
- * Licence.  See the file COPYING for details.\r
- *\r
- * (c) Lawrence Manning, 2001\r
- * Password stuff.\r
- * \r
- * $Id: passwords.c,v 1.5.2.1 2004/04/14 22:05:41 gespinasse Exp $\r
- * \r
- */\r
-\r
-#include "setup.h"\r
-\r
-extern FILE *flog;\r
-extern char *mylog;\r
-\r
-extern char **ctr;\r
-\r
-extern int automode;\r
-\r
-int getpassword(char *password, char *text);\r
-\r
-/* Root password. */\r
-int handlerootpassword(void)\r
-{\r
-       char password[STRING_SIZE];\r
-       char commandstring[STRING_SIZE];\r
-               \r
-       /* Root password. */\r
-       if (getpassword(password, ctr[TR_ENTER_ROOT_PASSWORD]) == 2)\r
-               return 0;\r
-       \r
-       snprintf(commandstring, STRING_SIZE,\r
-               "/bin/echo 'root:%s' | /usr/sbin/chpasswd",     password);\r
-       if (runhiddencommandwithstatus(commandstring, ctr[TR_SETTING_ROOT_PASSWORD]))\r
-       {\r
-               errorbox(ctr[TR_PROBLEM_SETTING_ROOT_PASSWORD]);\r
-               return 0;\r
-       }\r
-       \r
-       return 1;\r
-}\r
-\r
-int handleadminpassword(void)\r
-{\r
-       char password[STRING_SIZE];\r
-       char commandstring[STRING_SIZE];\r
-       char message[1000];\r
-               \r
-       /* web interface admin password. */\r
-       sprintf(message, ctr[TR_ENTER_ADMIN_PASSWORD], NAME, NAME);\r
-       if (getpassword(password, message) == 2)\r
-               return 0;\r
-       \r
-       snprintf(commandstring, STRING_SIZE,\r
-               "/usr/bin/htpasswd -c -m -b " CONFIG_ROOT "/auth/users admin '%s'", password);\r
-       sprintf(message, ctr[TR_SETTING_ADMIN_PASSWORD], NAME);\r
-       if (runhiddencommandwithstatus(commandstring, message))\r
-       {\r
-               sprintf(message, ctr[TR_PROBLEM_SETTING_ADMIN_PASSWORD], NAME);\r
-               errorbox(message);\r
-               return 0;\r
-       }\r
-\r
-       return 1;\r
-}\r
-\r
-/* Taken from the cdrom one. */\r
-int getpassword(char *password, char *text)\r
-{\r
-       char *values[] = {      NULL, NULL, NULL };     /* pointers for the values. */\r
-       struct newtWinEntry entries[] =\r
-       { \r
-               { ctr[TR_PASSWORD_PROMPT], &values[0], 2 },\r
-               { ctr[TR_AGAIN_PROMPT], &values[1], 2 },\r
-               { NULL, NULL, 0 }\r
-       };\r
-       char title[STRING_SIZE];\r
-       int rc;\r
-       int done;\r
-       \r
-       do\r
-       {\r
-               done = 1;\r
-               sprintf (title, "%s v%s - %s", NAME, VERSION, SLOGAN);\r
-               rc = newtWinEntries(title, text,\r
-                       50, 5, 5, 20, entries, ctr[TR_OK], ctr[TR_CANCEL], NULL);\r
-\r
-               if (rc != 2)\r
-               {\r
-                       if (strlen(values[0]) == 0 || strlen(values[1]) == 0)\r
-                       {\r
-                               errorbox(ctr[TR_PASSWORD_CANNOT_BE_BLANK]);\r
-                               done = 0;\r
-                               strcpy(values[0], "");\r
-                               strcpy(values[1], "");\r
-                       }\r
-                       else if (strcmp(values[0], values[1]) != 0)\r
-                       {\r
-                               errorbox(ctr[TR_PASSWORDS_DO_NOT_MATCH]);\r
-                               done = 0;\r
-                               strcpy(values[0], "");\r
-                               strcpy(values[1], "");\r
-                       }\r
-                       else if (strchr(values[0], ' '))\r
-                       {\r
-                               errorbox(ctr[TR_PASSWORD_CANNOT_CONTAIN_SPACES]);\r
-                               done = 0;\r
-                               strcpy(values[0], "");\r
-                               strcpy(values[1], "");\r
-                       }\r
-               }\r
-       }\r
-       while (!done);\r
-\r
-       strncpy(password, values[0], STRING_SIZE);\r
-\r
-       if (values[0]) free(values[0]);\r
-       if (values[1]) free(values[1]);\r
-\r
-       return rc;\r
-}\r
+/* SmoothWall setup program.
+ *
+ * This program is distributed under the terms of the GNU General Public
+ * Licence.  See the file COPYING for details.
+ *
+ * (c) Lawrence Manning, 2001
+ * Password stuff.
+ * 
+ * $Id: passwords.c,v 1.5.2.1 2004/04/14 22:05:41 gespinasse Exp $
+ * 
+ */
+
+#include "setup.h"
+
+extern FILE *flog;
+extern char *mylog;
+
+extern char **ctr;
+
+extern int automode;
+
+int getpassword(char *password, char *text);
+
+/* Root password. */
+int handlerootpassword(void)
+{
+       char password[STRING_SIZE];
+       char commandstring[STRING_SIZE];
+               
+       /* Root password. */
+       if (getpassword(password, ctr[TR_ENTER_ROOT_PASSWORD]) == 2)
+               return 0;
+       
+       snprintf(commandstring, STRING_SIZE,
+               "/bin/echo 'root:%s' | /usr/sbin/chpasswd", password);
+       if (runhiddencommandwithstatus(commandstring, ctr[TR_SETTING_ROOT_PASSWORD]))
+       {
+               errorbox(ctr[TR_PROBLEM_SETTING_ROOT_PASSWORD]);
+               return 0;
+       }
+       
+       return 1;
+}
+
+int handleadminpassword(void)
+{
+       char password[STRING_SIZE];
+       char commandstring[STRING_SIZE];
+       char message[1000];
+               
+       /* web interface admin password. */
+       sprintf(message, ctr[TR_ENTER_ADMIN_PASSWORD], NAME, NAME);
+       if (getpassword(password, message) == 2)
+               return 0;
+       
+       snprintf(commandstring, STRING_SIZE,
+               "/usr/sbin/htpasswd -c -m -b " CONFIG_ROOT "/auth/users admin '%s'", password);
+       sprintf(message, ctr[TR_SETTING_ADMIN_PASSWORD], NAME);
+       if (runhiddencommandwithstatus(commandstring, message))
+       {
+               sprintf(message, ctr[TR_PROBLEM_SETTING_ADMIN_PASSWORD], NAME);
+               errorbox(message);
+               return 0;
+       }
+
+       return 1;
+}
+
+/* Taken from the cdrom one. */
+int getpassword(char *password, char *text)
+{
+       char *values[] = {      NULL, NULL, NULL };     /* pointers for the values. */
+       struct newtWinEntry entries[] =
+       { 
+               { ctr[TR_PASSWORD_PROMPT], &values[0], 2 },
+               { ctr[TR_AGAIN_PROMPT], &values[1], 2 },
+               { NULL, NULL, 0 }
+       };
+       char title[STRING_SIZE];
+       int rc;
+       int done;
+       
+       do
+       {
+               done = 1;
+               sprintf (title, "%s %s - %s", NAME, VERSION, SLOGAN);
+               rc = newtWinEntries(title, text,
+                       70, 5, 5, 50, entries, ctr[TR_OK], ctr[TR_CANCEL], NULL);
+
+               if (rc != 2)
+               {
+                       if (strlen(values[0]) == 0 || strlen(values[1]) == 0)
+                       {
+                               errorbox(ctr[TR_PASSWORD_CANNOT_BE_BLANK]);
+                               done = 0;
+                               strcpy(values[0], "");
+                               strcpy(values[1], "");
+                       }
+                       else if (strcmp(values[0], values[1]) != 0)
+                       {
+                               errorbox(ctr[TR_PASSWORDS_DO_NOT_MATCH]);
+                               done = 0;
+                               strcpy(values[0], "");
+                               strcpy(values[1], "");
+                       }
+                       else if (strchr(values[0], ' '))
+                       {
+                               errorbox(ctr[TR_PASSWORD_CANNOT_CONTAIN_SPACES]);
+                               done = 0;
+                               strcpy(values[0], "");
+                               strcpy(values[1], "");
+                       }
+               }
+       }
+       while (!done);
+
+       strncpy(password, values[0], STRING_SIZE);
+
+       if (values[0]) free(values[0]);
+       if (values[1]) free(values[1]);
+
+       return rc;
+}