Common subdirectories: popa3d-0.5.9/md5 and popa3d-0.5.9-vname/md5
diff -uN popa3d-0.5.9/params.h popa3d-0.5.9-vname/params.h
--- popa3d-0.5.9/params.h	Sun Sep  8 09:49:24 2002
+++ popa3d-0.5.9-vname/params.h	Mon Dec 16 22:13:31 2002
@@ -66,6 +66,20 @@
 #if POP_VIRTUAL
 
 /*
+ * Name-based virtual domain support by Hallgrimur H. Gunnarsson <hhg@data.is>
+ */
+#define VIRTUAL_VNAME			0
+
+#if VIRTUAL_VNAME
+
+/*
+ * VNAME_MAP path is relative to VIRTUAL_HOME_PATH.
+ */
+#define VNAME_MAP			"vnamemap"
+
+#endif
+
+/*
  * VIRTUAL_HOME_PATH is where the virtual domain root directories live.
  */
 #define VIRTUAL_HOME_PATH		"/vhome"
diff -uN popa3d-0.5.9/virtual.c popa3d-0.5.9-vname/virtual.c
--- popa3d-0.5.9/virtual.c	Mon Oct 22 10:10:36 2001
+++ popa3d-0.5.9-vname/virtual.c	Mon Dec 16 22:12:46 2002
@@ -38,6 +38,52 @@
 	return 0;
 }
 
+#if VIRTUAL_VNAME
+
+static char *vname_lookup(char *user)
+{
+	FILE *fp;
+	char *pathname;
+	char *user_domain, *domain, *address;
+	static char buffer[255];
+
+	if (!(user_domain = strchr(user, '@')) || !*user_domain) return NULL;
+
+	*user_domain++ = 0;
+
+	pathname = malloc(strlen(VIRTUAL_HOME_PATH) + strlen(VNAME_MAP) + 2);
+
+	if (!pathname) return NULL;
+
+	sprintf(pathname, "%s/%s", VIRTUAL_HOME_PATH, VNAME_MAP);
+
+	if (!(fp = fopen(pathname, "r"))) {
+		free(pathname);
+		return NULL;
+	}
+
+	free(pathname);
+
+	while (!feof(fp)) {
+		if (!fgets(buffer, sizeof(buffer), fp)) break;
+
+		if (feof(fp) && ferror(fp)) break;
+
+		buffer[strlen(buffer) - 1] = '\0';
+
+		if (!(domain = strtok(buffer, ":")) || !*domain) break;
+		if (!(address = strtok(NULL, ":")) || !*address) break;
+
+		if (!strcmp(user_domain, domain)) return address;
+	}
+
+	fclose(fp);
+
+	return NULL;
+}
+
+#endif
+
 static char *lookup(void)
 {
 	struct sockaddr_in sin;
@@ -85,6 +131,9 @@
 	virtual_domain = "UNKNOWN";
 	virtual_spool = NULL;
 
+#if VIRTUAL_VNAME
+	if (!(address = vname_lookup(user)))
+#endif
 	if (!(address = lookup())) return NULL;
 
 /* Authenticate globally (if supported) if run on a non-socket */
