Hi all,

I am using hhg's patch at

  http://hhg.to/popa3d/popa3d-0.6.3-vname-2.diff

but it doesn't seem to support directory hierarchies for
directory values in vnamemap. e.g.

  "mydomain.com:mydomain"

works, but

  "mydomain.com:anotherdir/mydomain"

won't.

I wrote the attached patch to allow the above to happen,
but is this safe?

Note that the patch can be applied to unpatched 1.0.2
and result in compilable virtual.c, but only makes
sense when popa3d-0.6.3-vname-2.diff is also applied.

- Andy


============================
http://webmechs.com/webpress
The Webmechs Webpress Blog
--- virtual.c.orig      2010-11-09 10:06:10.829767335 +0000
+++ virtual.c   2010-11-09 10:06:15.847769298 +0000
@@ -127,6 +127,7 @@ struct passwd *virtual_userpass(char *us
        char *address, *pathname;
        char *template, *passwd;
        int fail;
+    int vname_lookup_fail=1;
        int fd, size;
 
        *known = 0;
@@ -137,7 +138,9 @@ struct passwd *virtual_userpass(char *us
        virtual_spool = NULL;
 
 #if VIRTUAL_VNAME
-       if (!(address = vname_lookup(user)))
+       if (address = vname_lookup(user))
+      vname_lookup_fail=0;
+    else
 #endif
        if (!(address = lookup())) return NULL;
 
@@ -154,7 +157,7 @@ struct passwd *virtual_userpass(char *us
        }
 
 /* This "can't happen", but is just too critical to not check explicitly */
-       if (strchr(address, '/') || strchr(user, '/'))
+       if ( vname_lookup_fail && (strchr(address, '/') || strchr(user, '/')) )
                return NULL;
 
        pathname = concat(VIRTUAL_HOME_PATH, "/", address, NULL);

Reply via email to