2 Unix SMB/Netbios implementation.
5 Copyright (C) Andrew Tridgell 1997
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.
28 static void print_header(void)
30 printf("Content-type: text/html\n\n");
31 printf("<HTML>\n<HEAD>\n<TITLE>smbstatus</TITLE>\n</HEAD>\n<BODY>\n\n");
34 static void print_footer(void)
36 printf("\n</BODY>\n</HTML>\n");
39 static void show_connections(void)
41 static pstring servicesf
= CONFIGFILE
;
44 struct connect_record crec
;
46 if (!lp_load(servicesf
,False
)) {
47 printf("Can't load %s - run testparm to debug it\n", servicesf
);
51 strcpy(fname
,lp_lockdir());
52 standard_sub_basic(fname
);
53 trim_string(fname
,"","/");
54 strcat(fname
,"/STATUS..LCK");
58 printf("Couldn't open status file %s\n",fname
);
60 printf("You need to have status=yes in your smb config file\n");
65 printf("\nSamba version %s\n<p>",VERSION
);
68 if (fread(&crec
,sizeof(crec
),1,f
) != 1)
70 if (crec
.magic
== 0x280267 && process_exists(crec
.pid
)) {
71 printf("%-10.10s %-8s %-8s %5d %-8s (%s) %s<br>",
72 crec
.name
,uidtoname(crec
.uid
),
73 gidtoname(crec
.gid
),crec
.pid
,
74 crec
.machine
,crec
.addr
,
75 asctime(LocalTime(&crec
.start
)));
81 int main(int argc
, char *argv
[])