1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-09 01:23:12 +02:00

Added ./unreal gencloak

This commit is contained in:
aquanight
2007-05-20 02:59:16 +00:00
parent ee77248055
commit 542fa2bcfc
5 changed files with 66 additions and 4 deletions
+4
View File
@@ -1717,3 +1717,7 @@ MOTDs
brainfart regarding DH), #0003345, patched by fez
- #0003350 - reported by aquanight regarding ./unreal restart not
working in 3.3*. Now works properly again.
- #0001924 - requested by syzop: Added ./unreal gencloak, which generates
random keys 10 ~ 20 characters in length (doesn't (yet) work for Win32).
- Misc fix for disabling extban chains, should've done stuff in our autoconf
stuff instead of hacking configure directly :P .
+2
View File
@@ -392,6 +392,8 @@ AC_ARG_WITH(disableusermod, [AC_HELP_STRING([--with-disableusermod], [Disable /s
AC_DEFINE(DISABLE_USERMOD))
AC_ARG_WITH(operoverride-verify, [AC_HELP_STRING([--with-operoverride-verify], [Require opers to invite themselves to +s/+p channels])],
AC_DEFINE(OPEROVERRIDE_VERIFY))
AC_ARG_WITH(disable-extendedban-stacking, [AC_HELP_STRING([--with-disable-extendedban-stacking], [Disable extended ban stacking])],
AC_DEFINE(DISABLE_STACKED_EXTBANS))
CHECK_SSL
CHECK_ZLIB
CHECK_LIBCURL
Vendored
+14 -3
View File
@@ -719,13 +719,13 @@ echo X"$0" |
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r $srcdir/$ac_unique_file; then
if test ! -r "$srcdir/$ac_unique_file"; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r $srcdir/$ac_unique_file; then
if test ! -r "$srcdir/$ac_unique_file"; then
if test "$ac_srcdir_defaulted" = yes; then
{ echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
{ (exit 1); exit 1; }; }
@@ -734,7 +734,7 @@ if test ! -r $srcdir/$ac_unique_file; then
{ (exit 1); exit 1; }; }
fi
fi
(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
(cd $srcdir && test -r "./$ac_unique_file") 2>/dev/null ||
{ echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
{ (exit 1); exit 1; }; }
srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
@@ -882,6 +882,8 @@ Optional Packages:
--with-disableusermod Disable /set* and /chg*
--with-operoverride-verify
Require opers to invite themselves to +s/+p channels
--with-disable-extendedban-stacking
Disable extended ban stacking
Some influential environment variables:
CC C compiler command
@@ -12494,6 +12496,15 @@ _ACEOF
fi;
# Check whether --with-disable-extendedban-stacking or --without-disable-extendedban-stacking was given.
if test "${with_disable_extendedban_stacking+set}" = set; then
withval="$with_disable_extendedban_stacking"
cat >>confdefs.h <<\_ACEOF
#define DISABLE_STACKED_EXTBANS 1
_ACEOF
fi;
# Check whether --enable-ssl or --disable-ssl was given.
if test "${enable_ssl+set}" = set; then
enableval="$enable_ssl"
+43
View File
@@ -964,6 +964,44 @@ extern time_t TSoffset;
extern int unreal_time_synch(int timeout);
#ifndef _WIN32
static inline /* Only called in one place */ void generate_cloakkeys()
{
/* Generate 3 cloak keys */
#define GENERATE_CLOAKKEY_MINLEN 10
#define GENERATE_CLOAKKEY_MAXLEN 20 /* Length of cloak keys to generate. */
char keyBuf[GENERATE_CLOAKKEY_MAXLEN + 1];
int keyNum;
int keyLen;
int charIndex;
int value;
srandom(TStime());
keyBuf[GENERATE_CLOAKKEY_MAXLEN] = '\0';
for (keyNum = 0; keyNum < 3; ++keyNum)
{
keyLen = (getrandom8() % (GENERATE_CLOAKKEY_MAXLEN - GENERATE_CLOAKKEY_MINLEN + 1)) + GENERATE_CLOAKKEY_MINLEN;
keyBuf[keyLen] = '\0';
for (charIndex = 0; charIndex < keyLen; ++charIndex)
{
switch (getrandom8() % 3)
{
case 0: /* Uppercase. */
keyBuf[charIndex] = (char)('A' + (getrandom8() % ('Z' - 'A')));
break;
case 1: /* Lowercase. */
keyBuf[charIndex] = (char)('a' + (getrandom8() % ('z' - 'a')));
break;
case 2: /* Digit. */
keyBuf[charIndex] = (char)('0' + (getrandom8() % ('9' - '0')));
break;
}
}
(void)fprintf(stderr, "%s\n", keyBuf);
}
}
#endif
#ifndef _WIN32
int main(int argc, char *argv[])
#else
@@ -1302,6 +1340,11 @@ int InitwIRCD(int argc, char *argv[])
#endif
}
exit(0);
#ifndef _WIN32
case 'k':
generate_cloakkeys();
exit(0);
#endif
default:
bad_command();
break;
+3 -1
View File
@@ -39,6 +39,8 @@ elif [ "$1" = "version" ] ; then
@BINDIR@/ircd -v
elif [ "$1" = "configtest" ] ; then
@BINDIR@/ircd -e
elif [ "$1" = "gencloak" ] ; then
@BINDIR@/ircd -k
elif [ "$1" = "backtrace" ] ; then
cd @IRCDDIR@
@@ -135,5 +137,5 @@ __EOF__
echo ""
echo "Thanks!"
else
echo "Usage: unreal start|stop|rehash|restart|mkpasswd|version"
echo "Usage: unreal start|stop|rehash|restart|mkpasswd|version|gencloak"
fi