]> jfr.im git - solanum.git/commitdiff
auth: enable soft reject of clients.
authorElizabeth Myers <redacted>
Thu, 10 Mar 2016 17:30:09 +0000 (11:30 -0600)
committerElizabeth Myers <redacted>
Thu, 10 Mar 2016 17:30:09 +0000 (11:30 -0600)
This doesn't cancel callbacks in progress. This is useful in cases where
you're not sure you want to reject a client yet.

authd/provider.c
authd/provider.h

index 97a2e882c18fefe32c25e8a5ad854cd433874515..bd46f53cdd06268cba2ff09d048db3b7a732cfa5 100644 (file)
@@ -83,7 +83,7 @@ void destroy_providers(void)
                {
                        /* TBD - is this the right thing?
                         * (NOTE - this error message is designed for morons) */
-                       reject_client(&auth_clients[i], 0,
+                       reject_client(&auth_clients[i], 0, true,
                                        "IRC server reloading... try reconnecting in a few seconds");
                }
        }
@@ -138,8 +138,8 @@ void provider_done(struct auth_client *auth, provider_t id)
        }
 }
 
-/* Reject a client, cancel outstanding providers if any */
-void reject_client(struct auth_client *auth, provider_t id, const char *reason)
+/* Reject a client, cancel outstanding providers if any if hard set to true */
+void reject_client(struct auth_client *auth, provider_t id, bool hard, const char *reason)
 {
        uint16_t cid = auth->cid;
        char reject;
@@ -165,10 +165,11 @@ void reject_client(struct auth_client *auth, provider_t id, const char *reason)
 
        unset_provider(auth, id);
 
-       if(auth->providers)
+       if(hard && auth->providers)
+       {
                cancel_providers(auth);
-
-       memset(&auth_clients[cid], 0, sizeof(struct auth_client));
+               memset(&auth_clients[cid], 0, sizeof(struct auth_client));
+       }
 }
 
 /* Accept a client, cancel outstanding providers if any */
index 494e33289ee47c1b8f475f39a95f6c77db3ba54b..4f3c57a90f14ae34e495340c3278229c0a1edf0f 100644 (file)
@@ -82,9 +82,9 @@ void init_providers(void);
 void destroy_providers(void);
 void cancel_providers(struct auth_client *auth);
 
-void provider_done(struct auth_client *auth, provider_t provider);
-void reject_client(struct auth_client *auth, provider_t provider, const char *reason);
-void accept_client(struct auth_client *auth, provider_t provider);
+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, bool hard, const char *reason);
 
 void notice_client(struct auth_client *auth, const char *notice);