Force nicklen (all flavours) to be at least 9.

This commit is contained in:
Jilles Tjoelker 2011-11-29 23:41:18 +01:00
parent b225bf93b7
commit ca8ff4830b
2 changed files with 11 additions and 2 deletions

View file

@ -898,9 +898,12 @@ AC_HELP_STRING([--with-nicklen=LENGTH],[Set the upper-bound nick length to LENGT
if ! expr "$withval" + 0 >/dev/null 2>&1; then if ! expr "$withval" + 0 >/dev/null 2>&1; then
AC_ERROR([NICKLEN must be a numeric value]) AC_ERROR([NICKLEN must be a numeric value])
fi fi
if test $withval -ge 50; then if test $withval -gt 50; then
NICKLEN=50 NICKLEN=50
AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50]) AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
elif test $withval -lt 9; then
NICKLEN=9
AC_MSG_WARN([NICKLEN has a lower limit of 9. Setting NICKLEN=9])
else else
NICKLEN="$withval" NICKLEN="$withval"
fi fi

View file

@ -268,9 +268,15 @@ conf_set_serverinfo_nicklen(void *data)
if (ConfigFileEntry.nicklen > NICKLEN) if (ConfigFileEntry.nicklen > NICKLEN)
{ {
conf_report_error("Warning -- ignoring serverinfo::nicklen -- provided nicklen (%u) is greater than allowed nicklen (%u)", conf_report_error("Warning -- ignoring serverinfo::nicklen -- provided nicklen (%u) is greater than allowed nicklen (%u)",
ConfigFileEntry.nicklen, NICKLEN); ConfigFileEntry.nicklen - 1, NICKLEN - 1);
ConfigFileEntry.nicklen = NICKLEN; ConfigFileEntry.nicklen = NICKLEN;
} }
else if (ConfigFileEntry.nicklen < 9 + 1)
{
conf_report_error("Warning -- serverinfo::nicklen is too low (%u) -- forcing 9",
ConfigFileEntry.nicklen);
ConfigFileEntry.nicklen = 9 + 1;
}
} }
static void static void