58 if((f = fopen(pidfile,
"w+")) == NULL) {
59 log_write(r->
log, LOG_ERR,
"couldn't open %s for writing: %s", pidfile, strerror(errno));
63 if(fprintf(f,
"%d", pid) < 0) {
64 log_write(r->
log, LOG_ERR,
"couldn't write to %s: %s", pidfile, strerror(errno));
71 log_write(r->
log, LOG_INFO,
"process id is %d, written to %s", pid, pidfile);
77 char *str, *ip, *mask, *name, *target;
91 if(strcmp(str,
"file") == 0)
93 else if(strcmp(str,
"syslog") == 0)
141 if(str == NULL || strcmp(str,
"deny,allow") != 0)
149 for(i = 0; i < elem->
nvalues; i++)
152 mask =
j_attr((
const char **) elem->
attrs[i],
"mask");
158 mask =
"255.255.255.255";
167 for(i = 0; i < elem->
nvalues; i++)
170 mask =
j_attr((
const char **) elem->
attrs[i],
"mask");
176 mask =
"255.255.255.255";
185 for(i = 0; i < elem->
nvalues; i++) {
186 name =
j_attr((
const char **) elem->
attrs[i],
"name");
187 target =
j_attr((
const char **) elem->
attrs[i],
"target");
189 if(name == NULL || target == NULL)
212 static char buf[1024];
217 strcpy(buf,
"jabberd-router");
241 if(pass == NULL || strcmp(creds->
pass, pass) != 0)
258 if (strcasecmp((
char *)arg,
"DIGEST-MD5")==0)
293 JABBER_MAIN(
"jabberd2router",
"Jabber 2 Router",
"Jabber Open Source Server: Router", NULL)
302 const char *cli_id = 0;
305 time_t pool_time = 0;
309 umask((mode_t) 0027);
314 #ifdef HAVE_WINSOCK2_H
317 WORD wVersionRequested;
321 wVersionRequested = MAKEWORD( 2, 2 );
323 err = WSAStartup( wVersionRequested, &wsaData );
347 config_file = CONFIG_DIR
"/router.xml";
350 while((optchar = getopt(argc, argv,
"Dc:hi:?")) >= 0)
355 config_file = optarg;
361 printf(
"WARN: Debugging not enabled. Ignoring -D.\n");
367 case 'h':
case '?':
default:
369 "router - jabberd router (" VERSION
")\n"
370 "Usage: router <options>\n"
372 " -c <config> config file to use [default: " CONFIG_DIR
"/router.xml]\n"
373 " -i id Override <id> config element\n"
375 " -D Show debug output\n"
387 fputs(
"router: couldn't load config, aborting\n", stderr);
423 log_write(r->
log, LOG_ERR,
"failed to load SSL pemfile, SSL disabled");
430 log_write(r->
log, LOG_ERR,
"failed to initialise SASL context, aborting");
491 if(time(NULL) > pool_time + 60) {
493 pool_time = time(NULL);
524 if (1 > close_wait_max--)
break;
592 #ifdef HAVE_WINSOCK2_H