From a988bbc86aed404b7bcfdbceafc030ea4bc5ecab Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Mon, 11 Oct 2010 16:54:49 +0200 Subject: [PATCH] New configuration option "NoZeroConf" to disable ZeroConf registration If ngIRCd is compiled to register its services using ZeroConf (e.g. using Howl, Avahi or on Mac OS X) this parameter can be used to disable service registration at runtime. --- ChangeLog | 3 +++ NEWS | 3 +++ doc/sample-ngircd.conf | 4 ++++ man/ngircd.conf.5.tmpl | 6 ++++++ src/ngircd/conf.c | 7 +++++++ src/ngircd/conf.h | 3 +++ src/ngircd/rendezvous.c | 8 ++++++-- 7 files changed, 32 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4402f068..de87b29f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,9 @@ ngIRCd Release 17 + - New configuration option "NoZeroConf" to disable service registration at + runtime even if ngIRCd is compiled with support for ZeroConf (e.g. using + Howl, Avahi or on Mac OS X). - New configuration option "SyslogFacility" to define the syslog "facility" (the "target"), to which ngIRCd should send its log messages. Possible values are system dependant, but most probably "auth", "daemon", diff --git a/NEWS b/NEWS index 61e8331e..3ab5ae96 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,9 @@ ngIRCd Release 17 + - New configuration option "NoZeroConf" to disable service registration at + runtime even if ngIRCd is compiled with support for ZeroConf (e.g. using + Howl, Avahi or on Mac OS X). - New configuration option "SyslogFacility" to define the syslog "facility" (the "target"), to which ngIRCd should send its log messages. Possible values are system dependant, but most probably "auth", "daemon", diff --git a/doc/sample-ngircd.conf b/doc/sample-ngircd.conf index a2694f8d..fe34dffa 100644 --- a/doc/sample-ngircd.conf +++ b/doc/sample-ngircd.conf @@ -144,6 +144,10 @@ # Don't use PAM, even if ngIRCd has been compiled with support for it. ;NoPAM = no + # Don't use ZeroConf service registration, even if ngIRCd has been + # compiled with support for it (e.g. Howl, Avahi, Mac OS X). + ;NoZeroConf = no + # try to connect to other irc servers using ipv4 and ipv6, if possible ;ConnectIPv6 = yes ;ConnectIPv4 = yes diff --git a/man/ngircd.conf.5.tmpl b/man/ngircd.conf.5.tmpl index f4f7f6e6..26457291 100644 --- a/man/ngircd.conf.5.tmpl +++ b/man/ngircd.conf.5.tmpl @@ -222,6 +222,12 @@ to the PAM library at runtime; all users connecting without password are allowed to connect, all passwords given will fail. Default: no. .TP +\fBNoZeroConf\fR +If ngIRCd is compiled to register its services using ZeroConf (e.g. using +Howl, Avahi or on Mac OS X) this parameter can be used to disable service +registration at runtime. +Default: no. +.TP \fBConnectIPv4\fR Set this to no if you do not want ngIRCd to connect to other IRC servers using IPv4. This allows usage of ngIRCd in IPv6-only setups. diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index acb40103..f8b470fa 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -338,6 +338,7 @@ Conf_Test( void ) printf(" NoDNS = %s\n", yesno_to_str(Conf_NoDNS)); printf(" NoIdent = %s\n", yesno_to_str(Conf_NoIdent)); printf(" NoPAM = %s\n", yesno_to_str(Conf_NoPAM)); + printf(" NoZeroConf = %s\n", yesno_to_str(Conf_NoZeroConf)); #ifdef WANT_IPV6 printf(" ConnectIPv4 = %s\n", yesno_to_str(Conf_ConnectIPv6)); @@ -587,6 +588,7 @@ Set_Defaults(bool InitServers) Conf_NoDNS = false; Conf_NoIdent = false; Conf_NoPAM = false; + Conf_NoZeroConf = false; Conf_Oper_Count = 0; Conf_Channel_Count = 0; @@ -1048,6 +1050,11 @@ Handle_GLOBAL( int Line, char *Var, char *Arg ) Conf_NoPAM = Check_ArgIsTrue(Arg); return; } + if(strcasecmp(Var, "NoZeroConf") == 0) { + /* don't register services using ZeroConf */ + Conf_NoZeroConf = Check_ArgIsTrue(Arg); + return; + } #ifdef WANT_IPV6 /* the default setting for all the WANT_IPV6 special options is 'true' */ if( strcasecmp( Var, "ConnectIPv6" ) == 0 ) { diff --git a/src/ngircd/conf.h b/src/ngircd/conf.h index ff67dc79..47a499ae 100644 --- a/src/ngircd/conf.h +++ b/src/ngircd/conf.h @@ -152,6 +152,9 @@ GLOBAL bool Conf_NoIdent; /* Disable all usage of PAM, even when compiled with support for it */ GLOBAL bool Conf_NoPAM; +/* Disable service registration using "ZeroConf" */ +GLOBAL bool Conf_NoZeroConf; + /* * try to connect to remote systems using the ipv6 protocol, * if they have an ipv6 address? (default yes) diff --git a/src/ngircd/rendezvous.c b/src/ngircd/rendezvous.c index 7c106292..2d9ae699 100644 --- a/src/ngircd/rendezvous.c +++ b/src/ngircd/rendezvous.c @@ -144,12 +144,16 @@ GLOBAL void Rendezvous_Exit( void ) } /* Rendezvous_Exit */ +/** + * Register ZeroConf service + */ GLOBAL bool Rendezvous_Register( char *Name, char *Type, UINT16 Port ) { - /* Register new service */ - int i; + if (Conf_NoZeroConf) + return; + /* Search free port structure */ for( i = 0; i < MAX_RENDEZVOUS; i++ ) if( ! My_Rendezvous[i].Desc[0] ) break; if( i >= MAX_RENDEZVOUS ) -- 2.39.2