+ /* Clean up server configuration structure: mark all already
+ * configured servers as "once" so that they are deleted
+ * after the next disconnect and delete all unused servers.
+ * And delete all servers which are "duplicates" of servers
+ * that are already marked as "once" (such servers have been
+ * created by the last rehash but are now useless). */
+ for( i = 0; i < MAX_SERVERS; i++ ) {
+ if( Conf_Server[i].conn_id == NONE ) Init_Server_Struct( &Conf_Server[i] );
+ else {
+ /* This structure is in use ... */
+ if( Conf_Server[i].flags & CONF_SFLAG_ONCE ) {
+ /* Check for duplicates */
+ for( n = 0; n < MAX_SERVERS; n++ ) {
+ if( n == i ) continue;
+
+ if( Conf_Server[i].conn_id == Conf_Server[n].conn_id ) {
+ Init_Server_Struct( &Conf_Server[n] );
+#ifdef DEBUG
+ Log(LOG_DEBUG,"Deleted unused duplicate server %d (kept %d).",
+ n, i );
+#endif
+ }
+ }
+ } else {
+ /* Mark server as "once" */
+ Conf_Server[i].flags |= CONF_SFLAG_ONCE;
+ Log( LOG_DEBUG, "Marked server %d as \"once\"", i );
+ }
+ }
+ }
+
+ /* Initialize variables */
+ line = 0;
+ strcpy( section, "" );
+ Init_Server_Struct( &New_Server );
+ New_Server_Idx = NONE;
+#ifdef SSL_SUPPORT
+ ConfSSL_Init();
+#endif
+ /* Read configuration file */
+ while( true ) {
+ if( ! fgets( str, LINE_LEN, fd )) break;
+ ngt_TrimStr( str );
+ line++;
+
+ /* Skip comments and empty lines */
+ if( str[0] == ';' || str[0] == '#' || str[0] == '\0' ) continue;
+
+ /* Is this the beginning of a new section? */
+ if(( str[0] == '[' ) && ( str[strlen( str ) - 1] == ']' )) {
+ strlcpy( section, str, sizeof( section ));
+ if (strcasecmp(section, "[GLOBAL]") == 0 ||
+ strcasecmp(section, "[LIMITS]") == 0 ||
+ strcasecmp(section, "[OPTIONS]") == 0)
+ continue;
+
+ if( strcasecmp( section, "[SERVER]" ) == 0 ) {
+ /* Check if there is already a server to add */
+ if( New_Server.name[0] ) {
+ /* Copy data to "real" server structure */
+ assert( New_Server_Idx > NONE );
+ Conf_Server[New_Server_Idx] = New_Server;
+ }
+
+ /* Re-init structure for new server */
+ Init_Server_Struct( &New_Server );
+
+ /* Search unused item in server configuration structure */
+ for( i = 0; i < MAX_SERVERS; i++ ) {
+ /* Is this item used? */
+ if( ! Conf_Server[i].name[0] ) break;
+ }
+ if( i >= MAX_SERVERS ) {
+ /* Oops, no free item found! */
+ Config_Error( LOG_ERR, "Too many servers configured." );
+ New_Server_Idx = NONE;
+ }
+ else New_Server_Idx = i;
+ continue;
+ }
+ if (strcasecmp(section, "[CHANNEL]") == 0) {
+ Conf_Channel_Count++;
+ continue;
+ }
+ if (strcasecmp(section, "[OPERATOR]") == 0) {
+ Conf_Oper_Count++;
+ continue;
+ }
+
+ Config_Error(LOG_ERR,
+ "%s, line %d: Unknown section \"%s\"!",
+ NGIRCd_ConfFile, line, section);
+ section[0] = 0x1;
+ }
+ if( section[0] == 0x1 ) continue;
+
+ /* Split line into variable name and parameters */
+ ptr = strchr( str, '=' );
+ if( ! ptr ) {
+ Config_Error( LOG_ERR, "%s, line %d: Syntax error!", NGIRCd_ConfFile, line );
+ continue;
+ }
+ *ptr = '\0';
+ var = str; ngt_TrimStr( var );
+ arg = ptr + 1; ngt_TrimStr( arg );
+
+ if(strcasecmp(section, "[GLOBAL]") == 0)
+ Handle_GLOBAL(line, var, arg);
+ else if(strcasecmp(section, "[LIMITS]") == 0)
+ Handle_LIMITS(line, var, arg);
+ else if(strcasecmp(section, "[OPTIONS]") == 0)
+ Handle_OPTIONS(line, var, arg);
+ else if(strcasecmp(section, "[OPERATOR]") == 0)
+ Handle_OPERATOR(line, var, arg);
+ else if(strcasecmp(section, "[SERVER]") == 0)
+ Handle_SERVER(line, var, arg);
+ else if(strcasecmp(section, "[CHANNEL]") == 0)
+ Handle_CHANNEL(line, var, arg);
+ else
+ Config_Error(LOG_ERR,
+ "%s, line %d: Variable \"%s\" outside section!",
+ NGIRCd_ConfFile, line, var);
+ }
+
+ /* Close configuration file */
+ fclose( fd );
+
+ /* Check if there is still a server to add */
+ if( New_Server.name[0] ) {
+ /* Copy data to "real" server structure */
+ assert( New_Server_Idx > NONE );
+ Conf_Server[New_Server_Idx] = New_Server;
+ }
+
+ /* not a single listening port? Add default. */
+ if (no_listenports() &&
+ !array_copyb(&Conf_ListenPorts, (char*) &defaultport, sizeof defaultport))
+ {
+ Config_Error(LOG_ALERT, "Could not add default listening Port %u: %s",
+ (unsigned int) defaultport, strerror(errno));
+
+ exit(1);
+ }
+
+ if (!Conf_ListenAddress)
+ Conf_ListenAddress = strdup_warn(DEFAULT_LISTEN_ADDRSTR);
+
+ if (!Conf_ListenAddress) {
+ Config_Error(LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME);
+ exit(1);
+ }
+
+ /* No MOTD phrase configured? (re)try motd file. */
+ if (array_bytes(&Conf_Motd) == 0)
+ Read_Motd(Conf_MotdFile);
+
+#ifdef SSL_SUPPORT
+ /* Make sure that all SSL-related files are readable */
+ CheckFileReadable("SSLCertFile", Conf_SSLOptions.CertFile);
+ CheckFileReadable("SSLDHFile", Conf_SSLOptions.DHFile);
+ CheckFileReadable("SSLKeyFile", Conf_SSLOptions.KeyFile);
+#endif
+
+ return true;
+}
+
+/**
+ * Check whether an string argument is true or false.
+ *
+ * @param Arg Input string.
+ * @returns true if string has been parsed as "yes"/"true"/"on".
+ */
+static bool
+Check_ArgIsTrue( const char *Arg )
+{
+ if( strcasecmp( Arg, "yes" ) == 0 ) return true;
+ if( strcasecmp( Arg, "true" ) == 0 ) return true;
+ if( atoi( Arg ) != 0 ) return true;
+
+ return false;
+}
+
+/**
+ * Handle setting of "MaxNickLength".
+ *
+ * @param Line Line number in configuration file.
+ * @raram Arg Input string.
+ * @returns New configured maximum nick name length.
+ */
+static unsigned int
+Handle_MaxNickLength(int Line, const char *Arg)
+{
+ unsigned new;
+
+ new = (unsigned) atoi(Arg) + 1;
+ if (new > CLIENT_NICK_LEN) {
+ Config_Error(LOG_WARNING,
+ "%s, line %d: Value of \"MaxNickLength\" exceeds %u!",
+ NGIRCd_ConfFile, Line, CLIENT_NICK_LEN - 1);
+ return CLIENT_NICK_LEN;
+ }
+ if (new < 2) {
+ Config_Error(LOG_WARNING,
+ "%s, line %d: Value of \"MaxNickLength\" must be at least 1!",
+ NGIRCd_ConfFile, Line);
+ return 2;
+ }
+ return new;
+}
+
+/**
+ * Output a warning messages if IDENT is configured but not compiled in.
+ */
+static void
+WarnIdent(int UNUSED Line)
+{
+#ifndef IDENTAUTH
+ if (Conf_Ident) {
+ /* user has enabled ident lookups explicitly, but ... */
+ Config_Error(LOG_WARNING,
+ "%s: line %d: \"Ident = yes\", but ngircd was built without IDENT support!",
+ NGIRCd_ConfFile, Line);
+ }
+#endif
+}
+
+/**
+ * Output a warning messages if IPv6 is configured but not compiled in.
+ */
+static void
+WarnIPv6(int UNUSED Line)
+{
+#ifndef WANT_IPV6
+ if (Conf_ConnectIPv6) {
+ /* user has enabled IPv6 explicitly, but ... */
+ Config_Error(LOG_WARNING,
+ "%s: line %d: \"ConnectIPv6 = yes\", but ngircd was built without IPv6 support!",
+ NGIRCd_ConfFile, Line);
+ }
+#endif
+}
+
+/**
+ * Output a warning messages if PAM is configured but not compiled in.
+ */
+static void
+WarnPAM(int UNUSED Line)
+{
+#ifndef PAM
+ if (Conf_PAM) {
+ Config_Error(LOG_WARNING,
+ "%s: line %d: \"PAM = yes\", but ngircd was built without PAM support!",
+ NGIRCd_ConfFile, Line);
+ }
+#endif
+}
+
+/**
+ * Handle legacy "NoXXX" options in [GLOBAL] section.
+ *
+ * TODO: This function and support for "NoXXX" could be removed starting
+ * with ngIRCd release 19 (one release after marking it "deprecated").
+ *
+ * @param Var Variable name.
+ * @param Arg Argument string.
+ * @returns true if a NoXXX option has been processed; false otherwise.
+ */
+static bool
+CheckLegacyNoOption(const char *Var, const char *Arg)
+{
+ if(strcasecmp(Var, "NoDNS") == 0) {
+ Conf_DNS = !Check_ArgIsTrue( Arg );
+ return true;
+ }
+ if (strcasecmp(Var, "NoIdent") == 0) {
+ Conf_Ident = !Check_ArgIsTrue(Arg);
+ return true;
+ }
+ if(strcasecmp(Var, "NoPAM") == 0) {
+ Conf_PAM = !Check_ArgIsTrue(Arg);
+ return true;
+ }
+ return false;
+}
+
+/**
+ * Handle deprecated legacy options in [GLOBAL] section.
+ *
+ * TODO: This function and support for these options in the [Global] section
+ * could be removed starting with ngIRCd release 19 (one release after
+ * marking it "deprecated").
+ *
+ * @param Var Variable name.
+ * @param Arg Argument string.
+ * @returns true if a legacy option has been processed; false otherwise.
+ */
+static const char*
+CheckLegacyGlobalOption(int Line, char *Var, char *Arg)
+{
+ if (strcasecmp(Var, "AllowRemoteOper") == 0
+ || strcasecmp(Var, "ChrootDir") == 0
+ || strcasecmp(Var, "ConnectIPv4") == 0
+ || strcasecmp(Var, "ConnectIPv6") == 0
+ || strcasecmp(Var, "OperCanUseMode") == 0
+ || strcasecmp(Var, "OperServerMode") == 0
+ || strcasecmp(Var, "PredefChannelsOnly") == 0
+#ifdef SSL_SUPPORT
+ || strcasecmp(Var, "SSLCertFile") == 0
+ || strcasecmp(Var, "SSLDHFile") == 0
+ || strcasecmp(Var, "SSLKeyFile") == 0
+ || strcasecmp(Var, "SSLKeyFilePassword") == 0
+ || strcasecmp(Var, "SSLPorts") == 0
+#endif
+ || strcasecmp(Var, "SyslogFacility") == 0
+ || strcasecmp(Var, "WebircPassword") == 0) {
+ Handle_OPTIONS(Line, Var, Arg);
+ return "[Options]";
+ }
+ if (strcasecmp(Var, "ConnectRetry") == 0
+ || strcasecmp(Var, "MaxConnections") == 0
+ || strcasecmp(Var, "MaxConnectionsIP") == 0
+ || strcasecmp(Var, "MaxJoins") == 0
+ || strcasecmp(Var, "MaxNickLength") == 0
+ || strcasecmp(Var, "PingTimeout") == 0
+ || strcasecmp(Var, "PongTimeout") == 0) {
+ Handle_LIMITS(Line, Var, Arg);
+ return "[Limits]";
+ }
+
+ return NULL;
+}
+
+/**
+ * Strip "no" prefix of a string.
+ *
+ * TODO: This function and support for "NoXXX" should be removed starting
+ * with ngIRCd release 19! (One release after marking it "deprecated").
+ *
+ * @param str Pointer to input string starting with "no".
+ * @returns New pointer to string without "no" prefix.
+ */
+static const char *
+NoNo(const char *str)
+{
+ assert(strncasecmp("no", str, 2) == 0 && str[2]);
+ return str + 2;
+}
+
+/**
+ * Invert "boolean" string.
+ *
+ * TODO: This function and support for "NoXXX" should be removed starting
+ * with ngIRCd release 19! (One release after marking it "deprecated").
+ *
+ * @param arg "Boolean" input string.
+ * @returns Pointer to inverted "boolean string".
+ */
+static const char *
+InvertArg(const char *arg)
+{
+ return yesno_to_str(!Check_ArgIsTrue(arg));
+}
+
+/**
+ * Handle variable in [Global] configuration section.
+ *
+ * @param Line Line numer in configuration file.
+ * @param Var Variable name.
+ * @param Arg Variable argument.
+ */
+static void
+Handle_GLOBAL( int Line, char *Var, char *Arg )
+{
+ struct passwd *pwd;
+ struct group *grp;
+ size_t len;
+ const char *section;
+
+ assert(Line > 0);
+ assert(Var != NULL);
+ assert(Arg != NULL);
+
+ if (strcasecmp(Var, "Name") == 0) {
+ len = strlcpy(Conf_ServerName, Arg, sizeof(Conf_ServerName));
+ if (len >= sizeof(Conf_ServerName))
+ Config_Error_TooLong(Line, Var);
+ return;
+ }
+ if (strcasecmp(Var, "AdminInfo1") == 0) {
+ len = strlcpy(Conf_ServerAdmin1, Arg, sizeof(Conf_ServerAdmin1));
+ if (len >= sizeof(Conf_ServerAdmin1))
+ Config_Error_TooLong(Line, Var);
+ return;
+ }
+ if (strcasecmp(Var, "AdminInfo2") == 0) {
+ len = strlcpy(Conf_ServerAdmin2, Arg, sizeof(Conf_ServerAdmin2));
+ if (len >= sizeof(Conf_ServerAdmin2))
+ Config_Error_TooLong(Line, Var);
+ return;
+ }
+ if (strcasecmp(Var, "AdminEMail") == 0) {
+ len = strlcpy(Conf_ServerAdminMail, Arg,
+ sizeof(Conf_ServerAdminMail));
+ if (len >= sizeof(Conf_ServerAdminMail))
+ Config_Error_TooLong(Line, Var);
+ return;
+ }
+ if (strcasecmp(Var, "Info") == 0) {
+ len = strlcpy(Conf_ServerInfo, Arg, sizeof(Conf_ServerInfo));
+ if (len >= sizeof(Conf_ServerInfo))
+ Config_Error_TooLong(Line, Var);
+ return;
+ }
+ if (strcasecmp(Var, "Listen") == 0) {
+ if (Conf_ListenAddress) {
+ Config_Error(LOG_ERR,
+ "Multiple Listen= options, ignoring: %s",
+ Arg);
+ return;
+ }
+ Conf_ListenAddress = strdup_warn(Arg);
+ /* If allocation fails, we're in trouble: we cannot ignore the
+ * error -- otherwise ngircd would listen on all interfaces. */
+ if (!Conf_ListenAddress) {
+ Config_Error(LOG_ALERT,
+ "%s exiting due to fatal errors!",
+ PACKAGE_NAME);
+ exit(1);
+ }
+ return;
+ }
+ if (strcasecmp(Var, "MotdFile") == 0) {
+ len = strlcpy(Conf_MotdFile, Arg, sizeof(Conf_MotdFile));
+ if (len >= sizeof(Conf_MotdFile))
+ Config_Error_TooLong(Line, Var);
+ return;
+ }
+ if (strcasecmp(Var, "MotdPhrase") == 0) {
+ len = strlen(Arg);
+ if (len == 0)
+ return;
+ if (len >= LINE_LEN) {
+ Config_Error_TooLong(Line, Var);
+ return;
+ }
+ if (!array_copyb(&Conf_Motd, Arg, len + 1))
+ Config_Error(LOG_WARNING,
+ "%s, line %d: Could not append MotdPhrase: %s",
+ NGIRCd_ConfFile, Line, strerror(errno));
+ Using_MotdFile = false;
+ return;
+ }
+ if(strcasecmp(Var, "Password") == 0) {
+ len = strlcpy(Conf_ServerPwd, Arg, sizeof(Conf_ServerPwd));
+ if (len >= sizeof(Conf_ServerPwd))
+ Config_Error_TooLong(Line, Var);
+ return;
+ }
+ if (strcasecmp(Var, "PidFile") == 0) {
+ len = strlcpy(Conf_PidFile, Arg, sizeof(Conf_PidFile));
+ if (len >= sizeof(Conf_PidFile))
+ Config_Error_TooLong(Line, Var);
+ return;
+ }
+ if (strcasecmp(Var, "Ports") == 0) {
+ ports_parse(&Conf_ListenPorts, Line, Arg);
+ return;
+ }
+ if (strcasecmp(Var, "ServerGID") == 0) {
+ grp = getgrnam(Arg);
+ if (grp)
+ Conf_GID = grp->gr_gid;
+ else {
+ Conf_GID = (unsigned int)atoi(Arg);
+ if (!Conf_GID && strcmp(Arg, "0"))
+ Config_Error_NaN(Line, Var);
+ }
+ return;
+ }
+ if (strcasecmp(Var, "ServerUID") == 0) {
+ pwd = getpwnam(Arg);
+ if (pwd)
+ Conf_UID = pwd->pw_uid;
+ else {
+ Conf_UID = (unsigned int)atoi(Arg);
+ if (!Conf_UID && strcmp(Arg, "0"))
+ Config_Error_NaN(Line, Var);
+ }
+ return;
+ }
+
+ if (CheckLegacyNoOption(Var, Arg)) {
+ /* TODO: This function and support for "NoXXX" could be
+ * be removed starting with ngIRCd release 19 (one release
+ * after marking it "deprecated"). */
+ Config_Error(LOG_WARNING,
+ "%s, line %d (section \"Global\"): \"No\"-Prefix is deprecated, use \"%s = %s\" in [Options] section!",
+ NGIRCd_ConfFile, Line, NoNo(Var), InvertArg(Arg));
+ if (strcasecmp(Var, "NoIdent") == 0)
+ WarnIdent(Line);
+ else if (strcasecmp(Var, "NoPam") == 0)
+ WarnPAM(Line);
+ return;
+ }
+ if ((section = CheckLegacyGlobalOption(Line, Var, Arg))) {
+ /** TODO: This function and support for these options in the
+ * [Global] section could be removed starting with ngIRCd
+ * release 19 (one release after marking it "deprecated"). */
+ Config_Error(LOG_WARNING,
+ "%s, line %d (section \"Global\"): \"%s\" is deprecated here, move it to %s!",
+ NGIRCd_ConfFile, Line, Var, section);
+ return;
+ }
+
+ Config_Error_Section(Line, Var, "Global");
+}
+
+/**
+ * Handle variable in [Limits] configuration section.
+ *
+ * @param Line Line numer in configuration file.
+ * @param Var Variable name.
+ * @param Arg Variable argument.
+ */
+static void
+Handle_LIMITS(int Line, char *Var, char *Arg)
+{
+ assert(Line > 0);
+ assert(Var != NULL);
+ assert(Arg != NULL);
+
+ if (strcasecmp(Var, "ConnectRetry") == 0) {
+ Conf_ConnectRetry = atoi(Arg);
+ if (Conf_ConnectRetry < 5) {
+ Config_Error(LOG_WARNING,
+ "%s, line %d: Value of \"ConnectRetry\" too low!",
+ NGIRCd_ConfFile, Line);
+ Conf_ConnectRetry = 5;
+ }
+ return;
+ }
+ if (strcasecmp(Var, "MaxConnections") == 0) {
+ Conf_MaxConnections = atol(Arg);
+ if (!Conf_MaxConnections && strcmp(Arg, "0"))
+ Config_Error_NaN(Line, Var);
+ return;
+ }
+ if (strcasecmp(Var, "MaxConnectionsIP") == 0) {
+ Conf_MaxConnectionsIP = atoi(Arg);
+ if (!Conf_MaxConnectionsIP && strcmp(Arg, "0"))
+ Config_Error_NaN(Line, Var);
+ return;
+ }
+ if (strcasecmp(Var, "MaxJoins") == 0) {
+ Conf_MaxJoins = atoi(Arg);
+ if (!Conf_MaxJoins && strcmp(Arg, "0"))
+ Config_Error_NaN(Line, Var);
+ return;
+ }
+ if (strcasecmp(Var, "MaxNickLength") == 0) {
+ Conf_MaxNickLength = Handle_MaxNickLength(Line, Arg);
+ return;
+ }
+ if (strcasecmp(Var, "PingTimeout") == 0) {
+ Conf_PingTimeout = atoi(Arg);
+ if (Conf_PingTimeout < 5) {
+ Config_Error(LOG_WARNING,
+ "%s, line %d: Value of \"PingTimeout\" too low!",
+ NGIRCd_ConfFile, Line);
+ Conf_PingTimeout = 5;
+ }
+ return;
+ }
+ if (strcasecmp(Var, "PongTimeout") == 0) {
+ Conf_PongTimeout = atoi(Arg);
+ if (Conf_PongTimeout < 5) {
+ Config_Error(LOG_WARNING,
+ "%s, line %d: Value of \"PongTimeout\" too low!",
+ NGIRCd_ConfFile, Line);
+ Conf_PongTimeout = 5;
+ }
+ return;
+ }
+
+ Config_Error_Section(Line, Var, "Limits");
+}
+
+/**
+ * Handle variable in [Options] configuration section.
+ *
+ * @param Line Line numer in configuration file.
+ * @param Var Variable name.
+ * @param Arg Variable argument.
+ */
+static void
+Handle_OPTIONS(int Line, char *Var, char *Arg)
+{
+ size_t len;
+
+ assert(Line > 0);
+ assert(Var != NULL);
+ assert(Arg != NULL);
+
+ if (strcasecmp(Var, "AllowRemoteOper") == 0) {
+ Conf_AllowRemoteOper = Check_ArgIsTrue(Arg);
+ return;
+ }
+ if (strcasecmp(Var, "ChrootDir") == 0) {
+ len = strlcpy(Conf_Chroot, Arg, sizeof(Conf_Chroot));
+ if (len >= sizeof(Conf_Chroot))
+ Config_Error_TooLong(Line, Var);
+ return;
+ }
+ if (strcasecmp(Var, "CloakHost") == 0) {
+ len = strlcpy(Conf_CloakHost, Arg, sizeof(Conf_CloakHost));
+ if (len >= sizeof(Conf_CloakHost))
+ Config_Error_TooLong(Line, Var);
+ return;
+ }
+ if (strcasecmp(Var, "CloakUserToNick") == 0) {
+ Conf_CloakUserToNick = Check_ArgIsTrue(Arg);
+ return;
+ }
+ if (strcasecmp(Var, "ConnectIPv6") == 0) {
+ Conf_ConnectIPv6 = Check_ArgIsTrue(Arg);
+ WarnIPv6(Line);
+ return;
+ }
+ if (strcasecmp(Var, "ConnectIPv4") == 0) {
+ Conf_ConnectIPv4 = Check_ArgIsTrue(Arg);
+ return;
+ }
+ if (strcasecmp(Var, "DNS") == 0) {
+ Conf_DNS = Check_ArgIsTrue(Arg);
+ return;
+ }
+ if (strcasecmp(Var, "Ident") == 0) {
+ Conf_Ident = Check_ArgIsTrue(Arg);
+ WarnIdent(Line);
+ return;
+ }
+ if (strcasecmp(Var, "NoticeAuth") == 0) {
+ Conf_NoticeAuth = Check_ArgIsTrue(Arg);
+ return;
+ }
+ if (strcasecmp(Var, "OperCanUseMode") == 0) {
+ Conf_OperCanMode = Check_ArgIsTrue(Arg);
+ return;
+ }
+ if (strcasecmp(Var, "OperServerMode") == 0) {
+ Conf_OperServerMode = Check_ArgIsTrue(Arg);
+ return;
+ }
+ if (strcasecmp(Var, "PAM") == 0) {
+ Conf_PAM = Check_ArgIsTrue(Arg);
+ WarnPAM(Line);
+ return;
+ }
+ if (strcasecmp(Var, "PredefChannelsOnly") == 0) {
+ Conf_PredefChannelsOnly = Check_ArgIsTrue(Arg);
+ return;
+ }
+#ifndef STRICT_RFC
+ if (strcasecmp(Var, "RequireAuthPing") == 0) {
+ Conf_AuthPing = Check_ArgIsTrue(Arg);
+ return;
+ }
+#endif
+ if (strcasecmp(Var, "ScrubCTCP") == 0) {
+ Conf_ScrubCTCP = Check_ArgIsTrue(Arg);
+ return;
+ }
+#ifdef SSL_SUPPORT
+ if (strcasecmp(Var, "SSLCertFile") == 0) {
+ assert(Conf_SSLOptions.CertFile == NULL);
+ Conf_SSLOptions.CertFile = strdup_warn(Arg);
+ return;
+ }
+ if (strcasecmp(Var, "SSLDHFile") == 0) {
+ assert(Conf_SSLOptions.DHFile == NULL);
+ Conf_SSLOptions.DHFile = strdup_warn(Arg);
+ return;
+ }
+ if (strcasecmp(Var, "SSLKeyFile") == 0) {
+ assert(Conf_SSLOptions.KeyFile == NULL);
+ Conf_SSLOptions.KeyFile = strdup_warn(Arg);
+ return;
+ }
+ if (strcasecmp(Var, "SSLKeyFilePassword") == 0) {
+ assert(array_bytes(&Conf_SSLOptions.KeyFilePassword) == 0);
+ if (!array_copys(&Conf_SSLOptions.KeyFilePassword, Arg))
+ Config_Error(LOG_ERR,
+ "%s, line %d (section \"Global\"): Could not copy %s: %s!",
+ NGIRCd_ConfFile, Line, Var,
+ strerror(errno));
+ return;
+ }
+ if (strcasecmp(Var, "SSLPorts") == 0) {
+ ports_parse(&Conf_SSLOptions.ListenPorts, Line, Arg);
+ return;
+ }
+#endif
+#ifdef SYSLOG
+ if (strcasecmp(Var, "SyslogFacility") == 0) {
+ Conf_SyslogFacility = ngt_SyslogFacilityID(Arg,
+ Conf_SyslogFacility);
+ return;
+ }
+#endif
+ if (strcasecmp(Var, "WebircPassword") == 0) {
+ len = strlcpy(Conf_WebircPwd, Arg, sizeof(Conf_WebircPwd));
+ if (len >= sizeof(Conf_WebircPwd))
+ Config_Error_TooLong(Line, Var);
+ return;
+ }
+
+ Config_Error_Section(Line, Var, "Options");
+}
+
+/**
+ * Handle variable in [Operator] configuration section.
+ *
+ * @param Line Line numer in configuration file.
+ * @param Var Variable name.
+ * @param Arg Variable argument.
+ */
+static void
+Handle_OPERATOR( int Line, char *Var, char *Arg )