[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2.99.44 is out..



> Happy New Year to everybody !
> 
> I have installed 2.99.44 on the Linux box with kernel 2.0.27 and
> immediately got segfault while expanding aliases. (Sure I removed all the
> old .fc files !). The new binaries work just fine with the old
> 'aliases.cf', so this is 'listexpand' problem. Here's a GDB output: 
...
> Any ideas ?

	Yes.  Patch at the end.
	(Great to have DEC ATOM-tools available at nic.funet.fi -- without
	 a heavy-duty memory access tracking malloc tracer it could have
	 been a triffle bit more difficult to figure out...)

> Alexandre Sidorenko		Senior System Administrator
> asid@microtec.net
> Internet Microtec, Montreal, QC

	/Matti Aarnio <mea@nic.funet.fi>

diff -u ../zmailer-2.99.43/router/functions.c router/functions.c
--- ../zmailer-2.99.43/router/functions.c	Mon Nov 11 18:33:19 1996
+++ router/functions.c	Sat Dec 28 05:12:45 1996
@@ -91,7 +91,7 @@
 extern void setfreefd();
 extern void v_purge();
 
-extern char *newattribute_2 __((struct conscell *, char *, char*));
+extern char *newattribute_2 __((char *, char *, char*));
 
 #ifndef strchr
 extern char *strchr(), *strrchr();
@@ -1256,9 +1256,8 @@
 	struct address *ap;
 	struct token **pt, *t;
 	struct addr *pp;
-	struct conscell *attributes, *tmp;
-	struct conscell *al, *alp = NULL;
-	char *localpart, *origaddr;
+	struct conscell *al, *alp = NULL, *tmp;
+	char *localpart, *origaddr, *attributenam;
 	int c, n, len, errflag, stuff;
 	volatile int cnt;
 	char *comment, *erroraddress;
@@ -1327,7 +1326,8 @@
 	tmp = il;
 	for (; tmp != NULL; tmp = cdr(tmp)) ++cnt; /* Count arguments.. */
 
-	if (errflag || cnt != 3) {
+	if (errflag || cnt != 3 ||
+	    !STRING(il) || !STRING(cdr(il)) || !STRING(cddr(il)) ) {
 		fprintf(stderr,
 			"Usage: %s [ -e error-address ] [ -E errors-to-address ] [-p privilege] [ -c comment ] [ -N notarystring ] $attribute $localpart $origaddr < /file/path \n",
 		car(avl)->string);
@@ -1337,11 +1337,9 @@
 		return NULL;
 	}
 
-	attributes = copycell(il);
-	car(attributes) = s_copy_tree(car(attributes));
-	cdr(attributes) = NULL;
-	localpart  = (char*) cdr(il)->string;
-	origaddr   = (char*) cddr(il)->string;
+	attributenam = (char*)    (il)->string;
+	localpart    = (char*) cdr(il)->string;
+	origaddr     = (char*) cddr(il)->string;
 
 	/* We (memory-)leak this stuff for a moment.. */
 	e = (struct envelope *)tmalloc(sizeof (struct envelope));
@@ -1485,6 +1483,7 @@
 	for (ap = hs.h_contents.a; ap != NULL; ap = ap->a_next) {
 		char *av[5];
 		int rc;
+		int omem;
 		struct conscell *l, *d, *lrc;
 		char *s, *s2, *se;
 
@@ -1522,20 +1521,29 @@
 		  ++s;
 		}
 		*s2 = 0;
-		s = newattribute_2(attributes,"DSN",DSNbuf);
+		s = newattribute_2(attributenam,"DSN",DSNbuf);
+
+		omem = stickymem;
+		/* stickymem = MEM_MALLOC; */
 
 		l       = newstring((u_char*)strsave(buf));
-		cdr(l)  = conststring((u_char*)origaddr);
+		cdr(l)  = newstring((u_char*)strsave(origaddr));
 		cddr(l) = newstring((u_char*)strsave(s));
 		l = ncons(l);
 
+		stickymem = omem;
+
 		deferit = 0;
 		v_set(DEFER, "");
 
 		rc = l_apply("rrouter", l);
 		lrc = s_value;
 		s_value = NULL;
-		s_free_tree(l); /* We can clean up the input list */
+
+		omem = stickymem;
+		/* stickymem = MEM_MALLOC;
+		   s_free_tree(l); */ /* We can clean up the input list */
+		stickymem = omem;
 #else
 		lrc = router(ap, privilege, "recipient");
 		rc = (lrc == NULL);
diff -u ../zmailer-2.99.43/router/shliaise.c router/shliaise.c
--- ../zmailer-2.99.43/router/shliaise.c	Thu Oct 31 19:03:47 1996
+++ router/shliaise.c	Sat Dec 28 04:13:13 1996
@@ -357,16 +357,13 @@
 /*
  *  newattribute_2()
  */
-char *newattribute_2(oattr,nam,val)
-struct conscell *oattr;
-char *nam, *val;
+char *newattribute_2(onam,nam,val)
+char *onam, *nam, *val;
 {
 	struct conscell *l, *lc, *tmp, **pl;
 	struct conscell	*l1;
 
-	if (!(LIST(oattr) && STRING(car(oattr))))
-	  return NULL;
-	l1 = v_find(car(oattr)->string);
+	l1 = v_find(onam);
 	if (!l1)
 	  return NULL;
 	l = copycell(cdr(l1));