diff -uNr ircservices-5.0.16/Changes ircservices-5.0.17/Changes --- ircservices-5.0.16/Changes 2003-04-10 10:45:01.000000000 +0900 +++ ircservices-5.0.17/Changes 2003-04-20 16:32:03.000000000 +0900 @@ -1,5 +1,12 @@ Version 5.0 ----------- +2003/04/20 .17 Fixed crash when using UNLINK FORCE with non-linked nicks. + Reported by Matthew Hodgson +2003/04/15 The configure script now uses "conf-tmp" instead of "tmp" + as its temporary directory name, to avoid potential + clashes with pre-existing directories. +2003/04/12 Precompiled binaries should now work with Linux kernel 2.2.x. + Reported by 2003/04/10 .16 Fixed crash on some systems when giving only spaces to certain commands. Reported by Joao Luis Marques Pinto diff -uNr ircservices-5.0.16/Makefile ircservices-5.0.17/Makefile --- ircservices-5.0.16/Makefile 2003-04-10 11:52:27.000000000 +0900 +++ ircservices-5.0.17/Makefile 2003-04-20 19:28:15.000000000 +0900 @@ -81,7 +81,7 @@ $(MAKE) -C lang spotless $(MAKE) -C modules spotless $(MAKE) -C tools spotless - rm -f config.cache config.h* configure.log Makefile.inc* \ + rm -f config.cache config.h* configure.log conf-tmp Makefile.inc* \ langstrs.h version.c install: myall myinstall diff -uNr ircservices-5.0.16/configure ircservices-5.0.17/configure --- ircservices-5.0.16/configure 2003-04-10 10:35:14.000000000 +0900 +++ ircservices-5.0.17/configure 2003-04-15 15:13:14.000000000 +0900 @@ -10,6 +10,11 @@ ########################################################################### +# Temporary directory to use for various things. +CONFTMP=conf-tmp + +########################################################################### + # Nifty handy functions. echo2 () { @@ -77,11 +82,11 @@ log "found $include in /usr/include" return 0 fi - cat >tmp/test.c <$CONFTMP/test.c < int main() { return 0; } EOT - if run $CC $CC_FLAGS tmp/test.c $CC_LIBS -o tmp/test ; then + if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then eval "HAVE_${inc2}=1" log "found $include" return 0 @@ -107,13 +112,13 @@ if [ ! "$TEST" ] ; then TEST="return 0;" fi - cat >tmp/test.c <$CONFTMP/test.c <&1 ; then + if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test && (run $CONFTMP/test) 2>&1 ; then eval "HAVE_${func2}=1" log "found $func" return 0 @@ -135,7 +140,7 @@ We suddenly couldn't compile using the C compiler we already tested! The command line we used was: - $CC $CC_FLAGS tmp/test.c $CC_LIBS -o tmp/test + $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test Please try to fix this; if you can't, mail achurch@achurch.org with information about your system, the output from this script, and the \`configure.log' file generated by this script. @@ -153,14 +158,14 @@ # Create a temporary directory for our use. -if exists tmp ; then - rm -rf tmp +if exists $CONFTMP ; then + rm -rf $CONFTMP fi -if mkdir tmp ; then : ; else +if mkdir $CONFTMP ; then : ; else echo "Failed to create temporary directory! Exiting." exit 2 fi -if chmod u+rwx tmp ; then : ; else +if chmod u+rwx $CONFTMP ; then : ; else echo "Cannot write to temporary directory! Exiting." exit 2 fi @@ -802,12 +807,12 @@ else echo "gcc not found." echo2 " Looking for alternatives... " - echo >tmp/test.c "int main(){return 1;}" - if run icc tmp/test.c -o tmp/test ; then + echo >$CONFTMP/test.c "int main(){return 1;}" + if run icc $CONFTMP/test.c -o $CONFTMP/test ; then CC=icc - elif run cc tmp/test.c -o tmp/test ; then + elif run cc $CONFTMP/test.c -o $CONFTMP/test ; then CC=cc - elif run c89 tmp/test.c -o tmp/test ; then + elif run c89 $CONFTMP/test.c -o $CONFTMP/test ; then CC=c89 else echo "no C compiler found!" @@ -816,13 +821,13 @@ exit 2 fi # See if it handles ANSI. - cat >tmp/test.c <$CONFTMP/test.c <tmp/test.c <$CONFTMP/test.c <tmp/test.c "int main(){return 1;}" - if run $CC $CC_FLAGS $CC_LFLAGS tmp/test.c -o tmp/test ; then - if [ -f tmp/test.exe ] ; then + rm -f $CONFTMP/test $CONFTMP/test.exe + echo >$CONFTMP/test.c "int main(){return 1;}" + if run $CC $CC_FLAGS $CC_LFLAGS $CONFTMP/test.c -o $CONFTMP/test ; then + if [ -f $CONFTMP/test.exe ] ; then log using .exe EXE_SUFFIX=.exe - elif [ -f tmp/test ] ; then + elif [ -f $CONFTMP/test ] ; then log using nothing EXE_SUFFIX="" else @@ -925,40 +930,40 @@ log cache supplied \`"$CC_LIBS'" else CC_LIBS= - cat >tmp/test.c <$CONFTMP/test.c <tmp/test-socket.c <$CONFTMP/test-socket.c <tmp/test-gethost.c <$CONFTMP/test-gethost.c <tmp/test-dlopen.c <$CONFTMP/test-dlopen.c < int main(int argc, char **argv) { - void *lib = dlopen("tmp/test-lib.so", RTLD_NOW); + void *lib = dlopen("$CONFTMP/test-lib.so", RTLD_NOW); printf("%d\n", lib != 0); if (lib) dlclose(lib); return 0; } EOT - cat >tmp/test-lib.c <$CONFTMP/test-lib.c < $a" + if run $CONFTMP/test ; then + a=`$CONFTMP/test` + log "missing-symbol test: $CONFTMP/test => $a" if [ "x$a" = "x0" ] ; then log "missing-symbol test succeeded" else @@ -1062,7 +1067,7 @@ fi fi if [ "$OK" ] ; then - cat >tmp/test-dynamic2.c <$CONFTMP/test-dynamic2.c < int main(int argc, char **argv) { printf("%d\n", foo(atoi(argv[1]))); @@ -1071,16 +1076,16 @@ return xyzzy+1; } EOT - cat >tmp/test-dynamic.c <$CONFTMP/test-dynamic.c < $a" + a=`$CONFTMP/test 1` + log "symbol resolution test: $CONFTMP/test 1 => $a" if [ "x$a" = "x4" ] ; then log "symbol resolution test: succeeded => using dynamic modules (dlfcn)" else @@ -1095,7 +1100,7 @@ fi # dlfcn test if [ "$OK" ] ; then log "checking for underscores in symbols" - cat >tmp/test-dynamic2.c <$CONFTMP/test-dynamic2.c < #include int main(int argc, char **argv) { @@ -1106,10 +1111,10 @@ } int quux(int x) {return x;} EOT - if run $CC $CC_FLAGS $CC_DYN_LFLAGS $CC_LIBS $CC_DYN_LIBS tmp/test-dynamic2.c tmp/test.so -o tmp/test + if run $CC $CC_FLAGS $CC_DYN_LFLAGS $CC_LIBS $CC_DYN_LIBS $CONFTMP/test-dynamic2.c $CONFTMP/test.so -o $CONFTMP/test then - a=`tmp/test` - log "underscore test: tmp/test => $a" + a=`$CONFTMP/test` + log "underscore test: $CONFTMP/test => $a" with_underscore=`echo "$a" | cut -c2` without_underscore=`echo "$a" | cut -c1` if [ "x$with_underscore" = "x1" ] ; then @@ -1152,15 +1157,15 @@ echo "(cached) $TYPE_INT8" log "cache supplied $TYPE_INT8" else - cat >tmp/test.c <$CONFTMP/test.c <tmp/test.c <$CONFTMP/test.c <tmp/test.c <$CONFTMP/test.c <tmp/test.c <$CONFTMP/test.c <tmp/test.c <$CONFTMP/test.c <tmp/test.c <$CONFTMP/test.c <tmp/test.c <$CONFTMP/test.c < int main() { time_t a = 0; @@ -1404,8 +1409,8 @@ return 0; } EOT - if run $CC $CC_FLAGS tmp/test.c $CC_LIBS -o tmp/test ; then - a="`tmp/test`" + if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then + a="`$CONFTMP/test`" log "test program output (sizeof(time_t) MAX_TIME_T): $a" if [ ! "$a" ] ; then echo "test program failed! Assuming 32 bits." @@ -1454,7 +1459,7 @@ log "cache said no gid_t" fi else - cat >tmp/test.c <$CONFTMP/test.c < int main() { gid_t a; @@ -1462,8 +1467,8 @@ return 0; } EOT - if run $CC $CC_FLAGS tmp/test.c $CC_LIBS -o tmp/test ; then - a="`tmp/test`" + if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then + a="`$CONFTMP/test`" log "test program output (sizeof(gid_t)): $a" if [ ! "$a" ] ; then echo "test program failed! Assuming 16 bits." @@ -1503,7 +1508,7 @@ log "cache said not present" fi else - cat >tmp/test.c <$CONFTMP/test.c < #include int main() { @@ -1511,7 +1516,7 @@ return 0; } EOT - if run $CC $CC_FLAGS tmp/test.c $CC_LIBS -o tmp/test ; then + if run $CC $CC_FLAGS $CONFTMP/test.c $CC_LIBS -o $CONFTMP/test ; then log "socklen_t found" echo "present." HAVE_SOCKLEN_T=1 @@ -1625,20 +1630,20 @@ log "cache supplied pseudo sys_errlist" fi else - cat >tmp/test.c <$CONFTMP/test.c <tmp/test.c <$CONFTMP/test.c <tmp/test.c <$CONFTMP/test.c <tmp/test.c <$CONFTMP/test.c <tmp/test - run cp tmp/test tmp/test2 - if run /bin/mkdir tmp/testA && run /bin/mkdir tmp/testB && run /bin/mv tmp/test2 tmp/testA ; then + run rm -rf $CONFTMP/test* + run echo test >$CONFTMP/test + run cp $CONFTMP/test $CONFTMP/test2 + if run /bin/mkdir $CONFTMP/testA && run /bin/mkdir $CONFTMP/testB && run /bin/mv $CONFTMP/test2 $CONFTMP/testA ; then : else echo "" @@ -2002,13 +2007,13 @@ echo "Are you out of disk space?" exit 4 fi - if run $CP_ALL tmp/testA tmp/testB/testC && run cmp tmp/testA/test2 tmp/testB/testC/test2 ; then + if run $CP_ALL $CONFTMP/testA $CONFTMP/testB/testC && run cmp $CONFTMP/testA/test2 $CONFTMP/testB/testC/test2 ; then echo "$CP_ALL" log \`"$CP_ALL' works" else log \`"$CP_ALL' doesn't work" - run /bin/rm -rf tmp/testB/* - if run sh -c '/bin/tar Ccf tmp/testA - . | /bin/tar Cxf tmp/testB -' + run /bin/rm -rf $CONFTMP/testB/* + if run sh -c '/bin/tar Ccf $CONFTMP/testA - . | /bin/tar Cxf $CONFTMP/testB -' then echo "tar (yuck)" CP_ALL='$(TOPDIR)/cp-recursive -t' @@ -2240,7 +2245,7 @@ # Delete the temporary directory we created. -rm -rf tmp +rm -rf $CONFTMP ########################################################################### diff -uNr ircservices-5.0.16/modules/nickserv/link.c ircservices-5.0.17/modules/nickserv/link.c --- ircservices-5.0.16/modules/nickserv/link.c 2003-04-10 11:52:28.000000000 +0900 +++ ircservices-5.0.17/modules/nickserv/link.c 2003-04-20 19:28:16.000000000 +0900 @@ -118,7 +118,7 @@ static void do_unlink(User *u) { NickInfo *ni = u->ni, *ni2; - NickGroupInfo *ngi = u->ngi; + NickGroupInfo *ngi = u->ngi, *ngi2 = NULL; char *nick = strtok(NULL, " "); char *extra = strtok(NULL, " "); int is_servadmin = is_services_admin(u); @@ -138,7 +138,8 @@ notice_lang(s_NickServ, u, NICK_IDENTIFY_REQUIRED, s_NickServ); } else if (irc_stricmp(nick, u->nick) == 0) { notice_lang(s_NickServ, u, NICK_UNLINK_SAME); - } else if (!(ni2 = get_nickinfo(nick)) || !ni2->nickgroup) { + } else if (!(ni2 = get_nickinfo(nick)) || !ni2->nickgroup + || !(ngi2 = get_ngi(ni2)) || ngi2->nicks_count == 1) { notice_lang(s_NickServ, u, force ? NICK_UNLINK_NOT_LINKED : NICK_UNLINK_NOT_LINKED_YOURS, nick); @@ -148,11 +149,12 @@ int msg, i; char *param1; - /* Adjust main nick if unlinking our current main nick (we set it - * to the caller's nick) */ - if (ni2->nickgroup == ni->nickgroup) { - ARRAY_SEARCH_PLAIN(ngi->nicks, ni2->nick, irc_stricmp, i); - if (i == ngi->mainnick) { + /* Adjust main nick if unlinking the current main nick (we set it + * to the caller's nick if the caller is unlinking their own nick, + * else the first in the list) */ + ARRAY_SEARCH_PLAIN(ngi2->nicks, ni2->nick, irc_stricmp, i); + if (i == ngi2->mainnick) { + if (ngi == ngi2) { ARRAY_SEARCH_PLAIN(ngi->nicks, nick, irc_stricmp, i); if (i >= ngi->nicks_count) { module_log("BUG: UNLINK: no entry in ngi->nicks[] for" @@ -160,15 +162,12 @@ } else { ngi->mainnick = i; } + } else { + ngi2->mainnick = 0; } } /* Actually delete the nick */ if (ni2->nickgroup != ni->nickgroup) { - NickGroupInfo *ngi2 = NULL; - if (!(ngi2 = get_ngi(ni2))) { - notice_lang(s_NickServ, u, INTERNAL_ERROR); - return; - } delnick(ni2); msg = NICK_X_UNLINKED; param1 = ngi2->nicks[ngi2->mainnick]; diff -uNr ircservices-5.0.16/version.sh ircservices-5.0.17/version.sh --- ircservices-5.0.16/version.sh 2003-04-10 11:13:07.000000000 +0900 +++ ircservices-5.0.17/version.sh 2003-04-20 16:33:46.000000000 +0900 @@ -3,7 +3,7 @@ # Build the version.c file which contains all the version related info and # needs to be updated on a per-build basis. -VERSION=5.0.16 +VERSION=5.0.17 # Increment Services build number if [ -f version.c ] ; then