* Cleaned up the 'citmail' MDA tool
* Added POP3 and SMTP port numbers to global system configuration
13 files changed:
+Revision 1.480 2000/03/08 03:36:37 ajc
+* Shut off hostname resolution when dealing with Unix domain sockets
+* Cleaned up the 'citmail' MDA tool
+* Added POP3 and SMTP port numbers to global system configuration
+
Revision 1.479 2000/03/07 21:54:58 ajc
* Fixed the naming conventions and permissions for unix domain sockets.
Revision 1.479 2000/03/07 21:54:58 ajc
* Fixed the naming conventions and permissions for unix domain sockets.
Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Initial CVS import
Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Initial CVS import
long c_maxmsglen; /* Maximum message length */
int c_min_workers; /* Lower limit on number of threads */
int c_max_workers; /* Upper limit on number of threads */
long c_maxmsglen; /* Maximum message length */
int c_min_workers; /* Lower limit on number of threads */
int c_max_workers; /* Upper limit on number of threads */
+ int c_pop3_port; /* POP3 listener port (usually 110) */
+ int c_smtp_port; /* SMTP listener port (usually 25) */
};
#define NODENAME config.c_nodename
};
#define NODENAME config.c_nodename
#include "snprintf.h"
#endif
#include "snprintf.h"
#endif
+/* #define DEBUG */ /* uncomment to get protocol traces */
+
*/
buf[i] = 0;
strip_trailing_nonprint(buf);
*/
buf[i] = 0;
strip_trailing_nonprint(buf);
+#ifdef DEBUG
+ printf("> %s\n", buf);
+#endif
*/
void serv_puts(char *buf)
{
*/
void serv_puts(char *buf)
{
- /* printf("< %s\n", buf); */
+#ifdef DEBUG
+ printf("< %s\n", buf);
+#endif
serv_write(buf, strlen(buf));
serv_write("\n", 1);
}
serv_write(buf, strlen(buf));
serv_write("\n", 1);
}
serv_puts("QUIT");
serv_gets(buf);
serv_puts("QUIT");
serv_gets(buf);
- fprintf(stderr, "%s\n", buf);
}
strip_trailing_nonprint(fromline);
}
strip_trailing_nonprint(fromline);
- sprintf(buf, "%d", SMTP_PORT);
serv_sock = uds_connectsock("smtp.socket");
serv_gets(buf);
serv_sock = uds_connectsock("smtp.socket");
serv_gets(buf);
- fprintf(stderr, "%s\n", buf);
if (buf[0]!='2') cleanup(1);
serv_puts("HELO localhost");
serv_gets(buf);
if (buf[0]!='2') cleanup(1);
serv_puts("HELO localhost");
serv_gets(buf);
- fprintf(stderr, "%s\n", buf);
if (buf[0]!='2') cleanup(1);
sprintf(buf, "MAIL %s", fromline);
serv_puts(buf);
serv_gets(buf);
if (buf[0]!='2') cleanup(1);
sprintf(buf, "MAIL %s", fromline);
serv_puts(buf);
serv_gets(buf);
- fprintf(stderr, "%s\n", buf);
if (buf[0]!='2') cleanup(1);
sprintf(buf, "RCPT To: %s", argv[1]);
serv_puts(buf);
serv_gets(buf);
if (buf[0]!='2') cleanup(1);
sprintf(buf, "RCPT To: %s", argv[1]);
serv_puts(buf);
serv_gets(buf);
- fprintf(stderr, "%s\n", buf);
if (buf[0]!='2') cleanup(1);
serv_puts("DATA");
serv_gets(buf);
if (buf[0]!='2') cleanup(1);
serv_puts("DATA");
serv_gets(buf);
- fprintf(stderr, "%s\n", buf);
if (buf[0]!='3') cleanup(1);
rewind(fp);
if (buf[0]!='3') cleanup(1);
rewind(fp);
}
serv_puts(".");
serv_gets(buf);
}
serv_puts(".");
serv_gets(buf);
- fprintf(stderr, "%s\n", buf);
if (buf[0]!='2') cleanup(1);
else cleanup(0);
return(0);
if (buf[0]!='2') cleanup(1);
else cleanup(0);
return(0);
if (num_parms(argbuf)<4) {
cprintf("%d usage error\n",ERROR);
return;
if (num_parms(argbuf)<4) {
cprintf("%d usage error\n",ERROR);
return;
dev_code = extract_int(argbuf,0);
cli_code = extract_int(argbuf,1);
dev_code = extract_int(argbuf,0);
cli_code = extract_int(argbuf,1);
CC->cs_clientname[31] = 0;
lprintf(9, "Looking up hostname '%s'\n", from_host);
CC->cs_clientname[31] = 0;
lprintf(9, "Looking up hostname '%s'\n", from_host);
- if ((strlen(from_host)>0) &&
- (is_public_client(CC->cs_host))) {
+ if ((strlen(from_host)>0)
+ && ( (CC->is_local_socket) || (is_public_client(CC->cs_host)))) {
if ((addr.s_addr = inet_addr(from_host)) != INADDR_NONE)
locate_host(CC->cs_host, &addr);
else {
safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host);
CC->cs_host[24] = 0;
if ((addr.s_addr = inet_addr(from_host)) != INADDR_NONE)
locate_host(CC->cs_host, &addr);
else {
safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host);
CC->cs_host[24] = 0;
syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
dev_code,
syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
dev_code,
(rev_level % 100),
desc);
cprintf("%d Ok\n",OK);
(rev_level % 100),
desc);
cprintf("%d Ok\n",OK);
safestrncpy(con->cs_host, config.c_fqdn, sizeof con->cs_host);
con->cs_host[sizeof con->cs_host - 1] = 0;
len = sizeof sin;
safestrncpy(con->cs_host, config.c_fqdn, sizeof con->cs_host);
con->cs_host[sizeof con->cs_host - 1] = 0;
len = sizeof sin;
- if (!getpeername(con->client_socket, (struct sockaddr *) &sin, &len))
- locate_host(con->cs_host, &sin.sin_addr);
+ if (!CC->is_local_socket) {
+ if (!getpeername(con->client_socket,
+ (struct sockaddr *) &sin, &len))
+ locate_host(con->cs_host, &sin.sin_addr);
+ }
+ else {
+ strcpy(con->cs_host, "");
+ }
con->cs_flags = 0;
con->upload_type = UPL_FILE;
con->dl_is_net = 0;
con->cs_flags = 0;
con->upload_type = UPL_FILE;
con->dl_is_net = 0;
cprintf("%d\n", config.c_maxmsglen);
cprintf("%d\n", config.c_min_workers);
cprintf("%d\n", config.c_max_workers);
cprintf("%d\n", config.c_maxmsglen);
cprintf("%d\n", config.c_min_workers);
cprintf("%d\n", config.c_max_workers);
+ cprintf("%d\n", config.c_pop3_port);
+ cprintf("%d\n", config.c_smtp_port);
config.c_min_workers = atoi(buf);
case 22: if (atoi(buf) >= config.c_min_workers)
config.c_max_workers = atoi(buf);
config.c_min_workers = atoi(buf);
case 22: if (atoi(buf) >= config.c_min_workers)
config.c_max_workers = atoi(buf);
+ case 23: config.c_pop3_port = atoi(buf);
+ break;
+ case 24: config.c_smtp_port = atoi(buf);
+ break;
-phonenum netproc[4026]: Adding non-neighbor system <catchat> to map
-gdom or system <catchat> to map
-humannode The Future BBS
-lastcontact 952138911 Fri Mar 3 22:01:51 2000
+phonenum US 612 470 9635
+gdom MN
+humannode C-86 Test System
+lastcontact 952375033 Mon Mar 6 15:37:13 2000
-phonenum netproc[4026]: Adding non-neighbor system <rundale> to map
-gdom or system <rundale> to map
-humannode 'Cat Chat
-lastcontact 952138915 Fri Mar 3 22:01:55 2000
+phonenum netproc[7145]: Adding non-neighbor system <internet> to map
+gdom or system <internet> to map
+humannode BCCS
+lastcontact 952418225 Tue Mar 7 03:37:05 2000
-rundale
-use uncnsrd
-phonenum US 609 854 9135
-gdom NJ
-humannode Rundale
-lastcontact 952138909 Fri Mar 3 22:01:49 2000
+internet
+uum %s
+humannode Internet Gateway
+lastcontact 952485943 Tue Mar 7 22:25:43 2000
-jacs
-use uncnsrd
-phonenum US6093461224
-gdom NJ
-humannode JACS
-lastcontact 952138912 Fri Mar 3 22:01:52 2000
+uncnsrd
+bin Mail
+phonenum US 914 244 3252
+humannode Uncensored
+lastcontact 952485944 Tue Mar 7 22:25:44 2000
-dogpound2
-use uncnsrd
-phonenum netproc[4026]: Adding non-neighbor system <sbn> to map
-gdom or system <sbn> to map
-humannode Dog Pound BBS II
-lastcontact 952349824 Mon Mar 6 08:37:04 2000
-sbn
-use uncnsrd
-phonenum netproc[4026]: Adding non-neighbor system <feathers> to map
-gdom or system <feathers> to map
-humannode Super BBS Network
-lastcontact 952138908 Fri Mar 3 22:01:48 2000
+tux
+bin Mail
+phonenum US 800 555 1212
+humannode My System
+lastcontact 951540103 Fri Feb 25 23:41:43 2000
+tesseract
+bin Mail
+phonenum US 800 555 1212
+humannode Tesseract Project
+lastcontact 952468624 Tue Mar 7 17:37:04 2000
+
+pixel
-phonenum CA (604) 589-8539
-gdom BC
-humannode Feathers & Furballs
-lastcontact 952138915 Fri Mar 3 22:01:55 2000
+phonenum netproc[4026]: Adding non-neighbor system <tesseract> to map
+gdom or system <tesseract> to map
+humannode PixelBBS
+lastcontact 952454224 Tue Mar 7 13:37:04 2000
-phonenum netproc[4026]: Adding non-neighbor system <gateway> to map
-gdom or system <gateway> to map
-humannode MascotSpeak
-lastcontact 952138904 Fri Mar 3 22:01:44 2000
+phonenum netproc[4026]: Adding non-neighbor system <pixel> to map
+gdom or system <pixel> to map
+humannode Barbaria
+lastcontact 952138915 Fri Mar 3 22:01:55 2000
-phonenum US (609) 931-3014
-gdom NJ
-humannode Gateway
-lastcontact 952138913 Fri Mar 3 22:01:53 2000
+phonenum netproc[4026]: Adding non-neighbor system <barbaria> to map
+gdom or system <barbaria> to map
+humannode Haven BBS
+lastcontact 952138910 Fri Mar 3 22:01:50 2000
-phonenum US (609) 953 8159
-gdom NJ
-humannode The Amiga Zone
-lastcontact 952138913 Fri Mar 3 22:01:53 2000
+phonenum US (612) 757-7307
+gdom MN
+humannode MN-Mensa
+lastcontact 952138905 Fri Mar 3 22:01:45 2000
humannode The CBBS
lastcontact 952138903 Fri Mar 3 22:01:43 2000
humannode The CBBS
lastcontact 952138903 Fri Mar 3 22:01:43 2000
-phonenum US (612) 757-7307
-gdom MN
-humannode MN-Mensa
-lastcontact 952138905 Fri Mar 3 22:01:45 2000
+phonenum US (609) 953 8159
+gdom NJ
+humannode The Amiga Zone
+lastcontact 952138913 Fri Mar 3 22:01:53 2000
-phonenum netproc[4026]: Adding non-neighbor system <barbaria> to map
-gdom or system <barbaria> to map
-humannode Haven BBS
-lastcontact 952138910 Fri Mar 3 22:01:50 2000
+phonenum US (609) 931-3014
+gdom NJ
+humannode Gateway
+lastcontact 952138913 Fri Mar 3 22:01:53 2000
-phonenum netproc[4026]: Adding non-neighbor system <pixel> to map
-gdom or system <pixel> to map
-humannode Barbaria
-lastcontact 952138915 Fri Mar 3 22:01:55 2000
+phonenum netproc[4026]: Adding non-neighbor system <gateway> to map
+gdom or system <gateway> to map
+humannode MascotSpeak
+lastcontact 952138904 Fri Mar 3 22:01:44 2000
-phonenum netproc[4026]: Adding non-neighbor system <tesseract> to map
-gdom or system <tesseract> to map
-humannode PixelBBS
-lastcontact 952454224 Tue Mar 7 13:37:04 2000
-
-tesseract
-bin Mail
-phonenum US 800 555 1212
-humannode Tesseract Project
-lastcontact 952468624 Tue Mar 7 17:37:04 2000
+phonenum CA (604) 589-8539
+gdom BC
+humannode Feathers & Furballs
+lastcontact 952138915 Fri Mar 3 22:01:55 2000
-tux
-bin Mail
-phonenum US 800 555 1212
-humannode My System
-lastcontact 951540103 Fri Feb 25 23:41:43 2000
+sbn
+use uncnsrd
+phonenum netproc[4026]: Adding non-neighbor system <feathers> to map
+gdom or system <feathers> to map
+humannode Super BBS Network
+lastcontact 952138908 Fri Mar 3 22:01:48 2000
+dogpound2
+use uncnsrd
+phonenum netproc[4026]: Adding non-neighbor system <sbn> to map
+gdom or system <sbn> to map
+humannode Dog Pound BBS II
+lastcontact 952349824 Mon Mar 6 08:37:04 2000
-uncnsrd
-bin Mail
-phonenum US 914 244 3252
-humannode Uncensored
-lastcontact 952439824 Tue Mar 7 09:37:04 2000
+jacs
+use uncnsrd
+phonenum US6093461224
+gdom NJ
+humannode JACS
+lastcontact 952138912 Fri Mar 3 22:01:52 2000
-internet
-uum %s
-humannode Internet Gateway
-lastcontact 952468623 Tue Mar 7 17:37:03 2000
+rundale
+use uncnsrd
+phonenum US 609 854 9135
+gdom NJ
+humannode Rundale
+lastcontact 952138909 Fri Mar 3 22:01:49 2000
-phonenum netproc[7145]: Adding non-neighbor system <internet> to map
-gdom or system <internet> to map
-humannode BCCS
-lastcontact 952418225 Tue Mar 7 03:37:05 2000
+phonenum netproc[4026]: Adding non-neighbor system <rundale> to map
+gdom or system <rundale> to map
+humannode 'Cat Chat
+lastcontact 952138915 Fri Mar 3 22:01:55 2000
-phonenum US 612 470 9635
-gdom MN
-humannode C-86 Test System
-lastcontact 952375033 Mon Mar 6 15:37:13 2000
+phonenum netproc[4026]: Adding non-neighbor system <catchat> to map
+gdom or system <catchat> to map
+humannode The Future BBS
+lastcontact 952138911 Fri Mar 3 22:01:51 2000
void do_system_configuration(void)
{
char buf[256];
void do_system_configuration(void)
{
char buf[256];
int expire_mode = 0;
int expire_value = 0;
int a;
int expire_mode = 0;
int expire_value = 0;
int a;
if (buf[0] == '1') {
a = 0;
while (serv_gets(buf), strcmp(buf, "000")) {
if (buf[0] == '1') {
a = 0;
while (serv_gets(buf), strcmp(buf, "000")) {
strcpy(&sc[a][0], buf);
++a;
}
strcpy(&sc[a][0], buf);
++a;
}
strprompt("Minimum number of worker threads", &sc[21][0], 3);
strprompt("Maximum number of worker threads", &sc[22][0], 3);
strprompt("Server-to-server networking password", &sc[15][0], 19);
strprompt("Minimum number of worker threads", &sc[21][0], 3);
strprompt("Maximum number of worker threads", &sc[22][0], 3);
strprompt("Server-to-server networking password", &sc[15][0], 19);
+ strprompt("POP3 server port (-1 to disable)", &sc[23][0], 5);
+ strprompt("SMTP server port (-1 to disable)", &sc[24][0], 5);
serv_puts("CONF set");
serv_gets(buf);
if (buf[0] == '4') {
serv_puts("CONF set");
serv_gets(buf);
if (buf[0] == '4') {
- for (a = 0; a < 23; ++a)
+ for (a = 0; a < 25; ++a)
serv_puts(&sc[a][0]);
serv_puts("000");
}
serv_puts(&sc[a][0]);
serv_puts("000");
}
char *Dynamic_Module_Init(void)
{
SYM_POP3 = CtdlGetDynamicSymbol();
char *Dynamic_Module_Init(void)
{
SYM_POP3 = CtdlGetDynamicSymbol();
- CtdlRegisterServiceHook(POP3_PORT,
+ CtdlRegisterServiceHook(config.c_pop3_port,
NULL,
pop3_greeting,
pop3_command_loop);
NULL,
pop3_greeting,
pop3_command_loop);
SYM_SMTP = CtdlGetDynamicSymbol();
SYM_SMTP_RECP = CtdlGetDynamicSymbol();
SYM_SMTP = CtdlGetDynamicSymbol();
SYM_SMTP_RECP = CtdlGetDynamicSymbol();
- CtdlRegisterServiceHook(SMTP_PORT, /* On the net... */
+ CtdlRegisterServiceHook(config.c_smtp_port, /* On the net... */
NULL,
smtp_greeting,
smtp_command_loop);
NULL,
smtp_greeting,
smtp_command_loop);
int internal_pgm; /* authenticated as internal program */
char temp[32]; /* temp file name */
int nologin; /* not allowed to log in */
int internal_pgm; /* authenticated as internal program */
char temp[32]; /* temp file name */
int nologin; /* not allowed to log in */
+ int is_local_socket; /* set to 1 if client is on unix domain sock */
char net_node[32]; /* Is the client another Citadel server? */
int client_socket;
char net_node[32]; /* Is the client another Citadel server? */
int client_socket;
config.c_ep.expire_value = 150;
}
config.c_ep.expire_value = 150;
}
+ /*
+ * Default port numbers for various services
+ */
+ if (config.c_pop3_port == 0) config.c_pop3_port = 110;
+ if (config.c_smtp_port == 0) config.c_smtp_port = 25;
+
/* Go through a series of dialogs prompting for config info */
for (curr = 1; curr <= MAXSETUP; ++curr) {
/* Go through a series of dialogs prompting for config info */
for (curr = 1; curr <= MAXSETUP; ++curr) {
-/*
- * These define what port to listen on for various services.
- * If you don't want to run these services on the network, you can specify
- * a negative port number to create Unix domain sockets. This will allow,
- * for example, the "citmail" utility to connect to the Citadel SMTP server
- * to import email, without having to actually run Citadel SMTP on the network.
- *
- * FIXME ... put this in a programmable config somewhere
- */
-#define POP3_PORT 110
-#define SMTP_PORT 25
-
/*
* SMTP delivery retry and give-up times
* FIXME ... put this in a programmable config somewhere
/*
* SMTP delivery retry and give-up times
* FIXME ... put this in a programmable config somewhere
#define SMTP_GIVE_UP 259200 /* give up after 3 days */
#define SMTP_GIVE_UP 259200 /* give up after 3 days */
-/*
- * Pathname template to use for Unix domain sockets
- */
-#define USOCKPATH "/tmp/citadel%04x"
-
-
/*
* The names of rooms which are automatically created by the system
*/
/*
* The names of rooms which are automatically created by the system
*/
}
/* Next, check to see if it's a new client connecting
}
/* Next, check to see if it's a new client connecting
- * on the master socket.
*/
else for (serviceptr = ServiceHookTable; serviceptr != NULL;
serviceptr = serviceptr->next ) {
*/
else for (serviceptr = ServiceHookTable; serviceptr != NULL;
serviceptr = serviceptr->next ) {
con->client_socket = ssock;
con->h_command_function =
serviceptr->h_command_function;
con->client_socket = ssock;
con->h_command_function =
serviceptr->h_command_function;
+
+ /* Determine whether local socket */
+ if (serviceptr->sockpath != NULL)
+ con->is_local_socket = 1;
/* Set the SO_REUSEADDR socket option */
i = 1;
/* Set the SO_REUSEADDR socket option */
i = 1;