chiark / gitweb /
Make forking work properly.
authormdw <mdw>
Wed, 15 Oct 2003 09:31:06 +0000 (09:31 +0000)
committermdw <mdw>
Wed, 15 Oct 2003 09:31:06 +0000 (09:31 +0000)
mallory.c

index 267e9d47148485132658d5676b6da56a82753a55..c66b45f4b703363f951d8f72d93dc01119ce8496 100644 (file)
--- a/mallory.c
+++ b/mallory.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: mallory.c,v 1.1 2001/06/19 22:11:14 mdw Exp $
+ * $Id: mallory.c,v 1.2 2003/10/15 09:31:06 mdw Exp $
  *
  * An evil proxy for TrIPE
  *
@@ -29,6 +29,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mallory.c,v $
+ * Revision 1.2  2003/10/15 09:31:06  mdw
+ * Make forking work properly.
+ *
  * Revision 1.1  2001/06/19 22:11:14  mdw
  * The beginnings of a malicious proxy for TrIPE.
  *
@@ -65,6 +68,8 @@
 #include <mLib/sub.h>
 #include <mLib/tv.h>
 
+#include <catacomb/buf.h>
+
 #include <catacomb/key.h>
 
 #include <catacomb/mp.h>
@@ -76,7 +81,6 @@
 #include <catacomb/rand.h>
 #include <catacomb/rc4.h>
 
-#include "buf.h"
 
 /*----- Data structures ---------------------------------------------------*/
 
@@ -212,18 +216,26 @@ static void addfork(filter *f, unsigned ac, char **av)
 
 static void nextfork(unsigned ac, char **av)
 {
-  unsigned i;
+  unsigned i, j;
   filter *f;
   forkfilt *ff;
   forknode *fn, **ffn;
   peer *p;
 
+  if (ac < 1)
+    die(1, "syntax: next:NAME:...");
   for (i = 0; i < 2; i++) {
     p = &peers[i];
     for (f = p->f; f; f = f->next) {
       if (f->func != dofork)
        continue;
       ff = f->state;
+      for (j = 0; j < ac; j++) {
+       if (strcmp(av[j], ff->name) == 0)
+         goto match;
+      }
+      continue;
+    match:
       fn = CREATE(forknode);
       for (ffn = &ff->fn; *ffn; ffn = &(*ffn)->next)
        ;