From c953f4b5cab310c5d4ab7f16289bfdaece05667f Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Wed, 15 Oct 2003 09:31:06 +0000 Subject: [PATCH] Make forking work properly. Organization: Straylight/Edgeware From: mdw --- mallory.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/mallory.c b/mallory.c index 267e9d47..c66b45f4 100644 --- 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 #include +#include + #include #include @@ -76,7 +81,6 @@ #include #include -#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) ; -- [mdw]