mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
authd/provider: add data to rejection tag.
This is used for information such as what blacklist rejected the client.
This commit is contained in:
parent
60374ac975
commit
6535177fef
3 changed files with 10 additions and 7 deletions
|
@ -115,7 +115,7 @@ destroy_providers(void)
|
|||
RB_DICTIONARY_FOREACH(auth, &iter, auth_clients)
|
||||
{
|
||||
/* TBD - is this the right thing? */
|
||||
reject_client(auth, 0, "Authentication system is down... try reconnecting in a few seconds");
|
||||
reject_client(auth, -1, "destroy", "Authentication system is down... try reconnecting in a few seconds");
|
||||
}
|
||||
|
||||
RB_DLINK_FOREACH(ptr, auth_providers.head)
|
||||
|
@ -161,7 +161,7 @@ provider_done(struct auth_client *auth, provider_t id)
|
|||
{
|
||||
if(!auth->providers_starting)
|
||||
/* Only do this when there are no providers left */
|
||||
accept_client(auth, 0);
|
||||
accept_client(auth, -1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ provider_done(struct auth_client *auth, provider_t id)
|
|||
|
||||
/* Reject a client - WARNING: do not use auth instance after calling! */
|
||||
void
|
||||
reject_client(struct auth_client *auth, provider_t id, const char *reason)
|
||||
reject_client(struct auth_client *auth, provider_t id, const char *data, const char *reason)
|
||||
{
|
||||
char reject;
|
||||
|
||||
|
@ -197,11 +197,14 @@ reject_client(struct auth_client *auth, provider_t id, const char *reason)
|
|||
break;
|
||||
}
|
||||
|
||||
if(data == NULL)
|
||||
data = "*";
|
||||
|
||||
/* We send back username and hostname in case ircd wants to overrule our decision.
|
||||
* In the future this may not be the case.
|
||||
* --Elizafox
|
||||
*/
|
||||
rb_helper_write(authd_helper, "R %x %c %s %s :%s", auth->cid, reject, auth->username, auth->hostname, reason);
|
||||
rb_helper_write(authd_helper, "R %x %c %s %s %s :%s", auth->cid, reject, auth->username, auth->hostname, data, reason);
|
||||
|
||||
set_provider_off(auth, id);
|
||||
cancel_providers(auth);
|
||||
|
@ -285,7 +288,7 @@ start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_
|
|||
|
||||
/* If no providers are running, accept the client */
|
||||
if(!auth->providers)
|
||||
accept_client(auth, 0);
|
||||
accept_client(auth, -1);
|
||||
}
|
||||
|
||||
/* Callback for the initiation */
|
||||
|
|
|
@ -97,7 +97,7 @@ void cancel_providers(struct auth_client *auth);
|
|||
|
||||
void provider_done(struct auth_client *auth, provider_t id);
|
||||
void accept_client(struct auth_client *auth, provider_t id);
|
||||
void reject_client(struct auth_client *auth, provider_t id, const char *reason);
|
||||
void reject_client(struct auth_client *auth, provider_t id, const char *data, const char *reason);
|
||||
|
||||
void handle_new_connection(int parc, char *parv[]);
|
||||
void handle_cancel_connection(int parc, char *parv[]);
|
||||
|
|
|
@ -246,7 +246,7 @@ blacklist_dns_callback(const char *result, bool status, query_type type, void *d
|
|||
{
|
||||
/* Match found, so proceed no further */
|
||||
blacklists_cancel(auth);
|
||||
reject_client(auth, PROVIDER_BLACKLIST, bl->reason);
|
||||
reject_client(auth, PROVIDER_BLACKLIST, bl->host, bl->reason);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue