1998-03-15 02:37:52 +00:00
/*
2002-01-30 06:08:46 +00:00
Unix SMB / CIFS implementation .
1998-03-15 02:37:52 +00:00
web status page
Copyright ( C ) Andrew Tridgell 1997 - 1998
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-09 19:25:36 +00:00
the Free Software Foundation ; either version 3 of the License , or
1998-03-15 02:37:52 +00:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
2007-07-10 00:52:41 +00:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
1998-03-15 02:37:52 +00:00
*/
# include "includes.h"
2004-10-07 04:01:18 +00:00
# include "web/swat_proto.h"
1998-03-15 02:37:52 +00:00
2001-10-06 18:03:25 +00:00
# define PIDMAP struct PidMap
2003-04-24 02:35:00 +00:00
/* how long to wait for start/stops to take effect */
# define SLEEP_TIME 3
2001-10-06 18:03:25 +00:00
PIDMAP {
PIDMAP * next , * prev ;
2007-05-07 09:35:35 +00:00
struct server_id pid ;
2001-10-06 18:03:25 +00:00
char * machine ;
} ;
static PIDMAP * pidmap ;
static int PID_or_Machine ; /* 0 = show PID, else show Machine name */
2007-05-07 09:35:35 +00:00
static struct server_id smbd_pid ;
1998-03-15 02:37:52 +00:00
2001-10-06 18:03:25 +00:00
/* from 2nd call on, remove old list */
static void initPid2Machine ( void )
{
/* show machine name rather PID on table "Open Files"? */
if ( PID_or_Machine ) {
2001-10-14 12:10:29 +00:00
PIDMAP * p ;
2001-10-06 18:03:25 +00:00
for ( p = pidmap ; p ! = NULL ; ) {
DLIST_REMOVE ( pidmap , p ) ;
SAFE_FREE ( p - > machine ) ;
SAFE_FREE ( p ) ;
}
pidmap = NULL ;
}
}
/* add new PID <-> Machine name mapping */
2007-05-07 09:35:35 +00:00
static void addPid2Machine ( struct server_id pid , char * machine )
2001-10-06 18:03:25 +00:00
{
/* show machine name rather PID on table "Open Files"? */
if ( PID_or_Machine ) {
PIDMAP * newmap ;
2004-12-07 18:25:53 +00:00
if ( ( newmap = SMB_MALLOC_P ( PIDMAP ) ) = = NULL ) {
2001-10-06 18:03:25 +00:00
/* XXX need error message for this?
if malloc fails , PID is always shown */
return ;
}
newmap - > pid = pid ;
2004-12-07 18:25:53 +00:00
newmap - > machine = SMB_STRDUP ( machine ) ;
2001-10-06 18:03:25 +00:00
DLIST_ADD ( pidmap , newmap ) ;
}
}
/* lookup PID <-> Machine name mapping */
2007-05-07 09:35:35 +00:00
static char * mapPid2Machine ( struct server_id pid )
2001-10-06 18:03:25 +00:00
{
static char pidbuf [ 64 ] ;
PIDMAP * map ;
/* show machine name rather PID on table "Open Files"? */
if ( PID_or_Machine ) {
for ( map = pidmap ; map ! = NULL ; map = map - > next ) {
2005-09-30 17:13:37 +00:00
if ( procid_equal ( & pid , & map - > pid ) ) {
2001-10-06 18:03:25 +00:00
if ( map - > machine = = NULL ) /* no machine name */
break ; /* show PID */
return map - > machine ;
}
}
}
/* PID not in list or machine name NULL? return pid as string */
2005-09-30 17:13:37 +00:00
snprintf ( pidbuf , sizeof ( pidbuf ) - 1 , " %s " ,
procid_str_static ( & pid ) ) ;
2001-10-06 18:03:25 +00:00
return pidbuf ;
}
1998-03-15 06:43:15 +00:00
static char * tstring ( time_t t )
{
static pstring buf ;
2007-03-05 23:40:03 +00:00
pstrcpy ( buf , time_to_asc ( t ) ) ;
1999-12-13 13:27:58 +00:00
all_string_sub ( buf , " " , " " , sizeof ( buf ) ) ;
1998-03-15 06:43:15 +00:00
return buf ;
}
2006-07-21 14:13:30 +00:00
static void print_share_mode ( const struct share_mode_entry * e ,
const char * sharepath ,
const char * fname ,
void * dummy )
1998-03-15 02:37:52 +00:00
{
2004-10-01 22:24:44 +00:00
char * utf8_fname ;
2006-01-31 21:54:24 +00:00
int deny_mode ;
if ( ! is_valid_share_mode_entry ( e ) ) {
return ;
}
deny_mode = map_share_mode_to_deny_mode ( e - > share_access ,
2005-07-08 04:51:27 +00:00
e - > private_options ) ;
2004-10-01 22:24:44 +00:00
printf ( " <tr><td>%s</td> " , _ ( mapPid2Machine ( e - > pid ) ) ) ;
2006-06-21 02:31:12 +00:00
printf ( " <td>%u</td> " , ( unsigned int ) e - > uid ) ;
2004-10-01 22:24:44 +00:00
printf ( " <td> " ) ;
2005-07-08 04:51:27 +00:00
switch ( ( deny_mode > > 4 ) & 0xF ) {
2004-10-01 22:24:44 +00:00
case DENY_NONE : printf ( " DENY_NONE " ) ; break ;
case DENY_ALL : printf ( " DENY_ALL " ) ; break ;
case DENY_DOS : printf ( " DENY_DOS " ) ; break ;
2005-07-08 04:51:27 +00:00
case DENY_FCB : printf ( " DENY_FCB " ) ; break ;
2004-10-01 22:24:44 +00:00
case DENY_READ : printf ( " DENY_READ " ) ; break ;
case DENY_WRITE : printf ( " DENY_WRITE " ) ; break ;
1998-03-15 02:37:52 +00:00
}
2004-10-01 22:24:44 +00:00
printf ( " </td> " ) ;
1998-03-15 02:37:52 +00:00
2004-10-01 22:24:44 +00:00
printf ( " <td> " ) ;
2005-07-08 04:51:27 +00:00
if ( e - > access_mask & ( FILE_READ_DATA | FILE_WRITE_DATA ) ) {
printf ( " %s " , _ ( " RDWR " ) ) ;
} else if ( e - > access_mask & FILE_WRITE_DATA ) {
printf ( " %s " , _ ( " WRONLY " ) ) ;
} else {
printf ( " %s " , _ ( " RDONLY " ) ) ;
1998-03-15 02:37:52 +00:00
}
2004-10-01 22:24:44 +00:00
printf ( " </td> " ) ;
1998-03-15 02:37:52 +00:00
2004-10-01 22:24:44 +00:00
printf ( " <td> " ) ;
1998-03-15 02:37:52 +00:00
if ( ( e - > op_type &
( EXCLUSIVE_OPLOCK | BATCH_OPLOCK ) ) = =
( EXCLUSIVE_OPLOCK | BATCH_OPLOCK ) )
2004-10-01 22:24:44 +00:00
printf ( " EXCLUSIVE+BATCH " ) ;
1998-03-15 02:37:52 +00:00
else if ( e - > op_type & EXCLUSIVE_OPLOCK )
2004-10-01 22:24:44 +00:00
printf ( " EXCLUSIVE " ) ;
1998-03-15 02:37:52 +00:00
else if ( e - > op_type & BATCH_OPLOCK )
2004-10-01 22:24:44 +00:00
printf ( " BATCH " ) ;
1999-12-13 13:27:58 +00:00
else if ( e - > op_type & LEVEL_II_OPLOCK )
2004-10-01 22:24:44 +00:00
printf ( " LEVEL_II " ) ;
1998-03-15 02:37:52 +00:00
else
2004-10-01 22:24:44 +00:00
printf ( " NONE " ) ;
printf ( " </td> " ) ;
1998-03-15 02:37:52 +00:00
2004-10-01 22:24:44 +00:00
push_utf8_allocate ( & utf8_fname , fname ) ;
printf ( " <td>%s</td><td>%s</td></tr> \n " ,
utf8_fname , tstring ( e - > time . tv_sec ) ) ;
SAFE_FREE ( utf8_fname ) ;
1998-03-15 02:37:52 +00:00
}
1999-12-21 04:54:30 +00:00
/* kill off any connections chosen by the user */
2007-05-28 11:38:42 +00:00
static int traverse_fn1 ( struct db_record * rec ,
2007-05-08 13:44:36 +00:00
const struct connections_key * key ,
const struct connections_data * crec ,
2007-05-28 11:38:42 +00:00
void * private_data )
1999-12-21 04:54:30 +00:00
{
2007-05-08 13:44:36 +00:00
if ( crec - > cnum = = - 1 & & process_exists ( crec - > pid ) ) {
1999-12-21 04:54:30 +00:00
char buf [ 30 ] ;
2007-05-28 11:38:42 +00:00
slprintf ( buf , sizeof ( buf ) - 1 , " kill_%s " , procid_str_static ( & crec - > pid ) ) ;
1999-12-21 04:54:30 +00:00
if ( cgi_variable ( buf ) ) {
2007-05-08 13:44:36 +00:00
kill_pid ( crec - > pid ) ;
2003-04-24 02:35:00 +00:00
sleep ( SLEEP_TIME ) ;
1999-12-21 04:54:30 +00:00
}
}
return 0 ;
}
/* traversal fn for showing machine connections */
2007-05-28 11:38:42 +00:00
static int traverse_fn2 ( struct db_record * rec ,
const struct connections_key * key ,
const struct connections_data * crec ,
void * private_data )
1999-12-21 04:54:30 +00:00
{
2007-05-08 13:44:36 +00:00
if ( crec - > cnum = = - 1 | | ! process_exists ( crec - > pid ) | |
procid_equal ( & crec - > pid , & smbd_pid ) )
2001-05-15 18:12:02 +00:00
return 0 ;
1999-12-21 04:54:30 +00:00
2007-05-08 13:44:36 +00:00
addPid2Machine ( crec - > pid , crec - > machine ) ;
2001-10-06 18:03:25 +00:00
2005-09-30 17:13:37 +00:00
printf ( " <tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td> \n " ,
2007-05-08 13:44:36 +00:00
procid_str_static ( & crec - > pid ) ,
crec - > machine , crec - > addr ,
tstring ( crec - > start ) ) ;
1999-12-21 04:54:30 +00:00
if ( geteuid ( ) = = 0 ) {
2005-09-30 17:13:37 +00:00
printf ( " <td><input type=submit value= \" X \" name= \" kill_%s \" ></td> \n " ,
2007-05-08 13:44:36 +00:00
procid_str_static ( & crec - > pid ) ) ;
1999-12-21 04:54:30 +00:00
}
2004-10-01 22:24:44 +00:00
printf ( " </tr> \n " ) ;
1999-12-21 04:54:30 +00:00
return 0 ;
}
/* traversal fn for showing share connections */
2007-05-28 11:38:42 +00:00
static int traverse_fn3 ( struct db_record * rec ,
const struct connections_key * key ,
const struct connections_data * crec ,
void * private_data )
1999-12-21 04:54:30 +00:00
{
2007-05-08 13:44:36 +00:00
if ( crec - > cnum = = - 1 | | ! process_exists ( crec - > pid ) )
2001-05-15 18:12:02 +00:00
return 0 ;
1999-12-21 04:54:30 +00:00
2005-09-30 17:13:37 +00:00
printf ( " <tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr> \n " ,
2007-05-08 13:44:36 +00:00
crec - > servicename , uidtoname ( crec - > uid ) ,
gidtoname ( crec - > gid ) , procid_str_static ( & crec - > pid ) ,
crec - > machine ,
tstring ( crec - > start ) ) ;
1999-12-21 04:54:30 +00:00
return 0 ;
}
1998-03-15 02:37:52 +00:00
/* show the current server status */
void status_page ( void )
{
2003-01-03 08:28:12 +00:00
const char * v ;
1998-03-17 11:44:16 +00:00
int autorefresh = 0 ;
int refresh_interval = 30 ;
2003-04-22 23:19:09 +00:00
int nr_running = 0 ;
2003-04-24 02:35:00 +00:00
BOOL waitup = False ;
1998-03-15 02:37:52 +00:00
2005-09-30 17:13:37 +00:00
smbd_pid = pid_to_procid ( pidfile_pid ( " smbd " ) ) ;
2001-05-07 03:55:54 +00:00
2003-04-22 23:19:09 +00:00
if ( cgi_variable ( " smbd_restart " ) | | cgi_variable ( " all_restart " ) ) {
2000-01-07 08:47:34 +00:00
stop_smbd ( ) ;
1998-05-08 01:45:12 +00:00
start_smbd ( ) ;
2003-04-24 02:35:00 +00:00
waitup = True ;
1998-05-08 01:45:12 +00:00
}
2003-04-22 23:19:09 +00:00
if ( cgi_variable ( " smbd_start " ) | | cgi_variable ( " all_start " ) ) {
1998-03-15 02:37:52 +00:00
start_smbd ( ) ;
2003-04-24 02:35:00 +00:00
waitup = True ;
1998-03-15 02:37:52 +00:00
}
2003-04-22 23:19:09 +00:00
if ( cgi_variable ( " smbd_stop " ) | | cgi_variable ( " all_stop " ) ) {
1998-03-15 02:37:52 +00:00
stop_smbd ( ) ;
2003-04-24 02:35:00 +00:00
waitup = True ;
1998-03-15 02:37:52 +00:00
}
2003-04-22 23:19:09 +00:00
if ( cgi_variable ( " nmbd_restart " ) | | cgi_variable ( " all_restart " ) ) {
2000-01-07 08:47:34 +00:00
stop_nmbd ( ) ;
1998-05-08 01:45:12 +00:00
start_nmbd ( ) ;
2003-04-24 02:35:00 +00:00
waitup = True ;
1998-05-08 01:45:12 +00:00
}
2003-04-22 23:19:09 +00:00
if ( cgi_variable ( " nmbd_start " ) | | cgi_variable ( " all_start " ) ) {
1998-03-15 02:37:52 +00:00
start_nmbd ( ) ;
2003-04-24 02:35:00 +00:00
waitup = True ;
1998-03-15 02:37:52 +00:00
}
2003-04-22 23:19:09 +00:00
if ( cgi_variable ( " nmbd_stop " ) | | cgi_variable ( " all_stop " ) ) {
1998-03-15 02:37:52 +00:00
stop_nmbd ( ) ;
2003-04-24 02:35:00 +00:00
waitup = True ;
1998-03-15 02:37:52 +00:00
}
2002-08-17 14:34:48 +00:00
# ifdef WITH_WINBIND
2003-04-22 23:19:09 +00:00
if ( cgi_variable ( " winbindd_restart " ) | | cgi_variable ( " all_restart " ) ) {
2002-08-17 14:34:48 +00:00
stop_winbindd ( ) ;
start_winbindd ( ) ;
2003-04-24 02:35:00 +00:00
waitup = True ;
2002-08-17 14:34:48 +00:00
}
2003-04-22 23:19:09 +00:00
if ( cgi_variable ( " winbindd_start " ) | | cgi_variable ( " all_start " ) ) {
2002-08-17 14:34:48 +00:00
start_winbindd ( ) ;
2003-04-24 02:35:00 +00:00
waitup = True ;
2002-08-17 14:34:48 +00:00
}
2003-04-22 23:19:09 +00:00
if ( cgi_variable ( " winbindd_stop " ) | | cgi_variable ( " all_stop " ) ) {
2002-08-17 14:34:48 +00:00
stop_winbindd ( ) ;
2003-04-24 02:35:00 +00:00
waitup = True ;
2002-08-17 14:34:48 +00:00
}
# endif
2003-04-24 02:35:00 +00:00
/* wait for daemons to start/stop */
if ( waitup )
sleep ( SLEEP_TIME ) ;
1998-03-17 11:44:16 +00:00
if ( cgi_variable ( " autorefresh " ) ) {
autorefresh = 1 ;
} else if ( cgi_variable ( " norefresh " ) ) {
autorefresh = 0 ;
} else if ( cgi_variable ( " refresh " ) ) {
autorefresh = 1 ;
}
if ( ( v = cgi_variable ( " refresh_interval " ) ) ) {
refresh_interval = atoi ( v ) ;
}
2001-10-06 18:03:25 +00:00
if ( cgi_variable ( " show_client_in_col_1 " ) ) {
PID_or_Machine = 1 ;
}
2003-10-03 01:42:53 +00:00
if ( cgi_variable ( " show_pid_in_col_1 " ) ) {
PID_or_Machine = 0 ;
}
2007-05-08 13:44:36 +00:00
connections_forall ( traverse_fn1 , NULL ) ;
2001-10-06 18:03:25 +00:00
initPid2Machine ( ) ;
1998-03-15 02:37:52 +00:00
2004-10-01 22:24:44 +00:00
printf ( " <H2>%s</H2> \n " , _ ( " Server Status " ) ) ;
1998-03-15 02:37:52 +00:00
2004-10-01 22:24:44 +00:00
printf ( " <FORM method=post> \n " ) ;
1998-03-15 02:37:52 +00:00
1998-03-17 11:44:16 +00:00
if ( ! autorefresh ) {
2004-10-01 22:24:44 +00:00
printf ( " <input type=submit value= \" %s \" name= \" autorefresh \" > \n " , _ ( " Auto Refresh " ) ) ;
printf ( " <br>%s " , _ ( " Refresh Interval: " ) ) ;
printf ( " <input type=text size=2 name= \" refresh_interval \" value= \" %d \" > \n " ,
1998-03-17 11:44:16 +00:00
refresh_interval ) ;
} else {
2004-10-01 22:24:44 +00:00
printf ( " <input type=submit value= \" %s \" name= \" norefresh \" > \n " , _ ( " Stop Refreshing " ) ) ;
printf ( " <br>%s%d \n " , _ ( " Refresh Interval: " ) , refresh_interval ) ;
printf ( " <input type=hidden name= \" refresh \" value= \" 1 \" > \n " ) ;
1998-03-17 11:44:16 +00:00
}
2004-10-01 22:24:44 +00:00
printf ( " <p> \n " ) ;
1998-03-17 11:44:16 +00:00
2004-10-01 22:24:44 +00:00
printf ( " <table> \n " ) ;
1998-03-15 02:37:52 +00:00
2004-10-01 22:24:44 +00:00
printf ( " <tr><td>%s</td><td>%s</td></tr> " , _ ( " version: " ) , SAMBA_VERSION_STRING ) ;
1998-03-15 02:37:52 +00:00
fflush ( stdout ) ;
2004-10-01 22:24:44 +00:00
printf ( " <tr><td>%s</td><td>%s</td> \n " , _ ( " smbd: " ) , smbd_running ( ) ? _ ( " running " ) : _ ( " not running " ) ) ;
1999-12-13 13:27:58 +00:00
if ( geteuid ( ) = = 0 ) {
if ( smbd_running ( ) ) {
2003-04-22 23:19:09 +00:00
nr_running + + ;
2004-10-01 22:24:44 +00:00
printf ( " <td><input type=submit name= \" smbd_stop \" value= \" %s \" ></td> \n " , _ ( " Stop smbd " ) ) ;
1999-12-13 13:27:58 +00:00
} else {
2004-10-01 22:24:44 +00:00
printf ( " <td><input type=submit name= \" smbd_start \" value= \" %s \" ></td> \n " , _ ( " Start smbd " ) ) ;
1999-12-13 13:27:58 +00:00
}
2004-10-01 22:24:44 +00:00
printf ( " <td><input type=submit name= \" smbd_restart \" value= \" %s \" ></td> \n " , _ ( " Restart smbd " ) ) ;
1998-03-15 02:37:52 +00:00
}
2004-10-01 22:24:44 +00:00
printf ( " </tr> \n " ) ;
1998-03-15 02:37:52 +00:00
fflush ( stdout ) ;
2004-10-01 22:24:44 +00:00
printf ( " <tr><td>%s</td><td>%s</td> \n " , _ ( " nmbd: " ) , nmbd_running ( ) ? _ ( " running " ) : _ ( " not running " ) ) ;
1999-12-13 13:27:58 +00:00
if ( geteuid ( ) = = 0 ) {
if ( nmbd_running ( ) ) {
2003-04-22 23:19:09 +00:00
nr_running + + ;
2004-10-01 22:24:44 +00:00
printf ( " <td><input type=submit name= \" nmbd_stop \" value= \" %s \" ></td> \n " , _ ( " Stop nmbd " ) ) ;
1999-12-13 13:27:58 +00:00
} else {
2004-10-01 22:24:44 +00:00
printf ( " <td><input type=submit name= \" nmbd_start \" value= \" %s \" ></td> \n " , _ ( " Start nmbd " ) ) ;
1999-12-13 13:27:58 +00:00
}
2004-10-01 22:24:44 +00:00
printf ( " <td><input type=submit name= \" nmbd_restart \" value= \" %s \" ></td> \n " , _ ( " Restart nmbd " ) ) ;
1998-03-15 02:37:52 +00:00
}
2004-10-01 22:24:44 +00:00
printf ( " </tr> \n " ) ;
1998-03-15 02:37:52 +00:00
2002-08-17 14:34:48 +00:00
# ifdef WITH_WINBIND
fflush ( stdout ) ;
2004-10-01 22:24:44 +00:00
printf ( " <tr><td>%s</td><td>%s</td> \n " , _ ( " winbindd: " ) , winbindd_running ( ) ? _ ( " running " ) : _ ( " not running " ) ) ;
2002-08-17 14:34:48 +00:00
if ( geteuid ( ) = = 0 ) {
if ( winbindd_running ( ) ) {
2003-04-22 23:19:09 +00:00
nr_running + + ;
2004-10-01 22:24:44 +00:00
printf ( " <td><input type=submit name= \" winbindd_stop \" value= \" %s \" ></td> \n " , _ ( " Stop winbindd " ) ) ;
2002-08-17 14:34:48 +00:00
} else {
2004-10-01 22:24:44 +00:00
printf ( " <td><input type=submit name= \" winbindd_start \" value= \" %s \" ></td> \n " , _ ( " Start winbindd " ) ) ;
2002-08-17 14:34:48 +00:00
}
2004-10-01 22:24:44 +00:00
printf ( " <td><input type=submit name= \" winbindd_restart \" value= \" %s \" ></td> \n " , _ ( " Restart winbindd " ) ) ;
2003-04-24 02:35:00 +00:00
}
2004-10-01 22:24:44 +00:00
printf ( " </tr> \n " ) ;
2003-04-24 02:35:00 +00:00
# endif
if ( geteuid ( ) = = 0 ) {
2004-10-01 22:24:44 +00:00
printf ( " <tr><td></td><td></td> \n " ) ;
2003-04-22 23:19:09 +00:00
if ( nr_running > = 1 ) {
/* stop, restart all */
2004-10-01 22:24:44 +00:00
printf ( " <td><input type=submit name= \" all_stop \" value= \" %s \" ></td> \n " , _ ( " Stop All " ) ) ;
printf ( " <td><input type=submit name= \" all_restart \" value= \" %s \" ></td> \n " , _ ( " Restart All " ) ) ;
2003-04-22 23:19:09 +00:00
}
else if ( nr_running = = 0 ) {
/* start all */
2004-10-01 22:24:44 +00:00
printf ( " <td><input type=submit name= \" all_start \" value= \" %s \" ></td> \n " , _ ( " Start All " ) ) ;
2003-04-22 23:19:09 +00:00
}
2004-10-01 22:24:44 +00:00
printf ( " </tr> \n " ) ;
2002-08-17 14:34:48 +00:00
}
2004-10-01 22:24:44 +00:00
printf ( " </table> \n " ) ;
1998-03-15 02:37:52 +00:00
fflush ( stdout ) ;
2004-10-01 22:24:44 +00:00
printf ( " <p><h3>%s</h3> \n " , _ ( " Active Connections " ) ) ;
printf ( " <table border=1> \n " ) ;
printf ( " <tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th> \n " , _ ( " PID " ) , _ ( " Client " ) , _ ( " IP address " ) , _ ( " Date " ) ) ;
1999-12-13 13:27:58 +00:00
if ( geteuid ( ) = = 0 ) {
2004-10-01 22:24:44 +00:00
printf ( " <th>%s</th> \n " , _ ( " Kill " ) ) ;
1999-12-13 13:27:58 +00:00
}
2004-10-01 22:24:44 +00:00
printf ( " </tr> \n " ) ;
1998-03-15 02:37:52 +00:00
2007-05-08 13:44:36 +00:00
connections_forall ( traverse_fn2 , NULL ) ;
1998-03-15 02:37:52 +00:00
2004-10-01 22:24:44 +00:00
printf ( " </table><p> \n " ) ;
1998-03-15 02:37:52 +00:00
2004-10-01 22:24:44 +00:00
printf ( " <p><h3>%s</h3> \n " , _ ( " Active Shares " ) ) ;
printf ( " <table border=1> \n " ) ;
printf ( " <tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr> \n \n " ,
2001-09-24 15:55:09 +00:00
_ ( " Share " ) , _ ( " User " ) , _ ( " Group " ) , _ ( " PID " ) , _ ( " Client " ) , _ ( " Date " ) ) ;
1998-03-15 02:37:52 +00:00
2007-05-08 13:44:36 +00:00
connections_forall ( traverse_fn3 , NULL ) ;
1998-03-15 02:37:52 +00:00
2004-10-01 22:24:44 +00:00
printf ( " </table><p> \n " ) ;
1998-03-15 02:37:52 +00:00
2004-10-01 22:24:44 +00:00
printf ( " <h3>%s</h3> \n " , _ ( " Open Files " ) ) ;
printf ( " <table border=1> \n " ) ;
printf ( " <tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr> \n " , _ ( " PID " ) , _ ( " Sharing " ) , _ ( " R/W " ) , _ ( " Oplock " ) , _ ( " File " ) , _ ( " Date " ) ) ;
1998-03-15 02:37:52 +00:00
locking_init ( 1 ) ;
2006-07-21 14:13:30 +00:00
share_mode_forall ( print_share_mode , NULL ) ;
1998-03-15 02:37:52 +00:00
locking_end ( ) ;
2004-10-01 22:24:44 +00:00
printf ( " </table> \n " ) ;
1998-03-15 02:37:52 +00:00
2004-10-01 22:24:44 +00:00
printf ( " <br><input type=submit name= \" show_client_in_col_1 \" value= \" %s \" > \n " , _ ( " Show Client in col 1 " ) ) ;
printf ( " <input type=submit name= \" show_pid_in_col_1 \" value= \" %s \" > \n " , _ ( " Show PID in col 1 " ) ) ;
2001-10-06 18:03:25 +00:00
2004-10-01 22:24:44 +00:00
printf ( " </FORM> \n " ) ;
1998-03-18 07:44:27 +00:00
if ( autorefresh ) {
/* this little JavaScript allows for automatic refresh
of the page . There are other methods but this seems
to be the best alternative */
2004-10-01 22:24:44 +00:00
printf ( " <script language= \" JavaScript \" > \n " ) ;
printf ( " <!-- \n setTimeout('window.location.replace( \" %s/status?refresh_interval=%d&refresh=1 \" )', %d) \n " ,
1998-03-18 07:44:27 +00:00
cgi_baseurl ( ) ,
refresh_interval ,
refresh_interval * 1000 ) ;
2004-10-01 22:24:44 +00:00
printf ( " //--> \n </script> \n " ) ;
1998-03-18 07:44:27 +00:00
}
1998-03-15 02:37:52 +00:00
}