From 51bc0c19c06f480c03cfc279388387c0aa8ae75c Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Fri, 8 May 1998 01:45:12 +0000 Subject: The globals section now shows non-default variables (like the view config section does) in the basic view. There is also a reset button to undo all changes you have made (that haven't been committed). In addition each field now has a "Set Default" button. Multi-choice fields are now select fields instead of a set of radio buttons. On the status screen I added a "restart" option for stopping then starting smbd and nmbd. (This used to be commit a6edde4f004d3ba65d938acd3e6e094664a6c468) --- source3/web/statuspage.c | 19 +++++-- source3/web/swat.c | 129 ++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 125 insertions(+), 23 deletions(-) (limited to 'source3') diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c index 5f89eee43a..9bcc99a6af 100644 --- a/source3/web/statuspage.c +++ b/source3/web/statuspage.c @@ -79,6 +79,12 @@ void status_page(void) int autorefresh=0; int refresh_interval=30; + if (cgi_variable("smbd_restart")) { + if (smbd_running()) + stop_smbd(); + start_smbd(); + } + if (cgi_variable("smbd_start")) { start_smbd(); } @@ -87,6 +93,11 @@ void status_page(void) stop_smbd(); } + if (cgi_variable("nmbd_restart")) { + if (nmbd_running()) + stop_nmbd(); + start_nmbd(); + } if (cgi_variable("nmbd_start")) { start_nmbd(); } @@ -161,16 +172,16 @@ void status_page(void) fflush(stdout); if (smbd_running()) { - printf("smbd:running\n"); + printf("smbd:running\n"); } else { - printf("smbd:not running\n"); + printf("smbd:not running>\n"); } fflush(stdout); if (nmbd_running()) { - printf("nmbd:running\n"); + printf("nmbd:running\n"); } else { - printf("nmbd:not running\n"); + printf("nmbd:not running\n"); } printf("\n"); diff --git a/source3/web/swat.c b/source3/web/swat.c index 53131461c9..e95ac5abd4 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -40,6 +40,42 @@ connection_struct Connections[MAX_CONNECTIONS]; files_struct Files[MAX_OPEN_FILES]; struct current_user current_user; +static int enum_index(int value, struct enum_list *enumlist) +{ +int i; + for (i=0;enumlist[i].name;i++) + if (value == enumlist[i].value) break; + return(i); +} + +static char *fix_backslash(char *string) +{ +static char newstring[1024]; +char *p = newstring; + + *p = '\0'; + while (*string) { + if (*string == '\\') {*p++ = '\\';*p++ = '\\';} + else *p++ = *string; + ++string; + *p = '\0'; + } + return newstring; +} + +static char *make_parm_name(char *label) +{ +static char parmname[1024]; +char *p = parmname; + + while (*label) { + if (*label == ' ') *p++ = '_'; + else *p++ = *label; + ++label; + *p = '\0'; + } + return parmname; +} /* start the page with standard stuff */ static void print_header(void) @@ -97,45 +133,64 @@ static void show_parameter(int snum, struct parm_struct *parm) switch (parm->type) { case P_CHAR: printf("", - parm->label, *(char *)ptr); + make_parm_name(parm->label), *(char *)ptr); + printf("", + make_parm_name(parm->label),(char)(parm->def.cvalue)); break; case P_STRING: case P_USTRING: printf("", - parm->label, *(char **)ptr); + make_parm_name(parm->label), *(char **)ptr); + printf("", + make_parm_name(parm->label),fix_backslash((char *)(parm->def.svalue))); break; case P_GSTRING: case P_UGSTRING: printf("", - parm->label, (char *)ptr); + make_parm_name(parm->label), (char *)ptr); + printf("", + make_parm_name(parm->label),fix_backslash((char *)(parm->def.svalue))); break; case P_BOOL: - printf("yes  ", parm->label, (*(BOOL *)ptr)?"CHECKED":""); - printf("no", parm->label, (*(BOOL *)ptr)?"":"CHECKED"); + printf(""); + printf("", + make_parm_name(parm->label),(BOOL)(parm->def.bvalue)?0:1); break; case P_BOOLREV: - printf("yes  ", parm->label, (*(BOOL *)ptr)?"":"CHECKED"); - printf("no", parm->label, (*(BOOL *)ptr)?"CHECKED":""); + printf(""); + printf("", + make_parm_name(parm->label),(BOOL)(parm->def.bvalue)?1:0); break; case P_INTEGER: - printf("", parm->label, *(int *)ptr); + printf("", make_parm_name(parm->label), *(int *)ptr); + printf("", + make_parm_name(parm->label),(int)(parm->def.ivalue)); break; case P_OCTAL: - printf("", parm->label, *(int *)ptr); + printf("", make_parm_name(parm->label), *(int *)ptr); + printf("", + make_parm_name(parm->label),(int)(parm->def.ivalue)); break; case P_ENUM: + printf("%s  ", - parm->label, parm->enum_list[i].name, - (*(int *)ptr)==parm->enum_list[i].value?"CHECKED":"", - parm->enum_list[i].name); + printf("