#include "control.h"
#include "tools.h"
+#ifndef HAVE_SNPRINTF
+#include "snprintf.h"
+#endif
+
struct CitContext *ContextList = NULL;
char *unique_session_numbers;
int ScheduledShutdown = 0;
tv = time(NULL);
- cprintf("%d %ld\n", OK, tv);
+ cprintf("%d %ld\n", OK, (long)tv);
}
/*
int session_num;
struct CitContext *ccptr;
int found_it = 0;
-
- if (CtdlAccessCheck(ac_aide)) return;
+ int allowed = 0;
session_num = extract_int(cmdbuf, 0);
if (session_num == CC->cs_pid) {
cprintf("%d You can't kill your own session.\n", ERROR);
return;
- }
+ }
lprintf(9, "Locating session to kill\n");
begin_critical_section(S_SESSION_TABLE);
for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
if (session_num == ccptr->cs_pid) {
- ccptr->kill_me = 1;
found_it = 1;
+ if ((ccptr->usersupp.usernum == CC->usersupp.usernum)
+ || (CC->usersupp.axlevel >= 6)) {
+ allowed = 1;
+ ccptr->kill_me = 1;
+ }
+ else {
+ allowed = 0;
}
}
+ }
end_critical_section(S_SESSION_TABLE);
if (found_it) {
- cprintf("%d Session terminated.\n", OK);
+ if (allowed) {
+ cprintf("%d Session terminated.\n", OK);
+ }
+ else {
+ cprintf("%d You are not allowed to do that.\n",
+ ERROR + HIGHER_ACCESS_REQUIRED);
}
+ }
else {
cprintf("%d No such session.\n", ERROR);
- }
}
+}
gettimeofday(&tv, NULL);
memset(con->cs_nonce, NONCE_SIZE, 0);
snprintf(con->cs_nonce, NONCE_SIZE, "<%d%ld@%s>",
- rand(), tv.tv_usec, config.c_fqdn);
+ rand(), (long)tv.tv_usec, config.c_fqdn);
}
cmd_ent0(&cmdbuf[5]);
}
- else if (!strncasecmp(cmdbuf,"ENT3",4)) {
- cmd_ent3(&cmdbuf[5]);
- }
-
else if (!strncasecmp(cmdbuf,"RINF",4)) {
cmd_rinf();
}