]>
Commit | Line | Data |
---|---|---|
d6aaa55d MT |
1 | /* SmoothWall install program. |
2 | * | |
3 | * This program is distributed under the terms of the GNU General Public | |
4 | * Licence. See the file COPYING for details. | |
5 | * | |
6 | * (c) Lawrence Manning, 2001 | |
7 | * Write the config and get password stuff. | |
8 | * | |
d6aaa55d MT |
9 | */ |
10 | ||
11 | #include "install.h" | |
10bc6f06 MT |
12 | |
13 | extern FILE *flog; | |
14 | extern char *mylog; | |
15 | ||
16 | extern char **ctr; | |
17 | ||
d6aaa55d MT |
18 | int write_lang_configs( char *lang) |
19 | { | |
20 | struct keyvalue *kv = initkeyvalues(); | |
21 | ||
22 | /* default stuff for main/settings. */ | |
23 | replacekeyvalue(kv, "LANGUAGE", lang); | |
24 | replacekeyvalue(kv, "HOSTNAME", SNAME); | |
25 | writekeyvalues(kv, "/harddisk" CONFIG_ROOT "/main/settings"); | |
26 | freekeyvalues(kv); | |
27 | ||
28 | return 1; | |
29 | } | |
30 | ||
31 | int write_ethernet_configs(struct keyvalue *ethernetkv) | |
32 | { | |
33 | /* Write out the network settings we got from a few mins ago. */ | |
34 | writekeyvalues(ethernetkv, "/harddisk" CONFIG_ROOT "/ethernet/settings"); | |
35 | return 1; | |
36 | } | |
37 | ||
38 | /* Taken from the cdrom one. */ | |
39 | int getpassword(char *password, char *text) | |
40 | { | |
41 | char *values[] = { NULL, NULL, NULL }; /* pointers for the values. */ | |
42 | struct newtWinEntry entries[] = | |
43 | { | |
44 | { ctr[TR_PASSWORD_PROMPT], &values[0], 2 }, | |
45 | { ctr[TR_AGAIN_PROMPT], &values[1], 2 }, | |
46 | { NULL, NULL, 0 } | |
47 | }; | |
48 | char title[STRING_SIZE]; | |
49 | int rc; | |
50 | int done; | |
51 | ||
52 | do | |
53 | { | |
54 | done = 1; | |
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); | |
58 | ||
59 | if (rc != 2) | |
60 | { | |
61 | if (strlen(values[0]) == 0 || strlen(values[1]) == 0) | |
62 | { | |
63 | errorbox(ctr[TR_PASSWORD_CANNOT_BE_BLANK]); | |
64 | done = 0; | |
65 | strcpy(values[0], ""); | |
66 | strcpy(values[1], ""); | |
67 | } | |
68 | else if (strcmp(values[0], values[1]) != 0) | |
69 | { | |
70 | errorbox(ctr[TR_PASSWORDS_DO_NOT_MATCH]); | |
71 | done = 0; | |
72 | strcpy(values[0], ""); | |
73 | strcpy(values[1], ""); | |
74 | } | |
75 | } | |
76 | } | |
77 | while (!done); | |
78 | ||
79 | strncpy(password, values[0], STRING_SIZE); | |
80 | ||
81 | if (values[0]) free(values[0]); | |
82 | if (values[1]) free(values[1]); | |
83 | ||
84 | return rc; | |
85 | } | |
10bc6f06 | 86 |