Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-05-11 04:15:14 UTC

Modified files:
     ChangeLog ircd/channel.c ircd/umkpasswd.c ircd/test/channel-1.cmd
     ircd/test/client-1.cmd ircd/test/ircd-t1.conf
     ircd/test/test-driver.pl

Added files:
     ircd/test/die.cmd ircd/test/gline-1.cmd ircd/test/run-tests.sh

Log message:

Avoid sending MODE +o to local channel creator, and more code coverage.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.629 ircu2.10/ChangeLog:1.630
--- ircu2.10/ChangeLog:1.629    Mon May  9 20:43:07 2005
+++ ircu2.10/ChangeLog  Tue May 10 21:15:01 2005
@@ -1,4 +1,18 @@
-n2005-08-09  Michael Poole <[EMAIL PROTECTED]>
+2005-08-10  Michael Poole <[EMAIL PROTECTED]>
+
+       * ircd/channel.c (joinbuf_join): Do not send a MODE +o when a
+       local user creates a channel.
+
+       * ircd/umkpasswd.c (crypt_pass): Allocate the proper amount of
+       memory for the tagged output string.
+
+       * ircd/test/test-driver.pl: Add -vhost=... option.
+
+       * ircd/test/ircd-t1.conf: Add new Operator blocks.
+
+       * ircd/test/*.cmd: Rearrange and add more coverage tests.
+
+2005-08-09  Michael Poole <[EMAIL PROTECTED]>
 
        * ircd/ircd_parser.y: Move error tokens to top level of parse, and
        make ';' a synchronizing token for them.  This avoids crashes in
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.131 ircu2.10/ircd/channel.c:1.132
--- ircu2.10/ircd/channel.c:1.131       Sat May  7 19:42:04 2005
+++ ircu2.10/ircd/channel.c     Tue May 10 21:15:03 2005
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Channel management and maintenance
- * @version $Id: channel.c,v 1.131 2005/05/08 02:42:04 entrope Exp $
+ * @version $Id: channel.c,v 1.132 2005/05/11 04:15:03 entrope Exp $
  */
 #include "config.h"
 
@@ -3416,7 +3416,7 @@
       sendcmdto_channel_butserv_butone(jbuf->jb_source, CMD_JOIN, chan, NULL, 
0, "%H", chan);
 
       /* send an op, too, if needed */
-      if (flags & CHFL_CHANOP)
+      if (flags & CHFL_CHANOP && (oplevel < MAXOPLEVEL || 
!MyUser(jbuf->jb_source)))
        sendcmdto_channel_butserv_butone((chan->mode.apass[0] ? &me : 
jbuf->jb_source),
                                          CMD_MODE, chan, NULL, 0, "%H +o %C",
                                         chan, jbuf->jb_source);
Index: ircu2.10/ircd/test/channel-1.cmd
diff -u ircu2.10/ircd/test/channel-1.cmd:1.1 
ircu2.10/ircd/test/channel-1.cmd:1.2
--- ircu2.10/ircd/test/channel-1.cmd:1.1        Mon May  9 20:43:09 2005
+++ ircu2.10/ircd/test/channel-1.cmd    Tue May 10 21:15:04 2005
@@ -45,6 +45,4 @@
 :cl2 wait cl1
 :cl2 mode #test2 -D
 :cl2 mode #test +v Alex
-:cl1 oper oper1 oper1
 :cl1 wait cl2
-:cl1 raw die :testing over
Index: ircu2.10/ircd/test/client-1.cmd
diff -u ircu2.10/ircd/test/client-1.cmd:1.1 ircu2.10/ircd/test/client-1.cmd:1.2
--- ircu2.10/ircd/test/client-1.cmd:1.1 Mon May  9 20:43:09 2005
+++ ircu2.10/ircd/test/client-1.cmd     Tue May 10 21:15:04 2005
@@ -1,11 +1,15 @@
 define srv localhost:7701
 
 connect cl1 Alex alex %srv% :Test client 1
-connect cl2 Bubb bubb %srv% :Test client 2
 :cl1 oper oper1 oper1
-:cl2 wait cl1
+connect cl2 Bubb bubb %srv% :Test client 2
 :cl2 oper oper3 oper4
+:cl2 oper oldoper wrongpass
+:cl2 oper md5oper wrongpass
+:cl2 oper cryptoper wrongpass
 :cl2 oper oper2 oper2
-:cl1 raw :privs Bubb
 :cl2 raw :privs Alex Alex
-sync cl1,cl2
+:cl1 wait cl2
+:cl1 raw :privs Bubb
+:cl1 nick A
+:cl1 nick Alexey
Index: ircu2.10/ircd/test/die.cmd
diff -u /dev/null ircu2.10/ircd/test/die.cmd:1.1
--- /dev/null   Tue May 10 21:15:16 2005
+++ ircu2.10/ircd/test/die.cmd  Tue May 10 21:15:04 2005
@@ -0,0 +1,5 @@
+connect cl1 Alex alex localhost:7701 :Test client 1
+:cl1 oper oper1 oper1
+:cl1 raw :restart brb
+:cl1 oper oper1 oper1
+:cl1 raw :die :testing over
Index: ircu2.10/ircd/test/gline-1.cmd
diff -u /dev/null ircu2.10/ircd/test/gline-1.cmd:1.1
--- /dev/null   Tue May 10 21:15:16 2005
+++ ircu2.10/ircd/test/gline-1.cmd      Tue May 10 21:15:04 2005
@@ -0,0 +1,26 @@
+define srv localhost:7701
+
+connect cl1 Alex alex %srv% :Test client 1
+:cl1 oper oper1 oper1
+:cl1 raw :gline !+$Rbubb 30 :Bubb is not welcome here
+:cl1 sleep 35
+:cl1 raw :gline !+127.2.* 3600 :Localclone?
+:cl1 sleep 5
+:cl1 raw :gline !+127.2.* 3600 :Localclone?
+connect cl2 Bubb bubb %srv% :Test client 2
+:cl1 raw :gline
+:cl1 raw :gline $Rbubb
+:cl1 raw :gline -$Rbubb
+:cl1 wait cl2
+:cl1 raw :gline !+$Rbubb * 3600 :Bubb is not welcome here
+:cl1 sleep 5
+:cl1 raw :gline -$Rbubb
+:cl1 raw :gline +#warez 30 :Warez r bad mmkay
+:cl2 wait cl1
+:cl2 join #warez
+:cl1 sleep 35
+:cl1 raw :stats glines
+:cl1 raw :gline [EMAIL PROTECTED] 3600 :Localclone?
+:cl1 raw :gline !+127.1.* 3600 :Localclone?
+:cl1 raw :stats memory
+:cl2 raw :gline
Index: ircu2.10/ircd/test/ircd-t1.conf
diff -u ircu2.10/ircd/test/ircd-t1.conf:1.1 ircu2.10/ircd/test/ircd-t1.conf:1.2
--- ircu2.10/ircd/test/ircd-t1.conf:1.1 Mon May  9 20:43:09 2005
+++ ircu2.10/ircd/test/ircd-t1.conf     Tue May 10 21:15:04 2005
@@ -70,6 +70,9 @@
 
 Operator { name = "oper1"; host = "[EMAIL PROTECTED]"; password = 
"$PLAIN$oper1"; class = "Opers"; };
 Operator { name = "oper2"; host = "[EMAIL PROTECTED]"; password = 
"$PLAIN$oper2"; class = "Opers"; local = yes; };
+Operator { name = "oldoper"; host = "[EMAIL PROTECTED]"; password = 
"Xlfc26b4eYGWs"; class = "Opers"; };
+Operator { name = "md5oper"; host = "[EMAIL PROTECTED]"; password = 
"$SMD5$2O$4O.rSAmhE4Fg05MmG.047/"; class = "Opers"; };
+Operator { name = "cryptoper"; host = "[EMAIL PROTECTED]"; password = 
"$CRYPT$41ndrxPQu3B66"; class = "Opers"; };
 
 Kill { username = "sub7"; realname = "s*7*"; reason = "You are infected with a 
Trojan"; };
 Kill { realname = "Chloe"; reason = "drones"; };
Index: ircu2.10/ircd/test/run-tests.sh
diff -u /dev/null ircu2.10/ircd/test/run-tests.sh:1.1
--- /dev/null   Tue May 10 21:15:16 2005
+++ ircu2.10/ircd/test/run-tests.sh     Tue May 10 21:15:04 2005
@@ -0,0 +1,12 @@
+#! /bin/sh
+set -e
+srcdir=$1
+for script in channel-1 client-1 stats-1 gline-1 ; do
+  echo "Running test $script."
+  ${srcdir}/test-driver.pl ${srcdir}/${script}.cmd
+done
+echo "Terminating server."
+${srcdir}/test-driver.pl ${srcdir}/die.cmd
+../ircd -?
+../ircd -v
+../ircd -x 6 -k -d ${srcdir} -f ircd-t1.conf -c [EMAIL PROTECTED]
Index: ircu2.10/ircd/test/test-driver.pl
diff -u ircu2.10/ircd/test/test-driver.pl:1.1 
ircu2.10/ircd/test/test-driver.pl:1.2
--- ircu2.10/ircd/test/test-driver.pl:1.1       Mon May  9 20:43:09 2005
+++ ircu2.10/ircd/test/test-driver.pl   Tue May 10 21:15:04 2005
@@ -4,7 +4,7 @@
 # collection isn't broken.  POE is sometimes too clever for our good
 # in finding references to sessions, and keeps running even after we
 # want to stop.
-# $Id: test-driver.pl,v 1.1 2005/05/10 03:43:09 entrope Exp $
+# $Id: test-driver.pl,v 1.2 2005/05/11 04:15:04 entrope Exp $
 
 # This interprets a simple scripting language.  Lines starting with a
 # hash mark (#, aka octothorpe, pound sign, etc) are ignored.  The
@@ -132,6 +132,8 @@
       $heap->{irc_debug} = 1;
     } elsif ($arg =~ /^-V$/) {
       $heap->{verbose} = 1;
+    } elsif ($arg =~ /^-vhost=(.*)$/) {
+      $heap->{vhost} = $1;
     } else {
       die "Extra command-line argument $arg\n" if $heap->{script};
       $heap->{script} = new FileHandle($arg, 'r')
@@ -215,6 +217,8 @@
                                  Debug    => $heap->{irc_debug},
                                }
                    };
+      $client->params->{LocalAddr} = $heap->{vhost}
+        if $heap->{vhost};
       $heap->{clients}->{$client->{name}} = $client;
       $heap->{sessions}->{$client->{irc}} = $client;
       $kernel->call($client->{irc}, 'register', 'all');
Index: ircu2.10/ircd/umkpasswd.c
diff -u ircu2.10/ircd/umkpasswd.c:1.7 ircu2.10/ircd/umkpasswd.c:1.8
--- ircu2.10/ircd/umkpasswd.c:1.7       Sun Mar 20 08:06:30 2005
+++ ircu2.10/ircd/umkpasswd.c   Tue May 10 21:15:04 2005
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: umkpasswd.c,v 1.7 2005/03/20 16:06:30 entrope Exp $
+ * $Id: umkpasswd.c,v 1.8 2005/05/11 04:15:04 entrope Exp $
 */
 #include "config.h"
 #include <unistd.h>
@@ -310,7 +310,7 @@
  salt = make_salt(default_salts);
 
  untagged = (char *)CryptFunc(crypt_mech->mech)(pw, salt);
- tagged = (char *)MyMalloc(strlen(salt)+CryptTokSize(crypt_mech->mech)+1);
+ tagged = (char *)MyMalloc(strlen(untagged)+CryptTokSize(crypt_mech->mech)+1);
  memset(tagged, 0, strlen(untagged)+CryptTokSize(crypt_mech->mech)+1);
  strncpy(tagged, CryptTok(crypt_mech->mech), CryptTokSize(crypt_mech->mech));
  strncpy(tagged+CryptTokSize(crypt_mech->mech), untagged, strlen(untagged));
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to