]> arthur.barton.de Git - ngircd-alex.git/commitdiff
New configuration option "NoticeAuth": send NOTICE AUTH on connect
authorAlexander Barton <alex@barton.de>
Fri, 25 Mar 2011 11:08:36 +0000 (12:08 +0100)
committerAlexander Barton <alex@barton.de>
Fri, 25 Mar 2011 11:15:11 +0000 (12:15 +0100)
When enabling "NoticeAuth" in the [Features] section, ngircd will send
"NOTICE AUTH" messages on client connect like e.g. snircd (QuakeNet) does.

src/ngircd/conf.c
src/ngircd/conf.h
src/ngircd/conn.c

index 32461f3550ffb127332754e44ae0033bfbd73c86..85e42335dabad0ef26bd64daa0eea3930d5b9b7b 100644 (file)
@@ -359,6 +359,7 @@ Conf_Test( void )
        printf("  DNS = %s\n", yesno_to_str(Conf_DNS));
        printf("  Ident = %s\n", yesno_to_str(Conf_Ident));
        printf("  PAM = %s\n", yesno_to_str(Conf_PAM));
+       printf("  NoticeAuth = %s\n", yesno_to_str(Conf_NoticeAuth));
        puts("");
 
        opers_puts();
@@ -614,6 +615,7 @@ Set_Defaults(bool InitServers)
        Conf_PongTimeout = 20;
        Conf_ConnectRetry = 60;
        Conf_DNS = true;
+       Conf_NoticeAuth = false;
 
        Conf_Oper_Count = 0;
        Conf_Channel_Count = 0;
@@ -1278,6 +1280,11 @@ Handle_FEATURES(int Line, char *Var, char *Arg)
                WarnPAM(Line);
                return;
        }
+       if(strcasecmp(Var, "NoticeAuth") == 0) {
+               /* send NOTICE AUTH messages to clients on connect */
+               Conf_NoticeAuth = Check_ArgIsTrue(Arg);
+               return;
+       }
 
        Config_Error(LOG_ERR,
                     "%s, line %d (section \"Features\"): Unknown variable \"%s\"!",
index 305ccaa1ff8c36540253f6283b43266d16fc043f..1633bc998932abea1176bfefc4686f52ed07caf5 100644 (file)
@@ -178,6 +178,9 @@ GLOBAL bool Conf_Ident;
 /** Enable all usage of PAM, even when compiled with support for it */
 GLOBAL bool Conf_PAM;
 
+/** Enable NOTICE AUTH messages on connect */
+GLOBAL bool Conf_NoticeAuth;
+
 /*
  * try to connect to remote systems using the ipv6 protocol,
  * if they have an ipv6 address? (default yes)
index 63093c25f64462b1468cc99bac2e4b7cea22e5a5..9d17a7382ff5283d34e5b0677790df1a5c2071f9 100644 (file)
@@ -1444,9 +1444,20 @@ New_Connection(int Sock)
        if (!Conf_Ident)
                identsock = -1;
 #endif
-       if (Conf_DNS)
+       if (Conf_DNS) {
+               if (Conf_NoticeAuth) {
+#ifdef IDENTAUTH
+                       if (Conf_Ident)
+                               (void)Conn_WriteStr(new_sock,
+                                       "NOTICE AUTH :*** Looking up your hostname and checking ident");
+                       else
+#endif
+                               (void)Conn_WriteStr(new_sock,
+                                       "NOTICE AUTH :*** Looking up your hostname");
+               }
                Resolve_Addr(&My_Connections[new_sock].proc_stat, &new_addr,
                             identsock, cb_Read_Resolver_Result);
+       }
 
        Account_Connection();
        return new_sock;
@@ -2175,13 +2186,22 @@ cb_Read_Resolver_Result( int r_fd, UNUSED short events )
                strlcpy(My_Connections[i].host, readbuf,
                        sizeof(My_Connections[i].host));
                Client_SetHostname(c, readbuf);
+               if (Conf_NoticeAuth)
+                       (void)Conn_WriteStr(i,
+                                       "NOTICE AUTH :*** Found your hostname");
 #ifdef IDENTAUTH
                ++identptr;
                if (*identptr) {
                        Log(LOG_INFO, "IDENT lookup for connection %d: \"%s\".", i, identptr);
                        Client_SetUser(c, identptr, true);
+                       if (Conf_NoticeAuth)
+                               (void)Conn_WriteStr(i,
+                                       "NOTICE AUTH :*** Got ident response");
                } else {
                        Log(LOG_INFO, "IDENT lookup for connection %d: no result.", i);
+                       if (Conf_NoticeAuth && Conf_Ident)
+                               (void)Conn_WriteStr(i,
+                                       "NOTICE AUTH :*** No ident response");
                }
 #endif
        }