0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 08:24:08 +01:00

authd/provider: make reject_client take a format string and varargs

This commit is contained in:
Elizabeth Myers 2016-03-30 01:29:21 -05:00
parent 3257f9d6af
commit 64afc35817
2 changed files with 9 additions and 3 deletions

View file

@ -184,9 +184,11 @@ 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 *data, const char *reason)
reject_client(struct auth_client *auth, provider_t id, const char *data, const char *fmt, ...)
{
char reject;
char buf[BUFSIZE];
va_list args;
switch(id)
{
@ -207,11 +209,15 @@ reject_client(struct auth_client *auth, provider_t id, const char *data, const c
if(data == NULL)
data = "*";
va_begin(fmt, args);
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
/* 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 :%s", auth->cid, reject, auth->username, auth->hostname, data, reason);
rb_helper_write(authd_helper, "R %x %c %s %s %s :%s", auth->cid, reject, auth->username, auth->hostname, data, buf);
set_provider_off(auth, id);
cancel_providers(auth);

View file

@ -105,7 +105,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 *data, const char *reason);
void reject_client(struct auth_client *auth, provider_t id, const char *data, const char *fmt, ...);
void handle_new_connection(int parc, char *parv[]);
void handle_cancel_connection(int parc, char *parv[]);