static void
restart_authd_cb(rb_helper * helper)
{
+ 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();
}
if(*ident != '*')
{
rb_strlcpy(client_p->username, ident, sizeof(client_p->username));
- ServerStats.is_abad++; /* s_auth used to do this, stay compatible */
+ ServerStats.is_asuc++;
}
else
- ServerStats.is_asuc++;
+ ServerStats.is_abad++; /* s_auth used to do this, stay compatible */
if(*host != '*')
rb_strlcpy(client_p->host, host, sizeof(client_p->host));
client_p->preClient->authd_reason = (reason == NULL ? NULL : rb_strdup(reason));
rb_dictionary_delete(cid_clients, RB_UINT_TO_POINTER(client_p->preClient->authd_cid));
-
client_p->preClient->authd_cid = 0;
/*
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, "*", "*", true, '\0', NULL, NULL);
+
client_p->preClient->authd_cid = 0;
}
RB_DICTIONARY_FOREACH(client_p, &iter, cid_clients)
{
if(client_p->preClient->authd_timeout < rb_current_time())
- {
- rb_helper_write(authd_helper, "E %x", client_p->preClient->authd_cid);
- rb_dictionary_delete(cid_clients, RB_UINT_TO_POINTER(client_p->preClient->authd_cid));
- }
+ authd_abort_client(client_p);
}
}
}
/* Adjust an authd timeout value */
-void
+bool
set_authd_timeout(const char *key, int timeout)
{
+ if(timeout <= 0)
+ return false;
+
rb_helper_write(authd_helper, "O %s %d", key, timeout);
+ return true;
}
+/* Enable identd checks */
void
ident_check_enable(bool enabled)
{
rb_helper_write(authd_helper, "O ident_enabled %d", enabled ? 1 : 0);
}
+
+/* Create an OPM listener */
+bool
+create_opm_listener(struct rb_sockaddr_storage *addr)
+{
+ char addrbuf[HOSTIPLEN];
+
+ if(!rb_inet_ntop_sock((struct sockaddr *)addr, addrbuf, sizeof(addrbuf)))
+ return false;
+
+ if(addrbuf[0] == ':')
+ {
+ /* Reformat for authd sending */
+ memmove(addrbuf + 1, addrbuf, sizeof(addrbuf) - 1);
+ addrbuf[0] = '0';
+ }
+
+ rb_helper_write(authd_helper, "O opm_listener %s %hu", addrbuf, ntohs(GET_SS_PORT(addr)));
+ return true;
+}