1 /* SmoothWall install program.
3 * This program is distributed under the terms of the GNU General Public
4 * Licence. See the file COPYING for details.
6 * (c) Lawrence Manning, 2001
7 * Write the config and get password stuff.
18 int write_lang_configs( char *lang
)
20 struct keyvalue
*kv
= initkeyvalues();
22 /* default stuff for main/settings. */
23 replacekeyvalue(kv
, "LANGUAGE", lang
);
24 replacekeyvalue(kv
, "HOSTNAME", SNAME
);
25 writekeyvalues(kv
, "/harddisk" CONFIG_ROOT
"/main/settings");
31 int write_ethernet_configs(struct keyvalue
*ethernetkv
)
33 /* Write out the network settings we got from a few mins ago. */
34 writekeyvalues(ethernetkv
, "/harddisk" CONFIG_ROOT
"/ethernet/settings");
38 /* Taken from the cdrom one. */
39 int getpassword(char *password
, char *text
)
41 char *values
[] = { NULL
, NULL
, NULL
}; /* pointers for the values. */
42 struct newtWinEntry entries
[] =
44 { ctr
[TR_PASSWORD_PROMPT
], &values
[0], 2 },
45 { ctr
[TR_AGAIN_PROMPT
], &values
[1], 2 },
48 char title
[STRING_SIZE
];
55 sprintf (title
, "%s v%s - %s", NAME
, VERSION
, SLOGAN
);
56 rc
= newtWinEntries(title
, text
,
57 50, 5, 5, 20, entries
, ctr
[TR_OK
], ctr
[TR_CANCEL
], NULL
);
61 if (strlen(values
[0]) == 0 || strlen(values
[1]) == 0)
63 errorbox(ctr
[TR_PASSWORD_CANNOT_BE_BLANK
]);
65 strcpy(values
[0], "");
66 strcpy(values
[1], "");
68 else if (strcmp(values
[0], values
[1]) != 0)
70 errorbox(ctr
[TR_PASSWORDS_DO_NOT_MATCH
]);
72 strcpy(values
[0], "");
73 strcpy(values
[1], "");
79 strncpy(password
, values
[0], STRING_SIZE
);
81 if (values
[0]) free(values
[0]);
82 if (values
[1]) free(values
[1]);