diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-03-15 02:37:52 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-03-15 02:37:52 +0000 |
commit | d360320618fe3a7f53ac1f05ee3ac54323a03c82 (patch) | |
tree | 97120a8949d82c8e9aab435bb56f6f0301beed28 /source3/web/swat.c | |
parent | 69bb6f6f5fa472d2bf5c619a09aecc3b0ce4c254 (diff) | |
download | samba-d360320618fe3a7f53ac1f05ee3ac54323a03c82.tar.gz samba-d360320618fe3a7f53ac1f05ee3ac54323a03c82.tar.bz2 samba-d360320618fe3a7f53ac1f05ee3ac54323a03c82.zip |
- added the ability to kill off individual connections from SWAT (from
the status page)
- split the claim_connection() code into its own file
- fixed the claim_connection() code to lock the file when manipulating
it
- always claim a null connection at startup
- fixed a bug in the pidfile code
(This used to be commit abd4a17e21d12be3d1747e94ceb1915abaf135e3)
Diffstat (limited to 'source3/web/swat.c')
-rw-r--r-- | source3/web/swat.c | 137 |
1 files changed, 0 insertions, 137 deletions
diff --git a/source3/web/swat.c b/source3/web/swat.c index d9f890ce13..1a12d99ffd 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -491,143 +491,6 @@ static void printers_page(void) } -static void print_share_mode(share_mode_entry *e, char *fname) -{ - printf("<tr><td>%d</td>",e->pid); - printf("<td>"); - switch ((e->share_mode>>4)&0xF) { - case DENY_NONE: printf("DENY_NONE"); break; - case DENY_ALL: printf("DENY_ALL "); break; - case DENY_DOS: printf("DENY_DOS "); break; - case DENY_READ: printf("DENY_READ "); break; - case DENY_WRITE:printf("DENY_WRITE "); break; - } - printf("</td>"); - - printf("<td>"); - switch (e->share_mode&0xF) { - case 0: printf("RDONLY "); break; - case 1: printf("WRONLY "); break; - case 2: printf("RDWR "); break; - } - printf("</td>"); - - printf("<td>"); - if((e->op_type & - (EXCLUSIVE_OPLOCK|BATCH_OPLOCK)) == - (EXCLUSIVE_OPLOCK|BATCH_OPLOCK)) - printf("EXCLUSIVE+BATCH "); - else if (e->op_type & EXCLUSIVE_OPLOCK) - printf("EXCLUSIVE "); - else if (e->op_type & BATCH_OPLOCK) - printf("BATCH "); - else - printf("NONE "); - printf("</td>"); - - printf("<td>%s</td><td>%s</td></tr>\n", - fname,asctime(LocalTime((time_t *)&e->time.tv_sec))); -} - - -/* show the current server status */ -static void status_page(void) -{ - struct connect_record crec; - pstring fname; - FILE *f; - - if (cgi_variable("smbd_start")) { - start_smbd(); - } - - if (cgi_variable("smbd_stop")) { - stop_smbd(); - } - - if (cgi_variable("nmbd_start")) { - start_nmbd(); - } - - if (cgi_variable("nmbd_stop")) { - stop_nmbd(); - } - - printf("<H2>Server Status</H2>\n"); - - printf("<FORM method=post>\n"); - - pstrcpy(fname,lp_lockdir()); - standard_sub_basic(fname); - trim_string(fname,"","/"); - strcat(fname,"/STATUS..LCK"); - - f = fopen(fname,"r"); - if (!f) { - printf("Couldn't open status file %s\n",fname); - if (!lp_status(-1)) - printf("You need to have status=yes in your smb config file\n"); - return; - } - - - printf("<table>\n"); - - printf("<tr><td>version:</td><td>%s</td></tr>",VERSION); - - fflush(stdout); - if (smbd_running()) { - printf("<tr><td>smbd:</td><td>running</td><td><input type=submit name=\"smbd_stop\" value=\"Stop smbd\"></td></tr>\n"); - } else { - printf("<tr><td>smbd:</td><td>not running</td><td><input type=submit name=\"smbd_start\" value=\"Start smbd\"></td></tr>\n"); - } - - fflush(stdout); - if (nmbd_running()) { - printf("<tr><td>nmbd:</td><td>running</td><td><input type=submit name=\"nmbd_stop\" value=\"Stop nmbd\"></td></tr>\n"); - } else { - printf("<tr><td>nmbd:</td><td>not running</td><td><input type=submit name=\"nmbd_start\" value=\"Start nmbd\"></td></tr>\n"); - } - - printf("</table>\n"); - fflush(stdout); - - - if (geteuid() != 0) - printf("<b>NOTE: You are not logged in as root and won't be able to start/stop the server</b><p>\n"); - - printf("<p><h3>Active Connections</h3>\n"); - printf("<table border=1>\n"); - printf("<tr><th>Share</th><th>User</th><th>Group</th><th>PID</th><th>Client</th><th>Date</th></tr>\n\n"); - - while (!feof(f)) { - if (fread(&crec,sizeof(crec),1,f) != 1) - break; - if (crec.magic == 0x280267 && process_exists(crec.pid)) { - printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%d</td><td>%s (%s)</td><td>%s</td></tr>\n", - crec.name,uidtoname(crec.uid), - gidtoname(crec.gid),crec.pid, - crec.machine,crec.addr, - asctime(LocalTime(&crec.start))); - } - } - - printf("</table><p>\n"); - - printf("<h3>Open Files</h3>\n"); - printf("<table border=1>\n"); - printf("<tr><th>PID</th><th>Sharing</th><th>R/W</th><th>Oplock</th><th>File</th><th>Date</th></tr>\n"); - - locking_init(1); - share_mode_forall(print_share_mode); - locking_end(); - printf("</table>\n"); - - fclose(f); - - printf("</FORM>\n"); -} - int main(int argc, char *argv[]) { |