mirror of
https://github.com/matrix-construct/construct
synced 2024-12-30 17:34:04 +01:00
authd/provider: make reject_client take a format string and varargs
This commit is contained in:
parent
3257f9d6af
commit
64afc35817
2 changed files with 9 additions and 3 deletions
|
@ -184,9 +184,11 @@ provider_done(struct auth_client *auth, provider_t id)
|
||||||
|
|
||||||
/* Reject a client - WARNING: do not use auth instance after calling! */
|
/* Reject a client - WARNING: do not use auth instance after calling! */
|
||||||
void
|
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 reject;
|
||||||
|
char buf[BUFSIZE];
|
||||||
|
va_list args;
|
||||||
|
|
||||||
switch(id)
|
switch(id)
|
||||||
{
|
{
|
||||||
|
@ -207,11 +209,15 @@ reject_client(struct auth_client *auth, provider_t id, const char *data, const c
|
||||||
if(data == NULL)
|
if(data == NULL)
|
||||||
data = "*";
|
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.
|
/* We send back username and hostname in case ircd wants to overrule our decision.
|
||||||
* In the future this may not be the case.
|
* In the future this may not be the case.
|
||||||
* --Elizafox
|
* --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);
|
set_provider_off(auth, id);
|
||||||
cancel_providers(auth);
|
cancel_providers(auth);
|
||||||
|
|
|
@ -105,7 +105,7 @@ void cancel_providers(struct auth_client *auth);
|
||||||
|
|
||||||
void provider_done(struct auth_client *auth, provider_t id);
|
void provider_done(struct auth_client *auth, provider_t id);
|
||||||
void accept_client(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_new_connection(int parc, char *parv[]);
|
||||||
void handle_cancel_connection(int parc, char *parv[]);
|
void handle_cancel_connection(int parc, char *parv[]);
|
||||||
|
|
Loading…
Reference in a new issue