]> jfr.im git - solanum.git/blobdiff - authd/provider.c
callerid: actually the guard should be for source_p
[solanum.git] / authd / provider.c
index aabfa119e4134143deada922c66e791dedb1e94b..2d196732d217c3597d5a2525fac199af46e8d599 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 /* The basic design here is to have "authentication providers" that do things
- * like query ident and blacklists and even open proxies.
+ * like query ident and DNSBLs and even open proxies.
  *
  * Providers are registered in the auth_providers linked list. It is planned to
  * use a bitmap to store provider ID's later.
@@ -93,10 +93,10 @@ init_providers(void)
        timeout_ev = rb_event_addish("provider_timeout_event", provider_timeout_event, NULL, 1);
 
        /* FIXME must be started before rdns/ident to receive completion notification from them */
-       load_provider(&blacklist_provider);
+       load_provider(&dnsbl_provider);
        load_provider(&opm_provider);
 
-       /* FIXME must be started after blacklist/opm in case of early completion notifications */
+       /* FIXME must be started after dnsbl/opm in case of early completion notifications */
        load_provider(&rdns_provider);
        load_provider(&ident_provider);
 }
@@ -294,7 +294,7 @@ accept_client(struct auth_client *auth)
 
 /* Begin authenticating user */
 static void
-start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_ip, const char *c_port)
+start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_ip, const char *c_port, const char *protocol)
 {
        struct auth_client *auth;
        unsigned long long lcid = strtoull(cid, NULL, 16);
@@ -315,14 +315,16 @@ start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_
                exit(EX_PROVIDER_ERROR);
        }
 
+       auth->protocol = strtoull(protocol, NULL, 16);
+
        rb_strlcpy(auth->l_ip, l_ip, sizeof(auth->l_ip));
        auth->l_port = (uint16_t)atoi(l_port);  /* should be safe */
-       (void) rb_inet_pton_sock(l_ip, (struct sockaddr *)&auth->l_addr);
+       (void) rb_inet_pton_sock(l_ip, &auth->l_addr);
        SET_SS_PORT(&auth->l_addr, htons(auth->l_port));
 
        rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip));
        auth->c_port = (uint16_t)atoi(c_port);
-       (void) rb_inet_pton_sock(c_ip, (struct sockaddr *)&auth->c_addr);
+       (void) rb_inet_pton_sock(c_ip, &auth->c_addr);
        SET_SS_PORT(&auth->c_addr, htons(auth->c_port));
 
        rb_strlcpy(auth->hostname, "*", sizeof(auth->hostname));
@@ -362,13 +364,12 @@ done:
 void
 handle_new_connection(int parc, char *parv[])
 {
-       if(parc < 6)
-       {
+       if (parc < 6) {
                warn_opers(L_CRIT, "provider: received too few params for new connection (6 expected, got %d)", parc);
                exit(EX_PROVIDER_ERROR);
        }
 
-       start_auth(parv[1], parv[2], parv[3], parv[4], parv[5]);
+       start_auth(parv[1], parv[2], parv[3], parv[4], parv[5], parc > 6 ? parv[6] : "0");
 }
 
 void