and automatically changes whenever an IPGM command is executed.
* Upon an IPGM authentication failure, wait 5 seconds before displaying an
error, then disconnect the session.
$Log$
+ Revision 607.21 2003/07/14 03:07:05 ajc
+ * ipgm_secret is no longer set during setup. Now it is set at server startup
+ and automatically changes whenever an IPGM command is executed.
+ * Upon an IPGM authentication failure, wait 5 seconds before displaying an
+ error, then disconnect the session.
+
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
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
{
int secret;
+ secret = extract_int(argbuf, 0);
+
/* 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) {
+ else if (secret == config.c_ipgm_secret) {
CC->internal_pgm = 1;
strcpy(CC->curr_user, "<internal program>");
CC->cs_flags = CC->cs_flags|CS_STEALTH;
cprintf("%d Authenticated as an internal program.\n",CIT_OK);
}
else {
+ sleep(5);
cprintf("%d Authentication failed.\n",ERROR);
lprintf(3, "Warning: ipgm authentication failed.\n");
+ CC->kill_me = 1;
}
+
+ /* Now change the ipgm secret for the next round. */
+ get_config();
+ config.c_ipgm_secret = rand();
+ put_config();
}
cprintf("%d\n", config.c_maxsessions);
cprintf("%s\n", config.c_net_password);
cprintf("%d\n", config.c_port_number);
- cprintf("%d\n", config.c_ipgm_secret);
cprintf("%d\n", config.c_ep.expire_mode);
cprintf("%d\n", config.c_ep.expire_value);
cprintf("%d\n", config.c_userpurge);
client_gets(buf); config.c_maxsessions = atoi(buf);
client_gets(config.c_net_password);
client_gets(buf); config.c_port_number = atoi(buf);
- client_gets(buf); config.c_ipgm_secret = atoi(buf);
client_gets(buf); config.c_ep.expire_mode = atoi(buf);
client_gets(buf); config.c_ep.expire_value = atoi(buf);
client_gets(buf); config.c_userpurge = atoi(buf);
init_sysdep();
openlog("citserver", LOG_PID, LOG_USER);
- /* Load site-specific parameters */
+ /* Load site-specific parameters, and set the ipgm secret */
lprintf(7, "Loading citadel.config\n");
get_config();
-
+ srand(getpid());
+ config.c_ipgm_secret = rand();
+ put_config();
/*
* Do non system dependent startup functions.
if (config.c_port_number == 0) {
config.c_port_number = 504;
}
- if (config.c_ipgm_secret == 0) {
- srand(getpid());
- config.c_ipgm_secret = rand();
- }
if (config.c_sleeping == 0) {
config.c_sleeping = 900;
}