diff -aur web-cyradm-0.5.4/config/conf.php.dist web-cyradm/config/conf.php.dist
--- web-cyradm-0.5.4/config/conf.php.dist	2004-04-04 08:31:37.000000000 -0700
+++ web-cyradm/config/conf.php.dist	2004-04-22 14:21:10.000000000 -0700
@@ -72,6 +72,24 @@
 ####
 $DOMAIN_AS_PREFIX = 0;
 
+# if you want to use cyrus 2.2.x's virtual domains support with fully
+# qualified usernames in the mailbox name you can set this option
+# ENABLE_FQUN to '1'.
+# NOTE: you must also set $CRYPT = "plain" unless you patch your sasl library
+# using the patch from http://frost.ath.cx/software/cyrus-sasl-patches/
+# with sasl auxprop's sql/mysql plugin in which case you can use "crypt".
+# In your sasl smtp.conf and your imapd.conf make your sql select statement
+# look like this:
+# select password from accountuser where username='%u@%r' or (username='%u' and domain_name='%r')
+# This will allow you to use a user with a non fully qualified username for
+# the admin user.
+# and add this line to your imapd.conf.
+#### imapd.conf: ####
+# virtdomains: yes
+
+####
+$ENABLE_FQUN = 0;
+
 # At the moment, web-cyradm supports two methods of password change:
 # - through sql
 # - poppassd
@@ -104,4 +122,3 @@
 
 # Define reserved Emailadresses (Separated by comma):
 $RESERVED="postmaster,root";
-
diff -aur web-cyradm-0.5.4/newaccount.php web-cyradm/newaccount.php
--- web-cyradm-0.5.4/newaccount.php	2003-08-14 11:58:12.000000000 -0700
+++ web-cyradm/newaccount.php	2004-04-07 16:12:17.000000000 -0700
@@ -99,7 +99,7 @@
 
 					<table>
 						<?php
-						if (!$DOMAIN_AS_PREFIX){
+						if (!($DOMAIN_AS_PREFIX || $ENABLE_FQUN)){
 							?>
 							<tr>
 								<td>
@@ -129,7 +129,7 @@
 								</td>
 								<!-- END Andreas Kreisl : freenames -->
 							</tr>
-							<?php
+						<?php
 						} // End of if (!$DOMAIN_AS_PREFIX)
 
 						$_fields = array(
@@ -193,6 +193,10 @@
 			} else {
 				$seperator	= '.';
 			}
+			if ($ENABLE_FQUN){
+				$username       = $email;
+				$username       = $username . "@" . $domain;
+			}	
 		    // check to see if there's an account with the same username
 		    $query3="select * from accountuser where username='$username'";
 		    $result3=$handle->query($query3);
@@ -217,10 +221,15 @@
 
 				$result=$handle->query($query3);
 
-				$query4 = "INSERT INTO virtual (alias, dest, username, status) values ( '" . $email . "@" . $domain . "' , '$username' , '$username' , '1')";
-
-				$result2 = $handle->query($query4);
-
+				// No need for virtual with the new
+				// virtual hosting capabilities in cyrus
+				if (!$ENABLE_FQUN){
+					$query4 = "INSERT INTO virtual (alias, dest, username, status) values ( '" . $email . "@" . $domain . "' , '$username' , '$username' , '1')";
+
+					$result2 = $handle->query($query4);
+				} else {
+					$result2=$result;
+				}
 				if ($result and $result2){
 					?>
 					<h3>

