#include "includes.h"
#include "web/swat_proto.h"
+#define _(x) lang_msg_rotate(talloc_tos(),x)
+
#define PIDMAP struct PidMap
/* how long to wait for start/stops to take effect */
{
/* show machine name rather PID on table "Open Files"? */
if (PID_or_Machine) {
- PIDMAP *p;
+ PIDMAP *p, *next;
- for (p = pidmap; p != NULL; ) {
+ for (p = pidmap; p != NULL; p = next) {
+ next = p->next;
DLIST_REMOVE(pidmap, p);
SAFE_FREE(p->machine);
SAFE_FREE(p);
}
/* add new PID <-> Machine name mapping */
-static void addPid2Machine (struct server_id pid, char *machine)
+static void addPid2Machine (struct server_id pid, const char *machine)
{
/* show machine name rather PID on table "Open Files"? */
if (PID_or_Machine) {
return pidbuf;
}
-static char *tstring(time_t t)
+static const char *tstring(TALLOC_CTX *ctx, time_t t)
{
- static pstring buf;
- pstrcpy(buf, time_to_asc(t));
- all_string_sub(buf," "," ",sizeof(buf));
+ char *buf;
+ buf = talloc_strdup(ctx, time_to_asc(t));
+ if (!buf) {
+ return "";
+ }
+ buf = talloc_all_string_sub(ctx,
+ buf,
+ " ",
+ " ");
+ if (!buf) {
+ return "";
+ }
return buf;
}
{
char *utf8_fname;
int deny_mode;
+ size_t converted_size;
if (!is_valid_share_mode_entry(e)) {
return;
printf("NONE ");
printf("</td>");
- push_utf8_allocate(&utf8_fname, fname);
+ push_utf8_allocate(&utf8_fname, fname, &converted_size);
printf("<td>%s</td><td>%s</td></tr>\n",
- utf8_fname,tstring(e->time.tv_sec));
+ utf8_fname,tstring(talloc_tos(),e->time.tv_sec));
SAFE_FREE(utf8_fname);
}
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td>\n",
procid_str_static(&crec->pid),
crec->machine, crec->addr,
- tstring(crec->start));
+ tstring(talloc_tos(),crec->start));
if (geteuid() == 0) {
printf("<td><input type=submit value=\"X\" name=\"kill_%s\"></td>\n",
procid_str_static(&crec->pid));
crec->servicename, uidtoname(crec->uid),
gidtoname(crec->gid),procid_str_static(&crec->pid),
crec->machine,
- tstring(crec->start));
+ tstring(talloc_tos(),crec->start));
return 0;
}
int autorefresh=0;
int refresh_interval=30;
int nr_running=0;
- BOOL waitup = False;
+ bool waitup = False;
+ TALLOC_CTX *ctx = talloc_stackframe();
smbd_pid = pid_to_procid(pidfile_pid("smbd"));
}
connections_forall(traverse_fn1, NULL);
-
+
initPid2Machine ();
printf("<H2>%s</H2>\n", _("Server Status"));
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"));
- locking_init(1);
+ locking_init_readonly();
share_mode_forall(print_share_mode, NULL);
locking_end();
printf("</table>\n");
refresh_interval*1000);
printf("//-->\n</script>\n");
}
+ TALLOC_FREE(ctx);
}