1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-10-28 04:46:17 +00:00

Merge branch 'NoticeAuth'

* NoticeAuth:
  Add documentation for "NoticeAuth" configuration option
  Configuration: move "NoticeAuth" to GLOBAL section
  New configuration option "NoticeAuth": send NOTICE AUTH on connect
This commit is contained in:
Alexander Barton 2011-03-27 20:56:50 +02:00
commit cf7e3b1c02
5 changed files with 41 additions and 1 deletions

View File

@ -154,6 +154,11 @@
# maximum nick name length! # maximum nick name length!
;MaxNickLength = 9 ;MaxNickLength = 9
# Normally ngIRCd doesn't send any messages to a client until it is
# registered. Enable this option to let the daemon send "NOTICE AUTH"
# messages to clients while connecting.
;NoticeAuth = no
# Set this hostname for every client instead of the real one. # Set this hostname for every client instead of the real one.
# Please note: don't use the percentage sign ("%"), it is reserved for # Please note: don't use the percentage sign ("%"), it is reserved for
# future extensions! # future extensions!

View File

@ -251,6 +251,11 @@ Maximum length of an user nick name (Default: 9, as in RFC 2812). Please
note that all servers in an IRC network MUST use the same maximum nick name note that all servers in an IRC network MUST use the same maximum nick name
length! length!
.TP .TP
\fBNoticeAuth\fR (boolean)
Normally ngIRCd doesn't send any messages to a client until it is registered.
Enable this option to let the daemon send "NOTICE AUTH" messages to clients
while connecting. Default: no.
.TP
\fBCloakHost\fR (string) \fBCloakHost\fR (string)
Set this hostname for every client instead of the real one. Default: empty, Set this hostname for every client instead of the real one. Default: empty,
don't change. don't change.

View File

@ -352,6 +352,7 @@ Conf_Test( void )
printf(" MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP); printf(" MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP);
printf(" MaxJoins = %d\n", Conf_MaxJoins > 0 ? Conf_MaxJoins : -1); printf(" MaxJoins = %d\n", Conf_MaxJoins > 0 ? Conf_MaxJoins : -1);
printf(" MaxNickLength = %u\n", Conf_MaxNickLength - 1); printf(" MaxNickLength = %u\n", Conf_MaxNickLength - 1);
printf(" NoticeAuth = %s\n", yesno_to_str(Conf_NoticeAuth));
printf(" CloakHost = %s\n", Conf_CloakHost); printf(" CloakHost = %s\n", Conf_CloakHost);
printf(" CloakUserToNick = %s\n\n", yesno_to_str(Conf_CloakUserToNick)); printf(" CloakUserToNick = %s\n\n", yesno_to_str(Conf_CloakUserToNick));
@ -614,6 +615,7 @@ Set_Defaults(bool InitServers)
Conf_PongTimeout = 20; Conf_PongTimeout = 20;
Conf_ConnectRetry = 60; Conf_ConnectRetry = 60;
Conf_DNS = true; Conf_DNS = true;
Conf_NoticeAuth = false;
Conf_Oper_Count = 0; Conf_Oper_Count = 0;
Conf_Channel_Count = 0; Conf_Channel_Count = 0;
@ -1192,6 +1194,11 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
Conf_MaxNickLength = Handle_MaxNickLength(Line, Arg); Conf_MaxNickLength = Handle_MaxNickLength(Line, Arg);
return; return;
} }
if(strcasecmp(Var, "NoticeAuth") == 0) {
/* send NOTICE AUTH messages to clients on connect */
Conf_NoticeAuth = Check_ArgIsTrue(Arg);
return;
}
if( strcasecmp( Var, "Listen" ) == 0 ) { if( strcasecmp( Var, "Listen" ) == 0 ) {
/* IP-Address to bind sockets */ /* IP-Address to bind sockets */

View File

@ -178,6 +178,9 @@ GLOBAL bool Conf_Ident;
/** Enable all usage of PAM, even when compiled with support for it */ /** Enable all usage of PAM, even when compiled with support for it */
GLOBAL bool Conf_PAM; GLOBAL bool Conf_PAM;
/** Enable NOTICE AUTH messages on connect */
GLOBAL bool Conf_NoticeAuth;
/* /*
* try to connect to remote systems using the ipv6 protocol, * try to connect to remote systems using the ipv6 protocol,
* if they have an ipv6 address? (default yes) * if they have an ipv6 address? (default yes)

View File

@ -1444,9 +1444,20 @@ New_Connection(int Sock)
if (!Conf_Ident) if (!Conf_Ident)
identsock = -1; identsock = -1;
#endif #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, Resolve_Addr(&My_Connections[new_sock].proc_stat, &new_addr,
identsock, cb_Read_Resolver_Result); identsock, cb_Read_Resolver_Result);
}
Account_Connection(); Account_Connection();
return new_sock; return new_sock;
@ -2175,13 +2186,22 @@ cb_Read_Resolver_Result( int r_fd, UNUSED short events )
strlcpy(My_Connections[i].host, readbuf, strlcpy(My_Connections[i].host, readbuf,
sizeof(My_Connections[i].host)); sizeof(My_Connections[i].host));
Client_SetHostname(c, readbuf); Client_SetHostname(c, readbuf);
if (Conf_NoticeAuth)
(void)Conn_WriteStr(i,
"NOTICE AUTH :*** Found your hostname");
#ifdef IDENTAUTH #ifdef IDENTAUTH
++identptr; ++identptr;
if (*identptr) { if (*identptr) {
Log(LOG_INFO, "IDENT lookup for connection %d: \"%s\".", i, identptr); Log(LOG_INFO, "IDENT lookup for connection %d: \"%s\".", i, identptr);
Client_SetUser(c, identptr, true); Client_SetUser(c, identptr, true);
if (Conf_NoticeAuth)
(void)Conn_WriteStr(i,
"NOTICE AUTH :*** Got ident response");
} else { } else {
Log(LOG_INFO, "IDENT lookup for connection %d: no result.", i); 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 #endif
} }