Avoid sending MODE +o to local channel creator, and more code coverage.
authorMichael Poole <mdpoole@troilus.org>
Wed, 11 May 2005 04:15:04 +0000 (04:15 +0000)
committerMichael Poole <mdpoole@troilus.org>
Wed, 11 May 2005 04:15:04 +0000 (04:15 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1403 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/channel.c
ircd/test/channel-1.cmd
ircd/test/client-1.cmd
ircd/test/die.cmd [new file with mode: 0644]
ircd/test/gline-1.cmd [new file with mode: 0644]
ircd/test/ircd-t1.conf
ircd/test/run-tests.sh [new file with mode: 0755]
ircd/test/test-driver.pl
ircd/umkpasswd.c

index 6913b1ca839a69931ba69792cc0753aeb0311805..11c9d8bb9a1d2294d18b6b5b432922df9fc88b00 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,18 @@
-n2005-08-09  Michael Poole <mdpoole@troilus.org>
+2005-08-10  Michael Poole <mdpoole@troilus.org>
+
+       * 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 <mdpoole@troilus.org>
 
        * ircd/ircd_parser.y: Move error tokens to top level of parse, and
        make ';' a synchronizing token for them.  This avoids crashes in
index 472d92759cf885dd5d7ea1f6586f52af54615eb2..4f30a65e3c6e204238bc0bd7b90c2b6131162731 100644 (file)
@@ -3416,7 +3416,7 @@ joinbuf_join(struct JoinBuf *jbuf, struct Channel *chan, unsigned int flags)
       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 5d8c5860cc38e30df497ce83271eb3338963889b..dfdcb8c4635151fd634027f22559c1d642833dc4 100644 (file)
@@ -45,6 +45,4 @@ connect cl2 Bubb bubb %srv% :Test client 2
 :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 ffb48531f24ddb05a9ee882deb1c836452454399..9a588c125b5770487abbb85fe8a29d6aea01e746 100644 (file)
@@ -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
diff --git a/ircd/test/die.cmd b/ircd/test/die.cmd
new file mode 100644 (file)
index 0000000..1ef7d95
--- /dev/null
@@ -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
diff --git a/ircd/test/gline-1.cmd b/ircd/test/gline-1.cmd
new file mode 100644 (file)
index 0000000..aa08dcc
--- /dev/null
@@ -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 !+*@127.0.0.2 3600 :Localclone?
+:cl1 raw :gline !+127.1.* 3600 :Localclone?
+:cl1 raw :stats memory
+:cl2 raw :gline
index 1662d127d6c73ab144372d767c3fddb37ac84989..92243ffb621d8e9207cd8e0131017772adb5a574 100644 (file)
@@ -70,6 +70,9 @@ Jupe {
 
 Operator { name = "oper1"; host = "*@*"; password = "$PLAIN$oper1"; class = "Opers"; };
 Operator { name = "oper2"; host = "*@*"; password = "$PLAIN$oper2"; class = "Opers"; local = yes; };
+Operator { name = "oldoper"; host = "*@*"; password = "Xlfc26b4eYGWs"; class = "Opers"; };
+Operator { name = "md5oper"; host = "*@*"; password = "$SMD5$2O$4O.rSAmhE4Fg05MmG.047/"; class = "Opers"; };
+Operator { name = "cryptoper"; host = "*@*"; password = "$CRYPT$41ndrxPQu3B66"; class = "Opers"; };
 
 Kill { username = "sub7"; realname = "s*7*"; reason = "You are infected with a Trojan"; };
 Kill { realname = "Chloe"; reason = "drones"; };
diff --git a/ircd/test/run-tests.sh b/ircd/test/run-tests.sh
new file mode 100755 (executable)
index 0000000..a2ef7c0
--- /dev/null
@@ -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 user@127.0.0.1
index 546c63c89faaf0eeec25208bd2399871c0c53824..7ee09cde50b2c45f46a548c711ffb63ca129c9e0 100755 (executable)
@@ -132,6 +132,8 @@ sub drv_start {
       $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 @@ sub drv_heartbeat {
                                  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 2eee9c01ec061b63a36fd2a4753e508e675ae738..27668bfea9e89d2efc8796f4f037eba5cca31d84 100644 (file)
@@ -310,7 +310,7 @@ char* salt, *untagged, *tagged;
  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));