X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Fconf.c;h=034281c06a86ac7c42bc3edb6adffcaa3fb0d0ae;hp=36eff905ecce8b04b4cfd9e20371c78c72c52b4b;hb=b68bb560e9140c0ec783ea02773aef50d11ac06d;hpb=49385a98b2878ae6f19dd0925e0dc90fcc3d6372 diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index 36eff905..034281c0 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -346,7 +346,7 @@ Conf_Test( void ) puts("[LIMITS]"); printf(" ConnectRetry = %d\n", Conf_ConnectRetry); - printf(" MaxConnections = %ld\n", Conf_MaxConnections); + printf(" MaxConnections = %d\n", Conf_MaxConnections); printf(" MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP); printf(" MaxJoins = %d\n", Conf_MaxJoins > 0 ? Conf_MaxJoins : -1); printf(" MaxNickLength = %u\n", Conf_MaxNickLength - 1); @@ -359,7 +359,7 @@ Conf_Test( void ) printf(" ChrootDir = %s\n", Conf_Chroot); printf(" CloakHost = %s\n", Conf_CloakHost); printf(" CloakHostModeX = %s\n", Conf_CloakHostModeX); - printf(" CloakHostModeXSalt = %s\n", Conf_CloakHostModeXSalt); + printf(" CloakHostSalt = %s\n", Conf_CloakHostSalt); printf(" CloakUserToNick = %s\n", yesno_to_str(Conf_CloakUserToNick)); #ifdef WANT_IPV6 printf(" ConnectIPv4 = %s\n", yesno_to_str(Conf_ConnectIPv6)); @@ -636,14 +636,41 @@ Conf_AddServer(const char *Name, UINT16 Port, const char *Host, } /** - * Check if the given nick name is an service. + * Check if the given nick name is reserved for services on a particular server. * + * @param ConfServer The server index to check. + * @param Nick The nick name to check. * @returns true if the given nick name belongs to an "IRC service". */ GLOBAL bool -Conf_IsService(int ConfServer, const char *Nick) +Conf_NickIsService(int ConfServer, const char *Nick) { - return MatchCaseInsensitive(Conf_Server[ConfServer].svs_mask, Nick); + assert (ConfServer >= 0); + assert (ConfServer < MAX_SERVERS); + + return MatchCaseInsensitiveList(Conf_Server[ConfServer].svs_mask, + Nick, ","); +} + +/** + * Check if the given nick name is blocked for "normal client" use. + * + * @param ConfServer The server index or NONE to check all configured servers. + * @param Nick The nick name to check. + * @returns true if the given nick name belongs to an "IRC service". + */ +GLOBAL bool +Conf_NickIsBlocked(const char *Nick) +{ + int i; + + for(i = 0; i < MAX_SERVERS; i++) { + if (!Conf_Server[i].name[0]) + continue; + if (Conf_NickIsService(i, Nick)) + return true; + } + return false; } /** @@ -653,7 +680,7 @@ static void Set_Defaults(bool InitServers) { int i; - char random[RANDOM_SALT_LEN]; + char random[RANDOM_SALT_LEN + 1]; /* Global */ strcpy(Conf_ServerName, ""); @@ -688,7 +715,7 @@ Set_Defaults(bool InitServers) strlcpy(Conf_Chroot, CHROOT_DIR, sizeof(Conf_Chroot)); strcpy(Conf_CloakHost, ""); strcpy(Conf_CloakHostModeX, ""); - strcpy(Conf_CloakHostModeXSalt,ngt_RandomStr(random,RANDOM_SALT_LEN)); + strcpy(Conf_CloakHostSalt, ngt_RandomStr(random, RANDOM_SALT_LEN)); Conf_CloakUserToNick = false; Conf_ConnectIPv4 = true; #ifdef WANT_IPV6 @@ -1405,7 +1432,7 @@ Handle_LIMITS(int Line, char *Var, char *Arg) return; } if (strcasecmp(Var, "MaxConnections") == 0) { - Conf_MaxConnections = atol(Arg); + Conf_MaxConnections = atoi(Arg); if (!Conf_MaxConnections && strcmp(Arg, "0")) Config_Error_NaN(Line, Var); return; @@ -1488,9 +1515,9 @@ Handle_OPTIONS(int Line, char *Var, char *Arg) Config_Error_TooLong(Line, Var); return; } - if (strcasecmp(Var, "CloakHostModeXSalt") == 0) { - len = strlcpy(Conf_CloakHostModeXSalt, Arg, sizeof(Conf_CloakHostModeXSalt)); - if (len >= sizeof(Conf_CloakHostModeX)) + if (strcasecmp(Var, "CloakHostSalt") == 0) { + len = strlcpy(Conf_CloakHostSalt, Arg, sizeof(Conf_CloakHostSalt)); + if (len >= sizeof(Conf_CloakHostSalt)) Config_Error_TooLong(Line, Var); return; }