diff -aur web-cyradm-0.5.4-1/change_password.php web-cyradm/change_password.php
--- web-cyradm-0.5.4-1/change_password.php 2004-03-21 11:02:01.000000000 -0800
+++ web-cyradm/change_password.php 2004-11-09 14:15:33.000000000 -0800
@@ -13,20 +13,31 @@
if ($authorized AND $new_password == $confirm_password){
- $query = "select * from virtual where alias='$alias'";
- $handle = DB::connect($DB['DSN'], true);
- if (DB::isError($handle)){
- die (_("Database error"));
- }
+ //With ENABLE_FQUN there are no usernames in virtual
+ if(! $ENABLE_FQUN ) {
+ $query = "select * from virtual where alias='$alias'";
+ $handle = DB::connect($DB['DSN'], true);
+ if (DB::isError($handle)){
+ die (_("Database error"));
+ }
- $result = $handle->query($query);
- $row = $result->fetchRow(DB_FETCHMODE_ASSOC, 0);
- $alias = $row['alias'];
- $dest = $row['dest'];
- $username = $row['username'];
+ $result = $handle->query($query);
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC, 0);
+ $alias = $row['alias'];
+ $dest = $row['dest'];
+ $username = $row['username'];
+ }
if (! empty($confirmed) && ("true" == $confirmed)){
if ($new_password == $confirm_password && $new_password != ""){
- $query = "select * from accountuser where username='$dest'";
+ //With ENABLE_FQUN there is no dest, only username
+ if( $ENABLE_FQUN )
+ {
+ $query = "select * from accountuser where username='$username'";
+ }
+ else
+ {
+ $query = "select * from accountuser where username='$dest'";
+ }
$handle = DB::connect($DB['DSN'], true);
if (DB::isError($handle)) {
die (_("Database error"));
@@ -57,6 +68,11 @@
include WC_BASE . "/browseaccounts.php";
} elseif ($PASSWORD_CHANGE_METHOD=="poppassd"){
include WC_BASE . '/lib/poppassd.php';
+ if( $ENABLE_FQUN )
+ {
+ //username is the username
+ $dest = $username;
+ }
$daemon = new poppassd;
if ($daemon->change_password($dest, $password, $new_password)) {
print ""._("Password changed")."
";
@@ -68,7 +84,7 @@
print ""._("New passwords are not equal. Password not changed")."";
}
}
- }
+ } // end confirmed
if (empty($confirmed) || ($confirmed != "true")){
// $test = ereg ("",$alias,$result_array);
@@ -80,7 +96,9 @@
-
+
+ ($ENABLE_FQUN)? echo $username : echo $dest;
+ ?>
diff -aur web-cyradm-0.5.4-1/config/conf.php.dist web-cyradm/config/conf.php.dist
--- web-cyradm-0.5.4-1/config/conf.php.dist 2004-04-04 10:17:02.000000000 -0700
+++ web-cyradm/config/conf.php.dist 2004-11-09 20:07:09.000000000 -0800
@@ -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 smtpd.conf and your imapd.conf make your sql_statement and
+# sasl_sql_statement look like this:
+# select password from accountuser where username='%u@%r' or (username='%u' and domain_name='')
+# 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-1/newaccount.php web-cyradm/newaccount.php
--- web-cyradm-0.5.4-1/newaccount.php 2003-08-14 11:58:12.000000000 -0700
+++ web-cyradm/newaccount.php 2004-11-09 16:10:13.000000000 -0800
@@ -99,7 +99,7 @@
@@ -129,7 +129,7 @@
|
- query($query3);
$cnt3=$result3->numRows();
- if ($cnt3!=0) {
+ if ($cnt3!=0) {
print "" .
_("Sorry, the username already exists") .
"
";
include WC_BASE . "/browseaccounts.php";
} else {
- if ($password == $confirm_password){
+ // No Empty Password
+ if ( empty($password) && empty($confirm_password) )
+ {
+ print "" .
+ _("Sorry, the password must not be empty") .
+ "
";
+ include WC_BASE . "/browseaccounts.php";
+ } elseif ($password == $confirm_password){
$pwd = new password;
$password = $pwd->encrypt($password, $CRYPT);
$query3="INSERT INTO accountuser (username, password, prefix, domain_name) VALUES ('" . $username . "','" . $password . "','" . $prefix . "','" . $domain . "')";
@@ -217,10 +228,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){
?>
diff -aur web-cyradm-0.5.4-1/search.php web-cyradm/search.php
--- web-cyradm-0.5.4-1/search.php 2003-11-30 04:13:43.000000000 -0800
+++ web-cyradm/search.php 2004-11-09 14:17:06.000000000 -0800
@@ -31,7 +31,15 @@
}
$query="SELECT * FROM domain a where domain_name LIKE '%$searchstring%' and $allowed_domains') ORDER BY domain_name";
-$query2="SELECT distinct a.username, a.domain_name FROM virtual as v, accountuser as a where ((v.username LIKE '%$searchstring%') or (v.alias LIKE '%$searchstring%')) and (v.username=a.username) and $allowed_domains') ORDER BY username";
+
+// Query Usernames
+if( $ENABLE_FQUN ) {
+ // If ENABLE_FQUN there is no email in the virtual table
+ // accountuser.username == email
+ $query2="SELECT distinct a.username, a.domain_name FROM accountuser as a where a.username LIKE '%$searchstring%' and $allowed_domains' ) ORDER BY username";
+} else {
+ $query2="SELECT distinct a.username, a.domain_name FROM virtual as v, accountuser as a where ((v.username LIKE '%$searchstring%') or (v.alias LIKE '%$searchstring%')) and (v.username=a.username) and $allowed_domains') ORDER BY username";
+}
$query3="SELECT DISTINCT alias, username FROM virtual WHERE (((dest LIKE '%$searchstring%') OR (alias LIKE '%$searchstring%')) AND (dest <> username) AND (username<>'') ) AND $allowed_domains3') ORDER BY username";
$result=$handle->query($query);
$result2=$handle->query($query2);
@@ -111,7 +119,15 @@
if (!isset($row_pos)){
$row_pos=0;
}
- $query="SELECT distinct a.username, a.domain_name FROM virtual as v, accountuser as a where ((v.username LIKE '%$searchstring%') or (v.alias LIKE '%$searchstring%')) and (v.username=a.username) and $allowed_domains') ORDER BY username";
+
+ // Query Usernames
+ if( $ENABLE_FQUN ) {
+ // If ENABLE_FQUN there is no email in the virtual table
+ // accountuser.username == email
+ $query="SELECT distinct a.username, a.domain_name FROM accountuser as a where a.username LIKE '%$searchstring%' and $allowed_domains' ) ORDER BY username";
+ } else {
+ $query="SELECT distinct a.username, a.domain_name FROM virtual as v, accountuser as a where ((v.username LIKE '%$searchstring%') or (v.alias LIKE '%$searchstring%')) and (v.username=a.username) and $allowed_domains') ORDER BY username";
+ }
$result=$handle->limitQuery($query,$row_pos,10);
$cnt=$result->numRows($result);