diff options
author | Jakub Moc <jakub@gentoo.org> | 2007-09-09 00:33:01 +0000 |
---|---|---|
committer | Jakub Moc <jakub@gentoo.org> | 2007-09-09 00:33:01 +0000 |
commit | 45060d860337ab1f1d3beb46266874e216ccd909 (patch) | |
tree | ca0902332781726e6f7791a0bb86359daa84b038 /net-mail/web-cyradm/files/web-cyradm-0.5.4-1.FQUN.20041109.diff | |
parent | Been InCVS for ages, remove (diff) | |
download | webapps-experimental-45060d860337ab1f1d3beb46266874e216ccd909.tar.gz webapps-experimental-45060d860337ab1f1d3beb46266874e216ccd909.tar.bz2 webapps-experimental-45060d860337ab1f1d3beb46266874e216ccd909.zip |
Move to net-mail
svn path=/experimental/; revision=473
Diffstat (limited to 'net-mail/web-cyradm/files/web-cyradm-0.5.4-1.FQUN.20041109.diff')
-rw-r--r-- | net-mail/web-cyradm/files/web-cyradm-0.5.4-1.FQUN.20041109.diff | 220 |
1 files changed, 220 insertions, 0 deletions
diff --git a/net-mail/web-cyradm/files/web-cyradm-0.5.4-1.FQUN.20041109.diff b/net-mail/web-cyradm/files/web-cyradm-0.5.4-1.FQUN.20041109.diff new file mode 100644 index 0000000..3cb9b9a --- /dev/null +++ b/net-mail/web-cyradm/files/web-cyradm-0.5.4-1.FQUN.20041109.diff @@ -0,0 +1,220 @@ +diff -aur web-cyradm-0.5.4-1/change_password.php web-cyradm/change_password.php +--- change_password.php 2004-03-21 11:02:01.000000000 -0800 ++++ 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 "<em><big>"._("Password changed")."</big></em><p><p>"; +@@ -68,7 +84,7 @@ + print "<b>"._("New passwords are not equal. Password not changed")."</b>"; + } + } +- } ++ } // end confirmed + if (empty($confirmed) || ($confirmed != "true")){ + // $test = ereg ("",$alias,$result_array); + +@@ -80,7 +96,9 @@ + <h3> + <?php print _("Change password for account");?> + <span style="color: red;"> +- <?php echo $dest;?> ++ <? ++ if ($ENABLE_FQUN) {echo $username;} else {echo $dest;} ++ ?> + </span> + </h3> + +diff -aur web-cyradm-0.5.4-1/config/conf.php.dist web-cyradm/config/conf.php.dist +--- config/conf.php 2004-04-04 10:17:02.000000000 -0700 ++++ config/conf.php 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 +--- newaccount.php 2003-08-14 11:58:12.000000000 -0700 ++++ newaccount.php 2004-11-09 16:10:13.000000000 -0800 +@@ -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,17 +193,28 @@ + } 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); + $cnt3=$result3->numRows(); +- if ($cnt3!=0) { ++ if ($cnt3!=0) { + print "<h3>" . + _("Sorry, the username already exists") . + "</h3><br>"; + include WC_BASE . "/browseaccounts.php"; + } else { +- if ($password == $confirm_password){ ++ // No Empty Password ++ if ( empty($password) && empty($confirm_password) ) ++ { ++ print "<h3>" . ++ _("Sorry, the password must not be empty") . ++ "</h3><br>"; ++ 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){ + ?> + <h3> +diff -aur web-cyradm-0.5.4-1/search.php web-cyradm/search.php +--- search.php 2003-11-30 04:13:43.000000000 -0800 ++++ 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); + |