2 Unix SMB/Netbios implementation.
4 Samba Web Administration Tool
5 Copyright (C) Andrew Tridgell 1997-1998
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #define GLOBALS_SNUM -1
31 static pstring servicesf = CONFIGFILE;
32 static BOOL demo_mode = False;
33 static BOOL have_write_access = False;
36 * Password Management Globals
38 #define SWAT_USER "username"
39 #define OLD_PSWD "old_passwd"
40 #define NEW_PSWD "new_passwd"
41 #define NEW2_PSWD "new2_passwd"
42 #define CHG_S_PASSWD_FLAG "chg_s_passwd_flag"
43 #define CHG_R_PASSWD_FLAG "chg_r_passwd_flag"
44 #define ADD_USER_FLAG "add_user_flag"
45 #define DISABLE_USER_FLAG "disable_user_flag"
46 #define ENABLE_USER_FLAG "enable_user_flag"
47 #define RHOST "remote_host"
49 /* we need these because we link to locking*.o */
50 void become_root(BOOL save_dir) {}
51 void unbecome_root(BOOL restore_dir) {}
53 /****************************************************************************
54 ****************************************************************************/
55 static int enum_index(int value, struct enum_list *enumlist)
58 for (i=0;enumlist[i].name;i++)
59 if (value == enumlist[i].value) break;
63 static char *fix_backslash(char *str)
65 static char newstring[1024];
69 if (*str == '\\') {*p++ = '\\';*p++ = '\\';}
77 static char *stripspace(char *str)
79 static char newstring[1024];
83 if (*str != ' ') *p++ = *str;
90 static char *make_parm_name(char *label)
92 static char parmname[1024];
96 if (*label == ' ') *p++ = '_';
104 /****************************************************************************
105 include a lump of html in a page
106 ****************************************************************************/
107 static int include_html(char *fname)
109 FILE *f = fopen(fname,"r");
114 printf("ERROR: Can't open %s\n", fname);
119 ret = fread(buf, 1, sizeof(buf), f);
121 fwrite(buf, 1, ret, stdout);
128 /****************************************************************************
129 start the page with standard stuff
130 ****************************************************************************/
131 static void print_header(void)
133 if (!cgi_waspost()) {
134 printf("Expires: 0\r\n");
136 printf("Content-type: text/html\r\n\r\n");
138 if (!include_html("include/header.html")) {
139 printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n");
140 printf("<HTML>\n<HEAD>\n<TITLE>Samba Web Administration Tool</TITLE>\n</HEAD>\n<BODY background=\"/swat/images/background.jpg\">\n\n");
144 /****************************************************************************
146 ****************************************************************************/
147 static void print_footer(void)
149 if (!include_html("include/footer.html")) {
150 printf("\n</BODY>\n</HTML>\n");
154 /****************************************************************************
155 display one editable parameter in a form
156 ****************************************************************************/
157 static void show_parameter(int snum, struct parm_struct *parm)
160 void *ptr = parm->ptr;
162 if (parm->class == P_LOCAL && snum >= 0) {
163 ptr = lp_local_ptr(snum, ptr);
166 printf("<tr><td><A HREF=\"/swat/help/smb.conf.5.html#%s\">?</A> %s</td><td>",
167 stripspace(parm->label), parm->label);
169 switch (parm->type) {
171 printf("<input type=text size=2 name=\"parm_%s\" value=\"%c\">",
172 make_parm_name(parm->label), *(char *)ptr);
173 printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.value=\'%c\'\">",
174 make_parm_name(parm->label),(char)(parm->def.cvalue));
179 printf("<input type=text size=40 name=\"parm_%s\" value=\"%s\">",
180 make_parm_name(parm->label), *(char **)ptr);
181 printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.value=\'%s\'\">",
182 make_parm_name(parm->label),fix_backslash((char *)(parm->def.svalue)));
187 printf("<input type=text size=40 name=\"parm_%s\" value=\"%s\">",
188 make_parm_name(parm->label), (char *)ptr);
189 printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.value=\'%s\'\">",
190 make_parm_name(parm->label),fix_backslash((char *)(parm->def.svalue)));
194 printf("<select name=\"parm_%s\">",make_parm_name(parm->label));
195 printf("<option %s>Yes", (*(BOOL *)ptr)?"selected":"");
196 printf("<option %s>No", (*(BOOL *)ptr)?"":"selected");
198 printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.selectedIndex=\'%d\'\">",
199 make_parm_name(parm->label),(BOOL)(parm->def.bvalue)?0:1);
203 printf("<select name=\"parm_%s\">",make_parm_name(parm->label));
204 printf("<option %s>Yes", (*(BOOL *)ptr)?"":"selected");
205 printf("<option %s>No", (*(BOOL *)ptr)?"selected":"");
207 printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.selectedIndex=\'%d\'\">",
208 make_parm_name(parm->label),(BOOL)(parm->def.bvalue)?1:0);
212 printf("<input type=text size=8 name=\"parm_%s\" value=%d>", make_parm_name(parm->label), *(int *)ptr);
213 printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.value=\'%d\'\">",
214 make_parm_name(parm->label),(int)(parm->def.ivalue));
218 printf("<input type=text size=8 name=\"parm_%s\" value=0%o>", make_parm_name(parm->label), *(int *)ptr);
219 printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.value=\'0%o\'\">",
220 make_parm_name(parm->label),(int)(parm->def.ivalue));
224 printf("<select name=\"parm_%s\">",make_parm_name(parm->label));
225 for (i=0;parm->enum_list[i].name;i++)
226 printf("<option %s>%s",(*(int *)ptr)==parm->enum_list[i].value?"selected":"",parm->enum_list[i].name);
228 printf("<input type=button value=\"Set Default\" onClick=\"swatform.parm_%s.selectedIndex=\'%d\'\">",
229 make_parm_name(parm->label),enum_index((int)(parm->def.ivalue),parm->enum_list));
234 printf("</td></tr>\n");
237 /****************************************************************************
238 display a set of parameters for a service
239 ****************************************************************************/
240 static void show_parameters(int snum, int allparameters, int advanced, int printers)
243 struct parm_struct *parm;
244 char *heading = NULL;
245 char *last_heading = NULL;
247 while ((parm = lp_next_parameter(snum, &i, allparameters))) {
248 if (snum < 0 && parm->class == P_LOCAL && !(parm->flags & FLAG_GLOBAL))
250 if (parm->class == P_SEPARATOR) {
251 heading = parm->label;
254 if (parm->flags & FLAG_HIDE) continue;
256 if (!printers && !(parm->flags & FLAG_BASIC)) {
257 void *ptr = parm->ptr;
259 switch (parm->type) {
261 if (*(char *)ptr == (char)(parm->def.cvalue)) continue;
266 if (!strcmp(*(char **)ptr,(char *)(parm->def.svalue))) continue;
271 if (!strcmp((char *)ptr,(char *)(parm->def.svalue))) continue;
276 if (*(BOOL *)ptr == (BOOL)(parm->def.bvalue)) continue;
281 if (*(int *)ptr == (int)(parm->def.ivalue)) continue;
286 if (*(int *)ptr == (int)(parm->def.ivalue)) continue;
292 if (printers && !(parm->flags & FLAG_PRINT)) continue;
294 if (heading && heading != last_heading) {
295 printf("<tr><td></td></tr><tr><td><b><u>%s</u></b></td></tr>\n", heading);
296 last_heading = heading;
298 show_parameter(snum, parm);
302 /****************************************************************************
304 ****************************************************************************/
305 static void write_config(FILE *f, BOOL show_defaults)
307 fprintf(f, "# Samba config file created using SWAT\n");
308 fprintf(f, "# from %s (%s)\n", cgi_remote_host(), cgi_remote_addr());
309 fprintf(f, "# Date: %s\n\n", timestring());
311 lp_dump(f, show_defaults);
314 /****************************************************************************
315 save and reoad the smb.conf config file
316 ****************************************************************************/
317 static int save_reload(void)
321 f = fopen(servicesf,"w");
323 printf("failed to open %s for writing\n", servicesf);
327 write_config(f, False);
332 if (!lp_load(servicesf,False,False,False)) {
333 printf("Can't reload %s\n", servicesf);
340 /****************************************************************************
342 ****************************************************************************/
343 static void commit_parameter(int snum, struct parm_struct *parm, char *v)
348 if (snum < 0 && parm->class == P_LOCAL) {
349 /* this handles the case where we are changing a local
350 variable globally. We need to change the parameter in
351 all shares where it is currently set to the default */
352 for (i=0;i<lp_numservices();i++) {
353 s = lp_servicename(i);
354 if (s && (*s) && lp_is_default(i, parm)) {
355 lp_do_parameter(i, parm->label, v);
360 lp_do_parameter(snum, parm->label, v);
363 /****************************************************************************
364 commit a set of parameters for a service
365 ****************************************************************************/
366 static void commit_parameters(int snum)
369 struct parm_struct *parm;
373 while ((parm = lp_next_parameter(snum, &i, 1))) {
374 slprintf(label, sizeof(label)-1, "parm_%s", make_parm_name(parm->label));
375 if ((v = cgi_variable(label))) {
376 if (parm->flags & FLAG_HIDE) continue;
377 commit_parameter(snum, parm, v);
382 /****************************************************************************
383 load the smb.conf file into loadparm.
384 ****************************************************************************/
385 static void load_config(void)
387 if (!lp_load(servicesf,False,True,False)) {
388 printf("<b>Can't load %s - using defaults</b><p>\n",
393 /****************************************************************************
394 spit out the html for a link with an image
395 ****************************************************************************/
396 static void image_link(char *name,char *hlink, char *src)
398 printf("<A HREF=\"%s/%s\"><img src=\"/swat/%s\" alt=\"%s\"></A>\n",
399 cgi_baseurl(), hlink, src, name);
402 /****************************************************************************
403 display the main navigation controls at the top of each page along
405 ****************************************************************************/
406 static void show_main_buttons(void)
408 image_link("Home", "", "images/home.gif");
410 image_link("Globals", "globals", "images/globals.gif");
411 image_link("Shares", "shares", "images/shares.gif");
412 image_link("Printers", "printers", "images/printers.gif");
413 image_link("Status", "status", "images/status.gif");
414 image_link("View Config", "viewconfig","images/viewconfig.gif");
415 image_link("Password Management", "passwd", "images/passwd.gif");
420 /****************************************************************************
421 display a welcome page
422 ****************************************************************************/
423 static void welcome_page(void)
425 include_html("help/welcome.html");
428 /****************************************************************************
429 display the current smb.conf
430 ****************************************************************************/
431 static void viewconfig_page(void)
435 if (cgi_variable("full_view")) {
439 printf("<H2>Current Config</H2>\n");
440 printf("<form method=post>\n");
443 printf("<input type=submit name=\"normal_view\" value=\"Normal View\">\n");
445 printf("<input type=submit name=\"full_view\" value=\"Full View\">\n");
449 write_config(stdout, full_view);
454 /****************************************************************************
455 display a globals editing page
456 ****************************************************************************/
457 static void globals_page(void)
461 printf("<H2>Global Variables</H2>\n");
463 if (cgi_variable("Advanced") && !cgi_variable("Basic"))
466 if (cgi_variable("Commit")) {
467 commit_parameters(GLOBALS_SNUM);
471 printf("<FORM name=\"swatform\" method=post>\n");
473 if (have_write_access) {
474 printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
477 printf("<input type=reset name=\"Reset Values\" value=\"Reset Values\">\n");
479 printf("<input type=submit name=\"Advanced\" value=\"Advanced View\">\n");
481 printf("<input type=submit name=\"Basic\" value=\"Basic View\">\n");
486 show_parameters(GLOBALS_SNUM, 1, advanced, 0);
487 printf("</table>\n");
490 printf("<input type=hidden name=\"Advanced\" value=1>\n");
496 /****************************************************************************
497 display a shares editing page
498 ****************************************************************************/
499 static void shares_page(void)
501 char *share = cgi_variable("share");
508 snum = lp_servicenumber(share);
510 printf("<H2>Share Parameters</H2>\n");
512 if (cgi_variable("Advanced") && !cgi_variable("Basic"))
515 if (cgi_variable("Commit") && snum >= 0) {
516 commit_parameters(snum);
520 if (cgi_variable("Delete") && snum >= 0) {
521 lp_remove_service(snum);
527 if (cgi_variable("createshare") && (share=cgi_variable("newshare"))) {
528 lp_copy_service(GLOBALS_SNUM, share);
530 snum = lp_servicenumber(share);
533 printf("<FORM name=\"swatform\" method=post>\n");
536 printf("<tr><td><input type=submit name=selectshare value=\"Choose Share\"></td>\n");
537 printf("<td><select name=share>\n");
539 printf("<option value=\" \"> \n");
540 for (i=0;i<lp_numservices();i++) {
541 s = lp_servicename(i);
542 if (s && (*s) && strcmp(s,"IPC$") && !lp_print_ok(i)) {
543 printf("<option %s value=\"%s\">%s\n",
544 (share && strcmp(share,s)==0)?"SELECTED":"",
548 printf("</select></td></tr><p>");
550 printf("<tr><td><input type=submit name=createshare value=\"Create Share\"></td>\n");
551 printf("<td><input type=text size=30 name=newshare></td></tr>\n");
556 if (have_write_access) {
557 printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
560 printf("<input type=submit name=\"Delete\" value=\"Delete Share\">\n");
562 printf("<input type=submit name=\"Advanced\" value=\"Advanced View\">\n");
564 printf("<input type=submit name=\"Basic\" value=\"Basic View\">\n");
571 show_parameters(snum, 1, advanced, 0);
572 printf("</table>\n");
576 printf("<input type=hidden name=\"Advanced\" value=1>\n");
582 /*************************************************************
583 change a password either locally or remotely
584 *************************************************************/
585 static BOOL change_password(const char *remote_machine, char *user_name,
586 char *old_passwd, char *new_passwd,
587 BOOL add_user, BOOL enable_user, BOOL disable_user)
594 printf("password change in demo mode rejected\n<p>");
598 if (remote_machine != NULL) {
599 ret = remote_password_change(remote_machine, user_name, old_passwd,
600 new_passwd, err_str, sizeof(err_str));
602 printf("%s\n<p>", err_str);
606 if(!initialize_password_db()) {
607 printf("Can't setup password database vectors.\n<p>");
611 ret = local_password_change(user_name, False, add_user, enable_user,
612 disable_user, False, new_passwd, err_str, sizeof(err_str),
613 msg_str, sizeof(msg_str));
616 printf("%s\n<p>", msg_str);
618 printf("%s\n<p>", err_str);
623 /****************************************************************************
624 do the stuff required to add or change a password
625 ****************************************************************************/
626 static void chg_passwd(void)
631 /* Make sure users name has been specified */
632 if (strlen(cgi_variable(SWAT_USER)) == 0) {
633 printf("<p> Must specify \"User Name\" \n");
638 * smbpasswd doesn't require anything but the users name to disable or enable the user,
639 * so if that's what we're doing, skip the rest of the checks
641 if (!cgi_variable(DISABLE_USER_FLAG) && !cgi_variable(ENABLE_USER_FLAG)) {
644 * If current user is not root, make sure old password has been specified
645 * If REMOTE change, even root must provide old password
647 if (((!am_root()) && (strlen( cgi_variable(OLD_PSWD)) <= 0)) ||
648 ((cgi_variable(CHG_R_PASSWD_FLAG)) && (strlen( cgi_variable(OLD_PSWD)) <= 0))) {
649 printf("<p> Must specify \"Old Password\" \n");
653 /* If changing a users password on a remote hosts we have to know what host */
654 if ((cgi_variable(CHG_R_PASSWD_FLAG)) && (strlen( cgi_variable(RHOST)) <= 0)) {
655 printf("<p> Must specify \"Remote Machine\" \n");
659 /* Make sure new passwords have been specified */
660 if ((strlen( cgi_variable(NEW_PSWD)) <= 0) ||
661 (strlen( cgi_variable(NEW2_PSWD)) <= 0)) {
662 printf("<p> Must specify \"New, and Re-typed Passwords\" \n");
666 /* Make sure new passwords was typed correctly twice */
667 if (strcmp(cgi_variable(NEW_PSWD), cgi_variable(NEW2_PSWD)) != 0) {
668 printf("<p> Re-typed password didn't match new password\n");
673 if (cgi_variable(CHG_R_PASSWD_FLAG)) {
674 host = cgi_variable(RHOST);
675 } else if (am_root()) {
680 rslt = change_password(host,
681 cgi_variable(SWAT_USER),
682 cgi_variable(OLD_PSWD), cgi_variable(NEW_PSWD),
683 cgi_variable(ADD_USER_FLAG)? True : False,
684 cgi_variable(ENABLE_USER_FLAG)? True : False,
685 cgi_variable(DISABLE_USER_FLAG)? True : False);
689 printf("<p> The passwd for '%s' has been changed. \n", cgi_variable(SWAT_USER));
691 printf("<p> The passwd for '%s' has NOT been changed. \n",cgi_variable(SWAT_USER));
697 /****************************************************************************
698 display a password editing page
699 ****************************************************************************/
700 static void passwd_page(void)
702 char *new_name = cgi_user_name();
705 * After the first time through here be nice. If the user
706 * changed the User box text to another users name, remember it.
708 if (cgi_variable(SWAT_USER)) {
709 new_name = cgi_variable(SWAT_USER);
712 if (!new_name) new_name = "";
714 printf("<H2>Server Password Management</H2>\n");
716 printf("<FORM name=\"swatform\" method=post>\n");
721 * Create all the dialog boxes for data collection
723 printf("<tr><td> User Name : </td>\n");
724 printf("<td><input type=text size=30 name=%s value=%s></td></tr> \n", SWAT_USER, new_name);
726 printf("<tr><td> Old Password : </td>\n");
727 printf("<td><input type=password size=30 name=%s></td></tr> \n",OLD_PSWD);
729 printf("<tr><td> New Password : </td>\n");
730 printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW_PSWD);
731 printf("<tr><td> Re-type New Password : </td>\n");
732 printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW2_PSWD);
735 * Create all the control buttons for requesting action
737 printf("<tr><td><input type=submit name=%s value=\"Change Password\"></td></tr>\n", CHG_S_PASSWD_FLAG);
738 if (demo_mode || am_root()) {
739 printf("<tr><td><input type=submit name=%s value=\"Add New User\"></td></tr>\n", ADD_USER_FLAG);
740 printf("<tr><td><input type=submit name=%s value=\"Disable User\"></td></tr>\n", DISABLE_USER_FLAG);
741 printf("<tr><td><input type=submit name=%s value=\"Enable User\"></td></tr>\n", ENABLE_USER_FLAG);
745 * Do some work if change, add, disable or enable was requested. It could be
746 * this is the first time through this code, so there isn't anything to do.
748 if ((cgi_variable(CHG_S_PASSWD_FLAG)) || (cgi_variable(ADD_USER_FLAG)) ||
749 (cgi_variable(DISABLE_USER_FLAG)) || (cgi_variable(ENABLE_USER_FLAG))) {
753 printf("</table>\n");
757 printf("<H2>Client/Server Password Management</H2>\n");
759 printf("<FORM name=\"swatform\" method=post>\n");
764 * Create all the dialog boxes for data collection
766 printf("<tr><td> User Name : </td>\n");
767 printf("<td><input type=text size=30 name=%s value=%s></td></tr>\n",SWAT_USER, new_name);
768 printf("<tr><td> Old Password : </td>\n");
769 printf("<td><input type=password size=30 name=%s></td></tr>\n",OLD_PSWD);
770 printf("<tr><td> New Password : </td>\n");
771 printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW_PSWD);
772 printf("<tr><td> Re-type New Password : </td>\n");
773 printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW2_PSWD);
774 printf("<tr><td> Remote Machine : </td>\n");
775 printf("<td><input type=password size=30 name=%s></td></tr>\n",RHOST);
778 * Create all the control buttons for requesting action
780 printf("<tr><td><input type=submit name=%s value=\"Change Password\"></td></tr>", CHG_R_PASSWD_FLAG);
783 * Do some work if a request has been made to change the password somewhere other
784 * than the server. It could be this is the first time through this code, so there
785 * isn't anything to do.
787 if (cgi_variable(CHG_R_PASSWD_FLAG)) {
796 /****************************************************************************
797 display a printers editing page
798 ****************************************************************************/
799 static void printers_page(void)
801 char *share = cgi_variable("share");
808 snum = lp_servicenumber(share);
810 printf("<H2>Printer Parameters</H2>\n");
812 if (cgi_variable("Advanced") && !cgi_variable("Basic"))
815 if (cgi_variable("Commit") && snum >= 0) {
816 commit_parameters(snum);
820 if (cgi_variable("Delete") && snum >= 0) {
821 lp_remove_service(snum);
827 if (cgi_variable("createshare") && (share=cgi_variable("newshare"))) {
828 lp_copy_service(GLOBALS_SNUM, share);
829 snum = lp_servicenumber(share);
830 lp_do_parameter(snum, "print ok", "Yes");
832 snum = lp_servicenumber(share);
835 printf("<FORM name=\"swatform\" method=post>\n");
838 printf("<tr><td><input type=submit name=selectshare value=\"Choose Printer\"></td>\n");
839 printf("<td><select name=share>\n");
840 if (snum < 0 || !lp_print_ok(snum))
841 printf("<option value=\" \"> \n");
842 for (i=0;i<lp_numservices();i++) {
843 s = lp_servicename(i);
844 if (s && (*s) && strcmp(s,"IPC$") && lp_print_ok(i)) {
845 printf("<option %s value=\"%s\">%s\n",
846 (share && strcmp(share,s)==0)?"SELECTED":"",
850 printf("</select></td></tr><p>");
852 printf("<tr><td><input type=submit name=createshare value=\"Create Printer\"></td>\n");
853 printf("<td><input type=text size=30 name=newshare></td></tr>\n");
858 if (have_write_access) {
859 printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
861 printf("<input type=submit name=\"Delete\" value=\"Delete Printer\">\n");
863 printf("<input type=submit name=\"Advanced\" value=\"Advanced View\">\n");
865 printf("<input type=submit name=\"Basic\" value=\"Basic View\">\n");
872 show_parameters(snum, 1, advanced, 1);
873 printf("</table>\n");
877 printf("<input type=hidden name=\"Advanced\" value=1>\n");
883 /****************************************************************************
885 ****************************************************************************/
886 int main(int argc, char *argv[])
894 /* just in case it goes wild ... */
897 dbf = fopen("/dev/null", "w");
899 if (!dbf) dbf = stderr;
901 while ((opt = getopt(argc, argv,"s:a")) != EOF) {
904 pstrcpy(servicesf,optarg);
912 cgi_setup(SWATDIR, !demo_mode);
916 charset_initialise();
918 /* if this binary is setuid then run completely as root */
923 cgi_load_variables(NULL);
927 page = cgi_pathinfo();
929 /* check if the authenticated user has write access - if not then
930 don't show write options */
931 have_write_access = (access(servicesf,W_OK) == 0);
933 /* Root gets full functionality */
934 if (strcmp(page, "globals")==0) {
936 } else if (strcmp(page,"shares")==0) {
938 } else if (strcmp(page,"printers")==0) {
940 } else if (strcmp(page,"status")==0) {
942 } else if (strcmp(page,"viewconfig")==0) {
944 } else if (strcmp(page,"passwd")==0) {