ConfigFileEntry.dpath, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR, suffix);
if(access(fullpath, X_OK) == -1)
{
- ilog(L_MAIN,
- "Unable to execute authd in %s or %s/bin",
- ircd_paths[IRCD_PATH_LIBEXEC], ConfigFileEntry.dpath);
+ ierror("Unable to execute authd in %s or %s/bin",
+ ircd_paths[IRCD_PATH_LIBEXEC], ConfigFileEntry.dpath);
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Unable to execute authd in %s or %s/bin",
ircd_paths[IRCD_PATH_LIBEXEC], ConfigFileEntry.dpath);
if(authd_helper == NULL)
{
- ilog(L_MAIN, "Unable to start authd helper: %s", strerror(errno));
+ ierror("Unable to start authd helper: %s", strerror(errno));
sendto_realops_snomask(SNO_GENERAL, L_ALL, "Unable to start authd helper: %s", strerror(errno));
return 1;
}
case 'E': /* DNS Result */
if(parc != 5)
{
- ilog(L_MAIN, "authd sent a result with wrong number of arguments: got %d", parc);
+ iwarn("authd sent a result with wrong number of arguments: got %d", parc);
restart_authd();
return;
}
case 'W': /* Oper warning */
if(parc != 3)
{
- ilog(L_MAIN, "authd sent a result with wrong number of arguments: got %d", parc);
+ iwarn("authd sent a result with wrong number of arguments: got %d", parc);
restart_authd();
return;
}
{
case 'D': /* Debug */
sendto_realops_snomask(SNO_DEBUG, L_ALL, "authd debug: %s", parv[3]);
+ idebug("authd: %s", parv[3]);
break;
case 'I': /* Info */
sendto_realops_snomask(SNO_GENERAL, L_ALL, "authd info: %s", parv[3]);
- inotice("authd info: %s", parv[3]);
+ inotice("authd: %s", parv[3]);
break;
case 'W': /* Warning */
sendto_realops_snomask(SNO_GENERAL, L_ALL, "authd WARNING: %s", parv[3]);
- iwarn("authd warning: %s", parv[3]);
+ iwarn("authd: %s", parv[3]);
break;
case 'C': /* Critical (error) */
sendto_realops_snomask(SNO_GENERAL, L_ALL, "authd CRITICAL: %s", parv[3]);
- ierror("authd critical: %s", parv[3]);
+ ierror("authd: %s", parv[3]);
break;
default: /* idk */
sendto_realops_snomask(SNO_GENERAL, L_ALL, "authd sent us an unknown oper notice type (%s): %s", parv[2], parv[3]);
case 'Z': /* End of stats reply */
if(parc < 3)
{
- ilog(L_MAIN, "authd sent a result with wrong number of arguments: got %d", parc);
+ iwarn("authd sent a result with wrong number of arguments: got %d", parc);
restart_authd();
return;
}
/* parv[0] conveys status */
if(parc < 4)
{
- ilog(L_MAIN, "authd sent a result with wrong number of arguments: got %d", parc);
+ iwarn("authd sent a result with wrong number of arguments: got %d", parc);
restart_authd();
return;
}
{
if(start_authd())
{
- ilog(L_MAIN, "Unable to start authd helper: %s", strerror(errno));
+ ierror("Unable to start authd helper: %s", strerror(errno));
exit(0);
}
}
static void
restart_authd_cb(rb_helper * helper)
{
- ilog(L_MAIN, "authd: restart_authd_cb called, authd died?");
+ rb_dictionary_iter iter;
+ struct Client *client_p;
+
+ iwarn("authd: restart_authd_cb called, authd died?");
sendto_realops_snomask(SNO_GENERAL, L_ALL, "authd: restart_authd_cb called, authd died?");
+
if(helper != NULL)
{
rb_helper_close(helper);
authd_helper = NULL;
}
+
+ RB_DICTIONARY_FOREACH(client_p, &iter, cid_clients)
+ {
+ /* Abort any existing clients */
+ authd_abort_client(client_p);
+ }
+
start_authd();
}
rb_inet_ntop_sock((struct sockaddr *)&client_p->localClient->ip, client_ipaddr, sizeof(client_ipaddr));
/* Retrieve listener and client ports */
-#ifdef RB_IPV6
- if(GET_SS_FAMILY(&client_p->preClient->lip) == AF_INET6)
- listen_port = ntohs(((struct sockaddr_in6 *)&client_p->preClient->lip)->sin6_port);
- else
-#endif
- listen_port = ntohs(((struct sockaddr_in *)&client_p->preClient->lip)->sin_port);
-
-#ifdef RB_IPV6
- if(GET_SS_FAMILY(&client_p->localClient->ip) == AF_INET6)
- client_port = ntohs(((struct sockaddr_in6 *)&client_p->localClient->ip)->sin6_port);
- else
-#endif
- client_port = ntohs(((struct sockaddr_in *)&client_p->localClient->ip)->sin_port);
+ listen_port = ntohs(GET_SS_PORT(&client_p->preClient->lip));
+ client_port = ntohs(GET_SS_PORT(&client_p->localClient->ip));
/* Add a bit of a fudge factor... */
- client_p->preClient->authd_timeout = rb_current_time() + ConfigFileEntry.connect_timeout + 5;
+ client_p->preClient->authd_timeout = rb_current_time() + ConfigFileEntry.connect_timeout + 10;
rb_helper_write(authd_helper, "C %x %s %hu %s %hu", authd_cid, listen_ipaddr, listen_port, client_ipaddr, client_port);
}
void
authd_abort_client(struct Client *client_p)
{
- if(client_p->preClient == NULL)
+ if(client_p == NULL || client_p->preClient == NULL)
return;
if(client_p->preClient->authd_cid == 0)
rb_dictionary_delete(cid_clients, RB_UINT_TO_POINTER(client_p->preClient->authd_cid));
- rb_helper_write(authd_helper, "E %x", client_p->preClient->authd_cid);
+ if(authd_helper != NULL)
+ rb_helper_write(authd_helper, "E %x", client_p->preClient->authd_cid);
+
+ /* XXX should we blindly allow like this? */
+ authd_decide_client(client_p, parv[2], parv[3], true, '\0', NULL, NULL);
+
client_p->preClient->authd_cid = 0;
}
timeout_dead_authd_clients(void *notused __unused)
{
rb_dictionary_iter iter;
- char *id;
+ struct Client *client_p;
- RB_DICTIONARY_FOREACH(id, &iter, cid_clients)
+ RB_DICTIONARY_FOREACH(client_p, &iter, cid_clients)
{
- struct Client *client_p;
-
if(client_p->preClient->authd_timeout < rb_current_time())
- {
- rb_helper_write(authd_helper, "E %x", client_p->preClient->authd_cid);
- rb_free(id);
- rb_dictionary_delete(cid_clients, RB_UINT_TO_POINTER(client_p->preClient->authd_cid));
- }
+ authd_abort_client(client_p);
}
}