$Log$
+ Revision 607.20 2003/07/13 04:58:35 ajc
+ * Allow connect on unix domain sockets to Citadels in other directories
+ * sendcommand now uses unix domain sockets instead of the network
+ * Do not allow IPGM command to run on the network -- unix domain sockets only
+
Revision 607.19 2003/07/11 22:33:02 ajc
* Ignore comments in public_clients file
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
/* $Id$ */
-#define UDS "_UDS_"
-#ifdef __CYGWIN__
-#define DEFAULT_HOST "localhost"
-#else
-#define DEFAULT_HOST UDS
-#endif
-#define DEFAULT_PORT "citadel"
-
#include "sysdep.h"
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
/* If we're using a unix domain socket we can do a bunch of stuff */
if (!strcmp(cithost, UDS)) {
- snprintf(sockpath, sizeof sockpath, BBSDIR "/citadel.socket");
+ if (!strcasecmp(citport, DEFAULT_PORT)) {
+ snprintf(sockpath, sizeof sockpath, "%s%s",
+ BBSDIR, "/citadel.socket");
+ }
+ else {
+ snprintf(sockpath, sizeof sockpath, "%s%s",
+ citport, "/citadel.socket");
+ }
ipc->sock = uds_connectsock(&(ipc->isLocal), sockpath);
if (ipc->sock == -1) {
ifree(ipc);
/* $Id$ */
+#define UDS "_UDS_"
+#ifdef __CYGWIN__
+#define DEFAULT_HOST "localhost"
+#else
+#define DEFAULT_HOST UDS
+#endif
+#define DEFAULT_PORT "citadel"
+
#include "sysdep.h"
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
{
int secret;
+ /* For security reasons, we do NOT allow this command to run
+ * over the network. Local sockets only.
+ */
+ if (!CC->is_local_socket) {
+ sleep(5);
+ cprintf("%d Authentication failed.\n",ERROR);
+ return;
+ }
+
secret = extract_int(argbuf, 0);
if (secret == config.c_ipgm_secret) {
CC->internal_pgm = 1;
{"sendcommand", NULL};
int r;
- strcpy(hostbuf, "localhost");
- strcpy(portbuf, "citadel");
+ strcpy(hostbuf, UDS); /* Only run on a unix domain socket */
+ strcpy(portbuf, "."); /* IPGM will refuse to run on the network */
fprintf(stderr, "Attaching to server...\n");
ipc = CtdlIPC_new(1, args, hostbuf, portbuf);
CtdlIPC_getline(ipc, buf);