]> arthur.barton.de Git - ngircd-alex.git/commitdiff
ClientHost setting
authorGabor Adam Toth <tg@tgbit.net>
Mon, 14 Feb 2011 15:16:07 +0000 (16:16 +0100)
committerAlexander Barton <alex@barton.de>
Wed, 16 Mar 2011 22:15:50 +0000 (23:15 +0100)
doc/sample-ngircd.conf.tmpl
src/ngircd/client.c
src/ngircd/conf.c
src/ngircd/conf.h

index 58696be469f801684db8fab24690f227e776e767..bb9350160c337ea27aac70cba2852bd5c6d663f2 100644 (file)
@@ -24,6 +24,9 @@
        # (".") and be unique in the IRC network. Required!
        Name = irc.the.net
 
        # (".") and be unique in the IRC network. Required!
        Name = irc.the.net
 
+       # Set this hostname for every client instead of the real one
+       ;ClientHost = irc.the.net
+
        # Info text of the server. This will be shown by WHOIS and
        # LINKS requests for example.
        Info = Server Info Text
        # Info text of the server. This will be shown by WHOIS and
        # LINKS requests for example.
        Info = Server Info Text
index 0bfe73d383d399e3903b78b540c382242e65bdb5..11decc8689584e116b6505a3369f20cbcd59f073 100644 (file)
@@ -319,7 +319,11 @@ Client_SetHostname( CLIENT *Client, const char *Hostname )
        assert( Client != NULL );
        assert( Hostname != NULL );
 
        assert( Client != NULL );
        assert( Hostname != NULL );
 
-       strlcpy( Client->host, Hostname, sizeof( Client->host ));
+       if (strlen(Conf_ClientHost)) {
+               strlcpy( Client->host, Conf_ClientHost, sizeof( Client->host ));
+       } else {
+               strlcpy( Client->host, Hostname, sizeof( Client->host ));
+       }
 } /* Client_SetHostname */
 
 
 } /* Client_SetHostname */
 
 
index 3ff5ddd896bf57ee5016f9e4b7b866217e6afb78..622cb9f8f3667a0c7b983a7f982e28312b37c162 100644 (file)
@@ -295,6 +295,7 @@ Conf_Test( void )
 
        puts( "[GLOBAL]" );
        printf("  Name = %s\n", Conf_ServerName);
 
        puts( "[GLOBAL]" );
        printf("  Name = %s\n", Conf_ServerName);
+       printf("  ClientHost = %s\n", Conf_ClientHost);
        printf("  Info = %s\n", Conf_ServerInfo);
 #ifndef PAM
        printf("  Password = %s\n", Conf_ServerPwd);
        printf("  Info = %s\n", Conf_ServerInfo);
 #ifndef PAM
        printf("  Password = %s\n", Conf_ServerPwd);
@@ -590,6 +591,7 @@ Set_Defaults(bool InitServers)
        int i;
 
        strcpy(Conf_ServerName, "");
        int i;
 
        strcpy(Conf_ServerName, "");
+       strcpy(Conf_ClientHost, "");
        snprintf(Conf_ServerInfo, sizeof Conf_ServerInfo, "%s %s",
                 PACKAGE_NAME, PACKAGE_VERSION);
        strcpy(Conf_ServerPwd, "");
        snprintf(Conf_ServerInfo, sizeof Conf_ServerInfo, "%s %s",
                 PACKAGE_NAME, PACKAGE_VERSION);
        strcpy(Conf_ServerPwd, "");
@@ -970,6 +972,13 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
                        Config_Error_TooLong( Line, Var );
                return;
        }
                        Config_Error_TooLong( Line, Var );
                return;
        }
+       if( strcasecmp( Var, "ClientHost" ) == 0 ) {
+               /* Client hostname */
+               len = strlcpy( Conf_ClientHost, Arg, sizeof( Conf_ClientHost ));
+               if (len >= sizeof( Conf_ClientHost ))
+                       Config_Error_TooLong( Line, Var );
+               return;
+       }
        if( strcasecmp( Var, "Info" ) == 0 ) {
                /* Info text of server */
                len = strlcpy( Conf_ServerInfo, Arg, sizeof( Conf_ServerInfo ));
        if( strcasecmp( Var, "Info" ) == 0 ) {
                /* Info text of server */
                len = strlcpy( Conf_ServerInfo, Arg, sizeof( Conf_ServerInfo ));
index 8c6aea8641194693d90ca0cac3362ecb454abab1..1747139df06055f53a4f5e89407b1adab11a1f6e 100644 (file)
@@ -97,6 +97,9 @@ struct Conf_Channel {
 /** Name (ID, "nick") of this server */
 GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
 
 /** Name (ID, "nick") of this server */
 GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
 
+/** Hostname of the clients */
+GLOBAL char Conf_ClientHost[CLIENT_ID_LEN];
+
 /** Server info text */
 GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
 
 /** Server info text */
 GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];