]> jfr.im git - solanum.git/blobdiff - authd/providers/ident.c
authd: Cleanup
[solanum.git] / authd / providers / ident.c
index f69a63a91afa82a5f198e92d4ece6091c40e1142..357bc74de69ce91ef320e2be83186f798e474d4e 100644 (file)
@@ -46,6 +46,7 @@ static const char *messages[] =
        "*** Got Ident response",
        "*** No Ident response",
        "*** Cannot verify ident validity, ignoring ident",
+       "*** Ident disabled, not checking ident",
 };
 
 typedef enum
@@ -54,6 +55,7 @@ typedef enum
        REPORT_FOUND,
        REPORT_FAIL,
        REPORT_INVALID,
+       REPORT_DISABLED,
 } ident_message;
 
 static EVH timeout_ident_queries_event;
@@ -66,6 +68,7 @@ static char * get_valid_ident(char *buf);
 
 static struct ev_entry *timeout_ev;
 static int ident_timeout = 5;
+static bool ident_enable = true;
 
 
 /* Timeout outstanding queries */
@@ -320,6 +323,18 @@ static bool ident_start(struct auth_client *auth)
        struct rb_sockaddr_storage l_addr, c_addr;
        int family = GET_SS_FAMILY(&auth->c_addr);
 
+       if(auth->data[PROVIDER_IDENT] != NULL)
+       {
+               set_provider_done(auth, PROVIDER_IDENT); /* for blacklists */
+               return true;
+       }
+       else if(!ident_enable)
+       {
+               notice_client(auth->cid, messages[REPORT_DISABLED]);
+               set_provider_done(auth, PROVIDER_IDENT);
+               return true;
+       }
+
        notice_client(auth->cid, messages[REPORT_LOOKUP]);
 
        auth->data[PROVIDER_IDENT] = query;
@@ -384,9 +399,16 @@ add_conf_ident_timeout(const char *key __unused, int parc __unused, const char *
        ident_timeout = timeout;
 }
 
+static void
+set_ident_enabled(const char *key __unused, int parc __unused, const char **parv)
+{
+       ident_enable = (*parv[0] == '1');
+}
+
 struct auth_opts_handler ident_options[] =
 {
        { "ident_timeout", 1, add_conf_ident_timeout },
+       { "ident_enabled", 1, set_ident_enabled },
        { NULL, 0, NULL },
 };