]> jfr.im git - solanum.git/commitdiff
authd/provider: make reject_client take a format string and varargs
authorElizabeth Myers <redacted>
Wed, 30 Mar 2016 06:29:21 +0000 (01:29 -0500)
committerElizabeth Myers <redacted>
Wed, 30 Mar 2016 06:29:21 +0000 (01:29 -0500)
authd/provider.c
authd/provider.h

index f4a0cb5ee8dbfb97aeb4317599ddbfa31fc0ba69..302eebb366ffecc5e75755b88b65c84889b69b3b 100644 (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);
index c5462c9318e58e4deb41fef26724bf420159937d..8ab21ad8bb6545d738d239c4409e9c92cfe20941 100644 (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[]);