+/* $Id$ */
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include "room_ops.h"
#include "file_ops.h"
#include "dynloader.h"
+#include "policy.h"
+#include "control.h"
struct CitContext *ContextList = NULL;
int ScheduledShutdown = 0;
/* Now go away. */
lprintf(3, "citserver: exiting.\n");
+ fflush(stdout); fflush(stderr);
exit(0);
}
}
+/*
+ * call set_wtmpsupp() with the name of the current room, modified a bit...
+ */
+void set_wtmpsupp_to_current_room() {
+ if (CC->quickroom.QRflags & QR_PRIVATE) {
+ set_wtmpsupp("<private room>");
+ }
+ else if (CC->quickroom.QRflags & QR_MAILBOX) {
+ set_wtmpsupp(&CC->quickroom.QRname[11]);
+ }
+ else {
+ set_wtmpsupp(CC->quickroom.QRname);
+ }
+ }
+
+
+
/*
* cmd_info() - tell the client about this server
*/
strncpy(CC->fake_roomname, newroomname, ROOMNAMELEN-1);
}
else
- CC->fake_roomname[0] = '\0';
- cprintf("%d\n",OK);
+ strcpy(CC->fake_roomname, "");
+ cprintf("%d OK\n",OK);
}
void cmd_hchg(char *newhostname)
strncpy(CC->fake_hostname, newhostname, 24);
}
else
- CC->fake_hostname[0] = '\0';
- cprintf("%d\n",OK);
+ strcpy(CC->fake_hostname, "");
+ cprintf("%d OK\n",OK);
}
void cmd_uchg(char *newusername)
strncpy(CC->cs_host,from_host,24);
CC->cs_host[24] = 0;
}
- set_wtmpsupp(CC->quickroom.QRname);
+ set_wtmpsupp_to_current_room();
syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
dev_code,
CC->cs_flags = CC->cs_flags|CS_STEALTH;
}
- set_wtmpsupp(CC->quickroom.QRname);
+ set_wtmpsupp_to_current_room();
cprintf("%d Ok\n",OK);
}
free(dirs[1]);
if (strlen(targ)==0) {
- sprintf(targ, "./help/%s", buf);
+ snprintf(targ, sizeof targ, "./help/%s", buf);
}
mfp = fopen(targ,"w");
strcpy(CC->cs_clientname, "(unknown)");
strcpy(CC->curr_user,"");
strcpy(CC->net_node,"");
- sprintf(CC->temp,"/tmp/CitServer.%d.%d", getpid(), CC->cs_pid);
+ snprintf(CC->temp, sizeof CC->temp, "/tmp/CitServer.%d.%d", getpid(), CC->cs_pid);
strcpy(CC->cs_room, "");
strncpy(CC->cs_host, config.c_fqdn, sizeof CC->cs_host);
CC->cs_host[sizeof CC->cs_host - 1] = 0;
do {
time(&CC->lastcmd);
+ bzero(cmdbuf, sizeof cmdbuf); /* Clear it, just in case */
if (client_gets(cmdbuf) < 1) cleanup(EXIT_NULL);
lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf);
cmd_asup(&cmdbuf[5]);
}
+ else if (!strncasecmp(cmdbuf, "GPEX", 4)) {
+ cmd_gpex(&cmdbuf[5]);
+ }
+
+ else if (!strncasecmp(cmdbuf, "SPEX", 4)) {
+ cmd_spex(&cmdbuf[5]);
+ }
+
+ else if (!strncasecmp(cmdbuf, "CONF", 4)) {
+ cmd_conf(&cmdbuf[5]);
+ }
+
else if (!DLoader_Exec_Cmd(cmdbuf))
{
cprintf("%d Unrecognized or unsupported command.\n",