From 8e8e305d1889640b81c92d92d4e1352997352b66 Mon Sep 17 00:00:00 2001 From: Dragan Dosen <bane@nekkar.carnet.hr> Date: Fri, 26 Mar 2010 14:21:22 +0100 Subject: [PATCH] Imported Upstream version 3.0 --- README | 1 + config_example.php | 9 ++ doc/.htaccess | 1 + doc/COPYING | 281 ++++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeLog | 144 +++++++++++++++++++++++++++ doc/FAQ | 26 +++++ doc/INSTALL | 59 +++++++++++ doc/README | 36 +++++++ doc/index.php | 13 +++ functions.php | 141 ++++++++++++++++++++++++++ index.php | 13 +++ options.php | 127 ++++++++++++++++++++++++ setup.php | 34 +++++++ version | 2 + 14 files changed, 887 insertions(+) create mode 100644 README create mode 100644 config_example.php create mode 100644 doc/.htaccess create mode 100644 doc/COPYING create mode 100644 doc/ChangeLog create mode 100644 doc/FAQ create mode 100644 doc/INSTALL create mode 100644 doc/README create mode 100644 doc/index.php create mode 100644 functions.php create mode 100644 index.php create mode 100644 options.php create mode 100644 setup.php create mode 100644 version diff --git a/README b/README new file mode 100644 index 0000000..dd0e567 --- /dev/null +++ b/README @@ -0,0 +1 @@ +See the documentation in the doc/ directory. diff --git a/config_example.php b/config_example.php new file mode 100644 index 0000000..ba9b67a --- /dev/null +++ b/config_example.php @@ -0,0 +1,9 @@ +<?php + // The default server is the configured IMAP server + #$poppass_server = 'localhost'; + + // The default port is 106 + #$poppass_port = 106; + + $min_pass_length = 0; + $max_pass_length = 9999999; diff --git a/doc/.htaccess b/doc/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/doc/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/doc/COPYING b/doc/COPYING new file mode 100644 index 0000000..9cac679 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,281 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/doc/ChangeLog b/doc/ChangeLog new file mode 100644 index 0000000..5c46220 --- /dev/null +++ b/doc/ChangeLog @@ -0,0 +1,144 @@ +$Id: ChangeLog,v 1.2 2009/05/09 17:35:38 indiri69 Exp $ +* Sat May 9 2009 Seth Randall <indiri69@users.sourceforge.net> +- Code cleanups and changes +- Updated version number to 3.0 + +* Sat Jan 17 2009 Seth Randall <indiri69@users.sourceforge.net> +- Considerable rewrite + +* Sat Jun 23 2007 Seth Randall <indiri69@users.sourceforge.net> +- Added Bahasa Melayu translation by zamri <myzamri@gmail.com> + +* Sat Jun 9 2007 Seth Randall <indiri69@users.sourceforge.net> +- Updated version to 2.7a-1.4.x + +* Mon Jun 4 2007 Seth Randall <indiri69@users.sourceforge.net> +- Added Korean translation by LEE CHANG MIN <mostech@gmail.com>. +- Added Dutch translation by Sander Eerkes <sander@eerkes.eu>. + +* Sun Jun 3 2007 Seth Randall <indiri69@users.sourceforge.net> +- Added Swedish translation by Erik Lindgren <erk@gote.org>. + +* Wed Oct 4 2006 Tomas Kuliavas <tokul@users.sourceforge.net> +- Added Norwegian Bokmal translation by Svein Olav Bjerkeset + <sobjerke@users.sourceforge.net>. SquirrelMail tracker #1525721. + +* Sat Nov 19 2005 Seth Randall <sethr@missoulafcu.org> + +- Added FAQ +- Updated INSTALL and README files +- Added Slovenian translation (sl_SI) from "Sasa Stupar <sasa@stupar.homelinux.net> +- Added Czech translation (cs_CZ) from "Martin Å louf" <martinslouf@users.sourceforge.net> +- Updated Italian translation (it_IT) from "Salvatore Bocchetti" <salvatore.bocchetti@euroeuro.net> + +* Mon Jul 18 2005 Seth Randall <sethr@missoulafcu.org> + +- Added Finnish translation (fi_FI) from "Kari Mattsson" <kari AT trivore DOT com> + +* Thu Sep 16 2004 Seth Randall <sethr@missoulafcu.org> + +- Added Italian translation (it_IT) from "magomarcelo" <magomarcelo@altervista.org> + +* Wed Jul 21 2004 Seth Randall <sethr@missoulafcu.org> + +- Added option to specify a poppass server if it's different than the imap server +- Changed version number to 2.7-1.4.x + +* Wed Jun 30 2004 Seth Randall <sethr@missoualfcu.org> + +- Added Brazilian Portuguese translation (pt_BR) from "Edinardo Potrich" <edinardo@cbainfo.com.br> + +* Thu Dec 18 2003 Seth Randall <sethr@missoulafcu.org> + +- Minor updates to some translations +- Changed version number to 2.6-1.4.x + +* Wed Dec 17 2003 Seth Randall <sethr@missoulafcu.org> + +- Added French translation (fr_FR) from "Ludovic Marcotte" <ludovic@sophos.ca> + +* Sun Dec 7 2003 Seth Randall <sethr@missoulafcu.org> + +- Added German translation (de_DE) from "Steffen Beyer" <sbeyer@reactor.de> +- Accept 3xx codes after pass command (arguably wrong, but the poppass daemon + in the ports collection does it that way) +- Changed version number to 2.5-1.4.x + +* Sat Nov 8 2003 Seth Randall <sethr@missoulafcu.org> + +- Added Bulgarian translation (bg_BG) from "Marian Popov" <mano@pazardjik.com> + +* Mon Oct 20 2003 Seth Randall <sethr@missoulafcu.org> + +- Changed version number to 2.4-1.4.x + +* Wed Oct 1 2003 Seth Randall <sethr@missoulafcu.org> + +- Added Polish translation (pl_PL) from "Sebastian Turzynski" <buzz@zamek.gda.pl> + +* Thu Sep 25 2003 Seth Randall <sethr@missoulafcu.org> + +- Added Spanish (es_ES) translation from "grana canal10" <grana@canal10.com.uy> +- Explicitly define SQ_SESSION as the source of onetimepad + +* Fri Sep 19 2003 Seth Randall <sethr@missoulafcu.org> + +- Added translation support (thanks to Ruben Leote Mendes) +- Added Portuguese (Portugal) (pt_PT) translation from "Ruben Leote Mendes" <ruben@nocturno.org> +- Added change_pass_version in setup.php +- Changed version number to 2.3-1.4.x + +* Thu Jul 10 2003 Seth Randall <sethr@missoulafcu.org> + +- Removed poppassd software +- Added proper handling of 2xx and 3xx responses +- Changed version number to 2.2-1.4.x + +* Fri Apr 25 2003 Seth Randall <sethr@missoulafcu.org> + +- Added support for 300 after "user" command (thanks to Richard Gee) +- Added version file +- Changed version number to 2.1-1.4.x + +* Mon Apr 7 2003 Seth Randall <sethr@missoulafcu.org> + +- Updated for SquirrelMail 1.4.x +- Changed version number to 2.0-1.4.x + +* Tue Jan 7 2003 Seth Randall <sethr@missoulafcu.org> + +- Added courierpassd +- Changed version number to 1.5 + +* Wed Dec 18 2002 Seth Randall <sethr@missoulafcu.org> + +- Removed debug code +- Added a poppassd for some BSDs +- Changed version number to 1.4a + +* Thu Sep 26 2002 Seth Randall <sethr@missoulafcu.org> + +- Updated for SquirrelMail 1.2.8 +- Changed version number to 1.4 + +* Mon Mar 26 2001 Tyler Akins + +- Now uses the mail server address instead of hardcoding "localhost" +- Now forwards to correct URL (removes errors if you want to change your + password twice in a row) +- Changed version number to 1.3 + +* Tue Feb 6 2001 Tyler Akins + +- Added debug mode +- Better error message +- Better error checking +- No need to log out and back in after password change +- Changed version number to 1.2 + +* Tue Jan 23 2001 Tyler Akins + +- Changed variable and function names using change_pass_ as a prefix to + avoid conflict with other plugins as has been mentioned in the plugins + mailing list +- Changed version number to 1.1 diff --git a/doc/FAQ b/doc/FAQ new file mode 100644 index 0000000..8c5ec52 --- /dev/null +++ b/doc/FAQ @@ -0,0 +1,26 @@ +Q. I get an error saying "ERROR: Connection refused (111)" + +A. You don't have a poppass daemon running on the server you've selected. + Make certain you have followed the installation steps in the INSTALL + document and tested it as shown below. + +Q. The plugin does not seem to work + +A. Make sure you can change the password manually. + To test, try telneting into the daemon and changing a password: + + $ telnet localhost 106 + Trying 127.0.0.1... + Connected to localhost. + Escape character is '^]'. + 200 poppassd v1.8.1 hello, who are you? + user <username> + 200 Your password please. + pass <oldpassword> + 200 Your new password please. + newpass <newpassword> + 200 Password changed, thank-you. + quit + 200 Bye. + Connection closed by foreign host. + diff --git a/doc/INSTALL b/doc/INSTALL new file mode 100644 index 0000000..53ef501 --- /dev/null +++ b/doc/INSTALL @@ -0,0 +1,59 @@ +Installing change_pass +====================== +0) NOTE: This plugin is not needed for SquirrelMail 1.5.0 or above. + The functionality it provides is already included in the + change_password plugin that is part of 1.5.x. + +1) Start with untaring the file into the plugins directory. + Here is an example for the 3.0 version of the change_pass plugin. + + $ cd plugins + $ tar -zxf change_pass-3.0-1.4.0.tar.gz + +2) By default, the plugin will connect to the IMAP server configured + for SquirrelMail on port 106 to change passwords. + If you need to change any of the following: + IP address of your poppass server + poppass server port number (if not 106) + minimum or maximum password length + you will need to create a configuration file. + + Decide if you want to store the plugin configuration file + in the plugin directory or in the main SquirrelMail config + directory. + + A) To store the configuration file in the plugin directory, + change into the change_pass directory, copy config_example.php + to config.php and edit config.php, making adjustments as + you deem necessary. + + $ cd change_pass + $ cp config_example.php config.php + $ vi config.php + + B) To store the configuration file in the main SquirrelMail + config directory, change into the change_pass directory, + copy config_example.php to ../../config/config_change_pass.php + and edit ../../config/config_change_pass.php, making + adjustments as you deem necessary. + + $ cd change_pass + $ cp config_example.php ../../config/config_change_pass.php + $ vi ../../config/config_change_pass.php + +3) Go to your config directory and run conf.pl. Choose + option 8 and move the plugin from the "Available Plugins" + category to the "Installed Plugins" category. Save and + exit. + + $ cd ../../../../config/ + $ ./conf.pl + +4) If not being used with SquirrelMail 1.4.16+, + please verify that you have the "Compatibility" plugin + installed (but not necessarily activated). + +5) Translations are not included in this package. To get a + translation, download the language pack needed from: + + http://www.squirrelmail.org/download.php diff --git a/doc/README b/doc/README new file mode 100644 index 0000000..92d644c --- /dev/null +++ b/doc/README @@ -0,0 +1,36 @@ +change_pass plugin for SquirrelMail +=================================== +Version 3.0, 2009/05/09 + +Ritchie Low +Tyler Akins +Seth Randall <indiri69@users.sourceforge.net> + +Description +=========== +This is a Squirrelmail plugin to change password using the Poppassd service + +You can get poppassd compliant services from the following places: +Pawel Krawczyk http://ipsec.pl/meta/pawel-krawczyk-projekty-open-source.html (Supports PAM) +Andrew Stevenson ftp://ftp.ugh.net.au/pub/unix/poppwd +NetWin http://netwinsite.com/poppassd/ (Changes /etc/passwd) +Kerberos http://kpoppassd.sourceforge.net (Thank to Michael G. Rozman this link) +HP-UX 11.x http://barney.gonzaga.edu/~awithers/poppassd/ (link from above site) +BSD users should try the one from the ports collection for their brand of BSD first. +Courier users should try courierpassd at http://www.arda.homeunix.net/store/ + +poppassd must be running on your whatever server handles the passwords for your +mail server for this plugin to work. Other than that, you just need to add +this plugin to SquirrelMail (using the perl script or by editing config.php +by hand), and all should be fine. For full installation instructions, +see the INSTALL file. + +To change the server or port poppassd listens on, see the INSTALL file. + +If you experience problems, please see the INSTALL file and FAQ + +License +======= + +This plugin is released under the GNU General Public +License (see COPYING for details). diff --git a/doc/index.php b/doc/index.php new file mode 100644 index 0000000..5fbde0d --- /dev/null +++ b/doc/index.php @@ -0,0 +1,13 @@ +<?php + + /** + ** index.php -- Displays the main frameset + ** + ** Copyright (c) 1999-2009 The SquirrelMail development team + ** Licensed under the GNU GPL. For full terms see the file COPYING. + ** + ** Redirects to the login page. + ** + **/ + + header('Location:../index.php'); diff --git a/functions.php b/functions.php new file mode 100644 index 0000000..28ed9c2 --- /dev/null +++ b/functions.php @@ -0,0 +1,141 @@ +<?php +/* + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * $Id: functions.php,v 1.7 2009/05/14 02:33:01 indiri69 Exp $ + */ + +function change_pass_option_link_do() { + global $optpage_blocks; + + sq_change_text_domain('change_pass'); + $optpage_blocks[] = array( + 'name' => _("Change Password"), + 'url' => sqm_baseuri() . 'plugins/change_pass/options.php', + 'desc' => _("Use this to change your email password."), + 'js' => FALSE + ); + sq_change_text_domain('squirrelmail'); +} + +function change_pass_dochange($change_pass_old, $change_pass_new, $debug = false) { + global $username, $imapServerAddress; + $poppass_server = $imapServerAddress; + $poppass_port = 106; + + if(!@include(SM_PATH . 'config/config_change_pass.php')) { + @include(SM_PATH . 'plugins/change_pass/config.php'); + } + + $error_messages = array(); + + $pop_socket = @fsockopen($poppass_server, $poppass_port, $errno, $errstr); + if (!$pop_socket) { + sq_change_text_domain('change_pass'); + $error_messages[] = sprintf(_("Connection error: %s"), "$errstr ($errno)"); + sq_change_text_domain('squirrelmail'); + return $error_messages; + } + + // Look for a 2xx result to continue + $result = change_pass_readfb($pop_socket, $debug); + if(preg_match('/^2\d\d/', $result)) { + // Send the username whose password to change + if(fwrite($pop_socket, "user $username\r\n")) { + $result = change_pass_readfb($pop_socket, $debug); + if(preg_match('/^[23]\d\d/', $result)) { + // Send the users current password + if(fwrite($pop_socket, "pass $change_pass_old\r\n")) { + $result = change_pass_readfb($pop_socket, $debug); + if(preg_match('/^[23]\d\d/', $result)) { + // Send the new password + if(fwrite($pop_socket, "newpass $change_pass_new\r\n")) { + $result = change_pass_readfb($pop_socket, $debug); + if(!preg_match('/^2\d\d/', $result)) { + sq_change_text_domain('change_pass'); + $error_messages[] = _("Password change was not successful!"); + sq_change_text_domain('squirrelmail'); + } else { + change_pass_closeport($pop_socket, $debug); + sqauth_save_password($change_pass_new); + session_write_close(); + header('Location: ' . sqm_baseuri() . 'src/options.php?optmode=submit&optpage=change_pass&plugin_change_pass=1'); + exit; + } + } + } + } + } + } + } + change_pass_closeport($pop_socket, $debug); + return $error_messages; +} + +function change_pass_closeport($pop_socket, $debug = false) { + if ($debug) { + $messages[] = "Closing Connection"; + } + fputs($pop_socket, "quit\r\n"); + fclose($pop_socket); +} + +function change_pass_readfb($pop_socket, $debug = false) { + $strResp = ''; + $result = ''; + + if (!feof($pop_socket)) { + $strResp = fgets($pop_socket, 1024); + $result = substr(trim($strResp), 0, 3); // 200, 300, 500 + if($debug) { + $messages[] = "--> $strResp"; + } + } + return $result; +} + +function change_pass_info_real() { + return array( + 'english_name' => 'Change Password', + 'authors' => array( + 'Richie Low' => array(), + 'Tyler Akins' => array(), + 'Seth Randall' => array( + 'email' => 'indiri69@users.sourceforge.net', + 'sm_site_username' => 'randall', + ), + ), + 'version' => '3.0', + 'required_sm_version' => '1.4.0', + 'requires_configuration' => 0, + 'requires_source_patch' => 0, + 'required_plugins' => array(), + 'per_version_requirements' => array( + '1.5.0' => SQ_INCOMPATIBLE, + '1.4.16' => array( + 'required_plugins' => array() + ), + '1.4.0' => array( + 'required_plugins' => array( + 'compatibility' => array( + 'version' => '2.0.13', + 'activate' => FALSE + ) + ) + ) + ), + 'summary' => 'Change passwords using a poppass daemon', + 'details' => 'Works with a compatible poppass daemon to allow users to change their passwords.' + ); +} + +function change_pass_loadinfo_real() { + global $optpage, $optpage_name; + + if ($optpage == 'change_pass') { + // i18n: is displayed after "Successfully Saved Options:" + sq_change_text_domain('change_pass'); + $optpage_name = _("User's Password"); + sq_change_text_domain('squirrelmail'); + } +} diff --git a/index.php b/index.php new file mode 100644 index 0000000..5fbde0d --- /dev/null +++ b/index.php @@ -0,0 +1,13 @@ +<?php + + /** + ** index.php -- Displays the main frameset + ** + ** Copyright (c) 1999-2009 The SquirrelMail development team + ** Licensed under the GNU GPL. For full terms see the file COPYING. + ** + ** Redirects to the login page. + ** + **/ + + header('Location:../index.php'); diff --git a/options.php b/options.php new file mode 100644 index 0000000..7649a3c --- /dev/null +++ b/options.php @@ -0,0 +1,127 @@ +<?php + +/* + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * $Id: options.php,v 1.7 2009/05/05 03:09:22 indiri69 Exp $ + */ + +define('SM_PATH', '../../'); +require_once(SM_PATH . 'include/validate.php'); +require_once(SM_PATH . 'functions/html.php'); +require_once(SM_PATH . 'functions/forms.php'); + +$debug = false; + +// Make sure the plugin is activated +global $plugins; +if(!in_array('change_pass', $plugins)) { + exit; +} + +$min_pass_length = 0; +$max_pass_length = 99999999; + +if (!@include(SM_PATH . 'config/config_change_pass.php')) { + @include(SM_PATH . 'plugins/change_pass/config.php'); +} + +include_once(SM_PATH . 'plugins/change_pass/functions.php'); + +global $color; +sqgetGlobalVar('change_pass_form', $change_pass_form, SQ_POST); + +$error_messages = array(); +$showform = true; + +if (isset($change_pass_form)) { + sq_change_text_domain('change_pass'); + sqgetGlobalVar('change_pass_old', $change_pass_old, SQ_POST); + sqgetGlobalVar('change_pass_new', $change_pass_new, SQ_POST); + sqgetGlobalVar('change_pass_verify', $change_pass_verify, SQ_POST); + + if(!isset($change_pass_old) || $change_pass_old == '') { + $error_messages['cp_no_old'] = _("You must type in your current password."); + } + + if(!isset($change_pass_new) || $change_pass_new == '') { + $error_messages['cp_no_new'] = _("You must type in a new password."); + } + + if(!isset($change_pass_verify) || $change_pass_verify == '') { + $error_messages['cp_no_verify'] = _("You must also type in your new password in the verify box."); + } + + if(!isset($error_messages['cp_no_new']) && !isset($error_messages['cp_no_verify'])) { + if($change_pass_new != $change_pass_verify) { + $error_messages['cp_new_mismatch'] = _("Your new password does not match the verify password."); + } else { + if (strlen($change_pass_new) < $min_pass_length || + strlen($change_pass_new) > $max_pass_length) { + $error_messages[] = sprintf(_("Your new password should be %s to %s characters long."), + $min_pass_length, $max_pass_length); + } + } + } + + $old_pass = sqauth_read_password(); + if(!isset($error_messages['cp_no_old']) && $change_pass_old != $old_pass) { + $error_messages['cp_wrong_old'] = _("Your current password is not correct."); + } + + if(count($error_messages) == 0) { + $error_messages = change_pass_dochange($change_pass_old, $change_pass_new, $debug); + if(count($error_messages) == 0) { + $showform = false; + } + } + sq_change_text_domain('squirrelmail'); +} +displayPageHeader($color, ''); +sq_change_text_domain('change_pass'); + +echo + html_tag('table', "\n" . + html_tag('tr', "\n" . + html_tag('td', '<b>' . _("Change Password") . '</b>', 'center', $color[0]) + ), + 'center', $color[9], 'width="95%" border="0" cellpadding="1" cellspacing="0"') . "<br>\n"; + +if(count($error_messages) > 0) { + echo html_tag('table', '', 'center', '', 'width="100%" border="0" cellpadding="1" cellspacing="0"'); + echo html_tag('tr'); + echo html_tag('td', '', 'center'); + echo html_tag('ul'); + foreach($error_messages as $line) { + echo html_tag('li', htmlspecialchars($line), '', '', 'style="color: ' . $color[2] . '"'); + } + echo html_tag('/ul'); + echo html_tag('tr', html_tag('td', ' ')) . "\n"; + echo html_tag('/table'); +} + +if($showform) { + echo addForm($PHP_SELF); + echo + html_tag('table', "\n" . + html_tag('tr', "\n" . + html_tag('td', _("Current Password:"), 'right') . + html_tag('td', addPwField('change_pass_old', ''), 'left') + ) . + html_tag('tr', "\n" . + html_tag('td', _("New Password:"), 'right') . + html_tag('td', addPwField('change_pass_new', ''), 'left') + ) . + html_tag('tr', "\n" . + html_tag('td', _("Verify New Password:"), 'right') . + html_tag('td', addPwField('change_pass_verify', ''), 'left') + ) . + html_tag('tr', "\n" . + html_tag('td', addSubmit(_('Change Password'), 'change_pass_form'), 'center', '', 'colspan="2"') + ), + 'center', '', 'border="0" cellpadding="1" cellspacing="0"') . "\n"; + echo html_tag('/form'); + echo html_tag('/body'); + echo html_tag('/html'); +} +sq_change_text_domain('squirrelmail'); diff --git a/setup.php b/setup.php new file mode 100644 index 0000000..a9f58fc --- /dev/null +++ b/setup.php @@ -0,0 +1,34 @@ +<?php + /* change_pass + * + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * $Id: setup.php,v 1.8 2009/05/05 03:09:22 indiri69 Exp $ + */ + +function squirrelmail_plugin_init_change_pass() { + global $squirrelmail_plugin_hooks; + + $squirrelmail_plugin_hooks['optpage_register_block']['change_pass'] = 'change_pass_opt'; + $squirrelmail_plugin_hooks['optpage_set_loadinfo']['change_pass'] = 'change_pass_loadinfo'; +} + +function change_pass_info() { + include_once(SM_PATH . 'plugins/change_pass/functions.php'); + return change_pass_info_real(); +} + +function change_pass_version() { + $info = change_pass_info(); + return $info['version']; +} + +function change_pass_opt() { + include_once(SM_PATH . 'plugins/change_pass/functions.php'); + change_pass_option_link_do(); +} + +function change_pass_loadinfo() { + include_once(SM_PATH . 'plugins/change_pass/functions.php'); + change_pass_loadinfo_real(); +} diff --git a/version b/version new file mode 100644 index 0000000..c553e1c --- /dev/null +++ b/version @@ -0,0 +1,2 @@ +Change Password +3.0 -- 1.7.10.4