$Log$
+ Revision 572.2 2000/06/02 03:38:50 ajc
+ * Bind unix socket prior to TCP socket for citadel protocol
+ * Fixed bug in sendcommand.c which was causing it to crash on attach
+
Revision 572.1 2000/05/26 19:27:51 ajc
* Changed some of the rev-level sensitive stuff to look at the actual version
of Citadel running, not the last version with which we ran setup
Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Initial CVS import
-
struct sockaddr_un addr;
int s;
+
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, sockpath, sizeof addr.sun_path);
void np_attach_to_server(void)
{
char buf[256];
- char portname[8];
char *args[] =
{ "netproc", NULL };
syslog(LOG_NOTICE, "Attaching to server...");
- sprintf(portname, "%d", config.c_port_number);
- args[2] = portname;
attach_to_server(1, args, NULL, NULL);
serv_gets(buf);
syslog(LOG_NOTICE, "%s", &buf[4]);
#include "ipc.h"
#include "config.h"
-#define LOCKFILE "/var/lock/LCK.sendcommand"
+#define LOCKFILE "/tmp/LCK.sendcommand"
struct config config;
extern int home_specified;
void np_attach_to_server(void) {
char hostbuf[256], portbuf[256];
char buf[256];
- char portname[8];
- char *args[] = { "sendcommand", NULL, NULL, NULL } ;
+ char *args[] = { "sendcommand", NULL } ;
fprintf(stderr, "Attaching to server...\n");
- sprintf(portname, "%d", config.c_port_number);
- args[2] = portname;
- attach_to_server(3, args, hostbuf, portbuf);
+ attach_to_server(1, args, hostbuf, portbuf);
serv_gets(buf);
fprintf(stderr, "%s\n",&buf[4]);
sprintf(buf,"IPGM %d", config.c_ipgm_secret);
/*
* Bind the server to our favorite ports.
*/
- CtdlRegisterServiceHook(config.c_port_number, /* TCP */
- NULL,
- citproto_begin_session,
- do_command_loop);
CtdlRegisterServiceHook(0, /* Unix */
"citadel.socket",
citproto_begin_session,
do_command_loop);
+ CtdlRegisterServiceHook(config.c_port_number, /* TCP */
+ NULL,
+ citproto_begin_session,
+ do_command_loop);
/*
* Load any server-side modules (plugins) available here.
for (serviceptr = ServiceHookTable; serviceptr != NULL;
serviceptr = serviceptr->next ) {
+ lprintf(9, "Will listen on master socket %d\n",
+ serviceptr->msock);
FD_SET(serviceptr->msock, &masterfds);
if (serviceptr->msock > masterhighest) {
masterhighest = serviceptr->msock;
*/
if (getenv("REQUEST_METHOD") != NULL) www = 1;
- attach_to_server(argc,argv, hostbuf, portbuf);
+ attach_to_server(argc, argv, hostbuf, portbuf);
serv_gets(buf);
if ((buf[0]!='2')&&(strncmp(buf,"551",3))) {
fprintf(stderr,"%s: %s\n",argv[0],&buf[4]);