dockapps/000077500000000000000000000000001242751507200126675ustar00rootroot00000000000000dockapps/AUTHORS000066400000000000000000000026601242751507200137430ustar00rootroot00000000000000 Copyrights This program was written by Gennady Belyakov [8]gb@ccat.elect.ru Exterior appearance was heavily derived from wminet, written by Dave Clark (clarkd@skynet.ca), Antoine Nulle (warp@xs4all.nl), Martijn Pieterse (pieterse@xs4all.nl) Some code (around mailbox checking, with some modifications) was taken from xled, written by Jan Schoenepauck (schoenep@uni-wuppertal.de) and Joachim Gassen (joachim@fb4-1112.uni-muenster.de) POP3 checking code was taken from wmpop3 by Scott Holden (scotth@thezone.net) Additional code was taken from xlassie, written by Trent Piepho Many thanks for: Angus Mackay (amackay@gusnet.cx) Jordi Mallach Pérez (jordi@sindominio.net) Eugene Bobin (gene@utb.ru) Helmut 'Kolbi' Kolb (office@kolbi.net) Vladimir Popov (pva48@mail.ru) Jorge García (Jorge.Garcia@uv.es) Nick Clarey (nclarey@3glab.com) Dwayne C. Litzenberger (dlitz@dlitz.net) Mark Hurley (debian4tux@telocity.com) Rob Funk (rfunk@funkinet.net) Neil Spring (nspring@cs.washington.edu) NAKAYAMA Takao (hoehoe@wakaba.jp) Jay T Francis (jtf@u880.org) David Smith (davidsmith@acm.org) Benoît Rouits (brouits@free.fr) Andelko Horvat (comel@srk.fer.hr) Jun-ichiro itojun Hagino (itojun@iijlab.net) Peter McAlpine (pmcalpin@uoguelph.ca) Paolo Gianrossi (paolino@yersinia.org) Sam Izzo (izzo@humbug.net) dockapps/COPYING000066400000000000000000000432541242751507200137320ustar00rootroot00000000000000 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 Lesser 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 How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. dockapps/ChangeLog000066400000000000000000002335511242751507200144520ustar00rootroot000000000000002014-11-07 Doug Torrance * wmbiff/Makefile.am: Remove sourceforgeupload target from Makefile; no longer needed. 2014-11-07 Doug Torrance * wmbiff/README, wmbiff/configure.ac, wmbiff/wmbiff/sample.wmbiffrc, wmbiff/wmbiff/wmbiff.1: Update email address. 2014-11-07 Doug Torrance * wmbiff/wmbiff/Imap4Client.c, wmbiff/wmbiff/Pop3Client.c: Use PACKAGE_BUGREPORT instead of hardcoding address. 2014-11-07 Doug Torrance * wmbiff/FAQ: Update FAQ. 2014-11-05 Doug Torrance * wmbiff/wmbiff/tlsComm.c, wmbiff/wmbiff/tlsComm.h: Fix cast to pointer from integer of different size compiler warning. 2014-11-05 Doug Torrance * wmbiff/wmbiff/gnutls-common.c, wmbiff/wmbiff/gnutls-common.h, wmbiff/wmbiff/tlsComm.c: Fix compiler warnings from deprecated gnutls types. 2014-11-05 Doug Torrance * wmbiff/wmbiff/wmbiff.1, wmbiff/wmbiff/wmbiffrc.5.in: Fix manpages. In particular, fix spelling-error-in-manpage, hyphen-used-as-minus-sign, and manpage-has-errors-from-man Lintian warnings from the Debian package. 2014-11-05 Doug Torrance * wmbiff/configure.ac: Remove arguments to AM_INIT_AUTOMAKE in configure.ac. This patch serves two purposes: - Avoid a " AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated" warning when running autoreconf. - Fix "syntax error near unexpected token" when running configure. 2014-11-05 Doug Torrance * wmbiff/INSTALL: Remove INSTALL; automatically generated by autotools. 2014-11-04 Doug Torrance * wmbiff/wmgeneral/wmgeneral.h: Increase number of actions to 40. Patch by Alberto Morales . For more information, see: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=589408 2014-11-04 Doug Torrance * wmbiff/wmbiff/Client.h, wmbiff/wmbiff/Imap4Client.c: Allow usernames with more than 32 characters. Patch by Tommaso Parisi . For more information, see: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=626393 2014-11-04 Doug Torrance * wmbiff/wmbiff/socket.c: Fix connection leak. Patch by Arnaud Giersch . For more information, see: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=663876 2014-11-04 Doug Torrance * wmbiff/scripts/security.debian.rb: Fix security.debian.rb script. Patch by Lothar Ketterer For more information, see: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525749 2014-11-04 Doug Torrance * wmbiff/wmbiff/gnutls-common.c: Remove LZO compression. GnuTLS LZO support was removed in version 3.0.0. Based on the patch by Andreas Metzler : http://sources.debian.net/src/wmbiff/0.4.27-2.3/debian/patches/15_no_more_LZO.diff/ For more information, see: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=638736 2014-10-05 Doug Torrance * wmbiff/AUTHORS, wmbiff/FAQ, wmbiff/Makefile.am, wmbiff/NEWS, wmbiff/README, wmbiff/TODO, wmbiff/autoconf/Makefile.am, wmbiff/configure.ac, wmbiff/scripts/security.debian.rb, wmbiff/wmbiff/Client.h, wmbiff/wmbiff/Imap4Client.c, wmbiff/wmbiff/Makefile.am, wmbiff/wmbiff/Pop3Client.c, wmbiff/wmbiff/ShellClient.c, wmbiff/wmbiff/charutil.c, wmbiff/wmbiff/charutil.h, wmbiff/wmbiff/gnutls-common.c, wmbiff/wmbiff/maildirClient.c, wmbiff/wmbiff/mboxClient.c, wmbiff/wmbiff/passwordMgr.c, wmbiff/wmbiff/sample.wmbiffrc, wmbiff/wmbiff/socket.c, wmbiff/wmbiff/test_wmbiff.c, wmbiff/wmbiff/tlsComm.c, wmbiff/wmbiff/tlsComm.h, wmbiff/wmbiff/wmbiff.1, wmbiff/wmbiff/wmbiff.c, wmbiff/wmbiff/wmbiffrc.5.in, wmbiff/wmgeneral/Makefile.am, wmbiff/wmgeneral/misc.c, wmbiff/wmgeneral/wmgeneral.c: Remove trailing whitespace. 2013-04-08 Gabriel VLASIU * wmbiff/wmbiff/Makefile.am, wmbiff/wmbiff/mboxClient.c, wmbiff/wmbiff/wmbiff-classic-master-led.xpm, wmbiff/wmbiff/wmbiff.1, wmbiff/wmbiff/wmbiff.c: Enable classic mode. 2013-04-08 Gabriel VLASIU * wmbiff/configure.ac, wmbiff/wmbiff/Imap4Client.c, wmbiff/wmbiff/Pop3Client.c, wmbiff/wmbiff/gnutls-common.c, wmbiff/wmbiff/test_tlscomm.c, wmbiff/wmbiff/test_wmbiff.c, wmbiff/wmbiff/tlsComm.c, wmbiff/wmbiff/wmbiff.c, wmbiff/wmbiff/wmbiffrc.5.in: Update gnutls code (require at least 2.2.0). 2013-04-08 Gabriel VLASIU * wmbiff/wmbiff/wmbiff.1: Remove gnomeicu from wmbif's manual. 2013-04-04 Gabriel VLASIU * wmbiff/wmgeneral/wmgeneral.c: Fix segfault when -display or -geometry argument is missing. 2013-04-04 Gabriel VLASIU * wmbiff/wmbiff/wmbiff.c: Free memory when using a custom skin. 2013-04-04 Gabriel VLASIU * wmbiff/wmbiff/wmbiff.c: Fix wmbiff restart. 2013-04-04 Gabriel VLASIU * wmbiff/wmbiff/gnutls-common.c: More gnutls casts. 2013-04-04 Gabriel VLASIU * wmbiff/wmbiff/wmbiff.c, wmbiff/wmgeneral/wmgeneral.c: Fix memory leaks pointed out by valgrind. 2013-04-04 Gabriel VLASIU * wmbiff/wmgeneral/Makefile.am, wmbiff/wmgeneral/list.c, wmbiff/wmgeneral/list.h, wmbiff/wmgeneral/misc.c: Remove unused files. 2013-04-03 Gabriel VLASIU * wmbiff/wmbiff/wmbiff.c: XKeycodeToKeysym is deprecated. 2013-04-03 Gabriel VLASIU * wmbiff/wmbiff/wmbiff.c: Remove unused variable. 2013-04-03 Gabriel VLASIU * wmbiff/wmbiff/gnutls-common.c, wmbiff/wmbiff/test_wmbiff.c, wmbiff/wmbiff/tlsComm.c: Fix signedness and/or cast. 2013-04-03 Gabriel VLASIU * wmbiff/wmbiff/Pop3Client.c: comparison between pointer and integer. 2013-04-03 Gabriel VLASIU * wmbiff/wmbiff/test_tlscomm.c: Add missing include. 2013-04-03 Gabriel VLASIU * wmbiff/wmbiff/wmbiff.1, wmbiff/wmbiff/wmbiffrc.5.in: Update manual for wmbiff and wmbiffrc. 2012-06-12 Wade Berrier * wmbiff/configure.ac, wmbiff/scripts/Makefile.am: slight automake/autoconf refresh AM_PATH_LIBGNUTLS seems to be obsolete. Replace the check with pkg-config using PKG_CHECK_MODULES. AM_CONFIG_HEADER also seems to be obsolete. Replace with AC_CONFIG_HEADER. Fix installing an extra script (security.debian.rb) 2012-06-05 Alexey I. Froloff * wmbiff/wmbiff/gnutls-common.c, wmbiff/wmbiff/socket.c, wmbiff/wmgeneral/list.c, wmbiff/wmgeneral/list.h, wmbiff/wmgeneral/misc.c: Mass update FSF address 2012-06-05 Alexey I. Froloff * wmbiff/configure.ac: Make autoreconf happy 2012-06-05 Alexey I. Froloff * wmbiff/Makefile.in, wmbiff/aclocal.m4, wmbiff/autoconf/Makefile.in, wmbiff/autoconf/depcomp, wmbiff/autoconf/install-sh, wmbiff/autoconf/missing, wmbiff/autoconf/mkinstalldirs, wmbiff/config.h.in, wmbiff/configure, wmbiff/scripts/Makefile.in, wmbiff/wmbiff/Makefile.in, wmbiff/wmbiff/wmbiffrc.5, wmbiff/wmgeneral/Makefile.in: Removed all autogenerated autotools and imake stuff There's no need to keep autogenerated files in repository. Those dockapps which use autotoold must be autoreconf'ed prior to build, those which use imake must be xmkmf'ed. As of wmbiff, AC_PATH_XTRA_CORRECTED was a hack to avoid bug in older autoconf version, which is no longer needed (it's 2012 now already). 2012-06-05 Alexey I. Froloff * wmbiff/COPYING: Mass update GPLv2 from http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 2011-03-21 Carlos R. Mafra * wmbiff/wmbiff-master-led.xpm, wmbiff/wmbiff.c: Change default colors 2011-03-21 Carlos R. Mafra * wmbiff/wmbiff.c: Remove trailing colon from mailbox label So now we have one extra char for the label name. 2011-03-21 Carlos R. Mafra * Makefile.am, README.licq, wmbiff/Client.h, wmbiff/LicqClient.c, wmbiff/Makefile.am, wmbiff/Makefile.in, wmbiff/sample.wmbiffrc, wmbiff/wmbiff.1, wmbiff/wmbiff.c: Remove Licq, gnomeicu and finger support 2011-03-21 Carlos R. Mafra * wmbiff/wmbiff.c: Raise sleep interval to 20 secs 2011-03-21 Carlos R. Mafra * wmbiff/wmbiff.c: Trivial code cleanups 2011-03-21 Carlos R. Mafra * wmbiff/wmbiff.c: Fix global notification Global notification would only work if all 'notify' commands for all mailboxes were unset (=='\0'). Fix that. 2011-03-21 Carlos R. Mafra * wmbiff/wmbiff.c: Remove autofetch on new email arrival 2011-03-21 Carlos R. Mafra * wmbiff/wmbiff.c: Remove 'beep' option for notification 2011-03-21 Carlos R. Mafra * wmbiff/wmbiff.c: Display "0" when there are no new emails ...instead of displaying the total number of emails in the mailbox. On my gmail account with +16k emails, there was not enough space to display the account label. Besides, the total number of emails is useless information anyway. 2005-10-08 Saturday 18:13 UTC -- Neil Spring * configure.ac: year stale 0.4.26 news 2005-10-07 Friday 03:07 UTC -- Neil Spring * wmbiff/wmbiff.c: fix debian #332540: prevent -c 'directory' from making wmbiff run away 2005-05-08 Sunday 21:31 UTC -- Neil Spring * wmbiff/: Client.h, MessageList.c, test_tlscomm.c, test_wmbiff.c, tlsComm.c, tlsComm.h, wmbiff.c: changes for gnutls 1.2 and attempt to make wmbiff more responsive to X events while communicating over the network 2004-12-12 Sunday 00:06 UTC -- Neil Spring * check-includes.rb: update the portability checker 2004-12-12 Sunday 00:05 UTC -- Neil Spring * wmgeneral/wmgeneral.c: allow KeyPress events through 2004-12-12 Sunday 00:03 UTC -- Neil Spring * wmbiff/passwordMgr.c: nicer debug message 2004-12-12 Sunday 00:02 UTC -- Neil Spring * wmbiff/: gnutls-common.c, test_wmbiff.c: compiler appeasement 2004-12-12 Sunday 00:01 UTC -- Neil Spring * wmbiff/: Pop3Client.c, wmbiff.c, wmbiffrc.5.in: tls and password asking support for pop3, keyboard event handling for the main window 2004-10-31 Sunday 22:09 UTC -- Neil Spring * wmbiff/tlsComm.c: indent and make tls_check_certificate void 2004-10-01 Friday 21:15 UTC -- Neil Spring * wmbiff/tlsComm.c: comment the SHUT_WR 2004-10-01 Friday 21:06 UTC -- Neil Spring * wmbiff/tlsComm.c: indent, and return if no certificate came back from the far side 2004-10-01 Friday 21:05 UTC -- Neil Spring * wmbiff/socket.c: thwack duplicate error messages about connecting to a remote server 2004-10-01 Friday 21:02 UTC -- Neil Spring * wmbiff/wmbiff.c: indent 2004-08-23 Monday 00:37 UTC -- Neil Spring * wmbiff/wmbiff.c: disable the secure memory warning (and its use) 2004-07-03 Saturday 23:45 UTC -- Neil Spring * FAQ: some faqs 2004-07-03 Saturday 23:43 UTC -- Neil Spring * scripts/security.debian.rb: handle the timeout error explicitly, better for disconnected operation 2004-07-03 Saturday 23:43 UTC -- Neil Spring * wmbiff/socket.c: strerror preferred to perror 2004-06-28 Monday 18:20 UTC -- Neil Spring * scripts/security.debian.rb: fix debian #256505: a small problem with the .wmbiff-sdr directory not being created 2004-06-23 Wednesday 21:51 UTC -- Neil Spring * configure.ac: 0.4.25 2004-06-23 Wednesday 21:46 UTC -- Neil Spring * configure.ac, wmbiff/tlsComm.c: probably fix the s390 debian build problems 2004-06-20 Sunday 01:03 UTC -- Neil Spring * wmbiff/tlsComm.c: oops, should pay attention to the retval of tls_compare_certificates 2004-06-19 Saturday 21:38 UTC -- Neil Spring * wmbiff/gnutls-common.c: warning cleanup 2004-06-19 Saturday 20:53 UTC -- Neil Spring * configure.ac, wmbiff/Client.h, wmbiff/Imap4Client.c, wmbiff/Pop3Client.c, wmbiff/gnutls-common.c, wmbiff/gnutls-common.h, wmbiff/tlsComm.c, wmbiff/wmbiff.c, wmgeneral/wmgeneral.c: 0.4.24, supporting newer gnutls, I think 2004-06-18 Friday 21:29 UTC -- Neil Spring * wmbiff/wmbiff.c: paranoid test to see if /var/mail/nspring is constructed wrong. 2004-04-28 Wednesday 00:19 UTC -- Neil Spring * wmbiff/: Client.h, charutil.c, socket.c, test_wmbiff.c, wmbiff.c: indent run 2004-04-28 Wednesday 00:18 UTC -- Neil Spring * wmbiff/: socket.c, test_wmbiff.c: handle ip addresses instead of hostnames in sock_connect 2004-04-27 Tuesday 23:35 UTC -- Neil Spring * configure.ac: 0.4.23 2004-04-27 Tuesday 23:31 UTC -- Neil Spring * wmbiff/test_wmbiff.c: ensure that sock_connect works with IP addresses 2004-04-21 Wednesday 21:53 UTC -- Neil Spring * wmbiff/Imap4Client.c: oops, broke the cacheHeaders flag 2004-04-20 Tuesday 04:55 UTC -- Neil Spring * wmbiff/: charutil.c, charutil.h, test_wmbiff.c, wmbiff.c: factor out comment stripping for testing, which seems to have passed 2004-04-06 Tuesday 20:58 UTC -- Neil Spring * wmbiff/: Imap4Client.c, Pop3Client.c, test_wmbiff.c: fix debian #242458 -- allow IP addresses as server names for IMAP mailboxes, and also for POP3 mailboxes 2004-03-28 Sunday 00:36 UTC -- Neil Spring * configure.ac: 0.4.22 2004-03-28 Sunday 00:28 UTC -- Neil Spring * wmbiff/: Client.h, Imap4Client.c, Pop3Client.c, ShellClient.c, charutil.c, maildirClient.c, mboxClient.c, passwordMgr.c, regulo.c, test_tlscomm.c, tlsComm.c, tlsComm.h, wmbiff.c: lots of indent changes and a change to let msglst enable header caching for imap 2004-03-12 Friday 21:35 UTC -- Neil Spring * wmbiff/wmbiffrc.5.in: mention courier imapd's means of specifying subfolders 2004-02-14 Saturday 18:10 UTC -- Neil Spring * wmbiff/Imap4Client.c: bugfix for cyrus imap servers, thanks to Jon Ramsey 2004-01-01 Thursday 23:47 UTC -- Neil Spring * configure.ac: really call it 0.4.20 2004-01-01 Thursday 07:47 UTC -- Neil Spring * AUTHORS, wmbiff/Client.h, wmbiff/Imap4Client.c, wmbiff/ShellClient.c, wmbiff/maildirClient.c, wmbiff/mboxClient.c, wmbiff/passwordMgr.c, wmbiff/wmbiff.c: Sam Izzo's patch 2003-12-30 Tuesday 19:44 UTC -- Neil Spring * Makefile.am, configure.ac: add --disable-crypto 2003-12-22 Monday 00:08 UTC -- Neil Spring * wmbiff/Imap4Client.c: print failure message if imap login fails 2003-11-09 Sunday 07:01 UTC -- Neil Spring * wmbiff/sample.wmbiffrc: mac os 10.3 mail responds to a different way of identifying the inbox 2003-11-09 Sunday 03:16 UTC -- Neil Spring * configure.ac: 0.4.19 2003-11-09 Sunday 03:16 UTC -- Neil Spring * wmbiff/test_tlscomm.c: fix bug #219787 2003-11-08 Saturday 23:46 UTC -- Neil Spring * Makefile.am: helper rule for sourceforge upload (I know, I know, maintenance cruft making it into the release, whatever) 2003-11-08 Saturday 23:46 UTC -- Neil Spring * wmbiff/Client.h: philosophical definition of truth 2003-11-08 Saturday 23:45 UTC -- Neil Spring * wmbiff/Imap4Client.c: because having both from and subject headers is no longer a way to tell when the end has happened, must clean up the completed command tag explicitly 2003-11-08 Saturday 23:44 UTC -- Neil Spring * wmbiff/passwordMgr.c: avoid compiler warning from inconsistent def of size_t as passed into printf 2003-11-08 Saturday 22:58 UTC -- Neil Spring * wmbiff/: ShellClient.c, charutil.c: strcpy is not defined to handle overlapping regions. valgrind complains, rightly, so reimplement lefttrim to avoid such behavior 2003-11-08 Saturday 22:17 UTC -- Neil Spring * wmbiff/wmbiff.c: bump up default_sleep_interval to clean up strace output while bored. 2003-11-08 Saturday 22:13 UTC -- Neil Spring * wmbiff/Imap4Client.c: handle messages without subject lines in msglst 2003-11-07 Friday 09:11 UTC -- Neil Spring * wmbiff/passwordMgr.c: panther (mac 10.3) does not appear to null-terminate passwords in the keychain for us 2003-10-29 Wednesday 18:15 UTC -- Neil Spring * wmbiff/: Imap4Client.c, Pop3Client.c: handle capitalized FROM and SUBJECT headers common typical of spam spam spam 2003-10-28 Tuesday 23:39 UTC -- Neil Spring * wmbiff/test_tlscomm.c: indent and add another check 2003-10-28 Tuesday 23:38 UTC -- Neil Spring * wmbiff/: Makefile.am, test_wmbiff.c: indent 2003-10-28 Tuesday 07:09 UTC -- Neil Spring * wmbiff/: Makefile.am, test_tlscomm.c: fix bug reported by Jingshao Chen with buffering trouble, and incorporate a regression test to keep it from accidentally popping up again 2003-10-28 Tuesday 06:56 UTC -- Neil Spring * wmbiff/: test_tlscomm.c, tlsComm.c: test for proper handling of buffering small bits of expected data 2003-10-26 Sunday 08:33 UTC -- Neil Spring * wmbiff/: Imap4Client.c, passwordMgr.c: sigh, I dislike running make indent 2003-10-26 Sunday 08:31 UTC -- Neil Spring * AUTHORS, wmbiff/Pop3Client.c, wmbiff/wmbiffrc.5.in: Paolo Gianrossi's patch to provide msglst support for pop3 mailboxes 2003-10-26 Sunday 07:42 UTC -- Neil Spring * check-includes.rb, wmbiff/maildirClient.c, wmbiff/socket.c: include file reordering, based on wisdom from porting some other networky code 2003-10-26 Sunday 07:31 UTC -- Neil Spring * scripts/security.debian.rb: fix some ruby1.8 warnings, minor cleanup 2003-10-10 Friday 18:00 UTC -- Neil Spring * configure.ac: 0.4.18 2003-10-10 Friday 15:59 UTC -- Neil Spring * scripts/security.debian.rb: fix ruby1.8's complaint. 2003-08-31 Sunday 18:05 UTC -- Neil Spring * configure.ac: 0.4.17 2003-08-31 Sunday 06:47 UTC -- Neil Spring * wmbiff/tlsComm.c: oops, looks like I resolved a conflict poorly 2003-08-31 Sunday 04:39 UTC -- Neil Spring * wmbiff/Makefile.am: build the test cases well 2003-08-31 Sunday 03:33 UTC -- Neil Spring * wmbiff/: test_wmbiff.c, tlsComm.h: check the newline bugfix 2003-08-31 Sunday 03:32 UTC -- Neil Spring * wmbiff/tlsComm.c: bugfix to avoid handing odd newlines badly 2003-07-31 Thursday 23:37 UTC -- Neil Spring * wmbiff/Imap4Client.c: fix some potential bugs - an access of freed memory and an uninitialized reference counter 2003-07-20 Sunday 00:52 UTC -- Neil Spring * wmbiff/: passwordMgr.c, test_wmbiff.c: fix a five-minute old regression test failure where null was returned instead of an empty string for an empty password. not sure it matters, but maybe. 2003-07-20 Sunday 00:44 UTC -- Neil Spring * wmbiff/passwordMgr.c: oops, I left a use-after-free bug in the askpass code 2003-07-19 Saturday 23:56 UTC -- Neil Spring * configure.ac, wmbiff/passwordMgr.c: use the apple keychain to grab passwords! I can very nearly forget about typing them in anymore 2003-07-10 Thursday 17:44 UTC -- Neil Spring * Makefile.am: ensure that the current directory is not setgid when making a distribution; this borks some untars 2003-07-07 Monday 09:00 UTC -- Neil Spring * wmbiff/Imap4Client.c: warnings cleanup 2003-07-07 Monday 08:57 UTC -- Neil Spring * configure.ac, wmbiff/Client.h, wmgeneral/wmgeneral.c: call it 0.4.16 2003-07-07 Monday 08:43 UTC -- Neil Spring * wmbiff/: Client.h, Imap4Client.c, passwordMgr.c, test_wmbiff.c: fix memfrob * bug (memfrob makes *'s zero, so password length must be tracked separately 2003-07-04 Friday 21:42 UTC -- Neil Spring * wmbiff/wmbiff.c: handle comments the way I meant to... 2003-07-03 Thursday 11:10 UTC -- Neil Spring * wmbiff/Imap4Client.c: switch the new header cache to use reference counting (better, but possibly buggy) instead of locking (dumb, and certainly buggy) 2003-07-03 Thursday 05:39 UTC -- Neil Spring * wmbiff/Imap4Client.c: try to avoid repetitive complaints of failed connections 2003-07-03 Thursday 05:34 UTC -- Neil Spring * wmbiff/socket.c: avoid repetitive error messages when hostname lookup fails (such as when disconnected) 2003-07-03 Thursday 05:33 UTC -- Neil Spring * wmgeneral/wmgeneral.c: last fix to geometry handling had a compiler warning 2003-07-03 Thursday 05:12 UTC -- Neil Spring * wmgeneral/wmgeneral.c: try doing geometry the way X intends it to be done, at least as far as I can tell. 2003-07-03 Thursday 01:03 UTC -- Neil Spring * wmbiff/wmbiff.c: make #'s comments only if preceded by whitespace or at the beginning of the line 2003-07-03 Thursday 00:53 UTC -- Neil Spring * wmbiff/wmbiff.c: looks like I'd broken the button click events recently 2003-07-03 Thursday 00:52 UTC -- Neil Spring * wmbiff/sample.wmbiffrc: osascript samples for driving mac mail using applescript 2003-06-30 Monday 23:42 UTC -- Neil Spring * wmbiff/: Imap4Client.c, tlsComm.c: warning message beautification 2003-06-08 Sunday 07:01 UTC -- Neil Spring * wmbiff/: Client.h, Imap4Client.c, MessageList.c, MessageList.h, ShellClient.c: general rewrite of the msglst headers, so that the list is pre-cached for responsiveness. 2003-06-08 Sunday 06:59 UTC -- Neil Spring * wmbiff/wmbiffrc.5.in: document msglst and buttontwo 2003-06-08 Sunday 06:59 UTC -- Neil Spring * wmbiff/wmbiff.c: show a watch pointer while working behind the scenes 2003-06-03 Tuesday 04:57 UTC -- Neil Spring * autogen.sh: enable dependency tracking 2003-04-17 Thursday 05:04 UTC -- Neil Spring * scripts/security.debian.rb: trap socket errors 2003-04-17 Thursday 01:56 UTC -- Neil Spring * scripts/security.debian.rb: print the detailed version 2003-04-17 Thursday 01:56 UTC -- Neil Spring * wmbiff/: Client.h, ShellClient.c, passwordMgr.c: space for detail in grab command output, use the detail to populate a message list in a getheaders function (eg. can see the list of thought to be updated packages if using hte security.debian script 2003-04-17 Thursday 01:54 UTC -- Neil Spring * wmbiff/test-wmbiffrc.shell: test usingthe debian script, allows trying shell get headers 2003-04-17 Thursday 01:54 UTC -- Neil Spring * wmbiff/tlsComm.c: try to print a helpful hint message to use gnutls-cli-debug 2003-04-16 Wednesday 23:30 UTC -- Neil Spring * configure.ac: downgrade configure.ac use of AM_INIT_AUTOMAKE to support automake-1.5 2003-04-16 Wednesday 08:21 UTC -- Neil Spring * wmgeneral/wmgeneral.c: export GetColor 2003-04-16 Wednesday 08:18 UTC -- Neil Spring * wmbiff/: Client.h, Imap4Client.c, MessageList.c, MessageList.h, tlsComm.c, wmbiff.c: indent run 2003-04-16 Wednesday 08:16 UTC -- Neil Spring * wmbiff/Imap4Client.c: get headers / message list support 2003-04-16 Wednesday 08:16 UTC -- Neil Spring * wmbiff/Makefile.am: messagelist 2003-04-16 Wednesday 08:15 UTC -- Neil Spring * wmbiff/tlsComm.c: rename state to tls_state for clarity, small cleanup, fixes for buffering several lines in an expectation 2003-04-16 Wednesday 08:14 UTC -- Neil Spring * wmbiff/: wmbiff.c, Client.h: message list, button 2 support 2003-04-16 Wednesday 08:13 UTC -- Neil Spring * wmbiff/: MessageList.c, MessageList.h: list new messages, currently only with an imap driver 2003-04-09 Wednesday 04:51 UTC -- Neil Spring * autogen.sh: fall back to automake-1.5 if necessary 2003-04-07 Monday 10:10 UTC -- Neil Spring * wmbiff/tlsComm.c: invalid is returned when it doesn't match? 2003-04-07 Monday 09:41 UTC -- Neil Spring * wmbiff/tlsComm.c: fix some info messages - drop complaints about version 0.2.3 of gnutls, mention certfile. 2003-04-07 Monday 09:33 UTC -- Neil Spring * wmbiff/wmbiffrc.5.in: doc certfile 2003-04-07 Monday 09:16 UTC -- Neil Spring * wmbiff/tlsComm.c: handle certfile errors properly; positive return values from gnutls_certificate_set_x509_trust_file appear okay. 2003-03-30 Sunday 11:47 UTC -- Neil Spring * wmbiff/: passwordMgr.c, test_wmbiff.c: oh, now I get why that foolish null-termination was present. it's better now 2003-03-30 Sunday 11:23 UTC -- Neil Spring * configure.ac: 0.4.15 2003-03-30 Sunday 11:22 UTC -- Neil Spring * wmbiff/wmbiffrc.5.in: note the hash caveat 2003-03-30 Sunday 11:05 UTC -- Neil Spring * wmbiff/passwordMgr.c: remove (unreleased) foolhardy null-termination 2003-03-30 Sunday 10:57 UTC -- Neil Spring * wmbiff/test_wmbiff.c: just so as not to confuse anyone that wmbiff allows #'s in passwords 2003-03-30 Sunday 10:38 UTC -- Neil Spring * README, wmbiff/wmbiff.c, wmgeneral/wmgeneral.c, wmgeneral/wmgeneral.h: support setting the background color using -bg 2003-03-28 Friday 08:16 UTC -- Neil Spring * wmbiff/test_wmbiff.c: check that passwords with # can be parsed 2003-03-28 Friday 08:16 UTC -- Neil Spring * wmbiff/wmbiffrc.5.in: doc password parsing damage 2003-03-11 Tuesday 08:07 UTC -- Neil Spring * README: gnupg reorganized their website 2003-03-11 Tuesday 08:03 UTC -- Neil Spring * configure.ac: provide a helpful message as to where gnutls and libgcrypt can be found in configure.ac 2003-03-06 Thursday 21:15 UTC -- Neil Spring * wmbiff/wmbiff.c: fix debian bug #183529 2003-03-03 Monday 19:06 UTC -- Neil Spring * wmbiff/passwordMgr.c: make returned password length consistent with stored password length 2003-03-02 Sunday 02:37 UTC -- Neil Spring * configure.ac, wmbiff/Imap4Client.c, wmbiff/passwordMgr.c, wmbiff/passwordMgr.h: in-memory frobnication of imap passwords 2003-03-02 Sunday 02:17 UTC -- Neil Spring * wmbiff/: Imap4Client.c, Makefile.am, Pop3Client.c, regulo.c, regulo.h, socket.c, test_wmbiff.c, wmbiff.c: hostname paranoia patch -- use -relax to skip hostname validation check, parse ambiguous config lines 2003-03-02 Sunday 01:04 UTC -- Neil Spring * wmbiff/wmbiff.c, wmgeneral/wmgeneral.c: indent run 2003-02-13 Thursday 21:07 UTC -- Neil Spring * Makefile.am, configure.ac: 0.4.14 2003-02-08 Saturday 21:04 UTC -- Neil Spring * wmbiff/: wmbiff.1, wmbiffrc.5.in: document restart schemes 2003-02-08 Saturday 07:06 UTC -- Neil Spring * wmbiff/wmbiff.c: restart wmbiff also on ctrl-shift-left click 2003-02-08 Saturday 03:45 UTC -- Neil Spring * wmbiff/wmbiff.c: restart on sig usr1 using exec() 2003-02-08 Saturday 03:43 UTC -- Neil Spring * autogen.sh: I think symlink is okay for autoreconf 2003-02-08 Saturday 03:42 UTC -- Neil Spring * wmgeneral/: wmgeneral.c, wmgeneral.h: much prefer if wmgeneral proclaimed that it would not modify argv; I think it's even true 2003-01-28 Tuesday 11:14 UTC -- Neil Spring * configure.ac: remove check for gnuregex 2003-01-28 Tuesday 11:13 UTC -- Neil Spring * wmbiff/Imap4Client.c: bugfix to avoid problems with the new regex scheme and the default mailbox (aliasing sucks.) 2003-01-28 Tuesday 11:12 UTC -- Neil Spring * wmbiff/charutil.h: remove gnuregex.h incl 2003-01-28 Tuesday 11:12 UTC -- Neil Spring * wmbiff/wmbiff.c: newline after error message 2003-01-25 Saturday 04:54 UTC -- Neil Spring * autogen.sh: remove dangling symlinks config.guess, config.sub 2003-01-25 Saturday 04:33 UTC -- Neil Spring * wmgeneral/list.c: compiler warning appeasement (shadowing index) 2003-01-25 Saturday 04:32 UTC -- Neil Spring * wmbiff/Makefile.am: use the non gnu-make form of the indent-a-c-file rule 2003-01-22 Wednesday 01:56 UTC -- Neil Spring * autogen.sh: make sure ChangeLog exists locally. 2003-01-21 Tuesday 08:56 UTC -- Neil Spring * wmbiff/tlsComm.c: fix some minor damage when select is interrupted (EINTR) 2003-01-21 Tuesday 05:55 UTC -- Neil Spring * autogen.sh: warn if autoconf/libgnutls.m4 does not exist 2003-01-20 Monday 19:52 UTC -- Neil Spring * wmbiff/Makefile.am: add libgcrypt libraries if used to test_wmbiff 2003-01-20 Monday 19:52 UTC -- Neil Spring * configure.ac: remove possibly unneeded check for gdbm 2003-01-19 Sunday 13:13 UTC -- Neil Spring * wmbiff/: Client.h, Imap4Client.c, Makefile.am, Pop3Client.c, ShellClient.c, charutil.c, charutil.h, passwordMgr.c, test_wmbiff.c, tlsComm.c, wmbiff.c: general portability fixes, including HAVE___ATTRIBUTE__ 2003-01-19 Sunday 13:12 UTC -- Neil Spring * wmbiff/: regulo.c, regulo.h: posix based regular expression handling with a not so lame interface 2003-01-19 Sunday 13:11 UTC -- Neil Spring * configure.ac: portability fixes: HAVE___ATTRIBUTE__ (maybe), libnsl (solaris), -no-cpp-precomp (os x) 2003-01-04 Saturday 03:39 UTC -- Neil Spring * configure.ac, wmbiff/wmbiff.c: 0.4.12, release to fix bad -geometry handling 2003-01-03 Friday 20:37 UTC -- Neil Spring * wmbiff/wmbiff.c: fix geometry argument handling bug (Debian #175220) 2002-12-29 Sunday 07:46 UTC -- Neil Spring * scripts/security.debian.rb: I meant to say 6 hours 2002-12-29 Sunday 05:42 UTC -- Neil Spring * wmbiff/sample.wmbiffrc: shell recipe for security.debian.rb 2002-12-29 Sunday 05:28 UTC -- Neil Spring * scripts/security.debian.rb: didn't mean to commit with a 6 minute refresh interval 2002-12-29 Sunday 04:54 UTC -- Neil Spring * Makefile.am, check-includes.rb, configure.ac: add scripts subdirectory to build system 2002-12-29 Sunday 04:54 UTC -- Neil Spring * scripts/: Makefile.am, security.debian.rb: new scripts directory to hold debian security checker and install it. 2002-12-29 Sunday 03:25 UTC -- Neil Spring * wmbiff/wmbiff.c: general cleanup - use strdup_ordie, malloc_ordie. reduce using ints and chars interchangeably. static annotations on module-local variables 2002-12-29 Sunday 03:22 UTC -- Neil Spring * wmbiff/tlsComm.c: bad_certificate called as if void, so change the signature 2002-12-29 Sunday 03:22 UTC -- Neil Spring * configure.ac: autodetect whether to use poll() 2002-12-29 Sunday 02:47 UTC -- Neil Spring * wmgeneral/: Makefile.am, wmgeneral.c, wmgeneral.h: make AddMouseRegion take an unsigned int for the region index (which is an _index_ which means negative values need not apply) 2002-12-29 Sunday 02:31 UTC -- Neil Spring * wmbiff/: charutil.c, charutil.h: change signature of *Trim to reflect that they can't fail (void instead of int); the return values are ignored in wmbiff 2002-12-29 Sunday 01:36 UTC -- Neil Spring * wmbiff/wmbiff.c: reorder functions to avoid pre-declaration. should simplify reading the (now very long) code 2002-12-29 Sunday 01:11 UTC -- Neil Spring * wmgeneral/: misc.c, misc.h: exec command can take a const char * 2002-12-29 Sunday 01:05 UTC -- Neil Spring * wmbiff/sample.wmbiffrc: another askpass recipe 2002-12-29 Sunday 00:57 UTC -- Neil Spring * wmbiff/wmbiff.c: cleanup unused variables 2002-12-29 Sunday 00:57 UTC -- Neil Spring * wmbiff/Makefile.am: surgical indent rule 2002-12-29 Sunday 00:37 UTC -- Neil Spring * configure.ac, wmbiff/wmbiff.c: use automake/autoconf defined PACKAGE_VERSION and PACKAGE_BUGREPORT 2002-12-29 Sunday 00:15 UTC -- Neil Spring * wmbiff/passwordMgr.c: support arbitrarily long password query commands 2002-12-29 Sunday 00:14 UTC -- Neil Spring * wmbiff/wmbiff.c: configuration file parsing cleanup, support longer configuration options, remove some ad-hockery in favor of sscanf 2002-12-13 Friday 05:38 UTC -- Neil Spring * configure.ac, wmbiff/tlsComm.c, wmbiff/wmbiff.1, wmbiff/wmbiff.c: 0.4.10, -skip-certificate-check option 2002-12-09 Monday 21:45 UTC -- Neil Spring * AUTHORS, wmbiff/sample.wmbiffrc, wmbiff/wmbiff.c, wmbiff/wmbiffrc.5.in: Peter McAlpine's globalnotify patch 2002-12-09 Monday 21:45 UTC -- Neil Spring * wmbiff/Imap4Client.c: minor change to timeout behavior, just delay a while before next check 2002-12-02 Monday 07:16 UTC -- Neil Spring * configure.ac: require gnutls 0.5.9, release 0.4.9 2002-11-30 Saturday 07:58 UTC -- Neil Spring * wmbiff/Imap4Client.c: more robust ETIMEDOUT handling -- just chill out for a few minues rather than blacklist as a compromise between the responsiveness of not retrying unresponsive servers and the robustness of prodding on. the right thing is probably a non-blocking connect, but that's messy 2002-11-15 Friday 08:06 UTC -- Neil Spring * wmbiff/tlsComm.c: should really be able to catch these problems earler - without gnutls, the build would fail 2002-11-15 Friday 08:05 UTC -- Neil Spring * autogen.sh: red hat hackery 2002-11-13 Wednesday 06:44 UTC -- Neil Spring * wmbiff/wmbiff.1, wmbiff/wmbiff.c, wmgeneral/wmgeneral.c, wmgeneral/wmgeneral.h: a method for not using the withdrawn state 2002-11-12 Tuesday 08:27 UTC -- Neil Spring * Makefile.am, configure.ac, wmbiff/wmbiff.c, wmbiff/wmbiffrc.5.in, wmgeneral/wmgeneral.c, wmgeneral/wmgeneral.h: Allow automatic sizing of the wmbiff window, effective for other window managers. 2002-10-26 Saturday 23:17 UTC -- Jordi Mallach * FromCVS.sh, autogen.sh: Rename FromCVS.sh to autogen.sh, which is the "common" name for such script. 2002-10-26 Saturday 23:15 UTC -- Jordi Mallach * ChangeLog, Makefile.am, maint/changelog-header, maint/prerelease.sh: Stop doing the ChangeLog header hack. Instead, remove ChangeLog entirely from CVS and get it generated correctly on dist. Remove unneeded maint scripts. 2002-10-26 Saturday 23:12 UTC -- Jordi Mallach * FromCVS.sh: Add automake-1.7 support. 2002-10-20 Sunday 21:58 UTC -- Jordi Mallach * wmbiff/: wmbiff.1, wmbiffrc.5.in: do not specify Debian GNU/Linux... I'm actually more interested in the Hurd right now :) 2002-10-14 Monday 05:52 UTC -- Neil Spring * wmbiff/maildirClient.c: use mkstemp instead of mktemp to appease the compiler 2002-10-14 Monday 01:47 UTC -- Neil Spring * wmbiff/wmbiffrc.5.in: add the 'this file automatically generated' tag 2002-10-13 Sunday 21:28 UTC -- Neil Spring * wmbiff/: Imap4Client.c, tlsComm.c, tlsComm.h: Check certificate hostname, using gnutls's new function 2002-10-13 Sunday 21:27 UTC -- Neil Spring * wmbiff/Client.h: a formatting glitch 2002-10-13 Sunday 21:27 UTC -- Neil Spring * FromCVS.sh, Makefile.am: use autoreconf instead of the ad-hockery 2002-09-25 Wednesday 06:16 UTC -- Neil Spring * FAQ: why doesn't wmbiff update my mailbox count when I read a message 2002-09-20 Friday 19:50 UTC -- Neil Spring * FromCVS.sh: support redhat autoconf sadness 2002-09-19 Thursday 07:00 UTC -- Neil Spring * wmbiff/test_wmbiff.c: allow test to run when nnot linked with gnutls 2002-09-18 Wednesday 23:45 UTC -- Neil Spring * wmbiff/maildirClient.c: compiler warning fixes 2002-09-18 Wednesday 23:43 UTC -- Neil Spring * ChangeLog, configure.ac, wmbiff/Client.h, wmbiff/Imap4Client.c, wmbiff/Makefile.am, wmbiff/maildirClient.c, wmbiff/test_wmbiff.c, wmbiff/wmbiffrc.5.in: bugfix to allow imap mailbox filenames to contain spaces, test that it works; also, prepare 0.4.8 2002-09-14 Saturday 18:51 UTC -- Dwayne C. Litzenberger * wmbiff/: Client.h, maildirClient.c, wmbiffrc.5.in: * maildirClient: Added support for quick checking of writable network-mounted maildirs where directory caching normally causes unwanted delays. 2002-08-16 Friday 07:55 UTC -- Neil Spring * ChangeLog, configure.ac, autoconf/libgnutls.m4, wmbiff/Imap4Client.c, wmbiff/gnutls-common.c, wmbiff/gnutls-common.h, wmbiff/tlsComm.c: handle new gnutls/gnutls.h convention, release 0.4.7 2002-08-06 Tuesday 08:05 UTC -- Neil Spring * FromCVS.sh: seek out and use athe underrated automake 1.6. 2002-07-27 Saturday 17:50 UTC -- Neil Spring * wmbiff/: Imap4Client.c, tlsComm.c: trivial formatting fixes 2002-07-19 Friday 18:51 UTC -- Neil Spring * ChangeLog, configure.ac: release version 0.4.6 2002-07-18 Thursday 02:55 UTC -- Neil Spring * wmbiff/wmbiff.c: ignore sigpipe, possible bugfix for abnormal termination during suspend for imap/gnutls 2002-07-04 Thursday 08:00 UTC -- Neil Spring * ChangeLog, configure.ac: last minute changes for 0.4.5 2002-07-04 Thursday 01:07 UTC -- Neil Spring * wmbiff/: Imap4Client.c, Makefile.am, Pop3Client.c, charutil.c, tlsComm.c, wmbiff.c: valgrind debugging, and support for -exit. some bugs were probably fixed, but since nobody has noticed yet, I don't know if they mattered 2002-07-04 Thursday 00:45 UTC -- Neil Spring * wmgeneral/wmgeneral.c: reminder in where valgrind complains 2002-07-04 Thursday 00:45 UTC -- Neil Spring * Makefile.am: add a top-level 'indent' rule 2002-07-03 Wednesday 02:28 UTC -- Neil Spring * wmbiff/tlsComm.c: doubled the timeout to 40 seconds. 2002-06-26 Wednesday 19:04 UTC -- Neil Spring * ChangeLog, Makefile.am, autoconf/Makefile.am: die configure.in! die acconfig.h! 2002-06-26 Wednesday 18:56 UTC -- Neil Spring * ChangeLog, FromCVS.sh, Makefile.am, configure.ac, configure.in, autoconf/acconfig.h: migrate to newer autoconf (2.5) to try to debug making-from-scratch problem and get rid of acconfig.h cruft 2002-06-25 Tuesday 23:52 UTC -- Neil Spring * Makefile.am: tiny automake 1.6 fix (doesn't appear to use stamp-h. who knew.) 2002-06-25 Tuesday 23:33 UTC -- Neil Spring * autoconf/libgnutls.m4: trivial upstream bugfix 2002-06-25 Tuesday 23:29 UTC -- Neil Spring * wmbiff/Makefile.am: never underestimate the complexity of solutions involving automake 2002-06-25 Tuesday 23:24 UTC -- Neil Spring * configure.in, wmbiff/Makefile.am: corrections to conditional compilation of gnutls-common for automake 1.5 (and thereby the true automake way) 2002-06-25 Tuesday 23:15 UTC -- Neil Spring * configure.in, wmbiff/Makefile.am: only compile gnutls-common.[ch] if gnutls is configured in (duh), and only check for gcrypt.h if libgcrypt is installed and current 2002-06-24 Monday 07:18 UTC -- Neil Spring * ChangeLog, FromCVS.sh: roughly finished 0.4.4 2002-06-24 Monday 07:16 UTC -- Neil Spring * wmbiff/tlsComm.c: restore certificate checking 2002-06-24 Monday 07:15 UTC -- Neil Spring * wmbiff/: gnutls-common.c, gnutls-common.h: indent run 2002-06-24 Monday 01:23 UTC -- Neil Spring * wmbiff/Makefile.am, configure.in: basic gnutls 0.4.3 support (that is, it compiles.) 2002-06-24 Monday 01:18 UTC -- Neil Spring * wmbiff/: gnutls-common.c, gnutls-common.h, tlsComm.c: basic gnutls 0.4.3 support (that is, it compiles.) 2002-06-23 Sunday 01:26 UTC -- Neil Spring * wmbiff/wmbiff.c: cleanup to periodic mail checking, removal of the first mail check - now all cases are the same 2002-06-21 Friday 04:34 UTC -- Neil Spring * wmbiff/wmbiff.c: y_ and x_origin, and num_mailboxes constants, highlight color for fn, restructured mailbox creation routines 2002-06-21 Friday 04:31 UTC -- Neil Spring * wmbiff/Pop3Client.c: splint 2002-06-21 Friday 04:31 UTC -- Neil Spring * wmbiff/: LicqClient.c, ShellClient.c, charutil.c, maildirClient.c, mboxClient.c, passwordMgr.c, test_wmbiff.c: config.h 2002-06-21 Friday 04:30 UTC -- Neil Spring * wmbiff/Imap4Client.c: clarity and splint 2002-06-21 Friday 04:29 UTC -- Neil Spring * wmbiff/Client.h: splint support 2002-06-21 Friday 04:29 UTC -- Neil Spring * wmbiff/wmbiff.1: highlight color 2002-06-21 Friday 04:28 UTC -- Neil Spring * wmbiff/Makefile.am: verify that config.h is included in each .c file 2002-06-15 Saturday 09:05 UTC -- Neil Spring * configure.in: likely bugfix for newer autoconf? 2002-06-15 Saturday 09:04 UTC -- Neil Spring * Makefile.am: keep automake1.6 happy 2002-06-08 Saturday 22:22 UTC -- Neil Spring * ChangeLog, configure.in: release 0.4.3 final updates 2002-06-08 Saturday 22:20 UTC -- Neil Spring * wmbiff/wmbiff.c: make the background black when using fonts 2002-06-08 Saturday 22:15 UTC -- Neil Spring * wmgeneral/: wmgeneral.c, wmgeneral.h: font support, ability to erase rectangles 2002-06-08 Saturday 22:14 UTC -- Neil Spring * wmbiff/Client.h: slightly changed debug messages; exists() is more a test -f than a test -e 2002-06-08 Saturday 22:13 UTC -- Neil Spring * wmbiff/wmbiff.1: documentation of -fg and -font options 2002-06-08 Saturday 22:13 UTC -- Neil Spring * wmbiff/: Imap4Client.c, ShellClient.c: cleanup for splint annotations 2002-06-08 Saturday 22:13 UTC -- Neil Spring * wmbiff/wmbiff.c: basic font support, color selection, cleanup to default configuration code, bugifx and cleanup to mouse region code 2002-06-08 Saturday 21:40 UTC -- Neil Spring * wmbiff/socket.c: need config.h to get IPv6 support 2002-06-01 Saturday 18:10 UTC -- Neil Spring * ChangeLog: 0.4.2 2002-06-01 Saturday 17:58 UTC -- Neil Spring * configure.in, wmbiff/wmbiff.c: oops, didn't really want to release with the crazy font stuff quite yet 2002-06-01 Saturday 07:03 UTC -- Neil Spring * ChangeLog, configure.in, wmbiff/test-wmbiffrc.shell: release 0.4.1 2002-06-01 Saturday 07:01 UTC -- Neil Spring * AUTHORS: release preparation 2002-06-01 Saturday 06:47 UTC -- Neil Spring * wmgeneral/wmgeneral.h: prototypes for basic font support 2002-06-01 Saturday 06:47 UTC -- Neil Spring * wmgeneral/wmgeneral.c: indent run 2002-06-01 Saturday 06:02 UTC -- Neil Spring * wmbiff/: Client.h, ShellClient.c, charutil.c, mboxClient.c: indent run 2002-06-01 Saturday 06:01 UTC -- Neil Spring * wmbiff/wmbiff.c: font support, disabled by default 2002-06-01 Saturday 06:00 UTC -- Neil Spring * wmbiff/tlsComm.c: a start at certificate checking (a daunting task at the moment) 2002-06-01 Saturday 05:59 UTC -- Neil Spring * wmbiff/Client.h: declare exists() 2002-06-01 Saturday 05:51 UTC -- Neil Spring * wmgeneral/wmgeneral.c: some basic font support, renaming some variables for clarity 2002-06-01 Saturday 05:45 UTC -- Neil Spring * wmbiff/socket.c: correct date 2002-06-01 Saturday 05:42 UTC -- Neil Spring * configure.in, wmbiff/socket.c: IPv6 support using getaddrinfo from Jun-ichiro itojun Hagino 2002-05-03 Friday 05:51 UTC -- Neil Spring * ChangeLog, configure.in: Release 0.4.0 2002-05-03 Friday 05:51 UTC -- Neil Spring * Makefile.am: don't list TODO changes in ChangeLog, to avoid confusion 2002-05-03 Friday 05:43 UTC -- Neil Spring * wmbiff/mboxClient.c: type casting hackery to help architectures I don't have 2002-05-03 Friday 05:42 UTC -- Neil Spring * wmbiff/: sample.wmbiffrc, wmbiffrc.5.in: lpq example creep 2002-05-03 Friday 05:42 UTC -- Neil Spring * wmbiff/ShellClient.c: bugfix when alternates between numeric and text 2002-04-29 Monday 02:01 UTC -- Neil Spring * wmbiff/: Client.h, ShellClient.c, charutil.c, charutil.h: lclint cleanups - strdup_ordie, some null annotations 2002-04-27 Saturday 08:54 UTC -- Neil Spring * wmbiff/: Client.h, ShellClient.c, passwordMgr.c: cleanup to use grabCommandOutput in passwordMgr instead of duplicating the popen/fgets/pclose code 2002-04-27 Saturday 08:29 UTC -- Neil Spring * wmbiff/: Client.h, Makefile.am, charutil.c, passwordMgr.c, passwordMgr.h, test_wmbiff.c: move passwordMgr testing to test_wmbiff.c; catch a small bug in handling empty passwords 2002-04-27 Saturday 08:29 UTC -- Neil Spring * FromCVS.sh: apparently aclocal barfs when macros are defined both in the system directory and in a local copy. semper fragile. 2002-04-25 Thursday 20:28 UTC -- Neil Spring * README: add a note about gnutls version 0.3.5 2002-04-25 Thursday 18:33 UTC -- Neil Spring * configure.in: hack attempt at supporting gnutls built locally 2002-04-25 Thursday 17:31 UTC -- Neil Spring * ChangeLog, FromCVS.sh, autoconf/libgcrypt.m4, autoconf/libgnutls.m4: add m4 macros for libgcrypt and libgnutls to the repository, so that FromCVS can be run to regenerate configure.in, even on systems without gnutls. 2002-04-20 Saturday 09:55 UTC -- Neil Spring * wmbiff/Makefile.am: correct a problem uncovered by sourceforge's compile farm 2002-04-20 Saturday 09:27 UTC -- Neil Spring * wmbiff/ShellClient.c: BSD fix (no strndup, no sighandler_t) 2002-04-20 Saturday 09:12 UTC -- Neil Spring * wmbiff/: LicqClient.c, mboxClient.c: move msgs=-1 assignment on failure to the common openMailbox() 2002-04-20 Saturday 08:53 UTC -- Neil Spring * ChangeLog, configure.in, wmbiff/Client.h: update meta-information for prerelease 5 2002-04-20 Saturday 08:51 UTC -- Neil Spring * wmbiff/Makefile.am: correct syntax for making a test program 2002-04-20 Saturday 08:13 UTC -- Neil Spring * wmbiff/sample.wmbiffrc: finish deprecating 2002-04-20 Saturday 08:12 UTC -- Neil Spring * wmbiff/: sample.wmbiffrc, wmbiffrc.5.in: document back-tick expansion, deprecate mbox style without mbox: prefix 2002-04-20 Saturday 07:54 UTC -- Neil Spring * wmbiff/: Client.h, LicqClient.c, ShellClient.c, mboxClient.c: oops (indent) 2002-04-20 Saturday 07:53 UTC -- Neil Spring * wmbiff/: LicqClient.c, mboxClient.c: refactor mailbox stat()'ting to reduce duplicated code and supprort backticks. 2002-04-20 Saturday 07:52 UTC -- Neil Spring * wmbiff/ShellClient.c: refactor command execution code to support backtick foo expansion 2002-04-20 Saturday 07:50 UTC -- Neil Spring * wmbiff/: Makefile.am, test_wmbiff.c: add tests for bbacktick expansion 2002-04-20 Saturday 07:49 UTC -- Neil Spring * wmbiff/Client.h: ctime has become useless; new prototypes to handle backtick 2002-04-16 Tuesday 07:37 UTC -- Neil Spring * ChangeLog, wmbiff/Client.h, wmbiff/Imap4Client.c, wmbiff/LicqClient.c, wmbiff/Pop3Client.c, wmbiff/mboxClient.c, wmbiff/passwordMgr.c, wmbiff/wmbiff.c: remove vestigial pc->open() 2002-04-16 Tuesday 07:08 UTC -- Neil Spring * wmbiff/test-make.sh: unnecessary now that autoconf is involved 2002-04-15 Monday 22:58 UTC -- Neil Spring * Makefile.am: dist the FAQ 2002-04-15 Monday 21:19 UTC -- Neil Spring * wmgeneral/: Makefile.am, list.c, list.h, misc.c, misc.h, wmgeneral.c, wmgeneral.h: run make indent; also tolerate standard geometry string (dumping the dimensions provided) 2002-04-15 Monday 21:06 UTC -- Neil Spring * wmbiff/wmbiff.c: bugfix to sigchld_handler (argh) 2002-04-15 Monday 08:15 UTC -- Neil Spring * ChangeLog, Makefile.am, configure.in, wmbiff/Makefile.am, autoconf/Makefile.am: try to make the distcheck target work correctly. voodoo. 2002-04-15 Monday 08:14 UTC -- Neil Spring * FAQ: a little documentation 2002-04-15 Monday 02:21 UTC -- Neil Spring * wmbiff/wmbiff.c: treat all gicu messages as new (they're unread) 2002-04-15 Monday 02:10 UTC -- Neil Spring * configure.in: chmod 0444 wmbiffrc.5 to remind me not to try to edit it. 2002-04-15 Monday 02:09 UTC -- Neil Spring * wmbiff/wmbiffrc.5.in: document finger, changes to shell 2002-04-15 Monday 01:58 UTC -- Neil Spring * wmbiff/: ShellClient.c, wmbiff.c: waitpid until done 2002-04-15 Monday 01:48 UTC -- Neil Spring * configure.in: slightly nicer message 2002-04-15 Monday 01:47 UTC -- Neil Spring * ChangeLog, configure.in, wmbiff/wmbiff-master-contrast.xpm: 0.4.0pre4 - finger support, text from shell support, minor code reorganization 2002-04-15 Monday 01:38 UTC -- Neil Spring * AUTHORS, README: add Andelko Horvat to the list of contributors, remove author list from README 2002-04-15 Monday 01:30 UTC -- Neil Spring * wmbiff/test-wmbiffrc.shell: test finger as well 2002-04-15 Monday 01:30 UTC -- Neil Spring * wmbiff/Client.h: TextStatus to hold a three-character status message 2002-04-15 Monday 01:30 UTC -- Neil Spring * wmbiff/wmbiff.c: support TextString as status; factor blitMsgCounters as displayMsgCounters was starting to get ugly, add finger recipe to use ShellClient instead of a separate module 2002-04-15 Monday 01:26 UTC -- Neil Spring * wmbiff/passwordMgr.c: use chomp to remove the newline from ssh-askpass output 2002-04-15 Monday 01:26 UTC -- Neil Spring * wmbiff/: charutil.c, charutil.h: duplicate perl's chomp() 2002-04-15 Monday 01:26 UTC -- Neil Spring * wmbiff/ShellClient.c: return sigchld to default hander before using popen; handle text input. Much complexity, I hope it's worth it. 2002-04-15 Monday 01:25 UTC -- Neil Spring * wmbiff/wmbiff-master-led.xpm: support yellow text 2002-04-15 Monday 01:24 UTC -- Neil Spring * wmbiff/Makefile.am: derive wmbiff-master-contrast.xpm from wmbiff-master-led.xpm 2002-04-12 Friday 05:54 UTC -- Neil Spring * wmbiff/socket.c: extra debugging messages, to be in-line with our -debug to stdout philosophy 2002-04-11 Thursday 21:39 UTC -- Jordi Mallach * autoconf/: install-sh, missing, mkinstalldirs: Shouldn't be in CVS... 2002-04-11 Thursday 18:24 UTC -- Neil Spring * configure.in: attempt to fix Jordi's configure bug 2002-04-11 Thursday 07:24 UTC -- Neil Spring * wmbiff/Pop3Client.c: APOP bugfix (unreleased bug) 2002-04-09 Tuesday 07:52 UTC -- Neil Spring * ChangeLog, configure.in: bump version to 0.4.0pre3 - permissions checking for .wmbiffrc added. 2002-04-09 Tuesday 07:47 UTC -- Neil Spring * Makefile.am: try to tell the difference between running make dist with cvs and missing cvs2cl (an error), and running make dist without cvs (which should be ok). 2002-04-09 Tuesday 07:45 UTC -- Neil Spring * wmbiff/: LicqClient.c, maildirClient.c, mboxClient.c: some explicit casts to make compiling on non-linux a bit more warning-free 2002-04-09 Tuesday 07:44 UTC -- Neil Spring * wmbiff/wmbiff.c: permissions checking for .wmbiffrc (if it exists), some minor cleanup associated with this. 2002-04-09 Tuesday 07:43 UTC -- Neil Spring * wmbiff/Makefile.am: _DATA files don't get distributed, add the skins into extra_dist. automake can be confusing 2002-04-08 Monday 09:35 UTC -- Neil Spring * configure.in, wmbiff/wmbiffrc.5, wmbiff/wmbiffrc.5.in: automatically generate wmbiffrc.5 based on the results of configure, so that the configure-time chosen defaults are accurately shown 2002-04-07 Sunday 19:30 UTC -- Neil Spring * configure.in: don't try to configure gnutls if libz or libgdbm aren't installed 2002-04-07 Sunday 19:30 UTC -- Neil Spring * FromCVS.sh: allow for automake 1.5's need for depcomp 2002-04-07 Sunday 05:08 UTC -- Neil Spring * COPYING, ChangeLog, FromCVS.sh, INSTALL, Makefile.am, configure.in, autoconf/acconfig.h, autoconf/install-sh, autoconf/missing, autoconf/mkinstalldirs, maint/changelog-header, wmbiff/Client.h, wmbiff/Imap4Client.c, wmbiff/LicqClient.c, wmbiff/Makefile, wmbiff/Makefile.am, wmbiff/Pop3Client.c, wmbiff/charutil.h, wmbiff/maildirClient.c, wmbiff/mboxClient.c, wmbiff/tlsComm.c, wmbiff/wmbiff.c, wmgeneral/Makefile.am, wmgeneral/wmgeneral.c: use automake / autoconf; after checkout run ./FromCVS.sh 2002-04-07 Sunday 03:23 UTC -- Neil Spring * AUTHORS: automake required file, duplicated from README 2002-04-05 Friday 19:44 UTC -- Neil Spring * wmbiff/wmbiff-master-contrast.xpm: a first cut higher-contrast skin 2002-04-05 Friday 19:43 UTC -- Neil Spring * wmbiff/: Makefile, sample.wmbiffrc, test-make.sh, wmbiff.c: askpass - invoke ssh-askpass to fill in passwords for IMAP servers; skin - dynamically load an .xpm background 2002-04-05 Friday 19:42 UTC -- Neil Spring * wmbiff/wmbiffrc.5: documentation of askpass and skin 2002-04-05 Friday 19:08 UTC -- Neil Spring * wmbiff/tlsComm.c: explicit handling of timeouts 2002-04-05 Friday 19:02 UTC -- Neil Spring * wmbiff/passwordMgr.c: askpass having a space in it is an INFO, not an ERR. 2002-04-04 Thursday 08:51 UTC -- Neil Spring * wmbiff/: Client.h, Imap4Client.c, Makefile, Pop3Client.c, passwordMgr.c, passwordMgr.h, sample.wmbiffrc, test-make.sh: interactive password prompting support for imap - leave password in the : format blank to use 2002-03-26 Tuesday 16:30 UTC -- Jordi Mallach * ChangeLog, wmbiff/Makefile: Released WMBiff 0.3.8. 2002-03-18 Monday 09:47 UTC -- Neil Spring * wmgeneral/wmgeneral.h: un-shadow index 2002-03-18 Monday 09:46 UTC -- Neil Spring * wmgeneral/wmgeneral.c: un-shadow a global variable 2002-03-14 Thursday 08:51 UTC -- Neil Spring * README: correct and expand upon crypto instructions 2002-03-12 Tuesday 23:53 UTC -- Neil Spring * wmbiff/: Client.h, Imap4Client.c, Pop3Client.c, ShellClient.c, tlsComm.c: fixed misunderstanding of the use of ## in macros with strings - the compiler does the concatenation, not the preprocessor 2002-03-11 Monday 00:11 UTC -- Neil Spring * wmbiff/tlsComm.c: slightly better message on expect failure 2002-03-09 Saturday 08:50 UTC -- Neil Spring * wmbiff/ShellClient.c: debug messages cleanup; start handling pclose errors; remove open() function pointer assignment; #include fix 2002-03-09 Saturday 08:03 UTC -- Neil Spring * wmgeneral/: list.h, wmgeneral.c: minor warning cleanups 2002-03-08 Friday 19:26 UTC -- Neil Spring * README: credit Ben 2002-03-07 Thursday 22:20 UTC -- Neil Spring * wmbiff/ShellClient.c: fix error return status (ben's 'lil' patch) 2002-03-07 Thursday 07:04 UTC -- Neil Spring * wmbiff/ShellClient.c: appropriate credits 2002-03-06 Wednesday 18:01 UTC -- Neil Spring * wmbiff/ShellClient.c: fix my sloppy mistake in shell path parsing 2002-03-06 Wednesday 07:59 UTC -- Neil Spring * wmbiff/ShellClient.c: misplaced string.h 2002-03-06 Wednesday 07:59 UTC -- Neil Spring * wmbiff/wmbiff.c: rename in Read_Config_File for more 'index' purging 2002-03-06 Wednesday 07:44 UTC -- Neil Spring * wmbiff/ShellClient.c: fix a potential file descriptor leak 2002-03-06 Wednesday 07:15 UTC -- Neil Spring * wmbiff/: Client.h, Makefile, ShellClient.c, mboxClient.c, sample.wmbiffrc, test-wmbiffrc.shell, wmbiff.1, wmbiff.c, wmbiffrc.5: Draft shell command and gnomeicu support from Benoît Rouits with minor modifications 1) implement gicu using the shell module rather than as a separate module, 2) edit Ben's shell format to have extra colons for extensibility, 3) add some extra error checking in the shell method. I also added a test wmbiffrc that can be used to verify that the gicu and shell methods "work". 2002-03-05 Tuesday 05:02 UTC -- Dwayne C. Litzenberger * wmbiff/maildirClient.c: cosmetic changes 2002-03-04 Monday 06:57 UTC -- Neil Spring * wmbiff/mboxClient.c: convert a lingering fprintf to DM 2002-03-02 Saturday 23:25 UTC -- Neil Spring * wmbiff/: Imap4Client.c, Makefile, wmbiff.c: a little -Wshadow and -Wcast-qual cleanup (or, eliminate the use of 'index' as a variable name) 2002-03-02 Saturday 22:38 UTC -- Neil Spring * wmbiff/Client.h: add preprocessor define to handle portability of __attribute__ tag to non-gcc compilers (untested) 2002-03-02 Saturday 06:42 UTC -- Neil Spring * wmbiff/tlsComm.c: indent run (oops) 2002-03-02 Saturday 06:41 UTC -- Neil Spring * wmbiff/: Pop3Client.c, Imap4Client.c: minor reorganization of gcrypt-needing authentication schemes 2002-03-02 Saturday 06:39 UTC -- Neil Spring * wmbiff/tlsComm.c: attribute tags for warning cleanup w/o gnutls 2002-03-02 Saturday 06:36 UTC -- Neil Spring * wmbiff/wmbiff.c: gcc attribute tags, minor debug message cleanup 2002-03-02 Saturday 06:31 UTC -- Neil Spring * wmbiff/Makefile: rearrange which compiler warnings are implied by DEBUG 2002-03-02 Saturday 05:58 UTC -- Neil Spring * wmbiff/Client.h: use off_t instead of size_t in Licq and Maildir for file sizes from stat() 2002-03-02 Saturday 05:50 UTC -- Neil Spring * wmbiff/tlsComm.c: bugfix to support compilation without crypto 2002-03-01 Friday 11:58 UTC -- Jordi Mallach * wmbiff/wmbiff.c: Added -debug to help text. Removed Gennady's mail address and added our devel list. 2002-03-01 Friday 11:28 UTC -- Jordi Mallach * wmbiff/Makefile: Fixed install rule in Makefile. 2002-03-01 Friday 08:41 UTC -- Neil Spring * wmbiff/: Client.h, Imap4Client.c, LicqClient.c, Makefile, Pop3Client.c, maildirClient.c, mboxClient.c, tlsComm.c, tlsComm.h, wmbiff.1, wmbiff.c, wmbiffrc.5: Replaced DEBUG_x preprocessor defines with a -debug option and debug configuration keyword. Replaced most debugging messages with a DM (debug message) macro. Removed gnutls version 0.2.x support. Added troubleshooting section to man page. 2002-02-03 Sunday 22:48 UTC -- Jordi Mallach * ChangeLog: Released WMBiff 0.3.7. 2002-02-03 Sunday 22:43 UTC -- Jordi Mallach * wmbiff/Makefile: Bumped WMBIFF_VERSION to 0.3.7. 2002-02-02 Saturday 18:04 UTC -- Jordi Mallach * wmbiff/: Client.h, Imap4Client.c, Makefile, Pop3Client.c, charutil.h: Makefile fixes from Simon L. Nielsen, which help building wmbiff in FreeBSD. Fixed the previous IMAP regex patch. 2002-01-27 Sunday 20:20 UTC -- Jordi Mallach * ChangeLog, maint/changelog.sed, maint/prerelease.sh: Some fixes for the maint scripts. 2002-01-27 Sunday 19:59 UTC -- Jordi Mallach * ChangeLog: Released WMBiff 0.3.6. 2002-01-27 Sunday 19:56 UTC -- Jordi Mallach * wmbiff/Imap4Client.c: Indent fixes. 2002-01-27 Sunday 19:52 UTC -- Jordi Mallach * wmbiff/Makefile: Bump WMBIFF_VERSION to 0.3.6. 2002-01-27 Sunday 12:46 UTC -- Jordi Mallach * README, wmbiff/Imap4Client.c, wmbiff/Makefile, wmbiff/wmbiffrc.5: Alternate regex for imap/imaps which allows "@" in passwords. Fix to correctly handle the auth list in imap. Patch from David Smith . 2002-01-14 Monday 01:51 UTC -- Jordi Mallach * ChangeLog: Released WMBiff 0.3.5. 2002-01-14 Monday 01:50 UTC -- Jordi Mallach * wmbiff/Makefile: Bump WMBIFF_VERSION to 0.3.5. 2002-01-12 Saturday 19:18 UTC -- Neil Spring * wmbiff/Imap4Client.c: quote patch from Nick Mitchell, ref debian #128863 2002-01-12 Saturday 06:17 UTC -- Neil Spring * wmbiff/tlsComm.c: debugging for gnutls3 2002-01-12 Saturday 05:50 UTC -- Neil Spring * wmbiff/Makefile: clarify what to do with gnutls version define 2002-01-12 Saturday 05:30 UTC -- Neil Spring * wmbiff/: Makefile, charutil.c, tlsComm.c: update for the interface change in gnutls 0.3.0 2001-11-23 Friday 15:57 UTC -- Jordi Mallach * ChangeLog: Released WMBiff 0.3.4. 2001-11-23 Friday 15:55 UTC -- Jordi Mallach * wmbiff/Makefile: Bumped version to 0.3.4, and release. 2001-11-23 Friday 15:53 UTC -- Jordi Mallach * ChangeLog, wmbiff/sample.wmbiffrc: Doc updates for 0.3.4. 2001-11-16 Friday 07:11 UTC -- Neil Spring * wmbiff/: Imap4Client.c, Pop3Client.c, charutil.c: regexes limit password and username to 32 characters 2001-11-16 Friday 06:08 UTC -- Neil Spring * wmgeneral/: wmgeneral.c, wmgeneral.h: -Wwrite-strings cleanliness 2001-11-16 Friday 01:13 UTC -- Neil Spring * wmbiff/: Client.h, Imap4Client.c, Makefile, Pop3Client.c, charutil.c: rewrite of authentication code to a) allow users to specify authentication type, b) fall back to other authentication methods when hash-based authentication fails (because not everybody uses the cleartext password file) c) fix debug messages 2001-11-16 Friday 00:40 UTC -- Neil Spring * wmbiff/charutil.h: regex helpers common to pop3 and imap4 clients extracted and moved here 2001-11-16 Friday 00:40 UTC -- Neil Spring * wmbiff/: tlsComm.c, tlsComm.h: blacklist and debugging updates for gnutls 0.2.10 and DM macro 2001-11-16 Friday 00:39 UTC -- Neil Spring * wmbiff/wmbiffrc.5: authentication method list, reduced indentation to fit screen better 2001-11-16 Friday 00:38 UTC -- Neil Spring * wmbiff/wmbiff-master-led.xpm: made pixmap const char 2001-11-16 Friday 00:37 UTC -- Neil Spring * wmbiff/wmbiff.c: -Wwrite-strings cleanliness 2001-11-02 Friday 08:53 UTC -- Neil Spring * wmbiff/: Imap4Client.c, wmbiff.c, wmbiffrc.5: Prefer "imaps" instead of "sslimap" (sslimap is still supported, but imaps is documented, and a better name). 2001-11-02 Friday 08:48 UTC -- Neil Spring * wmbiff/tlsComm.c: Small debugging message to help if a connection ends unexpectedly. 2001-10-29 Monday 13:57 UTC -- Jordi Mallach * ChangeLog: Released WMBiff 0.3.3. 2001-10-29 Monday 13:54 UTC -- Jordi Mallach * wmbiff/: Imap4Client.c, wmbiff.c: Indent run. 2001-10-28 Sunday 23:32 UTC -- Jordi Mallach * ChangeLog, README, wmbiff/Makefile, wmbiff/sample.wmbiffrc: Preparation for 0.3.3. Documentation updates. 2001-10-28 Sunday 22:22 UTC -- Neil Spring * wmbiff/wmbiff.c: Bugfix: initialize libgcrypt properly before cram-md5 (or probably apop) authentication. 2001-10-24 Wednesday 15:35 UTC -- Jordi Mallach * maint/changelog.sed: Added Neil to the sed script. 2001-10-23 Tuesday 21:14 UTC -- Neil Spring * wmbiff/Imap4Client.c: error check just in case sighup patch is applied 2001-10-23 Tuesday 18:35 UTC -- Jordi Mallach * ChangeLog: Released WMBiff 0.3.2. 2001-10-23 Tuesday 18:33 UTC -- Jordi Mallach * wmbiff/Makefile: Bump WMBIFF_VERSION to 0.3.2. 2001-10-05 Friday 16:10 UTC -- Jordi Mallach * wmbiff/Makefile: Changed order of additions to LIBS and EXTRAFLAGS, removed extra WMBIFF_VERSION definition. 2001-10-04 Thursday 09:50 UTC -- Jordi Mallach * README, wmbiff/Client.h, wmbiff/Imap4Client.c, wmbiff/LicqClient.c, wmbiff/Makefile, wmbiff/Pop3Client.c, wmbiff/charutil.c, wmbiff/charutil.h, wmbiff/maildirClient.c, wmbiff/mboxClient.c, wmbiff/socket.c, wmbiff/tlsComm.c, wmbiff/tlsComm.h, wmbiff/wmbiff.1, wmbiff/wmbiff.c, wmbiff/wmbiffrc.5: * Big patch from Neil Spring which adds lots of crypto support to WMBiff. * WMBiff can now speak IMAP over TLS and CRAM-MD5, and APOP using libgcrypt. * Known problems: - gnutls is being developed still, so it may have security related bugs. - A bug in gnutls (a too-small buffer) may cause problems in the parsing of openssl certificates. This should be fixed by gnutls soon, hopefully. Added error messages if this bug is tickled. If you've got problems with IMAP SSL, please try upgrading gnutls. If the problem persists, let us know. - IMAP has totally been rewritten, so bugs may crop up. - Pop3 hasn't been rewritten to use the TLS primitives, though it probably could be if someone wanted to. * There's a new interface for reading and writing to the socket in tlsComm.[ch]. This makes the IMAP code somewhat independent of whether ssl is used, and provides nicer primitives to help skip 'informational' messages. * WITH_TLS and WITH_GCRYPT are on-by-default in the Makefile. TLS applies to encryption, GCRYPT to cram-md5 and apop authentication. Since gnutls depends on libgcrypt anyway, these probably don't need to be independent. Some compile warnings may be generated when these are disabled. * Added code to optionally include dmalloc.h and link -ldmalloc. This doesn't do anything at the moment, but shouldn't hurt. It's off-by-default. * IMAP connections are now persistent. persistent. This is to cut down on the need to re-negotiate an SSL connection every time you want to check mail. It tries to use just one connection per (server/username/password/port number), which means multiple mailboxes need only one connection. * There are a handful of lclint (http://lclint.cs.virginia.edu) annotations in tlsComm.[ch]. These should also not hurt anyone, and are meant to keep the signal to noise ratio of lclint high. * The rewritten IMAP code uses the GNU regex library to handle the configuration line. I think its clearer than the cascading strtok() solution, but the regex might not be perfect. * Removed an unnecessary "inline" keyword from charutil.h. * Added a TODO document with the bits that are missing from the picture. * Please bow in awe at NAKAYAMA Takao, Jay T. Francis and specially Neil Spring for all of this. 2001-10-04 Thursday 09:21 UTC -- Jordi Mallach * wmbiff/ApopClient.c: Removed unneeded Apop support code, now integrated in Neil and Jay's patch. 2001-10-04 Thursday 09:00 UTC -- Jordi Mallach * maint/changelog.sed: Added my other SF account, which I intend to use now. 2001-10-04 Thursday 08:54 UTC -- Jordi Mallach * ChangeLog, README, wmbiff/Client.h, wmbiff/Makefile, wmbiff/sample.wmbiffrc, wmbiff/wmbiff.1, wmbiff/wmbiff.c, wmbiff/wmbiffrc.5: Backed out hoehoe's patch, preparing to apply Neil's. 2001-09-24 Monday 11:58 UTC -- Jordi Mallach * ChangeLog, README, wmbiff/ApopClient.c, wmbiff/Client.h, wmbiff/Makefile, wmbiff/sample.wmbiffrc, wmbiff/wmbiff.1, wmbiff/wmbiff.c, wmbiff/wmbiffrc.5: Added APOP support, patch from NAKAYAMA Takao . Fixed some bits of the manpage (Jordi) Bumped version to 0.3.2. 2001-09-24 Monday 11:56 UTC -- Jordi Mallach * maint/prerelease.sh: Removed -t to cvs2cl invocation, to make cleaner ChangeLogs. 2001-06-24 Sunday 18:17 UTC -- Jordi Mallach * ChangeLog: Released wmbiff 0.3.1. 2001-06-24 Sunday 18:08 UTC -- Jordi Mallach * ChangeLog, README: Removed duplicate entry for Vladimir Popov in README. 2001-06-23 Saturday 00:09 UTC -- Jordi Mallach * wmbiff/Imap4Client.c: Imap fix from Rob Funk 2001-06-23 Saturday 00:07 UTC -- Jordi Mallach * ChangeLog, maint/changelog.sed, maint/prerelease.sh: Renamed CHANGES to ChangeLog and RELEASE-NOTES to NEWS, modified release scripts accordingly. Added Mark to the sed file. 2001-06-22 Friday 23:55 UTC -- Jordi Mallach * CHANGES, RELEASE-NOTES: Renamed to NEWS and ChangeLog 2001-06-19 Tuesday 03:52 UTC -- Dwayne C. Litzenberger * CHANGES, maint/prerelease.sh: * Whoops! Messed up CVS expansion in maint/prerelease.sh. Fixed it. * Also changed maint/prerelease.sh a bit. 2001-06-19 Tuesday 03:38 UTC -- Dwayne C. Litzenberger * CHANGES, ChangeLog, README, RELEASE-NOTES, maint/changelog.sed, maint/prerelease.sh, wmbiff/Client.h, wmbiff/Imap4Client.c, wmbiff/LicqClient.c, wmbiff/Makefile, wmbiff/Pop3Client.c, wmbiff/charutil.c, wmbiff/charutil.h, wmbiff/maildirClient.c, wmbiff/mboxClient.c, wmbiff/sample.wmbiffrc, wmbiff/socket.c, wmbiff/wmbiff.1, wmbiff/wmbiff.c, wmbiff/wmbiffrc.5: * Another big patch that mucks with everything. I probably deserve to be flamed for this practice. Feel free... :-) * Added maint/prerelease.sh script. Run it before making any releases. * Added maint/changelog.sed. Add your SourceForge userid here. * Moved ChangeLog to RELEASE-NOTES (see below). * Added a new file, CHANGES (created by maint/prerelease.sh) that tabulates all the CVS changes. * Added "distclean" to wmbiff/Makefile. * Added CVS Id$ to all the files in wmbiff/ . * I reformatted ths changelog, again. I hope this is the last time I need to do this. The CVS logs should be used for all changes, and this file should by updated for user-visible changes only, from now on. (Dwayne C. Litzenberger) * Updated the README to reflect that Gennady Belyakov died right after releasing wmBiff 0.2. May your soul rest in peace, Gennady. (Dwayne C. Litzenberger) 2001-06-16 Saturday 01:02 UTC -- Jordi Mallach * ChangeLog, wmbiff/Makefile, wmbiff/sample.wmbiffrc, wmbiff/wmbiff.c: An FHS fix for wmbiff.c and use $(CC) in the Makefile 2001-05-17 Thursday 04:22 UTC -- Dwayne C. Litzenberger * ChangeLog, wmbiff/Makefile, wmbiff/charutil.c: Committing Mark Hurley's patch 2001-05-16 Wednesday 10:48 UTC -- Jordi Mallach * ChangeLog, README: Updated some obsolete info in README 2001-05-11 Friday 15:04 UTC -- Jordi Mallach * ChangeLog, wmbiff/Imap4Client.c, wmbiff/Makefile, wmbiff/charutil.c, wmbiff/charutil.h, wmbiff/wmbiff.c: Mark's wmbiffrc parsing fix, small Makefile changes and bump version to 0.3.0. 2001-05-11 Friday 14:49 UTC -- Jordi Mallach * wmbiff/Makefile: Uncommitted stuff to deal with the removal of the xmp link 2001-05-04 Friday 11:01 UTC -- Jordi Mallach * ChangeLog, wmbiff/Makefile: Updated Changelog and Makefile for 0.2r. 2001-05-01 Tuesday 16:11 UTC -- Jordi Mallach * README.licq, ChangeLog, README, wmgeneral/list.c, wmgeneral/list.h, wmgeneral/misc.c, wmgeneral/misc.h, wmgeneral/wmgeneral.h, wmbiff/socket.c, wmgeneral/wmgeneral.c, wmbiff/Imap4Client.c, wmbiff/Makefile, wmbiff/mboxClient.c, wmbiff/sample.wmbiffrc, wmbiff/wmbiff.1, wmbiff/wmbiff.c, wmbiff/wmbiff-master-led.xpm, wmbiff/Client.h, wmbiff/LicqClient.c, wmbiff/Pop3Client.c, wmbiff/maildirClient.c, wmbiff/wmbiffrc.5: Initial import to SourceForge, version 0.2q1+Debian 2001-05-01 Tuesday 16:11 UTC -- Jordi Mallach * README.licq, ChangeLog, README, wmgeneral/list.c, wmgeneral/list.h, wmgeneral/misc.c, wmgeneral/misc.h, wmgeneral/wmgeneral.h, wmbiff/socket.c, wmgeneral/wmgeneral.c, wmbiff/Imap4Client.c, wmbiff/Makefile, wmbiff/mboxClient.c, wmbiff/sample.wmbiffrc, wmbiff/wmbiff.1, wmbiff/wmbiff.c, wmbiff/wmbiff-master-led.xpm, wmbiff/Client.h, wmbiff/LicqClient.c, wmbiff/Pop3Client.c, wmbiff/maildirClient.c, wmbiff/wmbiffrc.5: Initial revision dockapps/FAQ000066400000000000000000000061711242751507200132260ustar00rootroot00000000000000* Does WMBiff have a mailing list? There is no longer a WMBiff-specific mailing list, but it may be discussed on the Window Maker Developers mailing list, wmaker-dev@lists.windowmaker.org. See http://lists.windowmaker.org/. * Why doesn't WMBiff update immediately after I read my mail? WMBiff looks only at the flags associated with mail messages to decide if they've been read. If your mail reader doesn't bother to update those flags immediately after you read a message, WMBiff has (essentially) no way of knowing that you've read the message. There are some workarounds: In mutt, you can ask it to sync the mailbox using the sync-mailbox command: it will write the mailbox file to disk (or back to the IMAP server) so that WMBiff can update its counters. Mutt's sync-mailbox command is bound to the $ key by default. In Mac OS X mail, changing to a different mailbox usually flushes changes, so I often hit Command-4 to switch to the sent mailbox for a few seconds. No workarounds are known for Kmail, which updates the status flags of all mail as if it were read, then adds its own status field to note that some are unread. (sourceforge tracker #706995). * WMBiff doesn't work. How do I submit a bug? See the Troubleshooting section of the wmbiffrc man page. If that doesn't work, run 'wmbiff -debug > wmbiff.log' and remove any passwords left in wmbiff.log. Submit this log and your wmbiffrc (sanitized of passwords of course) using 'reportbug' under Debian, or by sending mail to wmaker-dev. * WMBiff doesn't do something I want. How do I suggest a feature? If using Debian, use 'reportbug wmbiff' and submit a wishlist bug. Or, send mail with your suggestion to wmaker-dev@lists.windowmaker.org. Some previously requested features can't be done: - Count IMAP deleted messages separately (the protocol doesn't support it without locking the mailbox). - Reset the count of new messages to zero when spawning a mailer (it would just jump back again the next time wmbiff looked). Previously suggested features that are really hard: - Support dock sizes other than 64x64 - Inverse video on new mail (or do more visually to grab attention) * I'm about to start writing a patch. How do I make sure it will get incorporated in WMBiff? Start a conversation on wmaker-dev, and you'll probably get some help. Tidbits: Avoid creating new Clients. - If you want an existing client to do something differently, find a way to parameterize its behavior. - If you want to use a shell command to get some information, make a recipe for ShellClient (open wmbiff.c and search for 'gicu'). If you must create a new client, Avoid Duplicating Code. Document your patch. Add entries as appropriate to: - sample.wmbiffrc - wmbiffrc.5.in - wmbiff.1 * How do I get the very latest WMBiff from git? git clone http://repo.or.cz/dockapps.git cd dockapps/wmbiff * I added a feature to WMBiff. How do I submit a patch? Submit patches in the same way as you would patches for Window Maker. See: http://repo.or.cz/w/wmaker-crm.git/blob/HEAD:/The-perfect-Window-Maker-patch.txt * This FAQ is wrong. Send mail to wmaker-dev@lists.windowmaker.org. dockapps/Makefile.am000066400000000000000000000023171242751507200147260ustar00rootroot00000000000000SUBDIRS = wmgeneral wmbiff autoconf scripts EXTRA_DIST = ChangeLog FAQ TODO ACLOCAL_FLAGS = -I autoconf ## dummies. ACLOCAL = @ACLOCAL@ $(ACLOCAL_FLAGS) ## no longer needed AUTOHEADER = @AUTOHEADER@ -l autoconf # make maintainer-clean is all about returning to CVS. # aclocal.m4 is generated by aclocal # config.h.in is generated by autoheader # stamp-h.in appears somewhere # Makefile.in and configure are obviously generated. MAINTAINERCLEANFILES = aclocal.m4 config.h.in stamp-h.in \ Makefile.in configure Changelog.bak stamp-h1 maintainer-clean-local: rm -f *~ # conf.libgnutlstest seems to outstay its welcome. # I don't know why the -stamp s linger. DISTCLEANFILES = conf.libgnutlstest build-stamp install-stamp dist-hook-local: ChangeLog chmod -R g-s . indent: cd wmbiff && make indent cd wmgeneral && make indent # manually increment version in configure.ac, which should be enough. ChangeLog: Makefile configure.ac @if test "x$(CVS2CL)" != "x" && test -e maint/changelog.sed; then \ echo "Running $(CVS2CL)..."; \ $(CVS2CL) --stdout --utc --day-of-week -I TODO -I NEWS -I .cvsignore | \ sed -f maint/changelog.sed > $@; \ else \ echo "Unable to build ChangeLog for distribution"; \ exit 0; \ fi dockapps/NEWS000066400000000000000000000477161242751507200134050ustar00rootroot00000000000000Release Notes ~~~~~~~~~~~~~ Release 0.4.28 - November 7, 2014 * Lots of bug fixes and code cleanup. Release 0.4.27 - October 8, 2005 * GNUTLS 1.2 support * Minor bugfixes. Release 0.4.26 - October 10, 2004 * Don't crash if no certificate is sent by the remote side and -skip-certificate-check has been given. * Avoid duplicate error messages. * Disable libgcrypt secure memory warning. * security.debian.rb: better when disconnected. Release 0.4.25 - June 23, 2004 * Fix a build error in the new gnutls certificate verification code on s390. Release 0.4.24 - June 22, 2004 * Use GNUTLS 1.0.4 and GCRYPT 1.1.90, current Debian unstable package libgnutls10-dev. Release 0.4.23 - April 27, 2004 * Allow server hostnames in IMAP to be IP addresses (start with a number). Release 0.4.22 - March 27, 2004 * Skip examine/search unless requested with msglst option. * Exit if ssh-askpass permissions check fails. Release 0.4.21 - February 21, 2004 * Fix a bug where fetch times out to some IMAP servers. Release 0.4.20 - January 1, 2004 * Add --disable-crypto for source-based distributions while libgcrypt is unstable. * Sam Izzo's patch for changing the mouse click action depending on whether a box has new mail. Release 0.4.19 - November 8, 2003 * Fix test_tlscomm with the right signature for read() * Another bugfix to IMAP msglst when headers are abnormal. * Avoid strcpy for overlapping regions. Release 0.4.18 - November 8, 2003 * Update security.debian.rb for ruby 1.8. * Bugfix to avoid infinite loop when reading from IMAP. * Bugfix to msglst to allow capitalized header names. * Add msglst feature to Pop3 mailboxes. (Paolo Gianrossi) * Bugfix to OS X keychain use for panther. Release 0.4.17 - August 31, 2003 * On Mac, ask the keychain for passwords if askpass = internal:apple:keychain * Bugfix to an infinite loop found in the TLS interface. Release 0.4.16 - July 7, 2003 * Checks TLS certificates. See wmbiffrc(5) for details on the certfile option. Designed to work with mutt. * Show a busy mouse cursor while talking to remote servers, to show that wmbiff won't be responsive to mouse clicks for a little bit. * New buttontwo (middle click) action to complement action (left mouse click) and fetchcmd (right mouse). * #'s are now only comments in .wmbiffrc at the beginning of lines or following whitespace, allowing #'s in (most) passwords. * AppleScript examples for driving Apple's Mail application in sample.wmbiffrc * Special mailbox action 'msglst' brings up a transient window showing message headers from IMAP and program output for shell methods. This is intended to be faster than starting up a new mail program or re-executing a script. * Avoid repetitive error messages when disconnected. * Use conventional -geometry option handling. * Fix bug in 0.4.15 to re-enable *'s in IMAP passwords. Release 0.4.15 - Mar 30, 2003 * Frobnicate internally stored passwords, partially obfuscating them in memory. Not actually more secure, but harder to casually discover a password. * Tighten configuration file lines to more quickly detect misconfiguration. Add the -relax option if it is too paranoid. * Add support for -bg to round out -hi and -fg color specifiers. Release 0.4.14 - Jan 24, 2003 * Handle building on systems with both posix and gnu regex in different but conflicting files. * Restart wmbiff on SIGUSR1. You may need to use 'killall -USR1 wmbiff' if it gets stuck. * Restart wmbiff on ctrl-shift mouse 1. Release 0.4.13 - Jan 20, 2003 * Fix a file descriptor leak when using both Shell and IMAP clients. * Portability to Mac OS X, Solaris, and probably BSD restored (thanks sourceforge compile farm!) with a partial rewrite of regular expression handling for IMAP and POP mailboxes. Release 0.4.12 - Jan 3, 2003 * Fix a bug introduced in 0.4.9 that interfered with -geometry handling. (Debian #173813) Release 0.4.11 - Dec 28, 2002 * security.debian.rb script to check for updates on security.debian.org, installed in $prefix/lib/wmbiff/ add: path.x=/usr/lib/wmbiff/security.debian.rb to your .wmbiffrc (and install ruby if you haven't already). * Internal cleanups to allow long askpass commands. Release 0.4.10 - Dec 12, 2002 * Peter McAlpine's globalnotify feature - elect to play a sound on new mail in *any* mailbox without a chorus of sounds from every mailbox. * -skip-certificate-check option for when your imaps server is misconfigured and you can't do anything about it. Release 0.4.9 - Dec 1, 2002 * GNUTLS v0.5.9 or higher required * Check TLS certificate hostname against the hostname we're connecting to. This raises the bar, but does not make wmbiff's TLS implementation secure against man in the middle attacks. * WMBiff scales to the number of mailboxes you're using. For openbox, this means less wasted space in the slit and the possibility of up to 40 mailboxes. For WindowMaker, this means more pretty chrome and less dark LED if you have only a couple boxes. If you prefer the empty cells at the end, place "path.4=" in your .wmbiffrc. Release 0.4.8 - Sept 18, 2002 * GNUTLS v0.5.1-0.5.6, gcrypt v1.1.8 required. * Allow spaces in IMAP mailbox paths. The new syntax is: server/"mail box with spaces" where the old is server/mailbox. See wmbiffrc(5) for details. * Avoid filesystem caching for network mounted maildirs. See wmbiffrc(5) for details. (Dwayne C. Litzenberger) Release 0.4.7 - August 16, 2002 * GNUTLS v0.5.1, gcrypt v1.1.8 required. (no other changes) Release 0.4.6 - July 19, 2002 * Ignore sigpipe so that apm suspend works with IMAP/TLS. * Memory handling bugfixes to appease valgrind. * GNUTLS v0.4.3, gcrypt v1.17 expected Release 0.4.4 - June 27, 2002 * GNUTLS version 0.4.3 required. The API has changed, and wmbiff is no longer compatible with GNUTLS versions prior to 0.4.3. Certificate checking may be slightly more strict. * GCRYPT version 1.1.7 is expected as well. * Partial rewrite of mailbox-parsing code, splint annotations. * Bugfix in debug messages of ShellClient. * Internal cleanups; migration to autoconf 2.5 Release 0.4.3 - June 8, 2002 * IPv6 support for real. (missed a detail with autoconf) * Preliminary font support, allowing variable colors. Use wmbiff -fg violet to give it a spin. Note: if the number of old messages is at least 1000, the old number of messages will not be completely erased when new mail arrives. * Mouse handling fix. * Cleanup of internals: handling of default configuration when .wmbiffrc does not exist, vertical position of rows, variable names, etc. * GNUTLS version 0.3.5 is expected; earlier and later versions may be incompatible. * This release is by Neil Spring . Release 0.4.2 - June 1, 2002 * Bugfix: accidentally released a partial feature. Release 0.4.1 - June 1, 2002 * This release is by Neil Spring . * GNUTLS version 0.3.5 is expected; earlier and later versions may be incompatible. * IPv6 is now supported, thanks to Jun-ichiro itojun Hagino Release 0.4.0 - May 3, 2002 * This release is by Neil Spring . * GNUTLS version 0.3.5 is expected; earlier and later versions may be incompatible. * askpass: Passwords can be left empty for IMAP: ssh-askpass will be used to prompt the user. See sample.wmbiffrc and wmbiffrc(5). * skinfile: Background pixmaps can be specified in .wmbiffrc. This has the effect of "skins." See wmbiffrc(5). Add "skinfile=wmbiff-master-contrast.xpm" to .wmbiffrc for a more readable wmbiff. * finger: Finger client added - finger a user's mailbox to get its status. Requires perl and finger commands. See wmbiffrc(5). Thanks to Andelko Horvat. * shell: Improvements to ShellClient - now allows three character text to be printed as status. If "new" is on the output line, the text will be in yellow. Thanks to Andelko Horvat. * mbox: Paths can be specified including shell expressions in `'s. If requested, this feature can be expanded to other clients. Nested expressions are not supported. * Permissions on .wmbiffrc are checked to protect security. Only a warning is printed now. This will degenerate in later releases for .wmbiffrc's that store passwords. * Migrated to automake / autoconf to detect defaults for ssh-askpass and prepare for future changes. * Bugfix to handle -geometry tags with dimension as generated by fvwmSaveDesk. The size is ignored. (in Debian 0.3.8-3) Release 0.3.8 - Tue, 26 Mar 2002 17:17:07 +0100 * Added GnomeICU support. * Added an experimental shell command method which reads the output for a given command. See wmbiffrc(5) for details. * Debug support moved to runtime, using the -debug switch. * Fix for the install rule in Makefile. Release 0.3.7 - Sun, 3 Feb 2002 23:46:44 +0100 * No, 0.3.6 never happened :) * Removed unneeded auth list fix which broke things. * Makefile cleanup, with better FreeBSD support. You can now easily use the external GNU regex lib. Release 0.3.6 - Sun, 27 Jan 2002 20:49:52 +0100 * Added a new syntax for IMAP, which allows using a "@" in the password field. See wmbiffrc(5) for details. * Fix for a correct usage of the auth list in IMAP. Release 0.3.5 - Mon, 14 Jan 2002 02:43:23 +0100 * Added support for GNUtls 0.3. You can still compile wmbiff using GNUtls 0.2.x by removing the GNUTLS_VER=3 define in the Makefile. * Fixed password quoting in IMAP logins. Release 0.3.4 - Fri, 23 Nov 2001 16:56:29 +0100 * "imaps" is now prefered to "sslimap" in config files. The old type is still supported for backwards compatibility. * You can now specify what protocol wmbiff should use for a given Pop3 or IMAP mailbox. If unspecified, it will try the secure ones first, falling back to unsecure if they fail. See wmbiffrc(5). * Added some debug messages for tls connections. * Pop3 path parsing rewrite. * Manual page fixes. * Compile warning fixes. Release 0.3.3 - Mon, 29 Oct 2001 14:55:00 +0100 * Sanity check to IMAP code: exit if wmbiff tries to connect to more than 5 servers. * Fix a missbehaviour of cram-md5 (broke pop3). * Documentation updates. Release 0.3.2 - Tue, 23 Oct 2001 20:30:37 +0200 * After some tries (other OpenSSL based patches, independent APOP & CRAM-Md5 patches) we've come up with something based on GNUtls and gcrypt, which are GPL based and have no licensing issues for us. See ChangeLog for details. * WMBiff now supports IMAP-SSL, APOP and CRAM-Md5 authentication. These can be disabled at compile time, commenting out the WITH_TLS and WITH_GCRYPT defines. (Neil Spring, NAKAYAMA Takao and Jay T. Francis). Release 0.3.1 - Sun, 24 Jun 2001 20:15:41 +0200 * Replaced /var/spool/mail with /var/mail, which is what the FHS mandates. All decent systems should have either the directory or a symlink pointing somewhere else. (Jordi Mallach) * I reformatted ths changelog, again. I hope this is the last time I need to do this. The CVS logs should be used for all changes, and this file should by updated for user-visible changes only, from now on. (Dwayne C. Litzenberger) * Updated the README to reflect that Gennady Belyakov died right after releasing wmBiff 0.2. May your soul rest in peace, Gennady. (Dwayne C. Litzenberger) * Fixed the IMAP support, again. (Rob Funk) Release 0.3.0 - Fri, 16 May 2001 12:16:44 +0200 * [ReadLine] removed previous trim leading spaces, added TrimFull. Fixes Debian Bug #95849 (Mark Hurley). * There was a bug where if a POP3 or IMAP mailbox read failed and the following reads were successful, but no mail was in the server, the given mailbox would remain reading "XX". Now it updates the counter no matter what the read was (Mark Hurley). * wmBiff would only count as new mails in mbox mailboxes with "N" flags, ignoring those marked "ON" (Rob Funk). * Fixed reading of quoted imap folders, which some IMAPd's do (Rob Funk). * README: updated some very obsolete info. (Jordi Mallach) Release 0.2q1+Debian - Tue, 1 May 2001 10:11:00 +0000 * Moved to CVS at SourceForge. (Jordi Mallach) Release 0.2q1 - Fri, 13 Apr 2001 02:47:10 -0400 * This release is by Mark Hurley . * wmbiff/Client.h: move DEBUG_* macros to wmbiff/Makefile * wmbiff/Pop3Client.c: + My password contains an @ character. This causes the pop3 line to be incorrectly parsed by wmbiff. * Drop all of the ":" after the pop3 and delimit all values with spaces. This works well, as passwords/user-id's all agree that the space is a non-legit value. Example: assume my password is: myEmailhasa@init Old way: path.3=pop3:debian4tux:myEmailhasa@init@mail.telocity.com New way: path.3=pop3:debian4tux myEmailhasa@init mail.telcoity.com Ahh...before you say it. "Backward compatibility?" You will also find in the patch, a NEW function. So that the OLD and NEW way is easily compatible with all ".wmbiffrc" files. Dev. Comments: This was not the cleanest way to implement it, but I had to suffice with a clean/quick implementation. I originally wrote one function to handle past and new parsing. However, I thought it would be beneficial to leave them separated, so we could eventually drop the old method? Related Changes: The man page will need to be updated (not provided in patch). We can weed the "old" style out of the example script as well. Still explaining the changes in the man page to leave out confusion in a users mind (as they are likely to find "old" style scripts). + My mail server at Telocity.com is following the RFC's to a "T". RFC 1725 states that the LAST command be removed. After some searching I have NOT turned up a replacement. Which does make sense, this command is only so useful, and contributes to the popularity of other such remoting such as LDAP? * I've set the Unread messages to the TotalMessages, assuming (as suggested by the RFC) no messages have been read. I have also suppressed the error printed to stderr, it is correct to return an error, *now*. ;) The only way to keep track of messages which have been read, is to remember the unique number assigned to them. This is what fetchmail does. However, it does not work correctly if you check and read mail thru other methods (a web mail client). * wmbiff/wmbiff.c: - for (index = 0; index < 4; index++) + for (index = 0; index < 5; index++) BUG! Last postion #4 was not correctly being checked. Now correctly checks each position. Release 0.2q - Tue, 20 Mar 2001 05:32:35 +0100 * This release is by Jorge García . * wmbiff/{*.[ch]}: removed unnecesary includes. * wmbiff/wmbiff.c: some cleanups and optimizations. + init_biff: * show error if user config file does not exists * use of userconfig "interval" (wasn't correctly parsed) + {do_biff, displayMsgCounters}: some changes to make Sleep_Interval and Blink_Mode local + parse_cmd: some changes to make uconfig_file local + {BlinkOn, BlinkOff, BlinkToogle}: Removed (merged by do_biff) + {ReadConfigString, ReadConfigInt}: Removed + countmail: removed init in header (wasn't used) + ReadLine: Created (new parsing code, extracts pairs of setting and value) + Read_Config_File: now there is only ONE parse not 36! * wmbiff/{IMap4Client.c, Pop3Client.c}: check for correct format line to avoid "segmentation fault" while parsing. Release 0.2p - Mon, 12 Mar 2001 00:00:00 -0600 * This release is by Dwayne C. Litzenberger . * Added maildir support! Yay! * Stole the manpages from Debian. * Massive (lack of) coding style cleanup; Standardized coding style using GNU indent. * Reversed order of ChangeLog as suggested by Jordi. * Cleaned up the v0.2o ChangeLog entry. What a mess! Added missing credits. * Cleaned up and reformatted the rest of the changelog to an almost-Debian format while I'm at it. It's much more readable that way. * Moved definition of WMBIFF_VERSION to the Makefile. * All your base are belong to us. * I'm not maintaining wmBiff; I just submitted a big patch. Send your complaints (or complements) to Yong-iL Joh. Release 0.2o - Mon, 12 Mar 2001 00:00:00 +0900 * This release is by Yong-iL Joh . * I don't think the date of this changelog entry is right. (Dwayne C. Litzenberger) * Jordi Mallach , Debian's wmbiff maintainer, sent me an email a couple of days ago which included a patch with man pages. The patch did the following: + Fixed a major upstream bug that renders this new wmbiff unusable. Thanks to Guillaume Morin, Jérôme Marant and Mark Hurley for their help identifying the bug, and Jorge García for writing a patch. Basically, the new upstream broke backwards compatibility of wmbiffrc with Gennady's wmbiff, fixed that. This patch also fixes wmbiff not using $MAIL or defaulting to /var/spool/mail/$USER if no ~/.wmbiffrc is found (closes: #87778). + wmbiff/wmbiff.c: updated WMBIFF_VERSION to current. + wmbiff/{socket.c, wmbiff.c}: removed includes. + debian/{wmbiff.1, wmbiffrc.5}: updated for IMAP4 and Licq support. + Jorge García removed the segfault in Jordi's wmbiffrc + Vladimir Popov fixed a potential buffer overflow in init_biff() (The "/* Make labels look right */" section). + Jorge García fixed a display bug in the number-of- mails display. * use poll() instead of select() -- Yong-iL Joh 12-Mar-2001 +0900 Release 0.2n - Tue, 20 Feb 2001 0:00:00 +0900 * This release is by Yong-iL Joh . * Nick Clarey sent me a patch. that enhances the following: + UW Imap server 2000.283rh + Config file now supports IMAP mailbox "paths" rather than just the mailbox name (e.g. mail/foo/blah) Release 0.2m - Mon, 5 Feb 2001 00:00:00 +0900 * This release is by Yong-iL Joh . * Imap4Client.c did not close when a connection error occurred. Fixed it. Release 0.2l - Thu, 11 Jan 2001 00:00:00 +0900 * This release is by Yong-iL Joh . * Imap4Client.c had a bug when trying to connect to an imap4 server. Fixed it. Release 0.2j - Mon, 1 Jan 2001 00:00:00 +0900 * This release is by Yong-iL Joh . * Because I can't contact the author, I jumped to version 0.2j * Added imap4-based mail server check component. * Divided wmbiff.c to wmbiff.c, LicqClient.c mboxClient.c Release 0.2-licq - Sat, 1 Jan 2000 00:00:00 +0000 * This release is by Yong-iL Joh . * The actual date of this release is unknown, so I picked New Year's Day, Y2K. (Dwayne C. Litzenberger) * I found it from http://www.licq.org/download.html. Release 0.2 - Fri, 26 Nov 1999 00:00:00 +0000 * This release is by Gennady Belyakov . * We don't actually know the time zone of Gennady's changelog entries (Dwayne C. Litzenberger). * POP3 support added with (auto)fetching * digits blinking on new mail arrival * resource wasting lowered * individual rescan interval for differrent mailboxes * some bugfixes Release 0.1a - Thu, 18 Nov 1999 00:00:00 +0000 * This release is by Gennady Belyakov . * Some fixes with intialization Release 0.1 - Wed, 17 Nov 1999 00:00:00 +0000 * Initial release by Gennady Belyakov . $Id: NEWS,v 1.61 2005/10/08 18:13:09 bluehal Exp $ dockapps/README000066400000000000000000000071061242751507200135530ustar00rootroot00000000000000 Introducing WMBiff is an WindowMaker docking utility, that displays number of total messages count or unread mail messages count in differrent mailboxes. WMBiff was created by Gennady Belyakov in 1999, and was continued by a team of volunteers after his death. Green ( cyan? :) ) digits display total number of messages, if there are no unread messages in it. Yellow digits display number of unread messages, with blinking on new mail arrival, if any. At this moment unix-style (mbox), maildir, POP3, APOP and IMAP mailboxes are supported. WMBiff also understands Licq's history files. WMBiff supports up to 5 mailboxes (but you can start 2 or more wmbiff's with differrent configs). Pressing on a 1st (left) mouse button will execute appropriate mail reader (if defined in config file). Right-clicking will exec mail fetching program (if any). It is also possible to execute user-defined command line on new mail arrival (for example, play .WAV file). _________________________________________________________________ Compiling and Installation Extract the archive: tar -xvzf wmbiff-0.x.tar.gz Enter the wmbiff directory and follow INSTALL's directions. cd wmbiff-0.x/ ./configure For crypto support either: *) Install gnutls and libgrcypt packages from your distribution. *) Download them from http://www.gnupg.org/(en)/download/mirrors.html Choose a mirror, then download from the alpha/gnutls and alpha/libgcrypt directories. *) Do nothing; the configure script will note its absence. NOTE: gnutls-0.3.5 is the version that this release was tested with. Newer versions may have incompatible changes. Make the binary: make Install the binary: make install This will copy the binary to /usr/local/bin Then you need to copy sample.wmbiffrc into your home directory as .wmbiffrc, correct it as you like. Or, you can use the ``-c'' option and specify differrent name of config file. Without any config file wmbiff will use only default mailbox (from environment variable MAIL), labeled with word SPOOL, at first position. All other positions will be empty. _________________________________________________________________ See AUTHORS to see who has contributed to WMBiff. _________________________________________________________________ Any suggestions/bug reports please send to our mailing list, wmaker-dev@lists.windowmaker.org Please include the output of 'wmbiff -debug'. _________________________________________________________________ UPDATE [2001-06-18]: On Tuesday, 22 May 2001, Jordi Mallach sent the following email to the wmbiff-devel list: Hello, I just found evidence of what I had believed for a long time. http://www.monkey.org/openbsd/archive/ports/0101/msg00311.html Gennady Belyakov passed away right after releasing 0.2 and when he stopped answering mail :| I guess we need to update the docs. Jordi Here is the message, if that URL becomes unavailable: To: ports@openbsd.org Subject: Re: mail/wmbiff update From: Vladimir Popov Date: Sat, 27 Jan 2001 09:34:15 +0500 On Fri, Jan 26, 2001 at 01:02:59PM +0000, Christian Weisgerber wrote: > > The major issue I have with this port is that the master site/home > page is unreachable. > Well, wmbiff's author Gennady Belyakov passed away in late November 1999. That's why that url isn't any longer valid. -- Vladimir May your soul rest in peace, Gennady. dockapps/TODO000066400000000000000000000104171242751507200133620ustar00rootroot00000000000000This is not a prioritized list. Patches that accomplish these todo items are welcome. * Config file rewrite The current configuration file has the following problems ** # comments make #'s unsuitable for passwords. ** : and @ delimiters make such characters unsuitable for passwords. ** the hierarchical configuration is not exported cleanly, setting a default and then propagating or overriding it requires an odd syntax. ** elements with spaces are problematic ** annotations / customizations (such as the authentication methods) are cumbersome. ** continuation lines would allow richer shell actions without external shell scripts. * GNUTLS 0.5.9 ** adds gnutls_set_default_priority, which could clean up a lot of the code to set priorities for ciphers that don't really matter to wmbiff. * Font support ** Erase counts > 1000 successfully (redraw the whole line) ** Discover height of the font, scale appropriately. ** Draw relative to symbolic width, height. * Finish checking .wmbiffrc permissions. With shell command execution support, it is even more important to protect against other/group writability. With passwords in the .wmbiffrc, .wmbiffrc shouldn't be readable. It might be best to complain all the time, but only abort when a password is used from a readable file, or a shell command is executed from a writable file. * Better timeout handling Sometimes my IMAP server is slow... well, it's my fault that I keep a few thousand messages on it. The current timeout code will cause it to fail prematurely. * Generic constructors for mboxes. There's some common code across different Clients; this is one piece that could use refactoring. * Add more shell "recipes" besides gicu. Just added 'finger'. I'm hoping to add something to integrate 'remind' just as soon as I can figure it out. * Support on/off status LED's, for, for example, grep eth0 /proc/net/dev | wc -l The colored LED's are already in WMBiff's pixmap. * Support buttons 4 and 5 The mousewheel could be useful for some behaviors, like controlling volume, or selecting different mailboxes. * Use a helper program to blink keyboard led's. Requires killing the 'notify' program when new mail no longer exists. Keyboard blinking is done via a helper program because it requires root. ledcontrol seems ok, but extra complicated, and has a useless default install that requires root. xbuffy's led program seems quite good, but depending on another biff program seems odd. * Add a failure-expect case in tlsComm. For example, an IMAP status query has a good response (* STATUS) and a bad response (a003 NO STATUS). As soon as one of them is received, we're done. * Reload .wmbiffrc when it changes This is straightforward, except for IMAP mailboxes that keep a connection to the server open. A close function will have to be implemented to shut those down gracefully. Do not involve sighup or any other signals. Use or improve fileHasChanged(). * Runtime back-tick expansion for non-mbox Because interesting mailboxes can be defined by date, though its not clear any other clients can take advantage. * Support GSSAPI or SASL authentication Authentication using krb5 would be sweet. * Unlikely to get done, unless someone volunteers: * KDE/Gnome users: Test with KDE or gnome-panel Does Debian bug #108529 apply to wmbiff? Can wmbiff be swallowed by gnome-panel? It seems possible. It appears to be swallowed by FVWM correctly. * Autoconf / Automake Wizards: fix FromCVS.sh How best to deal with libgnutls's macros? All I can do is hack. * Paranoid Pop People: Support POP over TLS. tlsComm.c should make it easy to provide TLS support for POP. Unfortunately, this would only be useful for someone who has such a server that doesn't support IMAPS. * MH support Try "path.n=shell:::ls -1 directoryname | wc -l". If it works, tell us. Optionally the patch at sourceforge could be integrated. * Recursive maildir support Aggregation in general is an oft-desired feature. * G-Mail support Though the business model of free mail forces screen scrubbing, having someone else write and maintain the interface seems like it would significantly improve the utility of gmail. $Id: TODO,v 1.21 2004/10/31 22:08:42 bluehal Exp $ Local Variables: mode: outline End: dockapps/autoconf/000077500000000000000000000000001242751507200145055ustar00rootroot00000000000000dockapps/autoconf/Makefile.am000066400000000000000000000000161242751507200165360ustar00rootroot00000000000000 EXTRA_DIST = dockapps/configure.ac000066400000000000000000000146101242751507200151570ustar00rootroot00000000000000dnl Autoconf is here to detect: dnl gnutls, libgcrypt dnl default ssh-askpass dnl and the basics X11, Xext, Xpm dnl and configure: dnl installation prefix dnl version AC_INIT(WMBiff, 0.4.28, wmaker-dev@lists.windowmaker.org, wmbiff) AC_CONFIG_AUX_DIR(autoconf) AM_INIT_AUTOMAKE AC_CONFIG_HEADER([config.h]) dnl make sure autoheader finds version, implicitly defined above. AH_TEMPLATE([VERSION], [wmbiff's release version]) AC_SUBST(VERSION) AC_PROG_INSTALL AC_PROG_CC AC_PROG_RANLIB if test -n "$GCC"; then CFLAGS="$CFLAGS -D_GNU_SOURCE -W -Wall -Wshadow -Wpointer-arith -Wwrite-strings" AC_MSG_RESULT(adding -Wall and friends to CFLAGS.) fi case `(uname -s) 2>/dev/null` in "Darwin") CFLAGS="$CFLAGS -no-cpp-precomp" AC_MSG_RESULT(adding cpp precompiler workaround for Mac OS X) LDFLAGS="$LDFLAGS -framework Security" AC_MSG_RESULT(adding -framework Security for Mac OS X) ;; esac dnl a no-op to force autoconf to seek out the preprocessor now. AC_CHECK_HEADERS(stdio.h) dnl for IPv6 support AC_CHECK_FUNCS(getaddrinfo) dnl see if we can cheaply "encrypt" passwords in memory AC_CHECK_FUNCS(memfrob) dnl AC_CHECK_FUNC(asprintf, , VASPRINTF="vasprintf.c") dnl replacing the old USE_POLL define AC_CHECK_FUNCS(poll) dnl for gnutls-common.h, which defines this if missing. AC_CHECK_FUNCS(inet_ntop) dnl declare RETSIGTYPE AC_TYPE_SIGNAL dnl solaris AC_CHECK_LIB(nsl, gethostbyname) AC_CHECK_LIB(socket, connect) AC_CHECK_LIB(resolv, herror) dnl Pre-gnutls. gnutls="ok" gcrypt="ok" AC_CHECK_LIB(z, gzopen, [], [gnutls="nope"]) dnl GNUTLS seems to need libz; fail here if it's missing. dnl perhaps not required anymore: dnl AC_CHECK_LIB(gdbm, dbminit, [], [gnutls="nope"]) dnl GNUTLS seems to need libgdbm; fail here if it's missing. dnl Parameter is minimum version dnl TODO: fix so that GCRYPT is tested only if GNUTLS fails; the dependence dnl between them makes this turn redundant AC_ARG_ENABLE(crypto, AC_HELP_STRING([ --disable-crypto ], [ disable gnutls/gcrypt ]), [ if test $enableval != yes; then gnutls="disabled" gcrypt="disabled" fi ]) GNUTLS_MAN_STATUS="This copy of WMBiff was not compiled with GNUTLS." if test "$gnutls" = "ok"; then PKG_CHECK_MODULES([LIBGNUTLS], [gnutls > 2.2.0], [LIBS="$LIBS $LIBGNUTLS_LIBS" CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS" CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS" GNUTLS_COMMON_O="gnutls-common.o" GNUTLS_MAN_STATUS="This copy of WMBiff was compiled with GNUTLS." AC_CHECK_HEADERS(gnutls/gnutls.h) ], [ echo GNUTLS can be found at ftp://gnutls.hellug.gr/pub/gnutls ]) else AC_MSG_RESULT(GNUTLS support requires libz.a and libgdbm.a, so will be disabled) fi GCRYPT_MAN_STATUS="This copy of WMBiff was not compiled with gcrypt." if test "$gcrypt" = "ok"; then AM_PATH_LIBGCRYPT(1.1.90, [CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS" GCRYPT_MAN_STATUS="This copy of WMBiff was compiled with gcrypt." AC_CHECK_HEADERS(gcrypt.h) ], [ echo libgcrypt can be found at ftp://ftp.gnupg.org/pub/gcrypt/alpha/libgcrypt/ ] ) else AC_MSG_RESULT(GCRYPT disabled.) fi; AC_SUBST(LIBGCRYPT_LIBS) AC_SUBST(GNUTLS_MAN_STATUS) AC_SUBST(GCRYPT_MAN_STATUS) AC_SUBST(GNUTLS_COMMON_O) dnl regex stuff. AC_CHECK_HEADERS(regex.h) dnl gnuregex.h dnl no longer needed AC_CHECK_LIB(gnuregex, re_search) dnl BSD. dnl X11 stuff. AC_PATH_XTRA if test "$no_x" = yes; then AC_MSG_ERROR("Really need a working X. Check config.log to see why configure couldn't find it") fi LIBS="$X_LIBS $LIBS" dnl want to get the -I flags so that later tests for include files work. dnl the preprocessor is used for check_headers, which doesn't use cflags. CPPFLAGS="$X_CFLAGS $CPPFLAGS" AC_CHECK_LIB(X11, XrmParseCommand) AC_CHECK_LIB(Xext, XShapeCombineMask, , AC_MSG_ERROR(libXext not found or does not include XShape)) AC_CHECK_LIB(Xpm, XpmCreateImageFromXpmImage) AC_CHECK_HEADERS(X11/xpm.h, [], [AC_CHECK_HEADERS(xpm.h, [], AC_MSG_ERROR([xpm.h is needed]))]) dnl AM_PATH_GTK(1.2.10, , AC_MSG_WARN(Cannot find GTK: Is gtk-config in path?)) dnl AM_PATH_GDK_PIXBUF(0.15.0, [CFLAGS="$CFLAGS $GDK_PIXBUF_CFLAGS"], dnl AC_MSG_ERROR(Cannot find gdk-pixbuf)) dnl GNOME_INIT_HOOK([ ], failure) dnl GNOME_ORBIT_HOOK([GNOME_LIBS="$GNOME_LIBS $ORBIT_LIBS" dnl GNOME_CFLAGS="$GNOME_CFLAGS $ORBIT_CFLAGS"], failure) dnl GNOME_GNORBA_HOOK([GNOME_LIBS="$GNOME_LIBS $GNORBA_LIBS" dnl GNOME_CFLAGS="$GNOME_CFLAGS $GNORBA_CFLAGS"], failure) dnl AC_SUBST(GNOME_LIBS) dnl AC_SUBST(GNOME_CFLAGS) dnl see if __attribute__ is supported. modified from AC_C_INLINE dnl in the autoconf distribution. AC_DEFUN([WM_C_ATTRIBUTE], [AC_CACHE_CHECK([for __attribute__ support], wm_cv_c_attribute, [wm_cv_c_attribute=no AC_COMPILE_IFELSE([AC_LANG_SOURCE( [#ifndef __cplusplus typedef int foo_t; foo_t foo () __attribute__((unused)); foo_t foo () {return 0; } #endif ])], [wm_cv_c_attribute=yes]) ]) case $wm_cv_c_attribute in yes)AC_DEFINE(HAVE___ATTRIBUTE__, , [Define if '__attribute__' is supported by the compiler]) ;; esac ])# WM_C_ATTRIBUTE WM_C_ATTRIBUTE dnl Password prompting stuff. AC_PATH_PROGS(DEFAULT_ASKPASS, ssh-askpass x11-ssh-askpass ssh-askpass-gnome, /usr/bin/ssh-askpass) AC_PATH_PROG(CVS2CL, cvs2cl) AC_DEFINE_UNQUOTED(DEFAULT_ASKPASS, "$DEFAULT_ASKPASS", [Program to use for querying the user for a password: redefine if not on a debian system]) AC_CHECK_HEADERS(CoreServices/CoreServices.h Security/Security.h) dnl Skin files; note - this is duplicated in wmbiff/Makefile.am dnl haven't thought of a way around it. if test "x$prefix" != xNONE; then SKINDIR="$prefix/share/wmbiff/skins" else SKINDIR="$ac_default_prefix/share/wmbiff/skins" fi dnl where to install em AC_SUBST(SKINDIR) dnl where to find em AC_DEFINE_UNQUOTED(DEFAULT_SKIN_PATH, "$SKINDIR:/usr/share/wmbiff/skins:/usr/local/share/wmbiff/skins:.", [Path to use when finding skins (modified pixmaps)] ) dnl We're done. AC_CONFIG_FILES(Makefile wmbiff/Makefile wmgeneral/Makefile wmbiff/wmbiffrc.5 autoconf/Makefile scripts/Makefile) AC_OUTPUT dnl remind not to write the file. chmod 0444 wmbiff/wmbiffrc.5 dockapps/scripts/000077500000000000000000000000001242751507200143565ustar00rootroot00000000000000dockapps/scripts/Makefile.am000066400000000000000000000001531242751507200164110ustar00rootroot00000000000000wmbiff_pkglibdir = $(pkglibdir) wmbiff_pkglib_SCRIPTS = security.debian.rb EXTRA_DIST = security.debian.rb dockapps/scripts/security.debian.rb000077500000000000000000000113721242751507200200020ustar00rootroot00000000000000#! /usr/bin/ruby # Copyright 2002 Neil Spring # GPL # report bugs to wmbiff-devel@lists.sourceforge.net # or (preferred) use the debian BTS via 'reportbug' # Based on security-update-check.py by Rob Bradford require 'net/ftp' #require 'profile' # re-fetch interval - only bug the server once every hour. # allows wmbiff to ask us often how many packages have been # updated so that the number goes back to cyan (old) from # yellow (new) quickly on upgrade. # this still doesn't mean we grab the whole file. we get # if-modified-since. it just means we don't connect to the # server more often than this. # 6 hours * 60 min/hour * 60 sec/min Refetch_Interval_Sec = 6 * 60 * 60 # as an ordinary user, we store Packages in the home directory. Cachedir = ENV['HOME'] + '/.wmbiff-sdr' # look for updates from this server. This script is designed around # (and simplified greatly by) using just a single server. Server = 'security.debian.org' # extend the Array class with a max method. class Array def inject(n) each { |value| n = yield(n, value) } n end def max inject(0) { |n, value| ((n > value) ? n : value) } end end def debugmsg(str) $stderr.puts str if($VERBOSE) end # to be reimplemented without execing touch. def touch(filename) debugmsg "touching #{filename}" Kernel.system('/usr/bin/touch ' + filename) end # to be reimplemented without execing dpkg, though running # dpkg excessively doesn't seem to be a bottleneck. def version_a_gt_b(a, b) cmd = "/usr/bin/dpkg --compare-versions %s le %s" % [ a, b ] # $stderr.puts cmd return (!Kernel.system(cmd)) end # figure out which lists to check # there can be many implementations of # this behavior, this seemed simplest. # we're going to make an array of arrays, for each package # file, the url, the system's cache of the file, and a # per-user cache of the file. packagelists = Dir.glob("/var/lib/apt/lists/#{Server}*Packages").map { |pkgfile| [ '/debian-security' + pkgfile.gsub(/.*#{Server}/, '').tr('_','/').gsub(/Packages/, ''), # the url path pkgfile, # the system cache of the packages file. probably up-to-date. # and finally, a user's cache of the page, if needed. "%s/%s" % [ Cachedir, pkgfile.gsub(/.*#{Server}_/,'') ] ] } # update the user's cache if necessary. packagelists.each { |urlpath, sc, uc| sctime = File.stat(sc).mtime cached_time = if(test(?e, uc)) then uctime = File.stat(uc).mtime if ( uctime < sctime ) then # we have a user cache, but it is older than the system cache File.unlink(uc) # delete the obsolete user cache. sctime else uctime end else sctime end if(Time.now > cached_time + Refetch_Interval_Sec) then debugmsg "fetching #{urlpath} %s > %s + %d" % [Time.now, cached_time, Refetch_Interval_Sec] begin test(?e, Cachedir) or Dir.mkdir(Cachedir) ftp = Net::FTP.new(Server) ftp.login ftp.chdir(urlpath) ftp.getbinaryfile('Packages.gz', uc + '.gz', 1024) ftp.close # need to unzip Packages.gz cmd_gunzip = "gzip -df %s" % [ uc + '.gz' ] Kernel.system(cmd_gunzip) rescue SocketError => e # if the net is down, we'll get this error; avoid printing a stack trace. puts "XX old" puts e exit 1; rescue Timeout::Error => e # if the net is down, we might get this error instead. # but there is no good reason to print the specific exception. (execution expired) puts "XX old" exit 1; end debugmsg "urlpath updated" else debugmsg "skipping #{urlpath}" end } available = Hash.new package = nil packagelists.each { |url, sc, uc| File.open( (test(?e, uc)) ? uc : sc, 'r').each { |ln| if(m = /^Package: (.*)/.match(ln)) then package = m[1] elsif(m = /^Version: (.*)/.match(ln)) then available[package] = m[1] end } } installed = Hash.new package = nil isinstalled = false File.open('/var/lib/dpkg/status').each { |ln| if(m = /^Package: (.*)$/.match(ln)) then package = m[1] isinstalled = false # reset elsif(m = /^Status: install ok installed/.match(ln)) then isinstalled = true elsif(m = /^Version: (.*)$/.match(ln)) then isinstalled && installed[package] = m[1] end } debugmsg "%d installed, %d available" % [ installed.length, available.length ] updatedcount = 0 updated = Array.new ( installed.keys & available.keys ).each { |pkg| if(version_a_gt_b(available[pkg], installed[pkg])) then updatedcount += 1 updated.push(pkg + ": #{available[pkg]} > #{installed[pkg]}") end } # we're done. output a count in the format expected by wmbiff. if(updatedcount > 0) then puts "%d new" % [ updatedcount ] else puts "%d old" % [ installed.length ] end puts updated.join("\n") dockapps/wmbiff/000077500000000000000000000000001242751507200141415ustar00rootroot00000000000000dockapps/wmbiff/Client.h000066400000000000000000000133551242751507200155370ustar00rootroot00000000000000/* $Id: Client.h,v 1.42 2005/05/08 21:31:22 bluehal Exp $ */ /* Author : Scott Holden ( scotth@thezone.net ) Modified : Yong-iL Joh ( tolkien@mizi.com ) Modified : Jorge García ( Jorge.Garcia@uv.es ) * * Email Checker Pop3/Imap4/Gicu/mbox/maildir/finger * * Last Updated : $Date: 2005/05/08 21:31:22 $ * */ #ifndef CLIENT #define CLIENT #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #ifdef HAVE_GCRYPT_H #include #endif #ifdef __LCLINT__ typedef unsigned int off_t; #endif #define BUF_BIG 256 #define BUF_SMALL 32 #define BUF_SIZE 1024 struct msglst; typedef struct _mbox_t *Pop3; typedef struct _mbox_t { char label[BUF_SMALL]; /* Printed at left; max 5 chars */ char path[BUF_BIG]; /* Path to mailbox */ char notify[BUF_BIG]; /* Program to notify mail arrivation */ char action[BUF_BIG]; /* Action to execute on mouse click, reduces to * what happens on button1. this is executed after * either actionnew or actionnonew (if they are * defined in the config file) */ char actionnew[BUF_BIG]; /* Action to execute on mouse click when new mail */ char actionnonew[BUF_BIG]; /* Action to execute on mouse click when no new mail */ char actiondc[BUF_BIG]; /* Action to execute when icq is disconnected */ char button2[BUF_BIG]; /* What to run on button2. (middle) */ char fetchcmd[BUF_BIG]; /* Action for mail fetching for pop3/imap, reduces to what happens on button3 */ int fetchinterval; int TotalMsgs; /* Total messages in mailbox */ int UnreadMsgs; /* New (unread) messages in mailbox */ int OldMsgs; int OldUnreadMsgs; char TextStatus[10]; /* if set to a string, toupper() and blit * that string. instead of a message count */ int blink_stat; /* blink digits flag-counter */ int debug; /* debugging status */ struct msglst *headerCache; union { struct { time_t mtime; off_t size; } mbox; struct { char *detail; } shell; struct { time_t mtime_new; off_t size_new; time_t mtime_cur; off_t size_cur; unsigned int dircache_flush:1; /* hack to flush directory caches */ } maildir; struct { char password[BUF_SMALL]; char userName[BUF_BIG]; char serverName[BUF_BIG]; int serverPort; int localPort; char authList[100]; unsigned int dossl:1; /* use tls. */ /* prompt the user if we can't login / password is empty */ unsigned int interactive_password:1; /* using the msglst feature, fetch the headers to have them on hand */ unsigned int wantCacheHeaders:1; unsigned char password_len; /* memfrob may shorten passwords */ } pop_imap; } u; int (*checkMail) ( /*@notnull@ */ Pop3); /* collect the headers to show in a pop up */ struct msglst *(*getHeaders) ( /*@notnull@ */ Pop3); /* allow the client to free the headers, or keep them cached */ void (*releaseHeaders) ( /*@notnull@ */ Pop3, struct msglst * ml); time_t prevtime; time_t prevfetch_time; int loopinterval; /* loop interval for this mailbox */ /* command to execute to get a password, if needed */ const char *askpass; } mbox_t; /* creation calls must have this prototype */ int pop3Create( /*@notnull@ */ Pop3 pc, const char *str); int imap4Create( /*@notnull@ */ Pop3 pc, const char *str); int shellCreate( /*@notnull@ */ Pop3 pc, const char *str); int mboxCreate( /*@notnull@ */ Pop3 pc, const char *str); int maildirCreate( /*@notnull@ */ Pop3 pc, const char *str); int sock_connect(const char *hostname, int port); FILE *openMailbox(Pop3 pc, const char *mbox_filename); /* backtickExpand returns null on failure */ /*@null@ */ char *backtickExpand(Pop3 pc, const char *path); int fileHasChanged(const char *mbox_filename, time_t * atime, time_t * mtime, off_t * size); int grabCommandOutput(Pop3 pc, const char *command, /*@out@ */ char **output, /*@out@ *//*@null@ */ char **details); int exists(const char *filename); /* test -f */ /* _NONE is for silent operation. _ERROR is for things that should be printed assuming that the user might possibly see them. _INFO is for reasonably useless but possibly interesting messages. _ALL is for everything. Restated, _ERROR will always be printed, _INFO only if debugging messages were requested. */ #define DEBUG_NONE 0 #define DEBUG_ERROR 1 #define DEBUG_INFO 2 #define DEBUG_ALL 2 /* inspired by ksymoops-2.3.4/ksymoops.h */ #define DM(mbox, msglevel, X...) \ do { \ if (mbox == NULL || (mbox)->debug >= msglevel) { \ printf("wmbiff/%s ", (mbox != NULL) ? (mbox)->label : "NULL"); \ printf(X); \ (void)fflush(NULL); \ } \ } while(0) extern int debug_default; #define DMA(msglevel, X...) \ do { \ if (debug_default >= msglevel) { \ printf("wmbiff: " X); \ (void)fflush(NULL); \ } \ } while(0) /* technique used in apache to allow GCC's attribute tags, without requiring gcc as the compiler */ #if !defined(__GNUC__) || __GNUC__ < 2 || \ (__GNUC__ == 2 && __GNUC_MINOR__ < 7) #ifndef __attribute__ #define __attribute__(__x) #endif #endif /* gnuc */ #endif /* client.h */ #ifndef FALSE #define FALSE (0) #define TRUE (!FALSE) #endif #ifdef __LCLINT__ /* lclint doesn't do typeof */ #define min(x,y) ((x > y) ? x : y) #define max(x,y) ((x > y) ? x : y) #else /* from linux/kernel.h */ #define min(x,y) ({ \ const typeof(x) _xi = (x); \ const typeof(y) _yi = (y); \ (void) (&_xi == &_yi); \ _xi < _yi ? _xi : _yi; }) #define max(x,y) ({ \ const typeof(x) _xa = (x); \ const typeof(y) _ya = (y); \ (void) (&_xa == &_ya); \ _xa > _ya ? _xa : _ya; }) #endif /* vim:set ts=4: */ /* * Local Variables: * tab-width: 4 * c-indent-level: 4 * c-basic-offset: 4 * End: */ dockapps/wmbiff/Imap4Client.c000066400000000000000000000505021242751507200164200ustar00rootroot00000000000000/* rewrite of the IMAP code by Neil Spring * (nspring@cs.washington.edu) to support gnutls and * persistent connections to servers. */ /* Originally written by Yong-iL Joh (tolkien@mizi.com), * modified by Jorge Garcia (Jorge.Garcia@uv.es), and * modified by Jay Francis (jtf@u880.org) to support * CRAM-MD5 */ #ifdef HAVE_CONFIG_H #include #endif #include "Client.h" #include "charutil.h" #include "tlsComm.h" #include "passwordMgr.h" #include "regulo.h" #include "MessageList.h" #include #include #include #include #include #include #include #include #ifdef USE_DMALLOC #include #endif #define PCU (pc->u).pop_imap extern int Relax; #define IMAP_DM(pc, lvl, args...) DM(pc, lvl, "imap4: " args) #ifdef HAVE_MEMFROB #define DEFROB(x) memfrob(x, x ## _len) #define ENFROB(x) memfrob(x, x ## _len) #else #define DEFROB(x) #define ENFROB(x) #endif /* this array maps server:port pairs to file descriptors, so that when more than one mailbox is queried from a server, we only use one socket. It's limited in size by the number of different mailboxes displayed. */ #define FDMAP_SIZE 5 static struct fdmap_struct { char *user_server_port; /* tuple, in string form */ /*@owned@ */ struct connection_state *cs; } fdmap[FDMAP_SIZE]; static void ask_user_for_password( /*@notnull@ */ Pop3 pc, int bFlushCache); /* authentication callbacks */ #ifdef HAVE_GCRYPT_H static int authenticate_md5( /*@notnull@ */ Pop3 pc, struct connection_state *scs, const char *capabilities); #endif static int authenticate_plaintext( /*@notnull@ */ Pop3 pc, struct connection_state *scs, const char *capabilities); /* the auth_methods array maps authentication identifiers to the callback that will attempt to authenticate */ static struct imap_authentication_method { const char *name; /* callback returns 1 if successful, 0 if failed */ int (*auth_callback) ( /*@notnull@ */ Pop3 pc, struct connection_state * scs, const char *capabilities); } auth_methods[] = { { #ifdef HAVE_GCRYPT_H "cram-md5", authenticate_md5}, { #endif "plaintext", authenticate_plaintext}, { NULL, NULL} }; /* recover a socket from the connection cache */ /*@null@*/ /*@dependent@*/ static struct connection_state *state_for_pcu(Pop3 pc) { char *connection_id; struct connection_state *retval = NULL; int i; connection_id = malloc(strlen(PCU.userName) + strlen(PCU.serverName) + 22); sprintf(connection_id, "%s|%s|%d", PCU.userName, PCU.serverName, PCU.serverPort); for (i = 0; i < FDMAP_SIZE; i++) if (fdmap[i].user_server_port != NULL && (strcmp(connection_id, fdmap[i].user_server_port) == 0)) { retval = fdmap[i].cs; } free(connection_id); return (retval); } /* bind to the connection cache */ static void bind_state_to_pcu(Pop3 pc, /*@owned@ */ struct connection_state *scs) { char *connection_id; int i; if (scs == NULL) { abort(); } connection_id = malloc(strlen(PCU.userName) + strlen(PCU.serverName) + 22); sprintf(connection_id, "%s|%s|%d", PCU.userName, PCU.serverName, PCU.serverPort); for (i = 0; i < FDMAP_SIZE && fdmap[i].cs != NULL; i++); if (i == FDMAP_SIZE) { /* should never happen */ IMAP_DM(pc, DEBUG_ERROR, "Tried to open too many IMAP connections. Sorry!\n"); exit(EXIT_FAILURE); } fdmap[i].user_server_port = connection_id; fdmap[i].cs = scs; } /* remove from the connection cache */ static /*@owned@*/ /*@null@*/ struct connection_state *unbind( /*@returned@*/ struct connection_state *scs) { int i; struct connection_state *retval = NULL; assert(scs != NULL); for (i = 0; i < FDMAP_SIZE && fdmap[i].cs != scs; i++); if (i < FDMAP_SIZE) { free(fdmap[i].user_server_port); fdmap[i].user_server_port = NULL; retval = fdmap[i].cs; fdmap[i].cs = NULL; } return (retval); } /* creates a connection to the server, if a matching one doesn't exist. */ /* *always* returns null, just declared this wasy to match other protocols. */ /*@null@*/ FILE *imap_open(Pop3 pc) { static int complained_already; /* we have to succeed once before complaining again about failure */ struct connection_state *scs; struct imap_authentication_method *a; char *connection_name; int sd; char capabilities[BUF_SIZE]; char buf[BUF_SIZE]; if (state_for_pcu(pc) != NULL) { /* don't need to open. */ return NULL; } /* got this far; we're going to create a connection_state structure, although it might be a blacklist entry */ connection_name = malloc(strlen(PCU.serverName) + 20); sprintf(connection_name, "%s:%d", PCU.serverName, PCU.serverPort); assert(pc != NULL); /* no cached connection */ sd = sock_connect((const char *) PCU.serverName, PCU.serverPort); if (sd == -1) { if (complained_already == 0) { IMAP_DM(pc, DEBUG_ERROR, "Couldn't connect to %s:%d: %s\n", PCU.serverName, PCU.serverPort, errno ? strerror(errno) : ""); complained_already = 1; } if (errno == ETIMEDOUT) { /* temporarily bump the interval, in a crude way: fast forward time so that the mailbox isn't checked for a while. */ pc->prevtime = time(0) + 60 * 5; /* now + 60 seconds per min * 5 minutes */ /* TCP's retry (how much time has elapsed while the connect times out) is around 3 minutes; here we just try to allow checking local mailboxes more often while remote things are unavailable or disconnected. */ } return NULL; } /* build the connection using STARTTLS */ if (PCU.dossl != 0 && (PCU.serverPort == 143)) { /* setup an unencrypted binding long enough to invoke STARTTLS */ scs = initialize_unencrypted(sd, connection_name, pc); /* can we? */ tlscomm_printf(scs, "a000 CAPABILITY\r\n"); if (tlscomm_expect(scs, "* CAPABILITY", capabilities, BUF_SIZE) == 0) goto communication_failure; if (!strstr(capabilities, "STARTTLS")) { IMAP_DM(pc, DEBUG_ERROR, "server doesn't support ssl imap on port 143."); goto communication_failure; } /* we sure can! */ IMAP_DM(pc, DEBUG_INFO, "Negotiating TLS within IMAP"); tlscomm_printf(scs, "a001 STARTTLS\r\n"); if (tlscomm_expect(scs, "a001 ", buf, BUF_SIZE) == 0) goto communication_failure; if (strstr(buf, "a001 OK") == 0) { /* we didn't see the success message in the response */ IMAP_DM(pc, DEBUG_ERROR, "couldn't negotiate tls. :(\n"); goto communication_failure; } /* we don't need the unencrypted state anymore */ /* note that communication_failure will close the socket and free via tls_close() */ free(scs); /* fall through will scs = initialize_gnutls(sd); */ } /* either we've negotiated ssl from starttls, or we're starting an encrypted connection now */ if (PCU.dossl != 0) { scs = initialize_gnutls(sd, connection_name, pc, PCU.serverName); if (scs == NULL) { IMAP_DM(pc, DEBUG_ERROR, "Failed to initialize TLS\n"); return NULL; } } else { scs = initialize_unencrypted(sd, connection_name, pc); } /* authenticate; first find out how */ /* note that capabilities may have changed since last time we may have asked, if we called STARTTLS, my server will allow plain password login within an encrypted session. */ tlscomm_printf(scs, "a000 CAPABILITY\r\n"); if (tlscomm_expect(scs, "* CAPABILITY", capabilities, BUF_SIZE) == 0) { IMAP_DM(pc, DEBUG_ERROR, "unable to query capability string"); goto communication_failure; } /* try each authentication method in turn. */ for (a = auth_methods; a->name != NULL; a++) { /* was it specified or did the user leave it up to us? */ if (PCU.authList[0] == '\0' || strstr(PCU.authList, a->name) != NULL) /* try the authentication method */ if ((a->auth_callback(pc, scs, capabilities)) != 0) { /* store this well setup connection in the cache */ bind_state_to_pcu(pc, scs); complained_already = 0; return NULL; } } /* if authentication worked, we won't get here */ IMAP_DM(pc, DEBUG_ERROR, "All authentication methods failed for '%s@%s:%d'\n", PCU.userName, PCU.serverName, PCU.serverPort); communication_failure: tlscomm_printf(scs, "a002 LOGOUT\r\n"); tlscomm_close(scs); return NULL; } void imap_cacheHeaders( /*@notnull@ */ Pop3 pc); int imap_checkmail( /*@notnull@ */ Pop3 pc) { /* recover connection state from the cache */ struct connection_state *scs = state_for_pcu(pc); char buf[BUF_SIZE]; static int command_id; /* if it's not in the cache, try to open */ if (scs == NULL) { IMAP_DM(pc, DEBUG_INFO, "Need new connection to %s@%s\n", PCU.userName, PCU.serverName); (void) imap_open(pc); scs = state_for_pcu(pc); } if (scs == NULL) { return -1; } if (tlscomm_is_blacklisted(scs) != 0) { /* unresponsive server, don't bother. */ return -1; } /* if we've got it by now, try the status query */ command_id++; tlscomm_printf(scs, "a%03d STATUS %s (MESSAGES UNSEEN)\r\n", command_id % 1000, pc->path); if (tlscomm_expect(scs, "* STATUS", buf, 127) != 0) { /* a valid response? */ // doesn't support spaces: (void) sscanf(buf, "* STATUS %*s (MESSAGES %d UNSEEN %d)", const char *msg; msg = strstr(buf, "(MESSAGES"); if (msg != NULL) (void) sscanf(msg, "(MESSAGES %d UNSEEN %d)", &(pc->TotalMsgs), &(pc->UnreadMsgs)); /* update the cached headers if evidence that change has occurred; not necessarily complete. */ if (pc->UnreadMsgs != pc->OldUnreadMsgs || pc->TotalMsgs != pc->OldMsgs) { if (PCU.wantCacheHeaders) { imap_cacheHeaders(pc); } } } else { /* something went wrong. bail. */ tlscomm_close(unbind(scs)); return -1; } return 0; } void imap_releaseHeaders(Pop3 pc __attribute__ ((unused)), struct msglst *h) { assert(h != NULL); /* allow the list to be released next time around */ if (h->in_use <= 0) { /* free the old one */ while (h != NULL) { struct msglst *n = h->next; free(h); h = n; } } else { h->in_use--; } } void imap_cacheHeaders( /*@notnull@ */ Pop3 pc) { struct connection_state *scs = state_for_pcu(pc); char *msgid; char buf[BUF_SIZE]; if (scs == NULL) { (void) imap_open(pc); scs = state_for_pcu(pc); } if (scs == NULL) { return; } if (tlscomm_is_blacklisted(scs) != 0) { return; } if (pc->headerCache != NULL) { /* decrement the reference count, and free our version */ imap_releaseHeaders(pc, pc->headerCache); pc->headerCache = NULL; } IMAP_DM(pc, DEBUG_INFO, "working headers\n"); tlscomm_printf(scs, "a004 EXAMINE %s\r\n", pc->path); if (tlscomm_expect(scs, "a004 OK", buf, 127) == 0) { tlscomm_close(unbind(scs)); return; } IMAP_DM(pc, DEBUG_INFO, "examine ok\n"); /* if we've got it by now, try the status query */ tlscomm_printf(scs, "a005 SEARCH UNSEEN\r\n"); if (tlscomm_expect(scs, "* SEARCH", buf, 127) == 0) { tlscomm_close(unbind(scs)); return; } IMAP_DM(pc, DEBUG_INFO, "search: %s", buf); if (strlen(buf) < 9) return; /* search turned up nothing */ msgid = strtok(buf + 9, " \r\n"); pc->headerCache = NULL; /* the isdigit cruft is to deal with EOL */ if (msgid != NULL && isdigit(msgid[0])) do { struct msglst *m = malloc(sizeof(struct msglst)); char hdrbuf[128]; int fetch_command_done = FALSE; tlscomm_printf(scs, "a04 FETCH %s (FLAGS " "BODY[HEADER.FIELDS (FROM SUBJECT)])\r\n", msgid); if (tlscomm_expect(scs, "* ", hdrbuf, 127)) { m->subj[0] = '\0'; m->from[0] = '\0'; while (m->subj[0] == '\0' || m->from[0] == '\0') { if (tlscomm_expect(scs, "", hdrbuf, 127)) { if (strncasecmp(hdrbuf, "Subject:", 8) == 0) { strncpy(m->subj, hdrbuf + 9, SUBJ_LEN - 1); m->subj[SUBJ_LEN - 1] = '\0'; } else if (strncasecmp(hdrbuf, "From: ", 5) == 0) { strncpy(m->from, hdrbuf + 6, FROM_LEN - 1); m->from[FROM_LEN - 1] = '\0'; } else if (strncasecmp (hdrbuf, "a04 OK FETCH", 5) == 0) { /* server says we're done getting this header, which may occur if the message has no subject */ if (m->from[0] == '\0') { strcpy(m->from, " "); } if (m->subj[0] == '\0') { strcpy(m->subj, "(no subject)"); } fetch_command_done = TRUE; } } else { IMAP_DM(pc, DEBUG_ERROR, "timedout looking for headers.: %s", hdrbuf); strcpy(m->from, "wmbiff"); strcpy(m->subj, "failure"); } } IMAP_DM(pc, DEBUG_INFO, "From: '%s' Subj: '%s'\n", m->from, m->subj); m->next = pc->headerCache; pc->headerCache = m; pc->headerCache->in_use = 0; /* initialize that it isn't locked */ } else { IMAP_DM(pc, DEBUG_ERROR, "error fetching: %s", hdrbuf); } if (!fetch_command_done) { tlscomm_expect(scs, "a04 OK", hdrbuf, 127); } } while ((msgid = strtok(NULL, " \r\n")) != NULL && isdigit(msgid[0])); tlscomm_printf(scs, "a06 CLOSE\r\n"); /* return to polling state */ /* may be unneeded tlscomm_expect(scs, "a06 OK CLOSE\r\n" ); see if it worked? */ IMAP_DM(pc, DEBUG_INFO, "worked headers\n"); } /* a client is asking for the headers, hand em a reference, increase the one-bit reference counter */ struct msglst *imap_getHeaders( /*@notnull@ */ Pop3 pc) { if (pc->headerCache == NULL) imap_cacheHeaders(pc); if (pc->headerCache != NULL) pc->headerCache->in_use = 1; return pc->headerCache; } /* parse the config line to setup the Pop3 structure */ int imap4Create( /*@notnull@ */ Pop3 pc, const char *const str) { int i; int matchedchars; /* special characters aren't allowed in hostnames, rfc 1034 */ const char *regexes[] = { // type : username : password @ hostname (/ name)?(:port)? ".*imaps?:([^: ]{1,256}):([^@]{0,32})@([A-Za-z1-9][-A-Za-z0-9_.]+)(/(\"[^\"]+\")|([^:@ ]+))?(:[0-9]+)?( *([CcAaPp][-A-Za-z5 ]*))?$", ".*imaps?:([^: ]{1,256}) ([^ ]{1,32}) ([A-Za-z1-9][-A-Za-z0-9_.]+)(/(\"[^\"]+\")|([^: ]+))?( [0-9]+)?( *([CcAaPp][-A-Za-z5 ]*))?$", NULL }; char *unaliased_str; struct regulo regulos[] = { {1, PCU.userName, regulo_strcpy}, {2, PCU.password, regulo_strcpy}, {3, PCU.serverName, regulo_strcpy}, {4, pc->path, regulo_strcpy_skip1}, {7, &PCU.serverPort, regulo_atoi}, {9, PCU.authList, regulo_strcpy_tolower}, {0, NULL, NULL} }; if (Relax) { regexes[0] = ".*imaps?:([^: ]{1,256}):([^@]{0,32})@([^/: ]+)(/(\"[^\"]+\")|([^:@ ]+))?(:[0-9]+)?( *(.*))?$"; regexes[1] = ".*imaps?:([^: ]{1,256}) ([^ ]{1,32}) ([^/: ]+)(/(\"[^\"]+\")|([^: ]+))?( [0-9]+)?( *(.*))?$"; } /* IMAP4 format: imap:user:password@server/mailbox[:port] */ /* If 'str' line is badly formatted, wmbiff won't display the mailbox. */ if (strncmp("sslimap:", str, 8) == 0 || strncmp("imaps:", str, 6) == 0) { #ifdef HAVE_GNUTLS_GNUTLS_H PCU.dossl = 1; #else printf("This copy of wmbiff was not compiled with gnutls;\n" "imaps is unavailable. Exiting to protect your\n" "passwords and privacy.\n"); exit(EXIT_FAILURE); #endif } else { PCU.dossl = 0; } /* defaults */ PCU.serverPort = (PCU.dossl != 0) ? 993 : 143; PCU.authList[0] = '\0'; /* argh, str and pc->path are aliases, so we can't just write the default value into the string we're about to parse. */ unaliased_str = strdup(str); strcpy(pc->path, "INBOX"); for (matchedchars = 0, i = 0; regexes[i] != NULL && matchedchars <= 0; i++) { matchedchars = regulo_match(regexes[i], unaliased_str, regulos); } /* failed to match either regex */ if (matchedchars <= 0) { pc->label[0] = '\0'; IMAP_DM(pc, DEBUG_ERROR, "Couldn't parse line %s (%d)\n" " If this used to work, run wmbiff with the -relax option, and\n" " send mail to "PACKAGE_BUGREPORT" with the hostname\n" " of your mail server.\n", unaliased_str, matchedchars); return -1; } PCU.password_len = strlen(PCU.password); if (PCU.password[0] == '\0') { PCU.interactive_password = 1; } else { ENFROB(PCU.password); } // grab_authList(unaliased_str + matchedchars, PCU.authList); free(unaliased_str); IMAP_DM(pc, DEBUG_INFO, "userName= '%s'\n", PCU.userName); IMAP_DM(pc, DEBUG_INFO, "password is %d characters long\n", (int) PCU.password_len); IMAP_DM(pc, DEBUG_INFO, "serverName= '%s'\n", PCU.serverName); IMAP_DM(pc, DEBUG_INFO, "serverPath= '%s'\n", pc->path); IMAP_DM(pc, DEBUG_INFO, "serverPort= '%d'\n", PCU.serverPort); IMAP_DM(pc, DEBUG_INFO, "authList= '%s'\n", PCU.authList); if (strcmp(pc->action, "msglst") == 0 || strcmp(pc->fetchcmd, "msglst") == 0 || strcmp(pc->button2, "msglst") == 0) { PCU.wantCacheHeaders = 1; } else { PCU.wantCacheHeaders = 0; } pc->checkMail = imap_checkmail; pc->getHeaders = imap_getHeaders; pc->releaseHeaders = imap_releaseHeaders; pc->TotalMsgs = 0; pc->UnreadMsgs = 0; pc->OldMsgs = -1; pc->OldUnreadMsgs = -1; return 0; } static int authenticate_plaintext( /*@notnull@ */ Pop3 pc, struct connection_state *scs, const char *capabilities) { char buf[BUF_SIZE]; /* is login prohibited? */ /* "An IMAP client which complies with [rfc2525, section 3.2] * MUST NOT issue the LOGIN command if this capability is present. */ if (strstr(capabilities, "LOGINDISABLED")) { IMAP_DM(pc, DEBUG_ERROR, "Plaintext auth prohibited by server: (LOGINDISABLED).\n"); goto plaintext_failed; } ask_user_for_password(pc, 0); do { /* login */ DEFROB(PCU.password); tlscomm_printf(scs, "a001 LOGIN %s \"%s\"\r\n", PCU.userName, PCU.password); ENFROB(PCU.password); if (tlscomm_expect(scs, "a001 ", buf, BUF_SIZE) == 0) { IMAP_DM(pc, DEBUG_ERROR, "Did not get a response to the LOGIN command.\n"); goto plaintext_failed; } if (buf[5] != 'O') { IMAP_DM(pc, DEBUG_ERROR, "IMAP Login failed: %s\n", buf); /* if we're prompting the user, ask again, else fail */ if (PCU.interactive_password) { PCU.password[0] = '\0'; ask_user_for_password(pc, 1); /* 1=overwrite the cache */ } else { goto plaintext_failed; } } else { return (1); } } while (1); plaintext_failed: return (0); } #ifdef HAVE_GCRYPT_H static int authenticate_md5(Pop3 pc, struct connection_state *scs, const char *capabilities) { char buf[BUF_SIZE]; char buf2[BUF_SIZE]; unsigned char *md5; gcry_md_hd_t gmh; gcry_error_t rc; if (!strstr(capabilities, "AUTH=CRAM-MD5")) { /* server doesn't support cram-md5. */ return 0; } tlscomm_printf(scs, "a007 AUTHENTICATE CRAM-MD5\r\n"); if (tlscomm_expect(scs, "+ ", buf, BUF_SIZE) == 0) goto expect_failure; Decode_Base64(buf + 2, buf2); IMAP_DM(pc, DEBUG_INFO, "CRAM-MD5 challenge: %s\n", buf2); strcpy(buf, PCU.userName); strcat(buf, " "); ask_user_for_password(pc, 0); rc = gcry_md_open(&gmh, GCRY_MD_MD5, GCRY_MD_FLAG_HMAC); if (rc != 0) { IMAP_DM(pc, DEBUG_INFO, "unable to initialize gcrypt md5\n"); return 0; } DEFROB(PCU.password); gcry_md_setkey(gmh, PCU.password, strlen(PCU.password)); ENFROB(PCU.password); gcry_md_write(gmh, (unsigned char *) buf2, strlen(buf2)); gcry_md_final(gmh); md5 = gcry_md_read(gmh, 0); Bin2Hex(md5, 16, buf2); gcry_md_close(gmh); strcat(buf, buf2); IMAP_DM(pc, DEBUG_INFO, "CRAM-MD5 response: %s\n", buf); Encode_Base64(buf, buf2); tlscomm_printf(scs, "%s\r\n", buf2); if (tlscomm_expect(scs, "a007 ", buf, BUF_SIZE) == 0) goto expect_failure; if (!strncmp(buf, "a007 OK", 7)) return 1; /* AUTH successful */ IMAP_DM(pc, DEBUG_ERROR, "CRAM-MD5 AUTH failed for user '%s@%s:%d'\n", PCU.userName, PCU.serverName, PCU.serverPort); IMAP_DM(pc, DEBUG_INFO, "It said %s", buf); return 0; expect_failure: IMAP_DM(pc, DEBUG_ERROR, "tlscomm_expect failed during cram-md5 auth: %s", buf); IMAP_DM(pc, DEBUG_ERROR, "failed to authenticate using cram-md5."); return 0; } #endif static void ask_user_for_password( /*@notnull@ */ Pop3 pc, int bFlushCache) { /* see if we already have a password, as provided in the config file, or already requested from the user. */ if (PCU.interactive_password) { if (strlen(PCU.password) == 0) { /* we need to grab the password from the user. */ char *password; IMAP_DM(pc, DEBUG_INFO, "asking for password %d\n", bFlushCache); password = passwordFor(PCU.userName, PCU.serverName, pc, bFlushCache); if (password != NULL) { if (strlen(password) + 1 > BUF_SMALL) { DMA(DEBUG_ERROR, "Password is too long.\n"); memset(PCU.password, 0, BUF_SMALL - 1); } else { strncpy(PCU.password, password, BUF_SMALL - 1); PCU.password_len = strlen(PCU.password); } free(password); ENFROB(PCU.password); } } } } /* vim:set ts=4: */ /* * Local Variables: * tab-width: 4 * c-indent-level: 4 * c-basic-offset: 4 * End: */ dockapps/wmbiff/Makefile.am000066400000000000000000000063601242751507200162020ustar00rootroot00000000000000TESTS = test_wmbiff test_tlscomm noinst_PROGRAMS = test_wmbiff test_tlscomm bin_PROGRAMS = wmbiff wmbiff_SOURCES = wmbiff.c socket.c Pop3Client.c mboxClient.c \ maildirClient.c Imap4Client.c tlsComm.c tlsComm.h ShellClient.c \ passwordMgr.c passwordMgr.h charutil.c charutil.h Client.h \ regulo.c regulo.h MessageList.c MessageList.h EXTRA_wmbiff_SOURCES = gnutls-common.c gnutls-common.h wmbiff_LDADD = -L../wmgeneral -lwmgeneral @LIBGCRYPT_LIBS@ @GNUTLS_COMMON_O@ wmbiff_DEPENDENCIES = ../wmgeneral/libwmgeneral.a Makefile @GNUTLS_COMMON_O@ test_wmbiff_SOURCES = ShellClient.c charutil.c charutil.h Client.h \ test_wmbiff.c passwordMgr.c Imap4Client.c regulo.c Pop3Client.c \ tlsComm.c tlsComm.h socket.c test_tlscomm_SOURCES = test_tlscomm.c \ tlsComm.c tlsComm.h EXTRA_test_wmbiff_SOURCES = gnutls-common.c gnutls-common.h test_wmbiff_LDADD = @LIBGCRYPT_LIBS@ man_MANS = wmbiff.1 wmbiffrc.5 skindir = $(datadir)/wmbiff/skins skin_DATA = wmbiff-master-led.xpm wmbiff-master-contrast.xpm \ wmbiff-classic-master-led.xpm wmbiff-classic-master-contrast.xpm EXTRA_DIST = $(man_MANS) sample.wmbiffrc wmbiff-master-led.xpm \ wmbiff-classic-master-led.xpm MAINTAINERCLEANFILES = Makefile.in # CODING STYLE AND INDENTATION [2001-Mar-12]: # # There have been some problems with coding style in the past. Many people # contributed to wmbiff (thank you!), and the code got really messy. To help # resolve this, I used GNU indent with what I believe to be the most # widely-accepted coding style options (K&R style) with 4-space TAB indents # (because some of the code is highly nested) to clean up the code. Not # everyone may be happy with this, but has been determined to be necessary for # consistency and legibility. # # In other words, make sure you run "make clean" and "make indent", and do not # change the options on the indent command, before you submit patches against # wmbiff. This will make everyone's life easier. # # -- Dwayne C. Litzenberger indent: indent -npro -kr -i4 -ts4 $(wmbiff_SOURCES) test_*.c || true # to perform surgery on a few changed files. .c.indent: indent -npro -kr -i4 -ts4 $< || true dist-hook-local: indent config-h-check distclean-local: -rm -f wmbiff-master-contrast.xpm wmbiff-master.xpm \ wmbiff-classic-master-contrast.xpm # remove colors, then substitute old colors, then repalletize # for some reason $< doesn't always work. wmbiff-master-contrast.xpm: wmbiff-master-led.xpm Makefile egrep -v '^"[:%][[:space:]]c #' < wmbiff-master-led.xpm | \ sed -e 's/:/./g' -e 's/%/$$/g' -e 's/ 15 / 13 /' | \ sed -e 's/#\([0-9A-F]\{2\}\)[0-9A-F]\{2\}\([0-9A-F]\{2\}\)[0-9A-F]\{2\}\([0-9A-F]\{2\}\)[0-9A-F]\{2\}/#\1\2\3/'\ > $@ || rm $@ wmbiff-classic-master-contrast.xpm: wmbiff-classic-master-led.xpm Makefile egrep -v '^"[:%][[:space:]]c #' < wmbiff-classic-master-led.xpm | \ sed -e 's/:/./g' -e 's/%/$$/g' -e 's/ 15 / 13 /' | \ sed -e 's/#\([0-9A-F]\{2\}\)[0-9A-F]\{2\}\([0-9A-F]\{2\}\)[0-9A-F]\{2\}\([0-9A-F]\{2\}\)[0-9A-F]\{2\}/#\1\2\3/'\ > $@ || rm $@ # fail if there's a .c file that doesn't include config.h config-h-check: ls *.c | sort > cfiles grep -l config.h *.c | sort | diff - cfiles rm cfiles # just a reminder of how to run valgrind to get decent output. valgrind: valgrind --leak-check=yes ./wmbiff -exit dockapps/wmbiff/MessageList.c000066400000000000000000000126611242751507200165330ustar00rootroot00000000000000#include "Client.h" #include "MessageList.h" #include #ifdef HAVE_X11_XPM_H #include #endif #ifdef HAVE_XPM_H #include #endif #include /* needed for Region on solaris? */ #include #define LEFT_MAR 6 #define RIGHT_MAR 6 #define COL_SEP 4 extern Display *display; extern Window Root; extern int screen; extern int x_fd; extern int d_depth; extern Window win; static XSizeHints mysizehints; extern Pixel back_pix, fore_pix; static Window newwin; static GC localGC; extern Pixel GetColor(const char *name); static XFontStruct *fn; static int fontHeight; extern const char *foreground; extern const char *background; Pop3 Active_pc; static int loadFont(const char *fontname) { if (display != NULL) { fn = XLoadQueryFont(display, fontname); if (fn) { XSetFont(display, localGC, fn->fid); fontHeight = fn->max_bounds.ascent + fn->max_bounds.descent + 2; return 0; } else { printf("couldn't set font! (%s)\n", fontname); } } return -1; } static int flush_expose(Window w) { XEvent dummy; int i = 0; while (XCheckTypedWindowEvent(display, w, Expose, &dummy)) i++; return i; } struct msglst *Headers; void msglst_show(Pop3 pc, int x, int y) { int maxfrm = 0; int maxsubj = 0; int limit = 10; XGCValues gcv; unsigned long gcm; Active_pc = pc; /* hold so we can release later. */ /* local gc */ gcm = GCForeground | GCBackground | GCGraphicsExposures; gcv.foreground = GetColor(foreground); gcv.background = GetColor(background); gcv.graphics_exposures = 0; localGC = XCreateGC(display, Root, gcm, &gcv); if (fn == NULL) { /* loadFont? or use a proportional instead? mmm. */ if (loadFont("-*-fixed-*-r-*-*-10-*-*-*-*-*-*-*") < 0) { return; } } if (pc->getHeaders == NULL) { DM(pc, DEBUG_INFO, "no getHeaders callback\n"); return; } Headers = pc->getHeaders(pc); if (Headers == NULL) { #define NO_MSG "no new messages" mysizehints.height = 5 + fontHeight; mysizehints.width = XTextWidth(fn, NO_MSG, strlen(NO_MSG)); DM(pc, DEBUG_INFO, "no new messages\n"); } else { struct msglst *h; mysizehints.height = 5; for (h = Headers; h != NULL && limit > 0; h = h->next, limit--) { int frmlen; char *c; int subjlen; if ((c = index(h->from, '\r')) != NULL) { *c = '\0'; /* chomp newlines */ } if ((c = index(h->subj, '\r')) != NULL) { *c = '\0'; /* chomp newlines */ } if ((c = index(h->from, '<')) != NULL) { *c = '\0'; /* chomp from[0] == '"') { /* remove "'s */ for (c = &h->from[1]; *c && *c != '"'; c++) { *(c - 1) = *c; } *(c - 1) = '\0'; } subjlen = XTextWidth(fn, h->subj, strlen(h->subj)); frmlen = XTextWidth(fn, h->from, strlen(h->from)); if (frmlen > maxfrm) { maxfrm = frmlen; } if (subjlen > maxsubj) { maxsubj = subjlen; } mysizehints.height += fontHeight; } mysizehints.width = maxfrm + maxsubj + LEFT_MAR + RIGHT_MAR + COL_SEP; } /* Create a window to hold the stuff */ mysizehints.flags = USSize | USPosition; mysizehints.x = max(x - mysizehints.width, 0); mysizehints.y = max(y - mysizehints.height, 0); newwin = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y, mysizehints.width, mysizehints.height, 2, gcv.foreground, gcv.background); XSetWMNormalHints(display, newwin, &mysizehints); XStoreName(display, newwin, pc->label); XSelectInput(display, newwin, ExposureMask); { /* I confess I don't know what this does or whether it matters */ XSetWindowAttributes xswa; xswa.backing_store = Always; xswa.bit_gravity = CenterGravity; XChangeWindowAttributes(display, newwin, CWBackingStore | CWBitGravity, &xswa); } XMapWindow(display, newwin); } /* may be called without the window open */ void msglst_hide(void) { if (newwin) { flush_expose(newwin); /* swallow the messages */ XDestroyWindow(display, newwin); // } else { // no window fprintf(stderr, "unexpected error destroying msglist window\n"); if (Active_pc->releaseHeaders != NULL && Headers != NULL) { Active_pc->releaseHeaders(Active_pc, Headers); } newwin = 0; } } void msglst_redraw(void) { XEvent dummy; unsigned int width, height; unsigned int bw, d; int x, y; Window r; if (newwin == 0) { return; } while (XCheckTypedWindowEvent(display, newwin, Expose, &dummy)); XGetGeometry(display, newwin, &r, &x, &y, &width, &height, &bw, &d); XSetForeground(display, localGC, GetColor(background)); XFillRectangle(display, newwin, localGC, 0, 0, width, height); XSetForeground(display, localGC, GetColor(foreground)); XSetBackground(display, localGC, GetColor(background)); if (Headers == NULL) { XDrawString(display, newwin, localGC, 0, fontHeight, NO_MSG, strlen(NO_MSG)); flush_expose(newwin); } else { int linenum; struct msglst *h; int limit = 10; int maxfrm = 0; /* draw the from lines */ for (h = Headers, linenum = 0; h != NULL && linenum < limit; h = h->next, linenum++) { int frm = XTextWidth(fn, h->from, strlen(h->from)); if (frm > maxfrm) { maxfrm = frm; } XDrawString(display, newwin, localGC, LEFT_MAR, (linenum + 1) * fontHeight, h->from, strlen(h->from)); } /* draw the subject lines */ for (h = Headers, linenum = 0; h != NULL && linenum < limit; h = h->next, linenum++) { XDrawString(display, newwin, localGC, LEFT_MAR + maxfrm + COL_SEP, (linenum + 1) * fontHeight, h->subj, strlen(h->subj)); } } } dockapps/wmbiff/MessageList.h000066400000000000000000000003621242751507200165330ustar00rootroot00000000000000 #define SUBJ_LEN 50 #define FROM_LEN 22 struct msglst { struct msglst *next; char subj[SUBJ_LEN]; char from[FROM_LEN]; unsigned int in_use:1; }; void msglst_show(Pop3 pc, int x, int y); void msglst_hide(void); void msglst_redraw(void); dockapps/wmbiff/Pop3Client.c000066400000000000000000000347621242751507200163010ustar00rootroot00000000000000/* $Id: Pop3Client.c,v 1.23 2004/12/12 00:01:53 bluehal Exp $ */ /* Author : Scott Holden ( scotth@thezone.net ) Modified : Yong-iL Joh ( tolkien@mizi.com ) Modified : Jorge García ( Jorge.Garcia@uv.es ) Modified ; Mark Hurley ( debian4tux@telocity.com ) Modified : Neil Spring ( nspring@cs.washington.edu ) * * Pop3 Email checker. * * Last Updated : Tue Nov 13 13:45:23 PST 2001 * */ #ifdef HAVE_CONFIG_H #include #endif #include "Client.h" #include "charutil.h" #include "regulo.h" #include "MessageList.h" #include #include "tlsComm.h" #include "passwordMgr.h" #ifdef USE_DMALLOC #include #endif extern int Relax; /* temp */ static void ask_user_for_password( /*@notnull@ */ Pop3 pc, int bFlushCache); #define PCU (pc->u).pop_imap #define POP_DM(pc, lvl, args...) DM(pc, lvl, "pop3: " args) #ifdef HAVE_GCRYPT_H static struct connection_state *authenticate_md5( /*@notnull@ */ Pop3 pc, struct connection_state * scs, char *unused); static struct connection_state *authenticate_apop( /*@notnull@ */ Pop3 pc, struct connection_state * scs, char *apop_str); #endif static struct connection_state *authenticate_plaintext( /*@notnull@ */ Pop3 pc, struct connection_state * scs, char *unused); void pop3_cacheHeaders( /*@notnull@ */ Pop3 pc); extern void imap_releaseHeaders(Pop3 pc __attribute__ ((unused)), struct msglst *h); extern struct connection_state *state_for_pcu(Pop3 pc); static struct authentication_method { const char *name; /* callback returns the connection state pointer if successful, NULL if failed */ struct connection_state *(*auth_callback) (Pop3 pc, struct connection_state * scs, char *apop_str); } auth_methods[] = { { #ifdef HAVE_GCRYPT_H "cram-md5", authenticate_md5}, { "apop", authenticate_apop}, { #endif "plaintext", authenticate_plaintext}, { NULL, NULL} }; /*@null@*/ struct connection_state *pop3Login(Pop3 pc) { int fd; char buf[BUF_SIZE]; char apop_str[BUF_SIZE]; char *ptr1, *ptr2; struct authentication_method *a; struct connection_state *scs; char *connection_name; apop_str[0] = '\0'; /* if defined, server supports apop */ if ((fd = sock_connect(PCU.serverName, PCU.serverPort)) == -1) { POP_DM(pc, DEBUG_ERROR, "Not Connected To Server '%s:%d'\n", PCU.serverName, PCU.serverPort); return NULL; } connection_name = malloc(strlen(PCU.serverName) + 20); sprintf(connection_name, "%s:%d", PCU.serverName, PCU.serverPort); if (PCU.dossl != 0) { scs = initialize_gnutls(fd, connection_name, pc, PCU.serverName); if (scs == NULL) { POP_DM(pc, DEBUG_ERROR, "Failed to initialize TLS\n"); return NULL; } } else { scs = initialize_unencrypted(fd, connection_name, pc); } tlscomm_gets(buf, BUF_SIZE, scs); POP_DM(pc, DEBUG_INFO, "%s", buf); /* Detect APOP, copy challenge into apop_str */ for (ptr1 = buf + strlen(buf), ptr2 = NULL; ptr1 > buf; --ptr1) { if (*ptr1 == '>') { ptr2 = ptr1; } else if (*ptr1 == '<') { if (ptr2) { *(ptr2 + 1) = 0; strncpy(apop_str, ptr1, BUF_SIZE); } break; } } /* try each authentication method in turn. */ for (a = auth_methods; a->name != NULL; a++) { /* was it specified or did the user leave it up to us? */ if (PCU.authList[0] == '\0' || strstr(PCU.authList, a->name)) /* did it work? */ if ((a->auth_callback(pc, scs, apop_str)) != NULL) return (scs); } /* if authentication worked, we won't get here */ POP_DM(pc, DEBUG_ERROR, "All Pop3 authentication methods failed for '%s@%s:%d'\n", PCU.userName, PCU.serverName, PCU.serverPort); tlscomm_printf(scs, "QUIT\r\n"); tlscomm_close(scs); return NULL; } int pop3CheckMail( /*@notnull@ */ Pop3 pc) { struct connection_state *scs; int read; char buf[BUF_SIZE]; scs = pop3Login(pc); if (scs == NULL) return -1; tlscomm_printf(scs, "STAT\r\n"); if( ! tlscomm_expect(scs, "+", buf, BUF_SIZE) ) { POP_DM(pc, DEBUG_ERROR, "Error Receiving Stats '%s@%s:%d'\n", PCU.userName, PCU.serverName, PCU.serverPort); POP_DM(pc, DEBUG_INFO, "It said: %s\n", buf); return -1; } else { sscanf(buf, "+OK %d", &(pc->TotalMsgs)); } /* - Updated - Mark Hurley - debian4tux@telocity.com * In compliance with RFC 1725 * which removed the LAST command, any servers * which follow this spec will return: * -ERR unimplimented * We will leave it here for those servers which haven't * caught up with the spec. */ tlscomm_printf(scs, "LAST\r\n"); tlscomm_gets(buf, BUF_SIZE, scs); if (buf[0] != '+') { /* it is not an error to receive this according to RFC 1725 */ /* no error should be returned */ pc->UnreadMsgs = pc->TotalMsgs; // there's also a LIST command... not sure how to make use of it. */ } else { sscanf(buf, "+OK %d", &read); pc->UnreadMsgs = pc->TotalMsgs - read; } tlscomm_printf(scs, "QUIT\r\n"); tlscomm_close(scs); return 0; } struct msglst *pop_getHeaders( /*@notnull@ */ Pop3 pc) { if (pc->headerCache == NULL) pop3_cacheHeaders(pc); if (pc->headerCache != NULL) pc->headerCache->in_use = 1; return pc->headerCache; } int pop3Create(Pop3 pc, const char *str) { /* POP3 format: pop3:user:password@server[:port] */ /* new POP3 format: pop3:user password server [port] */ /* If 'str' line is badly formatted, wmbiff won't display the mailbox. */ int i; int matchedchars; /* ([^: ]+) user ([^@]+) or ([^ ]+) password ([^: ]+) server ([: ][0-9]+)? optional port ' *' gobbles trailing whitespace before authentication types. use separate regexes for old and new types to permit use of '@' in passwords */ const char *regexes[] = { "pop3s?:([^: ]{1,32}):([^@]{0,32})@([A-Za-z1-9][-A-Za-z0-9_.]+)(:[0-9]+)?( *([CcAaPp][-A-Za-z5 ]*))?$", "pop3s?:([^: ]{1,32}) ([^ ]{1,32}) ([A-Za-z1-9][-A-Za-z0-9_.]+)( [0-9]+)?( *([CcAaPp][-A-Za-z5 ]*))?$", // "pop3:([^: ]{1,32}) ([^ ]{1,32}) ([^: ]+)( [0-9]+)? *", // "pop3:([^: ]{1,32}):([^@]{0,32})@([^: ]+)(:[0-9]+)? *", NULL }; struct regulo regulos[] = { {1, PCU.userName, regulo_strcpy}, {2, PCU.password, regulo_strcpy}, {3, PCU.serverName, regulo_strcpy}, {4, &PCU.serverPort, regulo_atoi}, {6, PCU.authList, regulo_strcpy_tolower}, {0, NULL, NULL} }; if (Relax) { regexes[0] = "pop3:([^: ]{1,32}):([^@]{0,32})@([^/: ]+)(:[0-9]+)?( *(.*))?$"; regexes[1] = "pop3:([^: ]{1,32}) ([^ ]{1,32}) ([^/: ]+)( [0-9]+)?( *(.*))?$"; } if (strncmp("pop3s:", str, 6) == 0) { #ifdef HAVE_GNUTLS_GNUTLS_H PCU.dossl = 1; #else printf("This copy of wmbiff was not compiled with gnutls;\n" "imaps is unavailable. Exiting to protect your\n" "passwords and privacy.\n"); exit(EXIT_FAILURE); #endif } else { PCU.dossl = 0; } /* defaults */ PCU.serverPort = (PCU.dossl != 0) ? 995 : 110; PCU.authList[0] = '\0'; for (matchedchars = 0, i = 0; regexes[i] != NULL && matchedchars <= 0; i++) { matchedchars = regulo_match(regexes[i], str, regulos); } /* failed to match either regex */ if (matchedchars <= 0) { pc->label[0] = '\0'; POP_DM(pc, DEBUG_ERROR, "Couldn't parse line %s (%d)\n" " If this used to work, run wmbiff with the -relax option, and\n " " send mail to "PACKAGE_BUGREPORT" with the hostname\n" " of your mail server.\n", str, matchedchars); return -1; } // grab_authList(str + matchedchars, PCU.authList); PCU.password_len = strlen(PCU.password); if (PCU.password[0] == '\0') { PCU.interactive_password = 1; } else { // ENFROB(PCU.password); } POP_DM(pc, DEBUG_INFO, "userName= '%s'\n", PCU.userName); POP_DM(pc, DEBUG_INFO, "password is %ld chars long\n", strlen(PCU.password)); POP_DM(pc, DEBUG_INFO, "serverName= '%s'\n", PCU.serverName); POP_DM(pc, DEBUG_INFO, "serverPort= '%d'\n", PCU.serverPort); POP_DM(pc, DEBUG_INFO, "authList= '%s'\n", PCU.authList); pc->checkMail = pop3CheckMail; pc->getHeaders = pop_getHeaders; pc->TotalMsgs = 0; pc->UnreadMsgs = 0; pc->OldMsgs = -1; pc->OldUnreadMsgs = -1; return 0; } #ifdef HAVE_GCRYPT_H static struct connection_state *authenticate_md5(Pop3 pc, struct connection_state * scs, char *apop_str __attribute__ ((unused))) { char buf[BUF_SIZE]; char buf2[BUF_SIZE]; unsigned char *md5; gcry_md_hd_t gmh; gcry_error_t rc; /* See if MD5 is supported */ tlscomm_printf(scs, "AUTH CRAM-MD5\r\n"); tlscomm_gets(buf, BUF_SIZE, scs); POP_DM(pc, DEBUG_INFO, "%s", buf); if (buf[0] != '+' || buf[1] != ' ') { /* nope, not supported. */ return NULL; } Decode_Base64(buf + 2, buf2); POP_DM(pc, DEBUG_INFO, "CRAM-MD5 challenge: %s\n", buf2); strcpy(buf, PCU.userName); strcat(buf, " "); rc = gcry_md_open(&gmh, GCRY_MD_MD5, GCRY_MD_FLAG_HMAC); if (rc != 0) { POP_DM(pc, DEBUG_ERROR, "unable to initialize gcrypt md5.\n"); return NULL; } gcry_md_setkey(gmh, PCU.password, strlen(PCU.password)); gcry_md_write(gmh, (unsigned char *) buf2, strlen(buf2)); gcry_md_final(gmh); md5 = gcry_md_read(gmh, 0); /* hmac_md5(buf2, strlen(buf2), PCU.password, strlen(PCU.password), md5); */ Bin2Hex(md5, 16, buf2); gcry_md_close(gmh); strcat(buf, buf2); POP_DM(pc, DEBUG_INFO, "CRAM-MD5 response: %s\n", buf); Encode_Base64(buf, buf2); tlscomm_printf(scs, "%s\r\n", buf2); tlscomm_gets(buf, BUF_SIZE, scs); if (!strncmp(buf, "+OK", 3)) return scs; /* AUTH successful */ else { POP_DM(pc, DEBUG_ERROR, "CRAM-MD5 AUTH failed for user '%s@%s:%d'\n", PCU.userName, PCU.serverName, PCU.serverPort); fprintf(stderr, "It said %s", buf); return NULL; } } static struct connection_state *authenticate_apop(Pop3 pc, struct connection_state * scs, char *apop_str) { gcry_md_hd_t gmh; gcry_error_t rc; char buf[BUF_SIZE]; unsigned char *md5; if (apop_str[0] == '\0') { /* server doesn't support apop. */ return (NULL); } POP_DM(pc, DEBUG_INFO, "APOP challenge: %s\n", apop_str); strcat(apop_str, PCU.password); rc = gcry_md_open(&gmh, GCRY_MD_MD5, 0); if (rc != 0) { POP_DM(pc, DEBUG_ERROR, "unable to initialize gcrypt md5.\n"); return NULL; } gcry_md_write(gmh, (unsigned char *) apop_str, strlen(apop_str)); gcry_md_final(gmh); md5 = gcry_md_read(gmh, 0); Bin2Hex(md5, 16, buf); gcry_md_close(gmh); POP_DM(pc, DEBUG_INFO, "APOP response: %s %s\n", PCU.userName, buf); tlscomm_printf(scs, "APOP %s %s\r\n", PCU.userName, buf); tlscomm_gets(buf, BUF_SIZE, scs); if (!strncmp(buf, "+OK", 3)) return scs; /* AUTH successful */ else { POP_DM(pc, DEBUG_ERROR, "APOP AUTH failed for user '%s@%s:%d'\n", PCU.userName, PCU.serverName, PCU.serverPort); POP_DM(pc, DEBUG_INFO, "It said %s", buf); return NULL; } } #endif /* HAVE_GCRYPT_H */ /*@null@*/ static struct connection_state *authenticate_plaintext( /*@notnull@ */ Pop3 pc, struct connection_state * scs, char *apop_str __attribute__ ((unused))) { char buf[BUF_SIZE]; tlscomm_printf(scs, "USER %s\r\n", PCU.userName); if (tlscomm_gets(buf, BUF_SIZE, scs) == 0) { POP_DM(pc, DEBUG_ERROR, "Error reading from server authenticating '%s@%s:%d'\n", PCU.userName, PCU.serverName, PCU.serverPort); return NULL; } if (buf[0] != '+') { POP_DM(pc, DEBUG_ERROR, "Failed user name when authenticating '%s@%s:%d'\n", PCU.userName, PCU.serverName, PCU.serverPort); /* deb #128863 might be easier if we printed: */ POP_DM(pc, DEBUG_ERROR, "The server's error message was: %s\n", buf); return NULL; }; tlscomm_printf(scs, "PASS %s\r\n", PCU.password); if (tlscomm_gets(buf, BUF_SIZE, scs) == 0) { POP_DM(pc, DEBUG_ERROR, "Error reading from server (2) authenticating '%s@%s:%d'\n", PCU.userName, PCU.serverName, PCU.serverPort); return NULL; } if (strncmp(buf, "-ERR [AUTH] Password required", 20) == 0) { if (PCU.interactive_password) { PCU.password[0] = '\0'; ask_user_for_password(pc, 1); /* 1=overwrite the cache */ tlscomm_printf(scs, "PASS %s\r\n", PCU.password); if (tlscomm_gets(buf, BUF_SIZE, scs) == 0) { POP_DM(pc, DEBUG_ERROR, "Error reading from server (2) authenticating '%s@%s:%d'\n", PCU.userName, PCU.serverName, PCU.serverPort); return NULL; } } } if (buf[0] != '+') { POP_DM(pc, DEBUG_ERROR, "Failed password when authenticating '%s@%s:%d'\n", PCU.userName, PCU.serverName, PCU.serverPort); POP_DM(pc, DEBUG_ERROR, "The server's error message was: %s\n", buf); return NULL; }; return scs; } void pop3_cacheHeaders( /*@notnull@ */ Pop3 pc) { char buf[BUF_SIZE]; struct connection_state *scs; int i; if (pc->headerCache != NULL) { /* decrement the reference count, and free our version */ imap_releaseHeaders(pc, pc->headerCache); pc->headerCache = NULL; } POP_DM(pc, DEBUG_INFO, "working headers\n"); /* login the server */ scs = pop3Login(pc); if (scs == NULL) return; /* pc->UnreadMsgs = pc->TotalMsgs - read; */ pc->headerCache = NULL; for (i = pc->TotalMsgs - pc->UnreadMsgs + 1; i <= pc->TotalMsgs; ++i) { struct msglst *m; m = malloc(sizeof(struct msglst)); m->subj[0] = '\0'; m->from[0] = '\0'; POP_DM(pc, DEBUG_INFO, "search: %s", buf); tlscomm_printf(scs, "TOP %i 0\r\n", i); while (tlscomm_gets(buf, 256, scs) && buf[0] != '.') { if (!strncasecmp(buf, "From: ", 6)) { /* manage the from in heads */ strncpy(m->from, buf + 6, FROM_LEN - 1); m->from[FROM_LEN - 1] = '\0'; } else if (!strncasecmp(buf, "Subject: ", 9)) { /* manage subject */ strncpy(m->subj, buf + 9, SUBJ_LEN - 1); m->subj[SUBJ_LEN - 1] = '\0'; } if (!m->subj[0]) { strncpy(m->subj, "[NO SUBJECT]", 14); } if (!m->from[0]) { strncpy(m->from, "[ANONYMOUS]", 14); } } m->next = pc->headerCache; pc->headerCache = m; pc->headerCache->in_use = 0; } tlscomm_printf(scs, "QUIT\r\n"); tlscomm_close(scs); } /* vim:set ts=4: */ static void ask_user_for_password( /*@notnull@ */ Pop3 pc, int bFlushCache) { /* see if we already have a password, as provided in the config file, or already requested from the user. */ if (PCU.interactive_password) { if (strlen(PCU.password) == 0) { /* we need to grab the password from the user. */ char *password; POP_DM(pc, DEBUG_INFO, "asking for password %d\n", bFlushCache); password = passwordFor(PCU.userName, PCU.serverName, pc, bFlushCache); if (password != NULL) { if (strlen(password) + 1 > BUF_SMALL) { DMA(DEBUG_ERROR, "Password is too long.\n"); memset(PCU.password, 0, BUF_SMALL - 1); } else { strncpy(PCU.password, password, BUF_SMALL - 1); PCU.password_len = strlen(PCU.password); } free(password); // ENFROB(PCU.password); } } } } dockapps/wmbiff/ShellClient.c000066400000000000000000000175061242751507200165240ustar00rootroot00000000000000/* Author: Benoît Rouits ( brouits@free.fr ) thanks to Neil Spring. from LicqClient by Yong-iL Joh ( tolkien@mizi.com ) and Jorge García ( Jorge.Garcia@uv.es ) * * generic Shell command support * * Last Updated : Tue Mar 5 15:23:35 CET 2002 * */ #ifdef HAVE_CONFIG_H #include #endif #include "Client.h" #include #include #include #include #include #include #include #include "charutil.h" #include "MessageList.h" #ifdef USE_DMALLOC #include #endif #define SH_DM(pc, lvl, args...) DM(pc, lvl, "shell: " args) /* kind_popen bumps off the sigchld handler - we care whether a checking program fails. */ #ifdef __LCLINT__ void (*old_signal_handler) (int); #else RETSIGTYPE(*old_signal_handler) (int); #endif /*@null@*/ FILE *kind_popen(const char *command, const char *type) { FILE *ret; assert(strcmp(type, "r") == 0); assert(old_signal_handler == NULL); old_signal_handler = signal(SIGCHLD, SIG_DFL); ret = popen(command, type); if (ret == NULL) { DMA(DEBUG_ERROR, "popen: error while reading '%s': %s\n", command, strerror(errno)); (void) signal(SIGCHLD, old_signal_handler); old_signal_handler = NULL; } return (ret); } /* kind_pclose checks the return value from pclose and prints some nice error messages about it. ordinarily, this would be a good idea, but wmbiff has a sigchld handler that reaps children immediately (needed when spawning other child processes), so no error checking can be done here until that's disabled */ /* returns as a mailcheck function does: -1 on fail, 0 on success */ static int kind_pclose( /*@only@ */ FILE * F, const char *command, /*@null@ */ Pop3 pc) { int exit_status = pclose(F); if (old_signal_handler != NULL) { (void) signal(SIGCHLD, old_signal_handler); old_signal_handler = NULL; } if (exit_status != 0) { if (exit_status == -1) { /* wmbiff has a sigchld handler already, so wait is likely to fail */ SH_DM(pc, DEBUG_ERROR, "pclose '%s' failed: %s\n", command, strerror(errno)); } else { SH_DM(pc, DEBUG_ERROR, "'%s' exited with non-zero status %d\n", command, exit_status); } } return (exit_status); } int grabCommandOutput(Pop3 pc, const char *command, /*@out@ */ char **output, /*@out@ *//*@null@ */ char **details) { FILE *F; char linebuf[512]; SH_DM(pc, DEBUG_INFO, "Executing '%s'\n", command); *output = NULL; if ((F = kind_popen(command, "r")) == NULL) { return -1; } if (fgets(linebuf, 512, F) == NULL) { SH_DM(pc, DEBUG_ERROR, "fgets: unable to read the output of '%s': %s\n", command, strerror(errno)); } else { chomp(linebuf); /* remove trailing newline */ *output = strdup_ordie(linebuf); } if (details) { static char allbuf[4096]; allbuf[0] = '\0'; if (fread(allbuf, 1, 4095, F) == 0 && !feof(F)) { SH_DM(pc, DEBUG_ERROR, "fread: unable to read the detailed output of '%s': %s\n", command, strerror(errno)); } allbuf[4095] = '\0'; *details = strdup_ordie(allbuf); } return (kind_pclose(F, command, pc)); } /* returns null on failure */ /*@null@*/ char *backtickExpand(Pop3 pc, const char *path) { char bigbuffer[1024]; const char *tickstart; const char *tickend; bigbuffer[0] = '\0'; while ((tickstart = strchr(path, '`')) != NULL) { char *command; char *commandoutput; tickend = strchr(tickstart + 1, '`'); if (tickend == NULL) { SH_DM(pc, DEBUG_ERROR, "unbalanced \' in %s\n", path); return NULL; } strncat(bigbuffer, path, tickstart - path); command = strdup_ordie(tickstart + 1); command[tickend - tickstart - 1] = '\0'; (void) grabCommandOutput(pc, command, &commandoutput, NULL); free(command); if (commandoutput != NULL) { strcat(bigbuffer, commandoutput); free(commandoutput); } path = tickend + 1; } /* grab the rest */ strcat(bigbuffer, path); SH_DM(pc, DEBUG_INFO, "expanded to %s\n", bigbuffer); return (strdup_ordie(bigbuffer)); } int shellCmdCheck(Pop3 pc) { int count_status = 0; char *commandOutput; if (pc == NULL) return -1; SH_DM(pc, DEBUG_INFO, ">Mailbox: '%s'\n", pc->path); /* fetch the first line of input */ pc->TextStatus[0] = '\0'; if (pc->u.shell.detail != NULL) { free(pc->u.shell.detail); pc->u.shell.detail = NULL; } (void) grabCommandOutput(pc, pc->path, &commandOutput, &pc->u.shell.detail); if (commandOutput == NULL) { return -1; } SH_DM(pc, DEBUG_INFO, "'%s' returned '%s'\n", pc->path, commandOutput); /* see if it's numeric; the numeric check is somewhat useful, as wmbiff renders 4-digit numbers, but not 4-character strings. */ if (sscanf(commandOutput, "%d", &(count_status)) == 1) { if (strstr(commandOutput, "new")) { pc->UnreadMsgs = count_status; pc->TotalMsgs = 0; } else if (strstr(commandOutput, "old")) { pc->UnreadMsgs = 0; pc->TotalMsgs = count_status; } else { /* this default should be configurable. */ pc->UnreadMsgs = 0; pc->TotalMsgs = count_status; } } else if (strcasestr(commandOutput, "unable")) { return -1; } else if (sscanf(commandOutput, "%9s\n", pc->TextStatus) == 1) { /* validate the string input */ int i; for (i = 0; pc->TextStatus[i] != '\0' && isalnum(pc->TextStatus[i]) && i < 10; i++); if (pc->TextStatus[i] != '\0') { SH_DM(pc, DEBUG_ERROR, "wmbiff only supports alphanumeric (isalnum) strings:\n" " '%s' is not ok\n", pc->TextStatus); /* null terminate it at the first bad char: */ pc->TextStatus[i] = '\0'; } /* see if we should print as new or not */ pc->UnreadMsgs = (strstr(commandOutput, "new")) ? 1 : 0; pc->TotalMsgs = -1; /* we might alternat numeric /string */ } else { SH_DM(pc, DEBUG_ERROR, "'%s' returned something other than an integer message count" " or short string.\n", pc->path); free(commandOutput); return -1; } SH_DM(pc, DEBUG_INFO, "from: %s status: %s %d %d\n", pc->path, pc->TextStatus, pc->TotalMsgs, pc->UnreadMsgs); free(commandOutput); return (0); } struct msglst *shell_getHeaders( /*@notnull@ */ Pop3 pc) { struct msglst *message_list = NULL; char *ln = pc->u.shell.detail; int i, j; if (ln == NULL) return NULL; for (j = 0; ln[j] != '\0';) { struct msglst *m = malloc(sizeof(struct msglst)); m->next = message_list; m->subj[0] = '\0'; m->from[0] = '\0'; for (i = 0; i < SUBJ_LEN - 1 && ln[j + i] != '\n'; i++) { m->subj[i] = ln[j + i]; } m->subj[i] = '\0'; j += i + 1; message_list = m; } return message_list; } void shell_releaseHeaders(Pop3 pc __attribute__ ((unused)), struct msglst *h) { for (; h != NULL;) { struct msglst *n = h->next; free(h); h = n; } } int shellCreate( /*@notnull@ */ Pop3 pc, const char *str) { /* SHELL format: shell:::/path/to/script */ const char *reserved1, *reserved2, *commandline; pc->TotalMsgs = 0; pc->UnreadMsgs = 0; pc->OldMsgs = -1; pc->OldUnreadMsgs = -1; pc->checkMail = shellCmdCheck; pc->getHeaders = shell_getHeaders; reserved1 = str + 6; /* shell:>:: */ assert(strncasecmp("shell:", str, 6) == 0); reserved2 = index(reserved1, ':'); if (reserved2 == NULL) { SH_DM(pc, DEBUG_ERROR, "unable to parse '%s', expecting ':'", str); return 0; } reserved2++; /* shell::>: */ commandline = index(reserved2, ':'); if (commandline == NULL) { SH_DM(pc, DEBUG_ERROR, "unable to parse '%s', expecting another ':'", str); return 0; } commandline++; /* shell:::> */ /* strcpy is not specified to handle overlapping regions */ SH_DM(pc, DEBUG_INFO, "path= '%s'\n", commandline); { char *tmp = strdup(commandline); if (strlen(tmp) + 1 > BUF_BIG) { SH_DM(pc, DEBUG_ERROR, "commandline '%s' is too long.\n", commandline); memset(pc->path, 0, BUF_BIG); } else { strcpy(pc->path, tmp); } free(tmp); } return 0; } /* vim:set ts=4: */ /* * Local Variables: * tab-width: 4 * c-indent-level: 4 * c-basic-offset: 4 * End: */ dockapps/wmbiff/charutil.c000066400000000000000000000123771242751507200161320ustar00rootroot00000000000000/* $Id: charutil.c,v 1.19 2004/04/28 00:19:03 bluehal Exp $ */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #ifdef USE_DMALLOC #include #endif #include "charutil.h" static __inline__ void LeftTrim(char *psValue) { char *psTmp = psValue; while (*psTmp == ' ' || *psTmp == '\t') psTmp++; /* can't use strcpy here, as the strings must not overlap, at least according to spec. */ if (psTmp > psValue) { while (*psTmp != '\0') { *(psValue++) = *(psTmp++); } *(psValue) = '\0'; } } static __inline__ void RightTrim(char *psValue) { long lLength = strlen(psValue) - 1; while ((psValue[lLength] == ' ' || psValue[lLength] == '\t') && *psValue) { lLength--; } psValue[++lLength] = '\000'; } void FullTrim(char *psValue) { RightTrim(psValue); LeftTrim(psValue); } void Bin2Hex(unsigned char *src, int length, char *dst) { static char hex_tbl[] = "0123456789abcdef"; int i = 0; char *ptr = dst; if (src && ptr) { for (i = 0; i < length; i++) { *ptr++ = hex_tbl[*src >> 4]; *ptr++ = hex_tbl[*src++ & 0xf]; } *ptr = 0; } } #define PAD '=' char ALPHABET[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\000"; /* find char in in alphabet, return offset, -1 otherwise */ int find_char(char c) { char *a = ALPHABET; while (*a) if (*(a++) == c) return a - ALPHABET - 1; return -1; } void Encode_Base64(char *src, char *dst) { int g = 0; int c = 0; if (!src || !dst) return; while (*src) { g = (g << 8) | *src++; if (c == 2) { *dst++ = ALPHABET[0x3f & (g >> 18)]; *dst++ = ALPHABET[0x3f & (g >> 12)]; *dst++ = ALPHABET[0x3f & (g >> 6)]; *dst++ = ALPHABET[0x3f & g]; } c = (c + 1) % 3; } if (c) { if (c == 1) { *dst++ = ALPHABET[0x3f & (g >> 2)]; *dst++ = ALPHABET[0x3f & (g << 4)]; *dst++ = PAD; *dst++ = PAD; } else { *dst++ = ALPHABET[0x3f & (g >> 10)]; *dst++ = ALPHABET[0x3f & (g >> 4)]; *dst++ = ALPHABET[0x3f & (g << 2)]; *dst++ = PAD; } } *dst = 0; } void Decode_Base64(char *src, char *dst) { int g = 0; int c = 0; int n = 0; if (!src || !dst) return; while (*src) { n = find_char(*src++); if (n < 0) continue; g <<= 6; g |= n; if (c == 3) { *dst++ = g >> 16; *dst++ = g >> 8; *dst++ = g; g = 0; } c = (c + 1) % 4; } if (c) { if (c == 1) { /* shouldn't happen, but do something anyway */ *dst++ = g << 2; } else if (c == 2) { *dst++ = g >> 4; } else { *dst++ = g >> 10; *dst++ = g >> 2; } } *dst = 0; } /* helper function for the configuration line parser */ void copy_substring(char *destination, int startidx, int endidx, const char *source) { if (startidx > -1) { strncpy(destination, source + startidx, endidx - startidx); destination[endidx - startidx] = '\0'; } } /* common to Pop3 and Imap4 authentication list grabber. */ void grab_authList(const char *source, char *destination) { int i; /* regex isn't all that helpful for lists of things. */ /* but does leave the end of the matched region in regs.end[0] */ /* what remains is a list of legal authentication schemes. */ if (isalnum(source[0])) { /* copy, while turning caps into lower case */ for (i = 0; i < 99 && source[i] != '\0'; i++) { destination[i] = tolower(source[i]); } destination[i] = '\0'; } else { destination[0] = '\0'; } } #ifdef USE_GNU_REGEX int compile_and_match_regex(const char *regex, const char *str, /*@out@ */ struct re_registers *regs) { const char *errstr; int matchedchars; struct re_pattern_buffer rpbuf; /* compile the regex pattern */ memset(&rpbuf, 0, sizeof(struct re_pattern_buffer)); /* posix egrep interprets intervals (eg. {1,32}) nicely */ re_syntax_options = RE_SYNTAX_POSIX_EGREP; errstr = re_compile_pattern(regex, strlen(regex), &rpbuf); if (errstr != NULL) { fprintf(stderr, "error in compiling regular expression: %s\n", errstr); return -1; } /* match the regex */ regs->num_regs = REGS_UNALLOCATED; matchedchars = re_match(&rpbuf, str, strlen(str), 0, regs); /* this can fail (return -1 or 0) without being an error, if we're trying to apply a regex just to see if it matched. */ #ifdef undef printf("--\n"); for (i = 1; i < 6; i++) { printf("%d %d, (%.*s)\n", regs.start[i], regs.end[i], (regs.end[i] - regs.start[i]), (regs.start[i] >= 0) ? &str[regs.start[i]] : ""); } #endif regfree(&rpbuf); // added 3 jul 02, appeasing valgrind return matchedchars; } #endif /* like perl chomp(); useful for dealing with input from popen */ void chomp(char *s) { int l = strlen(s) - 1; if (l >= 0 && s[l] == '\n') s[l] = '\0'; } char *strdup_ordie(const char *c) { char *ret = strdup(c); if (ret == NULL) { fprintf(stderr, "ran out of memory\n"); exit(EXIT_FAILURE); } return (ret); } void StripComment(char *buf) { char *p; /* Strip comments at beginning of line, or after whitespace. a kludgy way of avoiding problems with #'s in passwords. */ if (buf[0] == '#') buf[0] = '\0'; for (p = (char *) buf + 1; *p && !(*p == '#' && isspace(*(p - 1))); p++); if (*p) { *p = '\0'; } } /* vim:set ts=4: */ /* * Local Variables: * tab-width: 4 * c-indent-level: 4 * c-basic-offset: 4 * End: */ dockapps/wmbiff/charutil.h000066400000000000000000000021141242751507200161230ustar00rootroot00000000000000/* $Id: charutil.h,v 1.12 2004/04/20 04:55:55 bluehal Exp $ */ /* Author: Mark Hurley (debian4tux@telocity.com) * * Character / string manipulation utilities. * */ #ifndef CHARUTIL #define CHARUTIL #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_REGEX_H #include #endif void FullTrim(char *psValue); void Bin2Hex(unsigned char *src, int length, char *dst); void Encode_Base64(char *src, char *dst); void Decode_Base64(char *src, char *dst); /* helper function for the configuration line parser */ void copy_substring(char *destination, int startidx, int endidx, const char *source); /* common to Pop3 and Imap4 authentication list grabber. */ void grab_authList(const char *source, char *destination); #ifdef USE_GNU_REGEX /* handles main regex work */ int compile_and_match_regex(const char *regex, const char *str, /*@out@ */ struct re_registers *regs); #endif /* acts like perl's function of the same name */ void chomp(char *s); /* same as xstrdup, just better named ;) */ char *strdup_ordie(const char *c); void StripComment(char *buf); #endif dockapps/wmbiff/gnutls-common.c000066400000000000000000000414061242751507200171140ustar00rootroot00000000000000#include # include #include #include #include #include #include #include #include #include #define TEST_STRING int xml = 0; int print_cert; static char buffer[5*1024]; #define PRINTX(x,y) if (y[0]!=0) printf(" # %s %s\n", x, y) #define PRINT_PGP_NAME(X) PRINTX( "NAME:", name) const char str_unknown[] = "(unknown)"; static const char *my_ctime(const time_t * tv) { static char buf[256]; struct tm *tp; if ( ( (tp = localtime(tv)) == NULL ) || (!strftime(buf, sizeof buf, "%a %b %e %H:%M:%S %Z %Y\n", tp)) ) strcpy(buf, str_unknown);/* make sure buf text isn't garbage */ return buf; } void print_x509_info(gnutls_session_t session, const char* hostname) { gnutls_x509_crt_t crt; const gnutls_datum_t *cert_list; unsigned int cert_list_size = 0; int ret; char digest[20]; char serial[40]; char dn[256]; size_t dn_size; size_t digest_size = sizeof(digest); unsigned int i, j; size_t serial_size = sizeof(serial); char printable[256]; char *print; unsigned int bits, algo; time_t expiret, activet; cert_list = gnutls_certificate_get_peers(session, &cert_list_size); if (cert_list_size == 0) { fprintf(stderr, "No certificates found!\n"); return; } printf(" - Got a certificate list of %d certificates.\n\n", cert_list_size); for (j = 0; j < cert_list_size; j++) { gnutls_x509_crt_init(&crt); ret = gnutls_x509_crt_import(crt, &cert_list[j], GNUTLS_X509_FMT_DER); if (ret < 0) { const char* str = gnutls_strerror(ret); if (str == NULL) str = str_unknown; fprintf(stderr, "Decoding error: %s\n", str); return; } printf(" - Certificate[%d] info:\n", j); if (print_cert) { size_t size; size = sizeof(buffer); ret = gnutls_x509_crt_export( crt, GNUTLS_X509_FMT_PEM, buffer, &size); if (ret < 0) { fprintf(stderr, "Encoding error: %s\n", gnutls_strerror(ret)); return; } fputs( "\n", stdout); fputs( buffer, stdout); fputs( "\n", stdout); } if (j==0 && hostname != NULL) { /* Check the hostname of the first certificate * if it matches the name of the host we * connected to. */ if (gnutls_x509_crt_check_hostname( crt, hostname)==0) { printf(" # The hostname in the certificate does NOT match '%s'.\n", hostname); } else { printf(" # The hostname in the certificate matches '%s'.\n", hostname); } } if (xml) { #ifdef ENABLE_PKI gnutls_datum_t xml_data; ret = gnutls_x509_crt_to_xml( crt, &xml_data, 0); if (ret < 0) { const char* str = gnutls_strerror(ret); if (str == NULL) str = str_unknown; fprintf(stderr, "XML encoding error: %s\n", str); return; } printf("%s", xml_data.data); gnutls_free( xml_data.data); #endif } else { expiret = gnutls_x509_crt_get_expiration_time(crt); activet = gnutls_x509_crt_get_activation_time(crt); printf(" # valid since: %s", my_ctime(&activet)); printf(" # expires at: %s", my_ctime(&expiret)); /* Print the serial number of the certificate. */ if (gnutls_x509_crt_get_serial(crt, serial, &serial_size) >= 0) { print = printable; for (i = 0; i < serial_size; i++) { sprintf(print, "%.2x ", (unsigned char) serial[i]); print += 3; } printf(" # serial number: %s\n", printable); } /* Print the fingerprint of the certificate */ digest_size = sizeof(digest); if ((ret=gnutls_x509_crt_get_fingerprint(crt, GNUTLS_DIG_MD5, digest, &digest_size)) < 0) { const char* str = gnutls_strerror(ret); if (str == NULL) str = str_unknown; fprintf(stderr, "Error in fingerprint calculation: %s\n", str); } else { print = printable; for (i = 0; i < digest_size; i++) { sprintf(print, "%.2x ", (unsigned char) digest[i]); print += 3; } printf(" # fingerprint: %s\n", printable); } /* Print the version of the X.509 * certificate. */ printf(" # version: #%d\n", gnutls_x509_crt_get_version(crt)); algo = gnutls_x509_crt_get_pk_algorithm(crt, &bits); printf(" # public key algorithm: "); if (algo == GNUTLS_PK_RSA) { printf("RSA\n"); printf(" # Modulus: %d bits\n", bits); } else if (algo == GNUTLS_PK_DSA) { printf("DSA\n"); printf(" # Exponent: %d bits\n", bits); } else { printf("UNKNOWN\n"); } dn_size = sizeof(dn); ret = gnutls_x509_crt_get_dn(crt, dn, &dn_size); if (ret >= 0) printf(" # Subject's DN: %s\n", dn); dn_size = sizeof(dn); ret = gnutls_x509_crt_get_issuer_dn(crt, dn, &dn_size); if (ret >= 0) printf(" # Issuer's DN: %s\n", dn); } gnutls_x509_crt_deinit(crt); printf("\n"); } } #ifdef HAVE_LIBOPENCDK void print_openpgp_info(gnutls_session_t session, const char* hostname) { char digest[20]; size_t digest_size = sizeof(digest); unsigned int i; int ret; char printable[120]; char *print; char name[256]; size_t name_len = sizeof(name); gnutls_openpgp_key crt; const gnutls_datum_t *cert_list; unsigned int cert_list_size = 0; time_t expiret; time_t activet; cert_list = gnutls_certificate_get_peers(session, &cert_list_size); if (cert_list_size > 0) { unsigned int algo, bits; gnutls_openpgp_key_init(&crt); ret = gnutls_openpgp_key_import(crt, &cert_list[0], GNUTLS_OPENPGP_FMT_RAW); if (ret < 0) { const char* str = gnutls_strerror(ret); if (str == NULL) str = str_unknown; fprintf(stderr, "Decoding error: %s\n", str); return; } if (print_cert) { size_t size; size = sizeof(buffer); ret = gnutls_openpgp_key_export( crt, GNUTLS_OPENPGP_FMT_BASE64, buffer, &size); if (ret < 0) { fprintf(stderr, "Encoding error: %s\n", gnutls_strerror(ret)); return; } fputs( "\n", stdout); fputs( buffer, stdout); fputs( "\n", stdout); } if (hostname != NULL) { /* Check the hostname of the first certificate * if it matches the name of the host we * connected to. */ if (gnutls_openpgp_key_check_hostname( crt, hostname)==0) { printf(" # The hostname in the key does NOT match '%s'.\n", hostname); } else { printf(" # The hostname in the key matches '%s'.\n", hostname); } } if (xml) { gnutls_datum_t xml_data; ret = gnutls_openpgp_key_to_xml( crt, &xml_data, 0); if (ret < 0) { const char* str = gnutls_strerror(ret); if (str == NULL) str = str_unknown; fprintf(stderr, "XML encoding error: %s\n", str); return; } printf("%s", xml_data.data); gnutls_free( xml_data.data); return; } activet = gnutls_openpgp_key_get_creation_time( crt); expiret = gnutls_openpgp_key_get_expiration_time( crt); printf(" # Key was created at: %s", my_ctime(&activet)); printf(" # Key expires: "); if (expiret != 0) printf("%s", my_ctime(&expiret)); else printf("Never\n"); if (gnutls_openpgp_key_get_fingerprint(crt, digest, &digest_size) >= 0) { print = printable; for (i = 0; i < digest_size; i++) { sprintf(print, "%.2x ", (unsigned char) digest[i]); print += 3; } printf(" # PGP Key version: %d\n", gnutls_openpgp_key_get_version(crt)); algo = gnutls_openpgp_key_get_pk_algorithm(crt, &bits); printf(" # PGP Key public key algorithm: "); if (algo == GNUTLS_PK_RSA) { printf("RSA\n"); printf(" # Modulus: %d bits\n", bits); } else if (algo == GNUTLS_PK_DSA) { printf("DSA\n"); printf(" # Exponent: %d bits\n", bits); } else { printf("UNKNOWN\n"); } printf(" # PGP Key fingerprint: %s\n", printable); name_len = sizeof(name); if (gnutls_openpgp_key_get_name(crt, 0, name, &name_len) < 0) { fprintf(stderr, "Could not extract name\n"); } else { PRINT_PGP_NAME(name); } } gnutls_openpgp_key_deinit( crt); } } #endif void print_cert_vrfy(gnutls_session_t session) { unsigned int status; int ret; ret = gnutls_certificate_verify_peers2(session, &status); printf("\n"); if(ret < 0) { if (ret == GNUTLS_E_NO_CERTIFICATE_FOUND) printf("- Peer did not send any certificate.\n"); else printf("- Could not verify certificate (err: %s (%d))\n", gnutls_strerror(ret), ret); return; } if (gnutls_certificate_type_get(session)==GNUTLS_CRT_X509) { if (status & GNUTLS_CERT_SIGNER_NOT_FOUND) printf("- Peer's certificate issuer is unknown\n"); if (status & GNUTLS_CERT_INVALID) printf("- Peer's certificate is NOT trusted\n"); else printf("- Peer's certificate is trusted\n"); } else { if (status & GNUTLS_CERT_INVALID) printf("- Peer's key is invalid\n"); else printf("- Peer's key is valid\n"); if (status & GNUTLS_CERT_SIGNER_NOT_FOUND) printf("- Could not find a signer of the peer's key\n"); } } int print_info(gnutls_session_t session, const char* hostname) { const char *tmp; gnutls_credentials_type_t cred; gnutls_kx_algorithm_t kx; /* print the key exchange's algorithm name */ kx = gnutls_kx_get(session); cred = gnutls_auth_get_type(session); switch (cred) { #ifdef ENABLE_ANON case GNUTLS_CRD_ANON: printf("- Anonymous DH using prime of %d bits, secret key " "of %d bits, and peer's public key is %d bits.\n", gnutls_dh_get_prime_bits(session), gnutls_dh_get_secret_bits(session), gnutls_dh_get_peers_public_bits(session)); break; #endif #ifdef ENABLE_SRP case GNUTLS_CRD_SRP: /* This should be only called in server * side. */ if (gnutls_srp_server_get_username(session) != NULL) printf("- SRP authentication. Connected as '%s'\n", gnutls_srp_server_get_username(session)); break; #endif case GNUTLS_CRD_CERTIFICATE: { char dns[256]; size_t dns_size = sizeof(dns); unsigned int type; /* This fails in client side */ if (gnutls_server_name_get (session, dns, &dns_size, &type, 0) == 0) { printf("- Given server name[%d]: %s\n", type, dns); } } print_cert_info(session, hostname); print_cert_vrfy(session); /* Check if we have been using ephemeral Diffie Hellman. */ if (kx == GNUTLS_KX_DHE_RSA || kx == GNUTLS_KX_DHE_DSS) { printf ("- Ephemeral DH using prime of %d bits, secret key " "of %d bits, and peer's public key is %d bits.\n", gnutls_dh_get_prime_bits(session), gnutls_dh_get_secret_bits(session), gnutls_dh_get_peers_public_bits(session)); } default: break; } tmp = gnutls_protocol_get_name(gnutls_protocol_get_version(session)); if (tmp != NULL) printf("- Version: %s\n", tmp); tmp = gnutls_kx_get_name(kx); if (tmp != NULL) printf("- Key Exchange: %s\n", tmp); tmp = gnutls_cipher_get_name(gnutls_cipher_get(session)); if (tmp != NULL) printf("- Cipher: %s\n", tmp); tmp = gnutls_mac_get_name(gnutls_mac_get(session)); if (tmp != NULL) printf("- MAC: %s\n", tmp); tmp = gnutls_compression_get_name(gnutls_compression_get(session)); if (tmp != NULL) printf("- Compression: %s\n", tmp); fflush (stdout); return 0; } void print_cert_info(gnutls_session_t session, const char* hostname) { printf("- Certificate type: "); switch (gnutls_certificate_type_get(session)) { case GNUTLS_CRT_X509: printf("X.509\n"); print_x509_info(session, hostname); break; #ifdef HAVE_LIBOPENCDK case GNUTLS_CRT_OPENPGP: printf("OpenPGP\n"); print_openpgp_info(session, hostname); break; #endif default: break; } } void print_list(void) { /* FIXME: This is hard coded. Make it print all the supported * algorithms. */ printf("\n"); printf("Certificate types:"); printf(" X.509"); printf(", OPENPGP\n"); printf("Protocols:"); printf(" TLS1.0"); printf(", SSL3.0\n"); printf("Ciphers:"); printf(" AES-128-CBC"); printf(", 3DES-CBC"); printf(", ARCFOUR"); printf(", ARCFOUR-40\n"); printf("MACs:"); printf(" MD5"); printf(", RMD160"); printf(", SHA1\n"); printf("Key exchange algorithms:"); printf(" RSA"); printf(", RSA-EXPORT"); printf(", DHE-DSS"); printf(", DHE-RSA"); printf(", SRP"); printf(", SRP-RSA"); printf(", SRP-DSS"); printf(", ANON-DH\n"); printf("Compression methods:"); printf(" ZLIB"); printf(", NULL\n"); } void print_license(void) { fprintf(stdout, "\nCopyright (C) 2001-2003 Nikos Mavroyanopoulos\n" "This program is free software; you can redistribute it and/or modify \n" "it under the terms of the GNU General Public License as published by \n" "the Free Software Foundation; either version 2 of the License, or \n" "(at your option) any later version. \n" "\n" "This program is distributed in the hope that it will be useful, \n" "but WITHOUT ANY WARRANTY; without even the implied warranty of \n" "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \n" "GNU General Public License for more details. \n" "\n" "You should have received a copy of the GNU General Public License \n" "along with this program; if not, write to the Free Software \n" "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n\n"); } void parse_protocols(char **protocols, int protocols_size, int *protocol_priority) { int i, j; if (protocols != NULL && protocols_size > 0) { for (j = i = 0; i < protocols_size; i++) { if (strncasecmp(protocols[i], "SSL", 3) == 0) protocol_priority[j++] = GNUTLS_SSL3; if (strncasecmp(protocols[i], "TLS", 3) == 0) protocol_priority[j++] = GNUTLS_TLS1; } protocol_priority[j] = 0; } } void parse_ciphers(char **ciphers, int nciphers, int *cipher_priority) { int j, i; if (ciphers != NULL && nciphers > 0) { for (j = i = 0; i < nciphers; i++) { if (strncasecmp(ciphers[i], "AES", 3) == 0) cipher_priority[j++] = GNUTLS_CIPHER_AES_128_CBC; if (strncasecmp(ciphers[i], "3DE", 3) == 0) cipher_priority[j++] = GNUTLS_CIPHER_3DES_CBC; if (strcasecmp(ciphers[i], "ARCFOUR-40") == 0) cipher_priority[j++] = GNUTLS_CIPHER_ARCFOUR_40; if (strcasecmp(ciphers[i], "ARCFOUR") == 0) cipher_priority[j++] = GNUTLS_CIPHER_ARCFOUR_128; if (strncasecmp(ciphers[i], "NUL", 3) == 0) cipher_priority[j++] = GNUTLS_CIPHER_NULL; } cipher_priority[j] = 0; } } void parse_macs(char **macs, int nmacs, int *mac_priority) { int i, j; if (macs != NULL && nmacs > 0) { for (j = i = 0; i < nmacs; i++) { if (strncasecmp(macs[i], "MD5", 3) == 0) mac_priority[j++] = GNUTLS_MAC_MD5; if (strncasecmp(macs[i], "RMD", 3) == 0) mac_priority[j++] = GNUTLS_MAC_RMD160; if (strncasecmp(macs[i], "SHA", 3) == 0) mac_priority[j++] = GNUTLS_MAC_SHA; } mac_priority[j] = 0; } } void parse_ctypes(char **ctype, int nctype, int *cert_type_priority) { int i, j; if (ctype != NULL && nctype > 0) { for (j = i = 0; i < nctype; i++) { if (strncasecmp(ctype[i], "OPE", 3) == 0) cert_type_priority[j++] = GNUTLS_CRT_OPENPGP; if (strncasecmp(ctype[i], "X", 1) == 0) cert_type_priority[j++] = GNUTLS_CRT_X509; } cert_type_priority[j] = 0; } } void parse_kx(char **kx, int nkx, int *kx_priority) { int i, j; if (kx != NULL && nkx > 0) { for (j = i = 0; i < nkx; i++) { if (strcasecmp(kx[i], "SRP") == 0) kx_priority[j++] = GNUTLS_KX_SRP; if (strcasecmp(kx[i], "SRP-RSA") == 0) kx_priority[j++] = GNUTLS_KX_SRP_RSA; if (strcasecmp(kx[i], "SRP-DSS") == 0) kx_priority[j++] = GNUTLS_KX_SRP_DSS; if (strcasecmp(kx[i], "RSA") == 0) kx_priority[j++] = GNUTLS_KX_RSA; if (strcasecmp(kx[i], "RSA-EXPORT") == 0) kx_priority[j++] = GNUTLS_KX_RSA_EXPORT; if (strncasecmp(kx[i], "DHE-RSA", 7) == 0) kx_priority[j++] = GNUTLS_KX_DHE_RSA; if (strncasecmp(kx[i], "DHE-DSS", 7) == 0) kx_priority[j++] = GNUTLS_KX_DHE_DSS; if (strncasecmp(kx[i], "ANON", 4) == 0) kx_priority[j++] = GNUTLS_KX_ANON_DH; } kx_priority[j] = 0; } } void parse_comp(char **comp, int ncomp, int *comp_priority) { int i, j; if (comp != NULL && ncomp > 0) { for (j = i = 0; i < ncomp; i++) { if (strncasecmp(comp[i], "NUL", 3) == 0) comp_priority[j++] = GNUTLS_COMP_NULL; if (strncasecmp(comp[i], "ZLI", 3) == 0) comp_priority[j++] = GNUTLS_COMP_ZLIB; } comp_priority[j] = 0; } } #ifndef HAVE_INET_NTOP #ifdef _WIN32 # include #else # include # include # include #endif const char *inet_ntop(int af __attribute__((unused)), const void *src, char *dst, size_t cnt) { char* ret; ret = inet_ntoa( *((struct in_addr*)src)); if (strlen(ret) > cnt) { return NULL; } strcpy( dst, ret); return dst; } #endif void sockets_init( void) { #ifdef _WIN32 WORD wVersionRequested; WSADATA wsaData; wVersionRequested = MAKEWORD(1, 1); if (WSAStartup(wVersionRequested, &wsaData) != 0) { perror("WSA_STARTUP_ERROR"); } #endif } dockapps/wmbiff/gnutls-common.h000066400000000000000000000022611242751507200171150ustar00rootroot00000000000000#define PORT 5556 #define SERVER "127.0.0.1" #include #include #ifdef _WIN32 # include # include # include # define socklen_t int # define close closesocket #else # include # include # include # include # include # include #endif /* the number of elements in the priority structures. */ #define PRI_MAX 16 extern const char str_unknown[]; int print_info( gnutls_session_t state, const char* hostname); void print_cert_info( gnutls_session_t state, const char* hostname); void print_list(void); void parse_comp( char** comp, int ncomp, int* comp_priority); void parse_kx( char** kx, int nkx, int* kx_priority); void parse_ctypes( char** ctype, int nctype, int * cert_type_priority); void parse_macs( char** macs, int nmacs, int *mac_priority); void parse_ciphers( char** ciphers, int nciphers, int* cipher_priority); void parse_protocols( char** protocols, int protocols_size, int* protocol_priority); void sockets_init( void); #ifndef HAVE_INET_NTOP const char *inet_ntop(int af, const void *src, char *dst, size_t cnt); #endif dockapps/wmbiff/maildirClient.c000066400000000000000000000107141242751507200170700ustar00rootroot00000000000000/* $Id: maildirClient.c,v 1.15 2004/03/28 00:28:58 bluehal Exp $ */ /* Author : Yong-iL Joh ( tolkien@mizi.com ) Modified : Jorge García ( Jorge.Garcia@uv.es ) Modified : Dwayne C. Litzenberger ( dlitz@dlitz.net ) * * Maildir checker. * * Last Updated : $Date: 2004/03/28 00:28:58 $ * */ #ifdef HAVE_CONFIG_H #include #endif #include "Client.h" #include #include #include #include #include #include #ifdef USE_DMALLOC #include #endif #define PCM (pc->u).maildir static int count_msgs(char *path) { DIR *D; struct dirent *de; int count = 0; D = opendir(path); if (D == NULL) { DMA(DEBUG_ERROR, "Error opening directory '%s': %s\n", path, strerror(errno)); return -1; } while ((de = readdir(D)) != NULL) { if ((strcmp(de->d_name, ".") & strcmp(de->d_name, "..")) != 0) { count++; } } closedir(D); return count; } int maildirCheckHistory(Pop3 pc) { struct stat st_new; struct stat st_cur; struct utimbuf ut; char path_new[BUF_BIG * 2], path_cur[BUF_BIG * 2]; int count_new = 0, count_cur = 0; DM(pc, DEBUG_INFO, ">Maildir: '%s'\n", pc->path); strcpy(path_new, pc->path); strcat(path_new, "/new/"); strcpy(path_cur, pc->path); strcat(path_cur, "/cur/"); if (pc->u.maildir.dircache_flush) { /* hack to clear directory cache for network-mounted maildirs */ int fd; char path_newtmp[BUF_BIG * 2 + 32]; strcpy(path_newtmp, path_new); strcat(path_newtmp, ".wmbiff.dircache_flush.XXXXXX"); if ((fd = mkstemp(path_newtmp)) >= 0) { close(fd); unlink(path_newtmp); } else { DM(pc, DEBUG_ERROR, "Can't create dircache flush file '%s': %s\n", path_newtmp, strerror(errno)); } } /* maildir */ if (stat(path_new, &st_new)) { DM(pc, DEBUG_ERROR, "Can't stat mailbox '%s': %s\n", path_new, strerror(errno)); return -1; /* Error stating mailbox */ } if (stat(path_cur, &st_cur)) { DM(pc, DEBUG_ERROR, "Can't stat mailbox '%s': %s\n", path_cur, strerror(errno)); return -1; /* Error stating mailbox */ } /* file was changed OR initially read */ if (st_new.st_mtime != PCM.mtime_new || st_new.st_size != PCM.size_new || st_cur.st_mtime != PCM.mtime_cur || st_cur.st_size != PCM.size_cur || pc->OldMsgs < 0) { DM(pc, DEBUG_INFO, " was changed,\n" " TIME(new): old %lu, new %lu" " SIZE(new): old %lu, new %lu\n" " TIME(cur): old %lu, new %lu" " SIZE(cur): old %lu, new %lu\n", PCM.mtime_new, (unsigned long) st_new.st_mtime, (unsigned long) PCM.size_new, (unsigned long) st_new.st_size, PCM.mtime_cur, (unsigned long) st_cur.st_mtime, (unsigned long) PCM.size_cur, (unsigned long) st_cur.st_size); count_new = count_msgs(path_new); count_cur = count_msgs(path_cur); if ((count_new | count_cur) == -1) { /* errors occurred */ return -1; } pc->TotalMsgs = count_cur + count_new; pc->UnreadMsgs = count_new; /* Reset atime for MUTT and something others work correctly */ ut.actime = st_new.st_atime; ut.modtime = st_new.st_mtime; utime(path_new, &ut); ut.actime = st_cur.st_atime; ut.modtime = st_cur.st_mtime; utime(path_cur, &ut); /* Store new values */ PCM.mtime_new = st_new.st_mtime; /* Store new mtime_new */ PCM.size_new = st_new.st_size; /* Store new size_new */ PCM.mtime_cur = st_cur.st_mtime; /* Store new mtime_cur */ PCM.size_cur = st_cur.st_size; /* Store new size_cur */ } return 0; } int maildirCreate(Pop3 pc, const char *str) { int i; char c; /* Maildir format: maildir:fullpathname */ pc->TotalMsgs = 0; pc->UnreadMsgs = 0; pc->OldMsgs = -1; pc->OldUnreadMsgs = -1; pc->checkMail = maildirCheckHistory; pc->u.maildir.dircache_flush = 0; /* special flags */ if (*(str + 8) == ':') { /* path is of the format maildir::flags:path */ c = ' '; for (i = 1; c != ':' && c != '\0'; i++) { c = *(str + 8 + i); switch (c) { case 'F': pc->u.maildir.dircache_flush = 1; DM(pc, DEBUG_INFO, "maildir: dircache_flush enabled\n"); } } } else { i = 0; } if (strlen(str + 8 + i) + 1 > BUF_BIG) { DM(pc, DEBUG_ERROR, "maildir '%s' is too long.\n", str + 8 + i); memset(pc->path, 0, BUF_BIG); } else { strncpy(pc->path, str + 8 + i, BUF_BIG - 1); /* cut off ``maildir:'' */ } DM(pc, DEBUG_INFO, "maildir: str = '%s'\n", str); DM(pc, DEBUG_INFO, "maildir: path= '%s'\n", pc->path); return 0; } /* vim:set ts=4: */ /* * Local Variables: * tab-width: 4 * c-indent-level: 4 * c-basic-offset: 4 * End: */ dockapps/wmbiff/mboxClient.c000066400000000000000000000104611242751507200164130ustar00rootroot00000000000000/* $Id: mboxClient.c,v 1.17 2004/03/28 00:28:58 bluehal Exp $ */ /* Author: Yong-iL Joh Modified: Jorge García Rob Funk Neil Spring * * MBOX checker. * * Last Updated : $Date: 2004/03/28 00:28:58 $ * */ #ifdef HAVE_CONFIG_H #include #endif #include "Client.h" #include #include #include #ifdef USE_DMALLOC #include #endif #define PCM (pc->u).mbox #define FROM_STR "From " #define STATUS_STR "Status: " FILE *openMailbox(Pop3 pc, const char *mbox_filename) { FILE *mailbox; if ((mailbox = fopen(mbox_filename, "r")) == NULL) { DM(pc, DEBUG_ERROR, "Error opening mailbox '%s': %s\n", mbox_filename, strerror(errno)); pc->TotalMsgs = -1; pc->UnreadMsgs = -1; } return (mailbox); } /* count the messages in a mailbox */ static void countMessages(Pop3 pc, const char *mbox_filename) { FILE *F; char buf[BUF_SIZE]; int is_header = 0; int next_from_is_start_of_header = 1; int count_from = 0, count_status = 0; int len_from = strlen(FROM_STR), len_status = strlen(STATUS_STR); int pseudo_mail = 0; F = openMailbox(pc, mbox_filename); if (F == NULL) return; /* count message */ while (fgets(buf, BUF_SIZE, F)) { // The first message usually is automatically created by POP3/IMAP // clients for internal record keeping and is ignored // (not displayed) by most email clients. if (is_header && !strncmp(buf, "X-IMAP: ", 8)) { pseudo_mail = 1; } if (buf[0] == '\n') { /* a newline by itself terminates the header */ if (is_header) is_header = 0; else next_from_is_start_of_header = 1; } else if (!strncmp(buf, FROM_STR, len_from)) { /* A line starting with "From" is the beginning of a new header. "From" in the text of the mail should get escaped by the MDA. If your MDA doesn't do that, it is broken. */ if (next_from_is_start_of_header) is_header = 1; if (is_header) count_from++; } else { next_from_is_start_of_header = 0; if (is_header && !strncmp(buf, STATUS_STR, len_status) && strrchr(buf, 'R')) { count_status++; } } } if (count_from && pseudo_mail) { count_from--; if (count_status) count_status--; } DM(pc, DEBUG_INFO, "from: %d status: %d\n", count_from, count_status); pc->TotalMsgs = count_from; pc->UnreadMsgs = count_from - count_status; fclose(F); } /* check file status; hold on to file information used to restore access time */ int fileHasChanged(const char *mbox_filename, time_t * atime, time_t * mtime, off_t * size) { struct stat st; /* mbox file */ if (stat(mbox_filename, &st)) { DMA(DEBUG_ERROR, "Can't stat '%s': %s\n", mbox_filename, strerror(errno)); } else if (st.st_mtime != *mtime || st.st_size != *size) { /* file was changed OR initially read */ DMA(DEBUG_INFO, " %s was changed," " mTIME: %lu -> %lu; SIZE: %lu -> %lu\n", mbox_filename, *mtime, st.st_mtime, (unsigned long) *size, (unsigned long) st.st_size); *atime = st.st_atime; *mtime = st.st_mtime; *size = st.st_size; return 1; } return 0; } int mboxCheckHistory(Pop3 pc) { char *mbox_filename = backtickExpand(pc, pc->path); struct utimbuf ut; DM(pc, DEBUG_INFO, ">Mailbox: '%s'\n", mbox_filename); if (fileHasChanged(mbox_filename, &ut.actime, &PCM.mtime, &PCM.size) || pc->OldMsgs < 0) { countMessages(pc, mbox_filename); /* Reset atime for (at least) MUTT to work */ /* ut.actime is set above */ ut.modtime = PCM.mtime; utime(mbox_filename, &ut); } free(mbox_filename); return 0; } int mboxCreate(Pop3 pc, const char *str) { /* MBOX format: mbox:fullpathname */ pc->TotalMsgs = 0; pc->UnreadMsgs = 0; pc->OldMsgs = -1; pc->OldUnreadMsgs = -1; pc->checkMail = mboxCheckHistory; /* default boxes are mbox... cut mbox: if it exists */ if (!strncasecmp(pc->path, "mbox:", 5)) { if (strlen(str + 5) + 1 > BUF_BIG) { DM(pc, DEBUG_ERROR, "mbox '%s' is too long.\n", str + 5); memset(pc->path, 0, BUF_BIG); } else { strncpy(pc->path, str + 5, BUF_BIG - 1); /* cut off ``mbox:'' */ } } DM(pc, DEBUG_INFO, "mbox: str = '%s'\n", str); DM(pc, DEBUG_INFO, "mbox: path= '%s'\n", pc->path); return 0; } /* vim:set ts=4: */ /* * Local Variables: * tab-width: 4 * c-indent-level: 4 * c-basic-offset: 4 * End: */ dockapps/wmbiff/passwordMgr.c000066400000000000000000000204361242751507200166220ustar00rootroot00000000000000/* passwordMgr.c * Author: Neil Spring */ /* this module implements a password cache: the goal is to allow multiple wmbiff mailboxes that are otherwise independent get all their passwords while only asking the user for an account's password once. */ /* NOTE: it will fail if a user has different passwords for pop vs. imap on the same server; this seems too far fetched to be worth complexity */ /* NOTE: it verifies that the askpass program, which, if given with a full path, must be owned either by the user or by root. There may be decent reasons not to do this. */ /* Intended properties: 1) exit()s if the user presses cancel from askpass - this is detected by no output from askpass. 2) allows the caller to remove a cached entry if it turns out to be wrong, and prompt the user again. This might be poor if the askpass program is replaced with something non-interactive. */ #ifdef HAVE_CONFIG_H #include #endif #include "passwordMgr.h" #include "Client.h" #include "charutil.h" /* chomp */ #include #include #include #include #include #include /* index */ #include #include "assert.h" #ifdef HAVE_MEMFROB #define DEFROB(x) memfrob(x, x ## _len) #define ENFROB(x) memfrob(x, x ## _len) #else #define DEFROB(x) #define ENFROB(x) #endif typedef struct password_binding_struct { struct password_binding_struct *next; char user[BUF_SMALL]; char server[BUF_BIG]; char password[BUF_SMALL]; /* may be frobnicated */ unsigned char password_len; /* frobnicated *'s are nulls */ } *password_binding; static password_binding pass_list = NULL; /* verifies that askpass_fname, if it has no spaces, exists as a file, is owned by the user or by root, and is not world writeable. This is just a sanity check, and is not intended to ensure the integrity of the password-asking program. */ /* would be static, but used in test_wmbiff */ int permissions_ok(Pop3 pc, const char *askpass_fname) { struct stat st; if (index(askpass_fname, ' ')) { DM(pc, DEBUG_INFO, "askpass has a space in it; not verifying ownership/permissions on '%s'\n", askpass_fname); return (1); } if (stat(askpass_fname, &st)) { DM(pc, DEBUG_ERROR, "Can't stat askpass program: '%s'\n", askpass_fname); if (askpass_fname[0] != '/') { DM(pc, DEBUG_ERROR, "For your own good, use a full pathname.\n"); } return (0); } if (st.st_uid != 0 && st.st_uid != getuid()) { DM(pc, DEBUG_ERROR, "askpass program isn't owned by you or root: '%s'\n", askpass_fname); return (0); } if (st.st_mode & S_IWOTH) { DM(pc, DEBUG_ERROR, "askpass program is world writable: '%s'\n", askpass_fname); return (0); } return (1); } #ifdef HAVE_CORESERVICES_CORESERVICES_H #ifdef HAVE_SECURITY_SECURITY_H #define HAVE_APPLE_KEYCHAIN #endif #endif #ifdef HAVE_APPLE_KEYCHAIN /* routines to use apple's keychain to get a password without a user having to type. this avoids some damage where although ssh-askpass can grab focus within X, it may not have a particularly secure keyboard. */ #include #include static void get_password_from_keychain(Pop3 pc, const char *username, const char *servername, /*@out@ */ char *password, /*@out@ */ unsigned char *password_len) { SecKeychainRef kc; OSStatus rc; char *secpwd; UInt32 pwdlen; rc = SecKeychainCopyDefault(&kc); if (rc != noErr) { DM(pc, DEBUG_ERROR, "passmgr: unable to open keychain, exiting\n"); exit(EXIT_FAILURE); } rc = SecKeychainFindInternetPassword(kc, strlen(servername), servername, 0, NULL, strlen(username), username, 0, NULL, 0, NULL, kSecAuthenticationTypeDefault, &pwdlen, (void **) &secpwd, NULL); if (rc != noErr) { DM(pc, DEBUG_ERROR, "passmgr: keychain password grab for %s at %s failed, exiting\n", username, servername); DM(pc, DEBUG_ERROR, "passmgr: (perhaps you pressed 'deny')\n"); /* this seems like the sanest thing to do, for now */ exit(EXIT_FAILURE); } if (pwdlen < *password_len) { strncpy(password, secpwd, pwdlen); password[pwdlen] = '\0'; *password_len = pwdlen; } else { DM(pc, DEBUG_ERROR, "passmgr: warning: your password appears longer (%lu) than expected (%d)\n", strlen(secpwd), *password_len - 1); } rc = SecKeychainItemFreeContent(NULL, secpwd); return; } #endif /* apple keychain */ static void get_password_from_command(Pop3 pc, const char *username, const char *servername, /*@out@ */ char *password, /*@out@ */ unsigned char *password_len) { password[*password_len - 1] = '\0'; password[0] = '\0'; /* check that the executed file is a good one. */ if (permissions_ok(pc, pc->askpass)) { char *command; char *password_ptr; int len = strlen(pc->askpass) + strlen(username) + strlen(servername) + 40; command = malloc(len); snprintf(command, len, "%s 'password for wmbiff: %s@%s'", pc->askpass, username, servername); (void) grabCommandOutput(pc, command, &password_ptr, NULL); /* it's not clear what to do with the exit status, though we can get it from grabCommandOutput if needed to deal with some programs that will print a message but exit non-zero on error */ free(command); if (password_ptr == NULL) { /* this likely means that the user cancelled, and doesn't want us to keep asking about the password. */ DM(pc, DEBUG_ERROR, "passmgr: fgets password failed, exiting\n"); DM(pc, DEBUG_ERROR, "passmgr: (it looks like you pressed 'cancel')\n"); /* this seems like the sanest thing to do, for now */ exit(EXIT_FAILURE); } strncpy(password, password_ptr, *password_len); if (password[*password_len - 1] != '\0') { DM(pc, DEBUG_ERROR, "passmgr: warning: your password appears longer (%lu) than expected (%d)\n", (unsigned long) strlen(password_ptr), *password_len - 1); } free(password_ptr); password[*password_len - 1] = '\0'; *password_len = strlen(password); } else { /* consider this error to be particularly troublesome */ DM(pc, DEBUG_ERROR, "passmgr: permissions check of '%s' failed.", pc->askpass); exit(EXIT_FAILURE); } } char *passwordFor(const char *username, const char *servername, Pop3 pc, int bFlushCache) { password_binding p; assert(username != NULL); assert(username[0] != '\0'); /* find the binding */ for (p = pass_list; p != NULL && (strcmp(username, p->user) != 0 || strcmp(servername, p->server) != 0); p = p->next); /* if so, return the password */ if (p != NULL) { if (p->password[0] != '\0') { if (bFlushCache == 0) { char *ret = strdup(p->password); #ifdef HAVE_MEMFROB unsigned short ret_len = p->password_len; DEFROB(ret); #endif return (ret); } /* else fall through, overwrite */ } else if (pc) { /* if we've asked, but received nothing, disable this box */ pc->checkMail = NULL; return (NULL); } } else { p = (password_binding) malloc(sizeof(struct password_binding_struct)); } /* else, try to get it. */ if (pc->askpass != NULL) { char *retval; p->password_len = 32; #ifdef HAVE_APPLE_KEYCHAIN if (strcmp(pc->askpass, "internal:apple:keychain") == 0) { get_password_from_keychain(pc, username, servername, p->password, &p->password_len); } else { DM(pc, DEBUG_ERROR, "you could change your askpass line to:\n" " askpass = internal:apple:keychain\n" "to use the OS X keychain instead of running a command\n"); #endif get_password_from_command(pc, username, servername, p->password, &p->password_len); #ifdef HAVE_APPLE_KEYCHAIN } #endif retval = strdup(p->password); if (strlen(username) + 1 > BUF_SMALL) { DM(pc, DEBUG_ERROR, "username is too long.\n"); memset(p->user, 0, BUF_SMALL); } else { strncpy(p->user, username, BUF_SMALL - 1); } if (strlen(servername) + 1 > BUF_BIG) { DM(pc, DEBUG_ERROR, "servername is too long.\n"); memset(p->server, 0, BUF_BIG); } else { strncpy(p->server, servername, BUF_BIG - 1); } ENFROB(p->password); p->next = pass_list; pass_list = p; return (retval); } return (NULL); } /* vim:set ts=4: */ /* * Local Variables: * tab-width: 4 * c-indent-level: 4 * c-basic-offset: 4 * End: */ dockapps/wmbiff/passwordMgr.h000066400000000000000000000004041242751507200166200ustar00rootroot00000000000000#include "Client.h" /*@mustfree@*/ char *passwordFor(const char *username, const char *servername, Pop3 pc, int bFlushCache); /* tested by test_wmbiff; don't use this for anything. */ int permissions_ok(Pop3 pc, const char *askpass_fname); dockapps/wmbiff/regulo.c000066400000000000000000000057311242751507200156100ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #include "regulo.h" #include "charutil.h" #define min(a,b) ((a)<(b) ? (a) : (b)) /* callbacks specified by the calling function to extract substrings to values. */ void regulo_atoi(void *dest_int, const char *source) { /* skip any leading non-digit */ while (*source != '\0' && !isdigit(*source)) source++; *(int *) dest_int = atoi(source); } void regulo_strcpy(void *dest, const char *source) { strcpy((char *) dest, source); } void regulo_strcpy_tolower(void *dest, const char *source) { unsigned int i; for (i = 0; i < strlen(source); i++) { ((char *) dest)[i] = tolower(source[i]); } ((char *) dest)[i] = '\0'; } void regulo_strcpy_skip1(void *dest, const char *source) { strcpy((char *) dest, source + 1); } #ifdef USE_GNU_REGEX /* deprecated as unportable */ int regulo_match(const char *regex, const char *string, const struct regulo *instructions) { struct re_registers regs; int ret; int matchedchars; int i; memset(®s, 0, sizeof(struct re_registers)); matchedchars = compile_and_match_regex(regex, string, ®s); if (matchedchars <= 0) return 0; if (instructions == NULL) return 1; for (i = 0; instructions[i].match_handler != NULL; i++) { char buf[255]; int j = instructions[i].match_index; int len = min(254, regs.end[j] - regs.start[j]); if (regs.start[j] >= 0) { strncpy(buf, string + regs.start[j], len); buf[len] = '\0'; instructions[i].match_handler(instructions[i].destination, buf); } } ret = regs.end[0]; free(regs.end); // added 3 jul 02, appeasing valgrind free(regs.start); // added 3 jul 02, appeasing valgrind return ret; } #else /* favored */ int compile_and_match_regex_posix(const char *regex, const char *str, /*@out@ */ regmatch_t * regs, size_t regs_len) { regex_t reg; int errcode; if ((errcode = regcomp(®, regex, REG_EXTENDED)) != 0) { char errbuf[256]; regerror(errcode, ®, errbuf, 256); fprintf(stderr, "error in compiling regular expression: %s\n", errbuf); return -1; } errcode = regexec(®, str, regs_len, regs, 0); regfree(®); if (errcode == 0) return 1; else return 0; } int regulo_match(const char *regex, const char *string, const struct regulo *instructions) { regmatch_t regs[20]; int ret; int matchedchars; int i; matchedchars = compile_and_match_regex_posix(regex, string, regs, 20); if (matchedchars <= 0) return 0; if (instructions == NULL) return 1; for (i = 0; instructions[i].match_handler != NULL; i++) { char buf[255]; int j = instructions[i].match_index; int len = min(254, regs[j].rm_eo - regs[j].rm_so); if (regs[j].rm_so >= 0) { strncpy(buf, string + regs[j].rm_so, len); buf[len] = '\0'; instructions[i].match_handler(instructions[i].destination, buf); } } ret = regs[0].rm_eo; return ret; } #endif dockapps/wmbiff/regulo.h000066400000000000000000000012201242751507200156020ustar00rootroot00000000000000/* $Id: regulo.h,v 1.2 2003/03/02 02:17:14 bluehal Exp $ */ /* regulo, (pronounced as if the name of a super-hero) added by Neil Spring to provide a portable interface to regular expressions that doesn't suck. */ void regulo_atoi(void *dest_int, const char *source); void regulo_strcpy(void *dest, const char *source); void regulo_strcpy_tolower(void *dest, const char *source); void regulo_strcpy_skip1(void *dest, const char *source); struct regulo { int match_index; void *destination; void (*match_handler) (void *dest, const char *source); }; int regulo_match(const char *regex, const char *string, const struct regulo *instructions); dockapps/wmbiff/sample.wmbiffrc000066400000000000000000000121011242751507200171360ustar00rootroot00000000000000# $Id: sample.wmbiffrc,v 1.18 2003/11/09 07:01:15 bluehal Exp $ # # See wmbiffrc(5) for more info. # # Global interval -- seconds between check mailboxes interval=60 # Global askpass -- choose a password acting program # that behaves like ssh-askpass. The default is # askpass = /usr/bin/ssh-askpass. # askpass is invoked on IMAP entries that have no password # below. # the commented version below is likely to work on RedHat # systems; wmbiff's default is likely to work on Debian # systems with ssh-askpass installed. #askpass = /usr/libexec/openssh/x11-ssh-askpass # If you'd like it to be visually distinct so that # you aren't confused with your normal passphrase: #askpass = /usr/bin/ssh-askpass -fg cyan -bg black -xrm '*Dialog.font: -b&h-lucida-medium-r-normal-*-*-100-*-*-*-*-iso8859-1' -xrm '*Dialog.title: WMBiff Password Entry' # If you're writing a better program for password prompting, # or that stores passwords cleverly, and don't like that # wmbiff adds 'password for wmbiff: user@site' to the command # line, you can use something like this: #askpass = /bin/echo mypassword ; true # If you's like to chain the password to another program, # such as kinit for Kerberos authentication, use (with the # ruby interpreter installed): askpass = /usr/bin/ssh-askpass -fg cyan -bg black -xrm '*Dialog.title: WMBiff Password Entry' | /usr/bin/ruby -e 'm = gets; IO.popen("/usr/bin/kinit > /dev/null", "w").puts(m); puts(m)' && true # Skin. A different source pixmap can be loaded dynamically. # If not a full path, wmbiff will search /usr/share/wmbiff:/usr/local/share/wmbiff:. # which is intended to keep the .wmbiffrc simple and portable to # different systems with wmbiff installed differently. # # default #skinfile=wmbiff-master-led.xpm # higher contrast for lower-color displays #skinfile=wmbiff-master-contrast.xpm # make your own derivative and submit it # to us at wmaker-dev@lists.windowmaker.org. ### First string ### # Label, that will be displayed label.0=Spool # Path to mailbox for UNIX-style mailboxes, # or pop3:user:password@mailserver[:port] for POP3 accounts # port are optional, default - 110 path.0=mbox:/var/mail/gb # Command, which will be executed for new mail in any watched mailbox globalnotify=my_play /home/gb/sounds/new_mail_has_arrived.wav # Command, which executed on new mail arrival, or special keyword 'beep' #notify.0=beep #notify.0=my_play /home/gb/sounds/new_mail_has_arrived.wav # Don't want any global notification for this mailbox notify.0=true # Command, which executed on left mouse click on label action.0=rxvt -name mutt -e mutt # Rescan interval; default to global interval # For POP3-accounts bigger values (>60sec) is recommended #interval.0=5 # Interval between mail auto-fetching; use 0 for disable (only # mouse right-clicking still worked) # use -1 for auto-fetching on new mail arrival #fetchinterval.0=300 # Command, which used for fetching mail. Leave commented out for full disable #fetchcmd.0=/usr/bin/fetchmail ### # NOTE: line under this line will not be parsed because the space before equal label.1 = MBOX # MBOX format: mbox:fullpathname path.1=mbox:/home/gb/mail/10_ksi-linux-list #notify.1=my_play /home/gb/sounds/new_mail_has_arrived.wav action.1=rxvt -name mutt -e mutt -f /home/gb/mail/10_ksi-linux-list # label.1 = MDIR # # Maildir format: maildir:fullpathname # path.1=maildir:/home/gb/Maildir/ # notify.1=my_play /home/gb/sounds/new_mail_has_arrived.wav # action.1=rxvt -name mutt -e mutt -f /home/gb/Maildir #or if you use gnomeicu: #label.2=ICQ #path.2=gicu:USER_UIN #notify.2=beep #action.2=gnomeicu-client show label.3=POP3 # pop3 format: pop3:user:password@server[:port] [auth] path.3=pop3:user:password@server apop #notify.3=my_play /home/gb/sounds/new_mail_has_arrived.wav action.3=rxvt -name mutt -e mutt -f /home/gb/mail/30_nftp-list interval.3=300 # 5 minutes fetchinterval.3=-1 fetchcmd.3=fetchmail label.4=IMAP4 # IMAP4 format: imap:user:password@server[/mailbox][:port] [auth] # mailbox is optional, default - INBOX # password is optional, default - ask using the askpass config # port is optional, default - 143 path.4=imap:user:password@server interval.4=300 # 5 minutes # label.4=IMAPS # Secure IMAP format: imaps:user:password@server[/mailbox][:port] [auth] # mailbox is optional, default - INBOX # password is optional, default - ask using the askpass config # port is optional, default - 993 # path.4=imaps:user:password@server cram-md5 # interval.4=300 # 5 minutes # Shell expansion. (can't be nested.) # path.4=mbox:/home/me/Mail/`ls -t1 /home/me/Mail/list-archive-* | head -1` # label.4=tick # Shell method # path.4=shell:::lpq | grep Queue | awk '{print $2}' # To check for security updates in debian path.4=shell:::/usr/lib/wmbiff/security.debian.rb # Ways wmbiff can drive MAC OS X Mail using AppleScript. # action.0 = osascript -e 'tell application "Mail"' -e 'set selected mailboxes of first message viewer to {mailbox "in-grads" of imap account "me@myaccount.org"}' -e 'activate' -e 'end tell' # action.1 = osascript -e 'tell application "Mail"' -e 'set selected mailboxes of first message viewer to {inbox}' -e 'activate' -e 'end tell' dockapps/wmbiff/socket.c000066400000000000000000000120421242751507200155740ustar00rootroot00000000000000/* $Id: socket.c,v 1.14 2004/10/01 21:05:36 bluehal Exp $ */ /* Copyright (C) 1998 Trent Piepho * (C) 1999 Trent Piepho * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; version 2 of the License. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include "regulo.h" #ifdef USE_DMALLOC #include #endif /* be paranoid about leaking passwords as hostnames, enough that we'll avoid attempting lookups on things that aren't host names */ extern int Relax; static int sanity_check_hostname(const char *hostname) { struct in_addr dummy; return (Relax || regulo_match("^[A-Za-z][-_A-Za-z0-9.]+$", hostname, NULL) || inet_aton(hostname, &dummy)); } static int ipv4_sock_connect(struct in_addr *address, short port) { struct sockaddr_in addr; int fd, i; fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { perror("Error opening socket"); printf("socket() failed.\n"); return (-1); }; if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) perror("fcntl(FD_CLOEXEC)"); addr.sin_family = AF_INET; addr.sin_addr.s_addr = *(u_long *) address; addr.sin_port = htons(port); i = connect(fd, (struct sockaddr *) &addr, sizeof(struct sockaddr)); if (i == -1) { int saved_errno = errno; perror("Error connecting"); printf("connect(%s:%d) failed: %s\n", inet_ntoa(addr.sin_addr), port, strerror(saved_errno)); close(fd); return (-1); }; return (fd); } /* nspring/blueHal, 10 Apr 2002; added some extra error printing, in line with the debug-messages-to-stdout philosophy of the rest of the wmbiff code */ /* 1 June 2002; incorporated IPv6 support by Jun-ichiro itojun Hagino , thanks! */ int sock_connect(const char *hostname, int port) { #ifdef HAVE_GETADDRINFO struct addrinfo hints, *res, *res0; struct sockaddr_in addr; int fd; char pbuf[NI_MAXSERV]; int error; if (!sanity_check_hostname(hostname)) { printf ("socket/connect to '%s' aborted: it does not appear to be a valid hostname\n", hostname); printf("if you really want this, use wmbiff's -relax option.\n"); return -1; } /* we were given an IP address, no need to try getaddrinfo on it */ if (inet_aton(hostname, &addr.sin_addr)) { return ipv4_sock_connect(&addr.sin_addr, port); } memset(&hints, 0, sizeof(hints)); hints.ai_socktype = SOCK_STREAM; snprintf(pbuf, sizeof(pbuf), "%d", port); error = getaddrinfo(hostname, pbuf, &hints, &res0); if (error) { static int last_error; if (last_error != error) { /* only report a problem if it's new. this is an approximation that minimizes kept state. */ printf("%s: %s\n", hostname, gai_strerror(error)); last_error = error; } return -1; } fd = -1; for (res = res0; res; res = res->ai_next) { fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); if (fd < 0) continue; if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) perror("fcntl(FD_CLOEXEC)"); if (connect(fd, res->ai_addr, res->ai_addrlen) < 0) { close(fd); fd = -1; continue; } break; } freeaddrinfo(res0); if (fd < 0) { static int last_connecterr; if (errno != last_connecterr) { /* only report a problem if it's new. EHOSTUNREACH is common when the net is down, for example; again, this is an approximation to minimize kept state. */ last_connecterr = errno; fprintf(stderr, "Error connecting to %s:%d: %s\n", hostname, port, strerror(errno)); printf("socket/connect to %s failed: %s (%d)\n", hostname, strerror(errno), errno); } return -1; } return fd; #else #warning "This build will not support IPv6" struct hostent *host; if (!sanity_check_hostname(hostname)) { printf ("socket/connect to '%s' aborted: it does not appear to be a valid hostname\n", hostname); printf("if you really want this, use wmbiff's -relax option.\n"); return -1; } host = gethostbyname(hostname); if (host == NULL) { herror("gethostbyname"); printf("gethostbyname(%s) failed.\n", hostname); return (-1); }; return ipv4_sock_connect(host->h_addr_list[0], port); #endif } /* vim:set ts=4: */ /* * Local Variables: * tab-width: 4 * c-indent-level: 4 * c-basic-offset: 4 * End: */ dockapps/wmbiff/test_tlscomm.c000066400000000000000000000040661242751507200170300ustar00rootroot00000000000000#include #include #include #include #include #include #include int debug_default = 2; int SkipCertificateCheck = 0; const char *certificate_filename = NULL; const char *tls = "NORMAL"; int exists(const char *filename __attribute__ ((unused))) { return (0); } void ProcessPendingEvents(void) { return; } int x_socket(void) { return (0); } int print_info(void *state __attribute__((unused))) { return (0); } int Relax = 1; int indices[12]; const char *sequence[][4] = { {NULL, NULL, NULL, NULL}, {"prefix", " hello", NULL}, {"pre", "fix", " hello", NULL}, {"\r\n", ")\r\n", "prefix", NULL}, {NULL, NULL, NULL, NULL}, }; /* trick tlscomm into believing it can read. */ ssize_t read(int s, void *buf, size_t buflen) { int val = indices[s]++; if (sequence[s][val] == NULL) { indices[s]--; /* make it stay */ return 0; } else { strncpy(buf, sequence[s][val], buflen); printf("read: %s\n", sequence[s][val]); return (strlen(sequence[s][val])); } } int select(int nfds, fd_set * r, fd_set * w __attribute__ ((unused)), fd_set * x __attribute__ ((unused)), struct timeval *tv __attribute__ ((unused))) { int i; int ready = 0; for (i = 0; i < nfds; i++) { if (FD_ISSET(i, r) && sequence[i][indices[i]] != NULL) { ready++; } else { FD_CLR(i, r); } } if (ready == 0) { printf("botched.\n"); } return ready; } #define BUF_SIZE 1024 struct connection_state { int sd; char *name; /*@null@ */ void *tls_state; /*@null@ */ void *xcred; char unprocessed[BUF_SIZE]; void *pc; /* mailbox handle for debugging messages */ }; int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused))) { char buf[255]; struct connection_state scs; scs.name = strdup("test"); scs.unprocessed[0] = '\0'; scs.pc = NULL; scs.tls_state = NULL; scs.xcred = NULL; alarm(10); for (scs.sd = 1; sequence[scs.sd][0] != NULL; scs.sd++) { memset(scs.unprocessed, 0, BUF_SIZE); printf("%d\n", tlscomm_expect(&scs, "prefix", buf, 255)); } return 0; } dockapps/wmbiff/test_wmbiff.c000066400000000000000000000254141242751507200166240ustar00rootroot00000000000000#ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE___ATTRIBUTE__ #define UNUSED(x) /*@unused@*/ x __attribute__((unused)) #else #define UNUSED(x) x #endif #ifdef HAVE_MEMFROB #define DEFROB(x) memfrob(x, x ## _len) #define ENFROB(x) memfrob(x, x ## _len) #else #define DEFROB(x) #define ENFROB(x) #endif #include #include "Client.h" #include "passwordMgr.h" #include "tlsComm.h" #include "charutil.h" void ProcessPendingEvents(void) { return; } int x_socket(void) { return (0); } int debug_default = DEBUG_INFO; int Relax = 1; /* return 1 if fail, 0 if success */ int test_backtickExpand(void) { const char *tests[] = { "prefix`echo 1`suffix", "prefix`echo 1`", "`echo 1`", "`echo a b` c", "`false`", NULL }; const char *solns[] = { "prefix1suffix", "prefix1", "1", "a b c", "", NULL }; int i; int retval = 0; for (i = 0; tests[i] != NULL; i++) { char *x = backtickExpand(NULL, tests[i]); if (strcmp(x, solns[i]) != 0) { printf("test failed: [%s] != [%s]\n", tests[i], solns[i]); retval = 1; } free(x); } printf("backtick tests complete\n"); return (retval); } #define CKSTRING(x,shouldbe) if(strcmp(x,shouldbe)) { \ printf("FAILED: expected '" #shouldbe "' but got '%s'\n", x); \ return 1; } else { printf("good: '" shouldbe "' == '%s'\n", x); } /* return 1 if fail, 0 if success */ int test_passwordMgr(void) { const char *b; mbox_t m; strcpy(m.label, "x"); /* sh is almost certainly conforming; owned by root, etc. */ if (!permissions_ok(NULL, "/bin/sh")) { printf("FAILURE: permission checker failed on /bin/sh."); return (1); } /* tmp is definitely bad; and better be og+w */ if (permissions_ok(NULL, "/tmp")) { printf("FAILURE: permission checker failed on /tmp."); return (1); } /* TODO: also find some user-owned binary that shouldn't be g+w */ printf("SUCCESS: permission checker sanity check went well.\n"); /* *** */ m.askpass = "echo xlnt; #"; b = passwordFor("bill", "ted", &m, 0); if (strcmp(b, "xlnt") != 0) { printf("FAILURE: expected 'xlnt' got '%s'\n", b); return (1); } printf("SUCCESS: expected 'xlnt' got '%s'\n", b); /* *** */ m.askpass = "should be cached"; b = passwordFor("bill", "ted", &m, 0); if (strcmp(b, "xlnt") != 0) { printf("FAILURE: expected 'xlnt' got '%s'\n", b); return (1); } printf("SUCCESS: cached 'xlnt' correctly\n"); /* *** */ m.askpass = "echo abcdefghi1abcdefghi2abcdefghi3a; #"; b = passwordFor("abbot", "costello", &m, 0); if (strcmp(b, "abcdefghi1abcdefghi2abcdefghi3a") != 0) { printf ("FAILURE: expected 'abcdefghi1abcdefghi2abcdefghi3a' got '%s'\n", b); return (1); } printf ("SUCCESS: expected 'abcdefghi1abcdefghi2abcdefghi3a' got '%s'\n", b); /* try overflowing the buffer */ m.askpass = "echo abcdefghi1abcdefghi2abcdefghi3ab; #"; b = passwordFor("laverne", "shirley", &m, 0); /* should come back truncated to fill the buffer */ if (strcmp(b, "abcdefghi1abcdefghi2abcdefghi3a") != 0) { printf ("FAILURE: expected 'abcdefghi1abcdefghi2abcdefghi3a' got '%s'\n", b); return (1); } printf ("SUCCESS: expected 'abcdefghi1abcdefghi2abcdefghi3a' got '%s'\n", b); /* make sure we still have the old one */ b = passwordFor("bill", "ted", &m, 0); if (strcmp(b, "xlnt") != 0) { printf("FAILURE: expected 'xlnt' got '%s'\n", b); return (1); } printf("SUCCESS: expected 'xlnt' got '%s'\n", b); /* what it's like if ssh-askpass is cancelled - should drop the mailbox */ #if 0 /* will exit on our behalf; not so good for continued testing. */ m.askpass = "echo -n ; #"; b = passwordFor("abort", "me", &m, 0); if (strcmp(b, "") != 0) { printf("FAILURE: expected '' got '%s'\n", b); return (1); } printf("SUCCESS: expected '' got '%s'\n", b); #endif /* what it's like if ssh-askpass is ok'd with an empty password. */ m.askpass = "echo ; #"; b = passwordFor("try", "again", &m, 0); if (b == NULL || strcmp(b, "") != 0) { printf("FAILURE: expected '' got '%s'\n", b ? b : "(null)"); return (1); } printf("SUCCESS: expected '' got '%s'\n", b); m.askpass = "echo \"rt*m\"; #"; b = passwordFor("faq", "faq", &m, 0); if (strcmp(b, "rt*m") != 0) { printf("FAILURE: expected '' got '%s'\n", b); return (1); } printf("SUCCESS: expected 'rt*m' got '%s'\n", b); return (0); } #define CKINT(x,shouldbe) if(x != shouldbe) { \ printf("Failed: expected '" #shouldbe "' but got '%d'\n", x); \ return 1; } int test_imap4creator(void) { mbox_t m; if (imap4Create(&m, "imap:foo:@bar/mybox")) { return 1; } CKSTRING(m.path, "mybox"); CKSTRING(m.u.pop_imap.serverName, "bar"); CKINT(m.u.pop_imap.serverPort, 143); if (imap4Create(&m, "imap:foo:@bar/\"mybox\"")) { return 1; } CKSTRING(m.path, "\"mybox\""); CKSTRING(m.u.pop_imap.serverName, "bar"); CKINT(m.u.pop_imap.serverPort, 143); if (imap4Create(&m, "imap:foo:@192.168.1.1/\"mybox\"")) { printf ("FAILED: to create IMAP box with IP address for servername\n"); return 1; } CKSTRING(m.path, "\"mybox\""); CKSTRING(m.u.pop_imap.serverName, "192.168.1.1"); CKINT(m.u.pop_imap.serverPort, 143); if (imap4Create(&m, "imap:foo:@bar/\"space box\"")) { return 1; } CKSTRING(m.path, "\"space box\""); CKSTRING(m.u.pop_imap.serverName, "bar"); CKINT(m.u.pop_imap.serverPort, 143); if (imap4Create(&m, "imap:user pass bar/\"space box\"")) { return 1; } CKSTRING(m.path, "\"space box\""); CKSTRING(m.u.pop_imap.serverName, "bar"); CKINT(m.u.pop_imap.serverPort, 143); if (imap4Create(&m, "imap:star *as* star/\"space box\"")) { return 1; } printf("mmm %s", (m.u.pop_imap.password)); DEFROB(m.u.pop_imap.password); CKSTRING(m.u.pop_imap.password, "*as*"); CKINT(m.u.pop_imap.serverPort, 143); if (imap4Create(&m, "imap:user:*as*@bar/blah")) { return 1; } DEFROB(m.u.pop_imap.password); CKSTRING(m.u.pop_imap.password, "*as*"); CKINT(m.u.pop_imap.serverPort, 143); if (imap4Create(&m, "imap:user pass bar/\"space box\" 12")) { return 1; } CKSTRING(m.path, "\"space box\""); CKSTRING(m.u.pop_imap.serverName, "bar"); CKINT(m.u.pop_imap.serverPort, 12); if (imap4Create(&m, "imap:foo:@bar/\"mybox\":12")) { return 1; } CKSTRING(m.path, "\"mybox\""); CKSTRING(m.u.pop_imap.serverName, "bar"); CKINT(m.u.pop_imap.serverPort, 12); if (imap4Create(&m, "imap:foo:@bar/\"mybox\":12 auth")) { return 1; } CKSTRING(m.path, "\"mybox\""); CKSTRING(m.u.pop_imap.serverName, "bar"); CKINT(m.u.pop_imap.serverPort, 12); CKSTRING(m.u.pop_imap.authList, "auth"); if (imap4Create(&m, "imap:foo:@bar/\"mybox\":12 cram-md5 plaintext")) { return 1; } CKSTRING(m.u.pop_imap.authList, "cram-md5 plaintext"); if (imap4Create(&m, "imap:foo:@bar/\"mybox\":12 CRAm-md5 plainTEXt")) { return 1; } CKSTRING(m.u.pop_imap.authList, "cram-md5 plaintext"); /* doesn't really matter, as the # is gobbled by the parser as a comment. */ if (imap4Create (&m, "imap:harry:has#pass@bar/\"mybox\":12 CRAm-md5 plainTEXt")) { return 1; } CKSTRING(m.u.pop_imap.userName, "harry"); DEFROB(m.u.pop_imap.password); CKSTRING(m.u.pop_imap.password, "has#pass"); if (pop3Create(&m, "pop3:foo:@bar:12 cram-md5 plaintext")) { return 1; } CKSTRING(m.u.pop_imap.authList, "cram-md5 plaintext"); /* should not parse this; it is ambiguous. */ if (!imap4Create(&m, "imap:foo:mi@ta@bar/mybox") && !Relax) { return 1; } /* should not parse this; it is ambiguous. */ if (!imap4Create(&m, "imap:user pa ss bar/\"space box\" 12") && !Relax) { return 1; } /* should not parse this; it is ambiguous. */ if (!pop3Create(&m, "pop3:user pa ss bar 12") && !Relax) { return 1; } return 0; } int test_getline_from_buffer(void) { #define LINE_BUF_LEN 256 char linebuf[LINE_BUF_LEN]; char scratchbuf[LINE_BUF_LEN]; /* try to ensure that even an endless loop terminates */ alarm(100); strcpy(scratchbuf, "\r\n"); getline_from_buffer(scratchbuf, linebuf, LINE_BUF_LEN); if (strlen(scratchbuf) != 0) { printf("FAILURE: scratchbuf not snarfed\n"); return (1); } if (strlen(linebuf) != 2) { printf("FAILURE: linebuf not populated\n"); return (1); } strcpy(scratchbuf, "\n"); getline_from_buffer(scratchbuf, linebuf, LINE_BUF_LEN); if (strlen(scratchbuf) != 0) { printf("FAILURE: scratchbuf not snarfed\n"); return (1); } if (strlen(linebuf) != 1) { printf("FAILURE: linebuf not populated\n"); return (1); } alarm(0); return (0); } int test_charutil(void) { char *v = strdup("abc#def"); StripComment(v); if (strcmp(v, "abc#def") != 0) { printf("FAILURE: comment stripper stripped when it shouldn't\n"); return 1; } v = strdup("abc #def"); StripComment(v); if (strcmp(v, "abc ") != 0) { printf("FAILURE: comment stripper should've stripped\n"); return 1; } return 0; } #include #include #include int test_sock_connect(void) { struct sockaddr_in addr; int s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); socklen_t addrlen = sizeof(struct sockaddr_in); if (s < 0) { perror("socket"); return 1; } addr.sin_family = AF_INET; addr.sin_addr.s_addr = 0; addr.sin_port = 0; if (bind(s, (const struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < 0) { perror("bind"); return 1; } getsockname(s, (struct sockaddr *)&addr, &addrlen); if (listen(s, 5) < 0) { perror("listen"); return 1; } if (sock_connect("127.0.0.1", htons(addr.sin_port)) < 0) { return 1; } if (sock_connect("localhost", htons(addr.sin_port)) < 0) { return 1; } return 0; } int print_info(UNUSED(void *state)) { return (0); } const char *certificate_filename = NULL; const char *tls = "NORMAL"; int SkipCertificateCheck = 0; int exists(UNUSED(const char *filename)) { return (0); } // void initialize_blacklist(void) { } // void tlscomm_printf(UNUSED(int x), UNUSED(const char *f), ...) { } // void tlscomm_expect(void) { } // void tlscomm_close() { } // int tlscomm_is_blacklisted(UNUSED(const char *x)) { return 1; } // void initialize_gnutls(void) { } // int sock_connect(UNUSED(const char *n), UNUSED(int p)) { return 1; } /* stdout */ // void initialize_unencrypted(void) { } int main(UNUSED(int argc), UNUSED(char *argv[])) { if (test_backtickExpand() || test_passwordMgr()) { printf("SOME TESTS FAILED!\n"); exit(EXIT_FAILURE); } Relax = 0; if (test_imap4creator()) { printf("SOME TESTS FAILED!\n"); exit(EXIT_FAILURE); } if (test_sock_connect()) { printf("SOME TESTS FAILED!\n"); exit(EXIT_FAILURE); } Relax = 1; if (test_imap4creator()) { printf("SOME TESTS FAILED!\n"); exit(EXIT_FAILURE); } if (test_getline_from_buffer()) { printf("SOME TESTS FAILED!\n"); exit(EXIT_FAILURE); } if (test_charutil()) { printf("SOME TESTS FAILED!\n"); exit(EXIT_FAILURE); } if (test_sock_connect()) { printf("SOME TESTS FAILED!\n"); exit(EXIT_FAILURE); } printf("Success! on all tests.\n"); exit(EXIT_SUCCESS); } /* vim:set ts=4: */ /* * Local Variables: * tab-width: 4 * c-indent-level: 4 * c-basic-offset: 4 * End: */ dockapps/wmbiff/tlsComm.c000066400000000000000000000501251242751507200157260ustar00rootroot00000000000000/* tlsComm.c - primitive routines to aid TLS communication within wmbiff, without rewriting each mailbox access scheme. These functions hide whether the underlying transport is encrypted. Neil Spring (nspring@cs.washington.edu) */ /* TODO: handle "* BYE" internally? */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include #ifdef HAVE_GNUTLS_GNUTLS_H #define USE_GNUTLS #include #include #include #endif #ifdef USE_DMALLOC #include #endif #include "tlsComm.h" #include "Client.h" /* debugging messages */ /* if non-null, set to a file for certificate verification */ extern const char *certificate_filename; /* if set, don't fail when dealing with a bad certificate. (continue to whine, though, as bad certs should be fixed) */ extern int SkipCertificateCheck; /* gnutls: specify the priorities to use on the ciphers, key exchange methods, macs and compression methods. */ extern const char *tls; /* WARNING: implcitly uses scs to gain access to the mailbox that holds the per-mailbox debug flag. */ #define TDM(lvl, args...) DM(scs->pc, lvl, "comm: " args) /* how long to wait for the server to do its thing when we issue it a command (in seconds) */ #define EXPECT_TIMEOUT 40 /* this is the per-connection state that is maintained for each connection; BIG variables are for ssl (null if not used). */ #define BUF_SIZE 1024 struct connection_state { int sd; char *name; #ifdef USE_GNUTLS gnutls_session_t tls_state; gnutls_certificate_credentials_t xcred; #else /*@null@ */ void *tls_state; /*@null@ */ void *xcred; #endif char unprocessed[BUF_SIZE]; Pop3 pc; /* mailbox handle for debugging messages */ }; /* gotta do our own line buffering, sigh */ int getline_from_buffer(char *readbuffer, char *linebuffer, int linebuflen); void handle_gnutls_read_error(int readbytes, struct connection_state *scs); void tlscomm_close(struct connection_state *scs) { TDM(DEBUG_INFO, "%s: closing.\n", (scs->name != NULL) ? scs->name : "null"); /* not ok to call this more than once */ if (scs->tls_state) { #ifdef USE_GNUTLS /* this next line seems capable of hanging... */ /* gnutls_bye(scs->tls_state, GNUTLS_SHUT_RDWR); */ /* so we'll try just _bye'ing the WR direction, which should send the alert but not wait for a response. */ gnutls_bye(scs->tls_state, GNUTLS_SHUT_WR); gnutls_certificate_free_credentials(scs->xcred); gnutls_deinit(scs->tls_state); scs->xcred = NULL; #endif } else { (void) close(scs->sd); } scs->sd = -1; scs->tls_state = NULL; scs->xcred = NULL; free(scs->name); scs->name = NULL; free(scs); } extern int x_socket(void); extern void ProcessPendingEvents(void); /* this avoids blocking without using non-blocking i/o */ static int wait_for_it(int sd, int timeoutseconds) { fd_set readfds; struct timeval tv; int ready_descriptors; int maxfd; int xfd; struct timeval time_now; struct timeval time_out; gettimeofday(&time_now, NULL); memcpy(&time_out, &time_now, sizeof(struct timeval)); time_out.tv_sec += timeoutseconds; xfd = x_socket(); maxfd = max(sd, xfd); do { do { ProcessPendingEvents(); gettimeofday(&time_now, NULL); tv.tv_sec = max(time_out.tv_sec - time_now.tv_sec + 1, (time_t) 0); /* sloppy, but bfd */ tv.tv_usec = 0; /* select will return if we have X stuff or we have comm stuff on sd */ FD_ZERO(&readfds); FD_SET(sd, &readfds); // FD_SET(xfd, &readfds); ready_descriptors = select(maxfd + 1, &readfds, NULL, NULL, &tv); // DMA(DEBUG_INFO, // "select %d/%d returned %d descriptor, %d\n", // sd, timeoutseconds, ready_descriptors, FD_ISSET(sd, &readfds)); } while(tv.tv_sec > 0 && (!FD_ISSET(sd, &readfds) || (errno == EINTR && ready_descriptors == -1))); FD_ZERO(&readfds); FD_SET(sd, &readfds); tv.tv_sec = 0; tv.tv_usec = 0; ready_descriptors = select(sd + 1, &readfds, NULL, NULL, &tv); } while (ready_descriptors == -1 && errno == EINTR); if (ready_descriptors == 0) { DMA(DEBUG_INFO, "select timed out after %d seconds on socket: %d\n", timeoutseconds, sd); return (0); } else if (ready_descriptors == -1) { DMA(DEBUG_ERROR, "select failed on socket %d: %s\n", sd, strerror(errno)); return (0); } return (FD_ISSET(sd, &readfds)); } /* exported for testing */ extern int getline_from_buffer(char *readbuffer, char *linebuffer, int linebuflen) { char *p, *q; int i; /* find end of line (stopping if linebuflen is too small. */ for (p = readbuffer, i = 0; *p != '\n' && *p != '\0' && i < linebuflen - 1; p++, i++); /* gobble \n if it starts the line. */ if (*p == '\n') { /* grab the end of line too! and then advance past the newline */ i++; p++; } else { /* TODO -- perhaps we should return no line at all here, as it might be incomplete. don't want to break anything though. */ DMA(DEBUG_INFO, "expected line doesn't end on its own.\n"); } if (i != 0) { /* copy a line into the linebuffer */ strncpy(linebuffer, readbuffer, (size_t) i); /* sigh, null terminate */ linebuffer[i] = '\0'; /* shift the rest over; this could be done instead with strcpy... I think. */ q = readbuffer; if (*p != '\0') { while (*p != '\0') { *(q++) = *(p++); } } /* null terminate */ *(q++) = *(p++); /* return the length of the line */ } if (i < 0 || i > linebuflen) { DM((Pop3) NULL, DEBUG_ERROR, "bork bork bork!: %d %d\n", i, linebuflen); } return i; } /* eat lines, until one starting with prefix is found; this skips 'informational' IMAP responses */ /* the correct response to a return value of 0 is almost certainly tlscomm_close(scs): don't _expect() anything unless anything else would represent failure */ int tlscomm_expect(struct connection_state *scs, const char *prefix, char *linebuf, int buflen) { int prefixlen = (int) strlen(prefix); int buffered_bytes = 0; memset(linebuf, 0, buflen); TDM(DEBUG_INFO, "%s: expecting: %s\n", scs->name, prefix); /* if(scs->unprocessed[0]) { TDM(DEBUG_INFO, "%s: buffered: %s\n", scs->name, scs->unprocessed); } */ while (scs->unprocessed[0] != '\0' || wait_for_it(scs->sd, EXPECT_TIMEOUT)) { if (scs->unprocessed[buffered_bytes] == '\0') { int thisreadbytes; #ifdef USE_GNUTLS if (scs->tls_state) { /* BUF_SIZE - 1 leaves room for trailing \0 */ thisreadbytes = gnutls_read(scs->tls_state, &scs->unprocessed[buffered_bytes], BUF_SIZE - 1 - buffered_bytes); if (thisreadbytes < 0) { handle_gnutls_read_error(thisreadbytes, scs); return 0; } } else #endif { thisreadbytes = read(scs->sd, &scs->unprocessed[buffered_bytes], BUF_SIZE - 1 - buffered_bytes); if (thisreadbytes < 0) { TDM(DEBUG_ERROR, "%s: error reading: %s\n", scs->name, strerror(errno)); return 0; } } buffered_bytes += thisreadbytes; /* force null termination */ scs->unprocessed[buffered_bytes] = '\0'; if (buffered_bytes == 0) { return 0; /* bummer */ } } else { buffered_bytes = strlen(scs->unprocessed); } while (buffered_bytes >= prefixlen) { int linebytes; linebytes = getline_from_buffer(scs->unprocessed, linebuf, buflen); if (linebytes == 0) { buffered_bytes = 0; } else { buffered_bytes -= linebytes; if (strncmp(linebuf, prefix, prefixlen) == 0) { TDM(DEBUG_INFO, "%s: got: %*s", scs->name, linebytes, linebuf); return 1; /* got it! */ } TDM(DEBUG_INFO, "%s: dumped(%d/%d): %.*s", scs->name, linebytes, buffered_bytes, linebytes, linebuf); } } } if (buffered_bytes == -1) { TDM(DEBUG_INFO, "%s: timed out while expecting '%s'\n", scs->name, prefix); } else { TDM(DEBUG_ERROR, "%s: expecting: '%s', saw (%d): %s%s", scs->name, prefix, buffered_bytes, linebuf, /* only print the newline if the linebuf lacks it */ (linebuf[strlen(linebuf) - 1] == '\n') ? "\n" : ""); } return 0; /* wait_for_it failed */ } int tlscomm_gets(char *buf, int buflen, struct connection_state *scs) { return (tlscomm_expect(scs, "", buf, buflen)); } void tlscomm_printf(struct connection_state *scs, const char *format, ...) { va_list args; char buf[1024]; int bytes; ssize_t unused __attribute__((unused)); if (scs == NULL) { DMA(DEBUG_ERROR, "null connection to tlscomm_printf\n"); abort(); } va_start(args, format); bytes = vsnprintf(buf, 1024, format, args); va_end(args); if (scs->sd != -1) { #ifdef USE_GNUTLS if (scs->tls_state) { int written = gnutls_write(scs->tls_state, buf, bytes); if (written < bytes) { TDM(DEBUG_ERROR, "Error %s prevented writing: %*s\n", gnutls_strerror(written), bytes, buf); return; } } else #endif /* Why???? */ unused = write(scs->sd, buf, bytes); } else { printf ("warning: tlscomm_printf called with an invalid socket descriptor\n"); return; } TDM(DEBUG_INFO, "wrote %*s", bytes, buf); } /* most of this file only makes sense if using TLS. */ #ifdef USE_GNUTLS #include "gnutls-common.h" static void bad_certificate(const struct connection_state *scs, const char *msg) { TDM(DEBUG_ERROR, "%s", msg); if (!SkipCertificateCheck) { TDM(DEBUG_ERROR, "to ignore this error, run wmbiff " "with the -skip-certificate-check option\n"); exit(1); } } static void warn_certificate(const struct connection_state *scs, const char *msg) { if (!SkipCertificateCheck) { TDM(DEBUG_ERROR, "%s", msg); TDM(DEBUG_ERROR, "to ignore this warning, run wmbiff " "with the -skip-certificate-check option\n"); } } /* a start of a hack at verifying certificates. does not provide any security at all. I'm waiting for either gnutls to make this as easy as it should be, or someone to port Andrew McDonald's gnutls-for-mutt patch. */ #define CERT_SEP "-----BEGIN" /* this bit is based on read_ca_file() in gnutls */ static int tls_compare_certificates(const gnutls_datum_t * peercert) { gnutls_datum_t cert; unsigned char *ptr; FILE *fd1; int ret; gnutls_datum_t b64_data; unsigned char *b64_data_data; struct stat filestat; if (stat(certificate_filename, &filestat) == -1) return 0; b64_data.size = filestat.st_size + 1; b64_data_data = (unsigned char *) malloc(b64_data.size); b64_data_data[b64_data.size - 1] = '\0'; b64_data.data = b64_data_data; fd1 = fopen(certificate_filename, "r"); if (fd1 == NULL) { return 0; } b64_data.size = fread(b64_data.data, 1, b64_data.size, fd1); fclose(fd1); do { ret = gnutls_pem_base64_decode_alloc(NULL, &b64_data, &cert); if (ret != 0) { free(b64_data_data); return 0; } ptr = (unsigned char *) strstr((char *) b64_data.data, CERT_SEP) + 1; ptr = (unsigned char *) strstr((char *) ptr, CERT_SEP); b64_data.size = b64_data.size - (ptr - b64_data.data); b64_data.data = ptr; if (cert.size == peercert->size) { if (memcmp(cert.data, peercert->data, cert.size) == 0) { /* match found */ gnutls_free(cert.data); free(b64_data_data); return 1; } } gnutls_free(cert.data); } while (ptr != NULL); /* no match found */ free(b64_data_data); return 0; } static void tls_check_certificate(struct connection_state *scs, const char *remote_hostname) { int ret; unsigned int certstat; const gnutls_datum_t *cert_list; unsigned int cert_list_size = 0; gnutls_x509_crt_t cert; if (gnutls_auth_get_type(scs->tls_state) != GNUTLS_CRD_CERTIFICATE) { bad_certificate(scs, "Unable to get certificate from peer.\n"); return; /* bad_cert will exit if -skip-certificate-check was not given */ } ret = gnutls_certificate_verify_peers2(scs->tls_state, &certstat); if (ret < 0) { char errbuf[1024]; snprintf(errbuf, 1024, "could not verify certificate: %s (%d).\n", gnutls_strerror(ret), ret); bad_certificate(scs, (ret == GNUTLS_E_NO_CERTIFICATE_FOUND ? "server presented no certificate.\n" : errbuf)); return; #ifdef GNUTLS_CERT_CORRUPTED } else if (certstat & GNUTLS_CERT_CORRUPTED) { bad_certificate(scs, "server's certificate is corrupt.\n"); #endif } else if (certstat & GNUTLS_CERT_REVOKED) { bad_certificate(scs, "server's certificate has been revoked.\n"); } else if (certstat & GNUTLS_CERT_EXPIRED) { bad_certificate(scs, "server's certificate is expired.\n"); } else if (certstat & GNUTLS_CERT_INSECURE_ALGORITHM) { warn_certificate(scs, "server's certificate use an insecure algorithm.\n"); } else if (certstat & GNUTLS_CERT_INVALID) { if (gnutls_certificate_type_get(scs->tls_state) == GNUTLS_CRT_X509) { /* bad_certificate(scs, "server's certificate is not trusted.\n" "there may be a problem with the certificate stored in your certfile\n"); */ } else { bad_certificate(scs, "server's certificate is invalid or not X.509.\n" "there may be a problem with the certificate stored in your certfile\n"); } #if defined(GNUTLS_CERT_SIGNER_NOT_FOUND) } else if (certstat & GNUTLS_CERT_SIGNER_NOT_FOUND) { TDM(DEBUG_INFO, "server's certificate is not signed.\n"); TDM(DEBUG_INFO, "to verify that a certificate is trusted, use the certfile option.\n"); #endif #if defined(GNUTLS_CERT_NOT_TRUSTED) } else if (certstat & GNUTLS_CERT_NOT_TRUSTED) { TDM(DEBUG_INFO, "server's certificate is not trusted.\n"); TDM(DEBUG_INFO, "to verify that a certificate is trusted, use the certfile option.\n"); #endif } if (gnutls_x509_crt_init(&cert) < 0) { bad_certificate(scs, "Unable to initialize certificate data structure"); } /* not checking for not-yet-valid certs... this would make sense if we weren't just comparing to stored ones */ cert_list = gnutls_certificate_get_peers(scs->tls_state, &cert_list_size); if (gnutls_x509_crt_import(cert, &cert_list[0], GNUTLS_X509_FMT_DER) < 0) { bad_certificate(scs, "Error processing certificate data"); } if (gnutls_x509_crt_get_expiration_time(cert) < time(NULL)) { bad_certificate(scs, "server's certificate has expired.\n"); } else if (gnutls_x509_crt_get_activation_time(cert) > time(NULL)) { bad_certificate(scs, "server's certificate is not yet valid.\n"); } else { TDM(DEBUG_INFO, "certificate passed time check.\n"); } if (gnutls_x509_crt_check_hostname(cert, remote_hostname) == 0) { char certificate_hostname[256]; size_t buflen = 255; gnutls_x509_crt_get_dn(cert, certificate_hostname, &buflen); /* gnutls_x509_extract_certificate_dn(&cert_list[0], &dn); */ TDM(DEBUG_INFO, "server's certificate (%s) does not match its hostname (%s).\n", certificate_hostname, remote_hostname); bad_certificate(scs, "server's certificate does not match its hostname.\n"); } else { if ((scs->pc)->debug >= DEBUG_INFO) { char certificate_hostname[256]; size_t buflen = 255; gnutls_x509_crt_get_dn(cert, certificate_hostname, &buflen); /* gnutls_x509_extract_certificate_dn(&cert_list[0], &dn); */ TDM(DEBUG_INFO, "server's certificate (%s) matched its hostname (%s).\n", certificate_hostname, remote_hostname); } } if (certificate_filename != NULL && tls_compare_certificates(&cert_list[0]) == 0) { bad_certificate(scs, "server's certificate was not found in the certificate file.\n"); } gnutls_x509_crt_deinit(cert); TDM(DEBUG_INFO, "certificate check ok.\n"); return; } struct connection_state *initialize_gnutls(intptr_t sd, char *name, Pop3 pc, const char *remote_hostname) { static int gnutls_initialized; int zok; struct connection_state *scs = malloc(sizeof(struct connection_state)); memset(scs, 0, sizeof(struct connection_state)); /* clears the unprocessed buffer */ scs->pc = pc; assert(sd >= 0); if (gnutls_initialized == 0) { assert(gnutls_global_init() == 0); gnutls_initialized = 1; } assert(gnutls_init(&scs->tls_state, GNUTLS_CLIENT) == 0); { const char *err_pos; if (GNUTLS_E_SUCCESS != gnutls_priority_set_direct(scs->tls_state, tls, &err_pos)) { DMA(DEBUG_ERROR, "Unable to set the priorities to use on the ciphers, " "key exchange methods, macs and/or compression methods.\n" "See 'tls' parameter in config file: '%s'.\n", err_pos); exit(1); } /* no client private key */ if (gnutls_certificate_allocate_credentials(&scs->xcred) < 0) { DMA(DEBUG_ERROR, "gnutls memory error\n"); exit(1); } /* certfile seems to work. */ if (certificate_filename != NULL) { if (!exists(certificate_filename)) { DMA(DEBUG_ERROR, "Certificate file (certfile=) %s not found.\n", certificate_filename); exit(1); } zok = gnutls_certificate_set_x509_trust_file(scs->xcred, (char *) certificate_filename, GNUTLS_X509_FMT_PEM); if (zok < 0) { DMA(DEBUG_ERROR, "GNUTLS did not like your certificate file %s (%d).\n", certificate_filename, zok); gnutls_perror(zok); exit(1); } } gnutls_cred_set(scs->tls_state, GNUTLS_CRD_CERTIFICATE, scs->xcred); gnutls_transport_set_ptr(scs->tls_state, (gnutls_transport_ptr_t) sd); do { zok = gnutls_handshake(scs->tls_state); } while (zok == GNUTLS_E_INTERRUPTED || zok == GNUTLS_E_AGAIN); tls_check_certificate(scs, remote_hostname); } if (zok < 0) { TDM(DEBUG_ERROR, "%s: Handshake failed\n", name); TDM(DEBUG_ERROR, "%s: This may be a problem in gnutls, " "which is under development\n", name); TDM(DEBUG_ERROR, "%s: This copy of wmbiff was compiled with \n" " gnutls version %s.\n", name, LIBGNUTLS_VERSION); gnutls_perror(zok); if (scs->pc->u.pop_imap.serverPort != 143 /* starttls */ ) { TDM(DEBUG_ERROR, "%s: Please run 'gnutls-cli-debug -p %d %s' to test ssl directly.\n" " That tool provides a lower-level test of gnutls with your server.\n", name, scs->pc->u.pop_imap.serverPort, remote_hostname); } gnutls_deinit(scs->tls_state); free(scs); return (NULL); } else { TDM(DEBUG_INFO, "%s: Handshake was completed\n", name); if (scs->pc->debug >= DEBUG_INFO) print_info(scs->tls_state, remote_hostname); scs->sd = sd; scs->name = name; } return (scs); } /* moved down here, to keep from interrupting the flow with verbose error crap */ void handle_gnutls_read_error(int readbytes, struct connection_state *scs) { if (gnutls_error_is_fatal(readbytes) == 1) { TDM(DEBUG_ERROR, "%s: Received corrupted data(%d) - server has terminated the connection abnormally\n", scs->name, readbytes); } else { if (readbytes == GNUTLS_E_WARNING_ALERT_RECEIVED || readbytes == GNUTLS_E_FATAL_ALERT_RECEIVED) TDM(DEBUG_ERROR, "* Received alert [%d]\n", gnutls_alert_get(scs->tls_state)); if (readbytes == GNUTLS_E_REHANDSHAKE) TDM(DEBUG_ERROR, "* Received HelloRequest message\n"); } TDM(DEBUG_ERROR, "%s: gnutls error reading: %s\n", scs->name, gnutls_strerror(readbytes)); } #else /* declare stubs when tls isn't compiled in */ struct connection_state *initialize_gnutls(UNUSED(int sd), UNUSED(char *name), UNUSED(Pop3 pc), UNUSED(const char *remote_hostname)) { DM(pc, DEBUG_ERROR, "FATAL: tried to initialize ssl when ssl wasn't compiled in.\n"); exit(EXIT_FAILURE); } #endif /* either way: */ struct connection_state *initialize_unencrypted(int sd, /*@only@ */ char *name, Pop3 pc) { struct connection_state *ret = malloc(sizeof(struct connection_state)); assert(sd >= 0); assert(ret != NULL); memset(ret, 0, sizeof(struct connection_state)); /* clears the unprocessed buffer */ ret->sd = sd; ret->name = name; ret->tls_state = NULL; ret->xcred = NULL; ret->pc = pc; return (ret); } /* bad seed connections that can't be setup */ /*@only@*/ struct connection_state *initialize_blacklist( /*@only@ */ char *name) { struct connection_state *ret = malloc(sizeof(struct connection_state)); assert(ret != NULL); ret->sd = -1; ret->name = name; ret->tls_state = NULL; ret->xcred = NULL; ret->pc = NULL; return (ret); } int tlscomm_is_blacklisted(const struct connection_state *scs) { return (scs != NULL && scs->sd == -1); } /* vim:set ts=4: */ /* * Local Variables: * tab-width: 4 * c-indent-level: 4 * c-basic-offset: 4 * End: */ dockapps/wmbiff/tlsComm.h000066400000000000000000000044121242751507200157310ustar00rootroot00000000000000/* tlsComm.h - interface for the thin layer that looks sort of like fgets and fprintf, but might read or write to a socket or a TLS association Neil Spring (nspring@cs.washington.edu) Comments in @'s are for lclint's benefit: http://lclint.cs.virginia.edu/ */ /* used to drill through per-mailbox debug keys */ #include #include "Client.h" /* opaque reference to the state associated with a connection: may be just a file handle, or may include encryption state */ struct connection_state; /* take a socket descriptor and negotiate a TLS connection over it */ /*@only@*/ struct connection_state *initialize_gnutls(intptr_t sd, /*@only@ */ char *name, Pop3 pc, const char *hostname); /* take a socket descriptor and bundle it into a connection state structure for later communication */ /*@only@*/ struct connection_state *initialize_unencrypted(int sd, /*@only@ */ char *name, Pop3 pc); /* store a binding when connect() times out. these should be skipped when trying to check mail so that other mailboxes are checked responsively. I believe linux defaults to around 90 seconds for a failed connect() attempt */ /* TODO: engineer an eventual retry scheme */ /*@only@*/ struct connection_state *initialize_blacklist( /*@only@ */ char *name); int tlscomm_is_blacklisted(const struct connection_state *scs); /* just like fprintf, only takes a connection state structure */ void tlscomm_printf(struct connection_state *scs, const char *format, ...); /* modeled after fgets; may not work exactly the same */ int tlscomm_gets( /*@out@ */ char *buf, int buflen, struct connection_state *scs); /* gobbles lines until it finds one starting with {prefix}, which is returned in buf */ int tlscomm_expect(struct connection_state *scs, const char *prefix, /*@out@ */ char *buf, int buflen); /* terminates the TLS association or just closes the socket, and frees the connection state */ void tlscomm_close( /*@only@ */ struct connection_state *scs); /* internal function exported for testing */ int getline_from_buffer(char *readbuffer, char *linebuffer, int linebuflen); #ifndef UNUSED #ifdef HAVE___ATTRIBUTE__ #define UNUSED(x) /*@unused@*/ x __attribute__((unused)) #else #define UNUSED(x) x #endif #endif dockapps/wmbiff/wmbiff-classic-master-led.xpm000066400000000000000000000440021242751507200216130ustar00rootroot00000000000000/* XPM */ static const char * wmbiff_classic_master_xpm[] = { "160 109 15 1", " c #00000000FFFF", ". c #208120812081", "X c #FFFFFFFF0000", "o c #492441030000", "O c #79E779E70820", "+ c #000000000000", "@ c #C71BC30BC71B", ": c #000049244103", "$ c #2081B2CAAEBA", "% c #00007DF771C6", "& c #B6DA04101861", "* c #0000EBAD0000", "= c #28A23CF338E3", "- c #F7DEF3CEFFFF", "; c #71C6E38D71C6", " ................................................................................ ", " ...XXX...oooO.OXXXO.OXXXO.OoooO.OXXXO.OXXXO.OXXXO.OXXXO.OXXXO................... ", " ..X...X.o...X.o...X.o...X.X...X.X...o.X...o.o...X.X...X.X...X............X...... ", " ..X...X.o...X.o...X.o...X.X...X.X...o.X...o.o...X.X...X.X...X..X....X....X...... ", " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ..OoooO..oooO.OXXXO..XXXO.OXXXO.OXXXO.OXXXO..oooO.oXXXo.OXXXO..O....O...X....... ", " +......................................................@ ..X...X.o...X.X...o.o...X.o...X.o...X.X...X.o...X.X...X.o...X...........X....... ", " +..:::...:::...:::...:::...:::.......:::...:::...:::...@ ..X...X.o...X.X...o.o...X.o...X.o...X.X...X.o...X.X...X.o...X..X....X..X........ ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ ...XXX...oooX.OXXXO.OXXXO..oooO.OXXXO.OXXXO..oooO.OXXXO.OXXXO..O....O..X........ ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ ................................................................................ ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +..:::...:::...:::...:::...:::.......:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +..:::...:::...:::...:::...:::.......:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +..:::...:::...:::...:::...:::.......:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +..:::...:::...:::...:::...:::.......:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +......................................................@ . ", " +......................................................@ . ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ . ", " . ", " . ", " . ", " . ", "............................................................................... ", "..$$$...:::%.%$$$%.%$$$%.%:::%.%$$$%.%$$$%.%$$$%.:$$$%.%$$$%................... ", ".$...$.:...$.:...$.:...$.$...$.$...:.$...:.:...$.$...$.$...$............$...... .&&. .**. .==. ", ".$...$.:...$.:...$.:...$.$...$.$...:.$...:.:...$.$...$.$...$..$....$....$...... &-&& *-** ==== ", ".%:::%..:::%.%$$$%..$$$%.%$$$%.%$$$%.%$$$%..:::%.:$$$:.%$$$%..%....%...$....... &&&& **** ==== .$:; ", ".$...$.:...$.$...:.:...$.:...$.:...$.$...$.:...$.$...$.:...$...........$....... .&&. .**. .==. ", ".$...$.:...$.$...:.:...$.:...$.:...$.$...$.:...$.$...$.:...$..$....$..$........ ", "..$$$...:::$.%$$$%.%$$$%..:::%.%$$$%.%$$$%..:::%.%$$$:.%$$$%..%....%..$........ ", "............................................................................... ", " ", "................................................................................................................................................................", ".:$$$:.%$$$..%$$$%.%$$$..%$$$%.%$$$%.%$$$%.%:::%..:::%..:::%.%:::%.%:::..$:::$.%$$$..%$$$%.%$$$%.%$$$%.%$$$%.%$$$%.%$$$%.%:::%.%:::%.%:::%.%:::%.%:::%.%$$$%....", ".$...$.$...$.$...:.$...$.$...:.$...:.$...:.$...$.:...$.:...$.$...$.$...:.$$.$$.$...$.$...$.$...$.$...$.$...$.$...:.:.$.:.$...$.$...$.$...$.$...$.$...$.:...$....", ".$...$.$...$.$...:.$...$.$...:.$...:.$...:.$...$.:...$.:...$.$..$:.$...:.$.$.$.$...$.$...$.$...$.$...$.$...$.$...:.:.$.:.$...$.$...$.$...$.:$.$:.$...$.:..$:....", ".%$$$%.%$$$..%:::..%:::%.%$$$..%$$$..%:$$%.%$$$%..:::%..:::%.%$$:..%:::..%:::%.%:::%.%:::%.%$$$%.%$::%.%$$$..%$$$%..:%:..%:::%.%:::%.%:::%..:$:..%$$$%..:$:.....", ".$...$.$...$.$...:.$...$.$...:.$...:.$...$.$...$.:...$.:...$.$..$:.$...:.$...$.$...$.$...$.$...:.$.$.$.$...$.:...$.:.$.:.$...$.$...$.$.$.$.:$.$:.:...$.:$..:....", ".$...$.$...$.$...:.$...$.$...:.$...:.$...$.$...$.:...$.:...$.$...$.$...:.$...$.$...$.$...$.$...:.$..$$.$...$.:...$.:.$.:.$...$.$...$.$$.$$.$...$.:...$.$...:....", ".%:::%.%$$$..%$$$%.$$$$..%$$$%.$:::..%$$$%.%:::%..:::$.:$$$%.%:::%.%$$$:.%:::%.$:::$.%$$$%.%:::..%$$$%.%:::%.%$$$%..:%:..:$$$$..$$$..$:::$.%:::$.:$$$%.%$$$%....", "................................................................................................................................................................", " ", " +......................................................@ . ", " ..:::...:::...:::...:::...:::.......:::...:::...:::... ", " .:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:.. ", " .:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:.. ", " ..:::...:::...:::...:::...:::...:...:::...:::...:::... ", " .:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:.. ", " .:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:.. ", " ..:::...:::...:::...:::...:::...:...:::...:::...:::... ", " ...................................................... ", " ...................................................... ", " ", "................................................................................................................................................................", ".oXXXo.OXXX..OXXXO.OXXX..OXXXO.OXXXO.OXXXO.OoooO..oooO..oooO.OoooO.Oooo..XoooX.OXXX..OXXXO.OXXXO.OXXXO.OXXXO.OXXXO.OXXXO.OoooO.OoooO.OoooO.OoooO.OoooO.OXXXO....", ".X...X.X...X.X...o.X...X.X...o.X...o.X...o.X...X.o...X.o...X.X...X.X...o.XX.XX.X...X.X...X.X...X.X...X.X...X.X...o.o.X.o.X...X.X...X.X...X.X...X.X...X.o...X....", ".X...X.X...X.X...o.X...X.X...o.X...o.X...o.X...X.o...X.o...X.X..Xo.X...o.X.X.X.X...X.X...X.X...X.X...X.X...X.X...o.o.X.o.X...X.X...X.X...X.oX.Xo.X...X.o..Xo....", ".OXXXO.OXXX..Oooo..OoooO.OXXX..OXXX..OoXXO.OXXXO..oooO..oooO.OXXo..Oooo..OoooO.OoooO.OoooO.OXXXO.OXooO.OXXX..OXXXO..oOo..OoooO.OoooO.OoooO..oXo..OXXXO..oXo.....", ".X...X.X...X.X...o.X...X.X...o.X...o.X...X.X...X.o...X.o...X.X..Xo.X...o.X...X.X...X.X...X.X...o.X.X.X.X...X.o...X.o.X.o.X...X.X...X.X.X.X.oX.Xo.o...X.oX..o....", ".X...X.X...X.X...o.X...X.X...o.X...o.X...X.X...X.o...X.o...X.X...X.X...o.X...X.X...X.X...X.X...o.X..XX.X...X.o...X.o.X.o.X...X.X...X.XX.XX.X...X.o...X.X...o....", ".OoooO.OXXX..OXXXO.XXXX..OXXXO.Xooo..OXXXO.OoooO..oooX.OXXXO.OoooO.OXXXo.OoooO.XoooX.OXXXO.Oooo..OXXXO.OoooO.OXXXO..oOo..oXXXX..XXX..XoooX.OoooX.oXXXO.OXXXO....", "................................................................................................................................................................", " ", " ", " ", " ", " ", " "}; dockapps/wmbiff/wmbiff-master-led.xpm000066400000000000000000000437721242751507200202110ustar00rootroot00000000000000/* XPM */ static const char * wmbiff_master_xpm[] = { "160 109 15 1", " c #00000000FFFF", ". c #505075000000", "X c #FFFFFFFF0000", "o c #492441030000", "O c #79E779E70820", "+ c #000000000000", "@ c #C71BC30BC71B", ": c #000049244103", "$ c #2081B2CAAEBA", "% c #00007DF771C6", "& c #B6DA04101861", "* c #0000EBAD0000", "= c #28A23CF338E3", "- c #F7DEF3CEFFFF", "; c #71C6E38D71C6", " ................................................................................ ", " ...XXX...oooO.OXXXO.OXXXO.OoooO.OXXXO.OXXXO.OXXXO.OXXXO.OXXXO................... ", " ..X...X.o...X.o...X.o...X.X...X.X...o.X...o.o...X.X...X.X...X............X...... ", " ..X...X.o...X.o...X.o...X.X...X.X...o.X...o.o...X.X...X.X...X..X....X....X...... ", " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ..OoooO..oooO.OXXXO..XXXO.OXXXO.OXXXO.OXXXO..oooO.oXXXo.OXXXO..O....O...X....... ", " +......................................................@ ..X...X.o...X.X...o.o...X.o...X.o...X.X...X.o...X.X...X.o...X...........X....... ", " +..:::...:::...:::...:::...:::.......:::...:::...:::...@ ..X...X.o...X.X...o.o...X.o...X.o...X.X...X.o...X.X...X.o...X..X....X..X........ ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ ...XXX...oooX.OXXXO.OXXXO..oooO.OXXXO.OXXXO..oooO.OXXXO.OXXXO..O....O..X........ ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ ................................................................................ ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +..:::...:::...:::...:::...:::.......:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +..:::...:::...:::...:::...:::.......:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +..:::...:::...:::...:::...:::.......:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +......................................................@ . ", " +..:::...:::...:::...:::...:::.......:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", " +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", " +......................................................@ . ", " +......................................................@ . ", " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ . ", " . ", " . ", " . ", " . ", "............................................................................... ", "..$$$...:::%.%$$$%.%$$$%.%:::%.%$$$%.%$$$%.%$$$%.:$$$%.%$$$%................... ", ".$...$.:...$.:...$.:...$.$...$.$...:.$...:.:...$.$...$.$...$............$...... .&&. .**. .==. ", ".$...$.:...$.:...$.:...$.$...$.$...:.$...:.:...$.$...$.$...$..$....$....$...... &-&& *-** ==== ", ".%:::%..:::%.%$$$%..$$$%.%$$$%.%$$$%.%$$$%..:::%.:$$$:.%$$$%..%....%...$....... &&&& **** ==== .$:; ", ".$...$.:...$.$...:.:...$.:...$.:...$.$...$.:...$.$...$.:...$...........$....... .&&. .**. .==. ", ".$...$.:...$.$...:.:...$.:...$.:...$.$...$.:...$.$...$.:...$..$....$..$........ ", "..$$$...:::$.%$$$%.%$$$%..:::%.%$$$%.%$$$%..:::%.%$$$:.%$$$%..%....%..$........ ", "............................................................................... ", " ", "................................................................................................................................................................", ".:$$$:.%$$$..%$$$%.%$$$..%$$$%.%$$$%.%$$$%.%:::%..:::%..:::%.%:::%.%:::..$:::$.%$$$..%$$$%.%$$$%.%$$$%.%$$$%.%$$$%.%$$$%.%:::%.%:::%.%:::%.%:::%.%:::%.%$$$%....", ".$...$.$...$.$...:.$...$.$...:.$...:.$...:.$...$.:...$.:...$.$...$.$...:.$$.$$.$...$.$...$.$...$.$...$.$...$.$...:.:.$.:.$...$.$...$.$...$.$...$.$...$.:...$....", ".$...$.$...$.$...:.$...$.$...:.$...:.$...:.$...$.:...$.:...$.$..$:.$...:.$.$.$.$...$.$...$.$...$.$...$.$...$.$...:.:.$.:.$...$.$...$.$...$.:$.$:.$...$.:..$:....", ".%$$$%.%$$$..%:::..%:::%.%$$$..%$$$..%:$$%.%$$$%..:::%..:::%.%$$:..%:::..%:::%.%:::%.%:::%.%$$$%.%$::%.%$$$..%$$$%..:%:..%:::%.%:::%.%:::%..:$:..%$$$%..:$:.....", ".$...$.$...$.$...:.$...$.$...:.$...:.$...$.$...$.:...$.:...$.$..$:.$...:.$...$.$...$.$...$.$...:.$.$.$.$...$.:...$.:.$.:.$...$.$...$.$.$.$.:$.$:.:...$.:$..:....", ".$...$.$...$.$...:.$...$.$...:.$...:.$...$.$...$.:...$.:...$.$...$.$...:.$...$.$...$.$...$.$...:.$..$$.$...$.:...$.:.$.:.$...$.$...$.$$.$$.$...$.:...$.$...:....", ".%:::%.%$$$..%$$$%.$$$$..%$$$%.$:::..%$$$%.%:::%..:::$.:$$$%.%:::%.%$$$:.%:::%.$:::$.%$$$%.%:::..%$$$%.%:::%.%$$$%..:%:..:$$$$..$$$..$:::$.%:::$.:$$$%.%$$$%....", "................................................................................................................................................................", " ", " +......................................................@ . ", " ..:::...:::...:::...:::...:::.......:::...:::...:::... ", " .:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:.. ", " .:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:.. ", " ..:::...:::...:::...:::...:::...:...:::...:::...:::... ", " .:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:.. ", " .:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:.. ", " ..:::...:::...:::...:::...:::...:...:::...:::...:::... ", " ...................................................... ", " ...................................................... ", " ", "................................................................................................................................................................", ".oXXXo.OXXX..OXXXO.OXXX..OXXXO.OXXXO.OXXXO.OoooO..oooO..oooO.OoooO.Oooo..XoooX.OXXX..OXXXO.OXXXO.OXXXO.OXXXO.OXXXO.OXXXO.OoooO.OoooO.OoooO.OoooO.OoooO.OXXXO....", ".X...X.X...X.X...o.X...X.X...o.X...o.X...o.X...X.o...X.o...X.X...X.X...o.XX.XX.X...X.X...X.X...X.X...X.X...X.X...o.o.X.o.X...X.X...X.X...X.X...X.X...X.o...X....", ".X...X.X...X.X...o.X...X.X...o.X...o.X...o.X...X.o...X.o...X.X..Xo.X...o.X.X.X.X...X.X...X.X...X.X...X.X...X.X...o.o.X.o.X...X.X...X.X...X.oX.Xo.X...X.o..Xo....", ".OXXXO.OXXX..Oooo..OoooO.OXXX..OXXX..OoXXO.OXXXO..oooO..oooO.OXXo..Oooo..OoooO.OoooO.OoooO.OXXXO.OXooO.OXXX..OXXXO..oOo..OoooO.OoooO.OoooO..oXo..OXXXO..oXo.....", ".X...X.X...X.X...o.X...X.X...o.X...o.X...X.X...X.o...X.o...X.X..Xo.X...o.X...X.X...X.X...X.X...o.X.X.X.X...X.o...X.o.X.o.X...X.X...X.X.X.X.oX.Xo.o...X.oX..o....", ".X...X.X...X.X...o.X...X.X...o.X...o.X...X.X...X.o...X.o...X.X...X.X...o.X...X.X...X.X...X.X...o.X..XX.X...X.o...X.o.X.o.X...X.X...X.XX.XX.X...X.o...X.X...o....", ".OoooO.OXXX..OXXXO.XXXX..OXXXO.Xooo..OXXXO.OoooO..oooX.OXXXO.OoooO.OXXXo.OoooO.XoooX.OXXXO.Oooo..OXXXO.OoooO.OXXXO..oOo..oXXXX..XXX..XoooX.OoooX.oXXXO.OXXXO....", "................................................................................................................................................................", " ", " ", " ", " ", " ", " "}; dockapps/wmbiff/wmbiff.1000066400000000000000000000105271242751507200155020ustar00rootroot00000000000000.\" Hey, Emacs! This is an -*- nroff -*- source file. .\" $Id: wmbiff.1,v 1.13 2003/02/08 21:04:48 bluehal Exp $ .\" .\" wmbiff.1 and wmbiffrc.5 are copyright 1999-2001 by .\" Jordi Mallach .\" .\" This is free documentation, see the latest version of the GNU .\" General Public License for copying conditions. There is NO warranty. .TH WMBIFF 1 "October 4, 2001" "wmbiff" .SH NAME WMBiff \- A dockable Mailbox Monitor .SH SYNOPSIS .B wmbiff [\-display ] [\-geometry +XPOS+YPOS] [\-c ] [\-h] [\-v] [\-debug] [\-fg ] [\-bg ] [\-hi ] [\-font |default] [\-o] [+w] .br .SH DESCRIPTION WMbiff displays the status of up to five mailboxes. It shows the number of new mail messages, if any, otherwise 0. In classic mode instead of 0 it shows the total number of messages. It also has mail retrieval capabilies, and can be configured to do this automatically. At the moment, UNIX-style, maildir, POP3, APOP and IMAP4 mailboxes are supported. The mailboxes are displayed in 5 different lines, each one with its own description of up to five chars. If no mail is present in a given mailbox, WMbiff will display the total number of mails in cyan. If there's new mail in the box, the number of new messages will be displayed in yellow. When new mail arrives, this number will optionally flash for a small period of time, and also optionally, a command can be executed on mail arrival (for example, opening your mail reader or playing a sound file). Pressing mouse button 1 will execute a command, defined in the user's config file. Mouse button 3 will execute a command to fetch mail, if defined. To restart wmbiff, press mouse button 1 while holding control and shift keys, or send it SIGUSR1. .PP .SH OPTIONS .TP .B \-h Show summary of options. .TP .B \-v Show version of program. .TP .B \-display Use an alternate X Display. .TP .B \-geometry Initial window position. .TP .B \-c Use specified configuration file instead of ~/.wmbiffrc. .TP .B \-debug Print verbose log of progress. .TP .B \-fg Use specified X11 color for foreground. Implies \-font default, unless overridden. .TP .B \-bg Use specified X11 color for background. Implies \-font default, unless overridden. .TP .B \-hi Use specified X11 color for new mail counters. Implies \-font default, unless overridden. .TP .B \-font Use specified X11 font instead of the LED pixmap. This may be more readable or suitable for some non-US characters. The special font "default" tells wmbiff to use a compile time default. .TP .B \-skip-certificate-check When using TLS (IMAPS), keep going, even if the server's certificate is invalid. Invalid certificates have expired, have a different hostname than you connected to, are corrupt, or have been revoked. Do not use this option unless wmbiff fails and suggests it to you, and even then, be careful and consider alerting your mail system administrator first. The need to use this option is a sign of server misconfiguration. .TP .B \-o Enable classical mode look and behaviour: shows the number of new mail messages, if any, or the total number of messages. This option also enables the special keyword "beep" (disabled by default). .TP .B \+w Do not use the "withdrawn" state: the wmbiff window will not be captured as an icon and placed in the dock, but will instead have its own window. This option starts with a '+' for consistency with other software programs: many use '\-w' to mean the opposite. .SH BUGS Send bug reports or suggestions to the Window Maker Development Mailing List . Consider attaching a transcript of your session, generated using: .RS wmbiff \-debug | tee wmbiff-log .RE Be sure to remove any instances of your password. .SH FILES .TP .I ~/.wmbiffrc peruser wmbiff configuration file. .SH AUTHOR This manual page was written by Jordi Mallach , originally for the Debian system (but may be used by others). .br WMBiff was first maintained by Gennady Belyakov. Since January 2001 it is maintained group of people that have added lots of new features to the original program. Please see the README document for a list of all the people involved. .SH SEE ALSO .PD 0 .TP \fBwmbiffrc\fP(5) .PP \fI/usr/share/doc/wmbiff/examples/sample.wmbiffrc\fP (or equivalent for your system) dockapps/wmbiff/wmbiff.c000066400000000000000000001160701242751507200155640ustar00rootroot00000000000000/* $Id: wmbiff.c,v 1.70 2005/10/07 03:07:58 bluehal Exp $ */ // typedef int gcry_error_t; #ifdef HAVE_CONFIG_H #include #endif #include #include #ifdef HAVE_POLL #include #else #include #endif #include #include #include #include #include #include #include #include #include #include #include "../wmgeneral/wmgeneral.h" #include "../wmgeneral/misc.h" #include "Client.h" #include "charutil.h" #include "MessageList.h" #ifdef USE_DMALLOC #include #endif #include "wmbiff-master-led.xpm" #include "wmbiff-classic-master-led.xpm" static char wmbiff_mask_bits[64 * 64]; static const int wmbiff_mask_width = 64; // const int wmbiff_mask_height = 64; #define CHAR_WIDTH 5 #define CHAR_HEIGHT 7 #define BLINK_TIMES 8 #define DEFAULT_SLEEP_INTERVAL 20000 #define BLINK_SLEEP_INTERVAL 200 #define DEFAULT_LOOP 5 #define MAX_NUM_MAILBOXES 40 static mbox_t mbox[MAX_NUM_MAILBOXES]; /* this is the normal pixmap. */ static const char *skin_filename = "wmbiff-master-led.xpm"; static const char *classic_skin_filename = "wmbiff-classic-master-led.xpm"; /* global notify action taken (if globalnotify option is set) */ static const char *globalnotify = NULL; /* path to search for pixmaps */ /* /usr/share/wmbiff should have the default pixmap. */ /* /usr/local/share/wmbiff if compiled locally. */ /* / is there in case a user wants to specify a complete path */ /* . is there for development. */ static const char *skin_search_path = DEFAULT_SKIN_PATH; /* for gnutls */ const char *certificate_filename = NULL; /* gnutls: specify the priorities to use on the ciphers, key exchange methods, macs and compression methods. */ const char *tls = NULL; /* it could be argued that a better default exists. */ #define DEFAULT_FONT "-*-fixed-*-r-*-*-10-*-*-*-*-*-*-*" static const char *font = NULL; int debug_default = DEBUG_ERROR; /* color from wmbiff's xpm, down to 24 bits. */ const char *foreground = "white"; /* foreground white */ const char *background = "#505075"; /* background blue */ static const char *highlight = "red"; const char *foreground_classic = "#21B3AF"; /* classic foreground cyan */ const char *background_classic = "#202020"; /* classic background gray */ static const char *highlight_classic = "yellow"; /* classic highlight color */ int SkipCertificateCheck = 0; int Relax = 0; /* be not paranoid */ static int notWithdrawn = 0; static unsigned int num_mailboxes = 1; static const int x_origin = 5; static const int y_origin = 5; static int forever = 1; /* keep running. */ unsigned int custom_skin = 0; /* user has choose a custom skin */ static int classic_mode = 0; /* use classic behaviour/theme of wmbiff */ extern Window win; extern Window iconwin; Cursor busy_cursor, ready_cursor; static __inline /*@out@ */ void * malloc_ordie(size_t len) { void *ret = malloc(len); if (ret == NULL) { fprintf(stderr, "unable to allocate %d bytes\n", (int) len); abort(); } return (ret); } /* where vertically the mailbox sits for blitting characters. */ static int mbox_y(unsigned int mboxnum) { return ((11 * mboxnum) + y_origin); } /* Read a line from a file to obtain a pair setting=value skips # and leading spaces NOTE: if setting finish with 0, 1, 2, 3 or 4 last char are deleted and index takes its value... if not index will get -1 Returns -1 if no setting=value */ static int ReadLine(FILE * fp, /*@out@ */ char *setting, /*@out@ */ char *value, /*@out@ */ int *mbox_index) { char buf[BUF_SIZE]; char *p, *q; int len; *setting = '\0'; *value = '\0'; *mbox_index = -1; if (!fp || feof(fp)) return -1; if (!fgets(buf, BUF_SIZE - 1, fp)) return -1; len = strlen(buf); if (buf[len - 1] == '\n') { buf[len - 1] = '\0'; /* strip linefeed */ } StripComment(buf); if (!(p = strtok(buf, "="))) return -1; if (!(q = strtok(NULL, "\n"))) return -1; /* Chg - Mark Hurley * Date: May 8, 2001 * Removed for loop (which removed leading spaces) * Leading & Trailing spaces need to be removed * to Fix Debian bug #95849 */ FullTrim(p); FullTrim(q); /* strcpy(setting, p); nspring replaced with sscanf dec 2002 */ strcpy(value, q); if (sscanf(p, "%[_a-z.]%d", setting, mbox_index) == 2) { /* mailbox-specific configuration, ends in a digit */ if (*mbox_index < 0 || *mbox_index >= MAX_NUM_MAILBOXES) { DMA(DEBUG_ERROR, "invalid mailbox number %d\n", *mbox_index); exit(EXIT_FAILURE); } } else if (sscanf(p, "%[a-z]", setting) == 1) { /* global configuration, all text. */ *mbox_index = -1; } else { /* we found an uncommented line that has an equals, but is non-alphabetic. */ DMA(DEBUG_INFO, "unparsed setting %s\n", p); return -1; } DMA(DEBUG_INFO, "@%s.%d=%s@\n", setting, *mbox_index, value); return 1; } struct path_demultiplexer { const char *id; /* followed by a colon */ int (*creator) ( /*@notnull@ */ Pop3 pc, const char *path); }; static struct path_demultiplexer paths[] = { {"pop3:", pop3Create}, {"pop3s:", pop3Create}, {"shell:", shellCreate}, {"imap:", imap4Create}, {"imaps:", imap4Create}, {"sslimap:", imap4Create}, {"maildir:", maildirCreate}, {"mbox:", mboxCreate}, {NULL, NULL} }; static void parse_mbox_path(unsigned int item) { int i; /* find the creator */ for (i = 0; paths[i].id != NULL && strncasecmp(mbox[item].path, paths[i].id, strlen(paths[i].id)); i++); /* if found, execute */ if (paths[i].id != NULL) { if (paths[i].creator((&mbox[item]), mbox[item].path) != 0) { DMA(DEBUG_ERROR, "creator for mailbox %u returned failure\n", item); } } else { /* default are mbox */ mboxCreate((&mbox[item]), mbox[item].path); } } static int Read_Config_File(char *filename, int *loopinterval) { FILE *fp; char setting[BUF_SMALL], value[BUF_SIZE]; int mbox_index; unsigned int i; char *skin = NULL; if (classic_mode) { skin = strdup_ordie(skin_filename); } if (!(fp = fopen(filename, "r"))) { DMA(DEBUG_ERROR, "Unable to open %s, no settings read: %s\n", filename, strerror(errno)); return 0; } while (!feof(fp)) { /* skanky: -1 can represent an unparsed line or an error */ if (ReadLine(fp, setting, value, &mbox_index) == -1) continue; /* settings that can be global go here. */ if (!strcmp(setting, "interval")) { *loopinterval = atoi(value); continue; } else if (!strcmp(setting, "askpass")) { const char *askpass = strdup_ordie(value); if (mbox_index == -1) { DMA(DEBUG_INFO, "setting all to askpass %s\n", askpass); for (i = 0; i < MAX_NUM_MAILBOXES; i++) mbox[i].askpass = askpass; } else { mbox[mbox_index].askpass = askpass; } continue; } else if (!strcmp(setting, "skinfile")) { skin_filename = strdup_ordie(value); custom_skin = 1; continue; } else if (!strcmp(setting, "certfile")) { /* not yet supported */ certificate_filename = strdup_ordie(value); continue; } else if (!strcmp(setting, "globalnotify")) { globalnotify = strdup_ordie(value); continue; } else if (!strcmp(setting, "tls")) { tls = strdup_ordie(value); continue; } else if (mbox_index == -1) { DMA(DEBUG_INFO, "Unknown global setting '%s'\n", setting); continue; /* Didn't read any setting.[0-5] value */ } if (mbox_index >= MAX_NUM_MAILBOXES) { DMA(DEBUG_ERROR, "Don't have %d mailboxes.\n", mbox_index); continue; } if (1U + mbox_index > num_mailboxes && mbox_index + 1 <= MAX_NUM_MAILBOXES) { num_mailboxes = 1U + mbox_index; } /* now only local settings */ if (!strcmp(setting, "label.")) { if (strlen(value) + 1 > BUF_SMALL) { DMA(DEBUG_ERROR, "Mailbox %i label string '%s' is too long.\n", mbox_index, value); continue; } else { strncpy(mbox[mbox_index].label, value, BUF_SMALL - 1); } } else if (!strcmp(setting, "path.")) { if (strlen(value) + 1 > BUF_BIG) { DMA(DEBUG_ERROR, "Mailbox %i path string '%s' is too long.\n", mbox_index, value); continue; } else { strncpy(mbox[mbox_index].path, value, BUF_BIG - 1); } } else if (!strcmp(setting, "notify.")) { if (strlen(value) + 1 > BUF_BIG) { DMA(DEBUG_ERROR, "Mailbox %i notify string '%s' is too long.\n", mbox_index, value); continue; } else { strncpy(mbox[mbox_index].notify, value, BUF_BIG - 1); } } else if (!strcmp(setting, "action.")) { if (strlen(value) + 1 > BUF_BIG) { DMA(DEBUG_ERROR, "Mailbox %i action string '%s' is too long.\n", mbox_index, value); continue; } else { strncpy(mbox[mbox_index].action, value, BUF_BIG - 1); } } else if (!strcmp(setting, "action_disconnected.")) { if (strlen(value) + 1 > BUF_BIG) { DMA(DEBUG_ERROR, "Mailbox %i action_disconnected string '%s' is too long.\n", mbox_index, value); continue; } else { strncpy(mbox[mbox_index].actiondc, value, BUF_BIG - 1); } } else if (!strcmp(setting, "action_new_mail.")) { if (strlen(value) + 1 > BUF_BIG) { DMA(DEBUG_ERROR, "Mailbox %i action_new_mail string '%s' is too long.\n", mbox_index, value); continue; } else { strncpy(mbox[mbox_index].actionnew, value, BUF_BIG - 1); } } else if (!strcmp(setting, "action_no_new_mail.")) { if (strlen(value) + 1 > BUF_BIG) { DMA(DEBUG_ERROR, "Mailbox %i action_no_new_mail string '%s' is too long.\n", mbox_index, value); continue; } else { strncpy(mbox[mbox_index].actionnonew, value, BUF_BIG - 1); } } else if (!strcmp(setting, "interval.")) { mbox[mbox_index].loopinterval = atoi(value); } else if (!strcmp(setting, "buttontwo.")) { if (strlen(value) + 1 > BUF_BIG) { DMA(DEBUG_ERROR, "Mailbox %i buttontwo string '%s' is too long.\n", mbox_index, value); continue; } else { strncpy(mbox[mbox_index].button2, value, BUF_BIG - 1); } } else if (!strcmp(setting, "fetchcmd.")) { if (strlen(value) + 1 > BUF_BIG) { DMA(DEBUG_ERROR, "Mailbox %i fetchcmd string '%s' is too long.\n", mbox_index, value); continue; } else { strncpy(mbox[mbox_index].fetchcmd, value, BUF_BIG - 1); } } else if (!strcmp(setting, "fetchinterval.")) { mbox[mbox_index].fetchinterval = atoi(value); } else if (!strcmp(setting, "debug.")) { int debug_value = debug_default; if (strcasecmp(value, "all") == 0) { debug_value = DEBUG_ALL; } /* could disable debugging, but I want the command line argument to provide all information possible. */ mbox[mbox_index].debug = debug_value; } else { DMA(DEBUG_INFO, "Unknown setting '%s'\n", setting); } } (void) fclose(fp); if (!tls) // use GnuTLS's default ciphers. tls = "NORMAL"; if (classic_mode && skin && !strcmp(skin, skin_filename)) skin_filename = classic_skin_filename; if (skin) free(skin); for (i = 0; i < num_mailboxes; i++) if (mbox[i].label[0] != '\0') parse_mbox_path(i); return 1; } static void init_biff(char *config_file) { #ifdef HAVE_GCRYPT_H gcry_error_t rc; #endif int loopinterval = DEFAULT_LOOP; unsigned int i; for (i = 0; i < MAX_NUM_MAILBOXES; i++) { memset(mbox[i].label, 0, BUF_SMALL); memset(mbox[i].path, 0, BUF_BIG); memset(mbox[i].notify, 0, BUF_BIG); memset(mbox[i].action, 0, BUF_BIG); memset(mbox[i].actiondc, 0, BUF_BIG); memset(mbox[i].actionnew, 0, BUF_BIG); memset(mbox[i].actionnonew, 0, BUF_BIG); memset(mbox[i].button2, 0, BUF_BIG); memset(mbox[i].fetchcmd, 0, BUF_BIG); mbox[i].loopinterval = 0; mbox[i].getHeaders = NULL; mbox[i].releaseHeaders = NULL; mbox[i].debug = debug_default; mbox[i].askpass = DEFAULT_ASKPASS; } #ifdef HAVE_GCRYPT_H /* gcrypt is a little strange, in that it doesn't * seem to initialize its memory pool by itself. * I believe we *expect* "Warning: using insecure memory!" */ /* gcryctl_disable_secmem gets called before check_version -- in a message on gcrypt-devel august 17 2004. */ if ((rc = gcry_control(GCRYCTL_DISABLE_SECMEM, 0)) != 0) { DMA(DEBUG_ERROR, "Error: tried to disable gcrypt warning and failed: %d\n" " Message: %s\n" " libgcrypt version: %s\n", rc, gcry_strerror(rc), gcry_check_version(NULL)); } /* recently made a requirement, section 2.4 of gcrypt manual */ if (gcry_check_version("1.1.42") == NULL) { DMA(DEBUG_ERROR, "Error: incompatible gcrypt version.\n"); } #endif DMA(DEBUG_INFO, "config_file = %s.\n", config_file); if (!Read_Config_File(config_file, &loopinterval)) { char *m; /* setup defaults if there's no config */ if ((m = getenv("MAIL")) != NULL) { /* we are using MAIL environment var. type mbox */ if (strlen(m) + 1 > BUF_BIG) { DMA(DEBUG_ERROR, "MAIL environment var '%s' is too long.\n", m); } else { DMA(DEBUG_INFO, "Using MAIL environment var '%s'.\n", m); strncpy(mbox[0].path, m, BUF_BIG - 1); } } else if ((m = getenv("USER")) != NULL) { /* we will use the USER env var to find an mbox name */ if (strlen(m) + 10 + 1 > BUF_BIG) { DMA(DEBUG_ERROR, "USER environment var '%s' is too long.\n", m); } else { DMA(DEBUG_INFO, "Using /var/mail/%s.\n", m); strcpy(mbox[0].path, "/var/mail/"); strncat(mbox[0].path, m, BUF_BIG - 1 - 10); if (mbox[0].path[9] != '/') { DMA(DEBUG_ERROR, "Unexpected failure to construct /var/mail/username, please " "report this with your operating system info and the version of wmbiff."); } } } else { DMA(DEBUG_ERROR, "Cannot open config file '%s' nor use the " "MAIL environment var.\n", config_file); exit(EXIT_FAILURE); } if (!exists(mbox[0].path)) { DMA(DEBUG_ERROR, "Cannot open config file '%s', and the " "default %s doesn't exist.\n", config_file, mbox[0].path); exit(EXIT_FAILURE); } strcpy(mbox[0].label, "Spool"); mboxCreate((&mbox[0]), mbox[0].path); } /* Make labels look right */ for (i = 0; i < num_mailboxes; i++) { if (mbox[i].label[0] != '\0') { /* append a colon, but skip if we're using fonts. */ if (font == NULL) { int j = strlen(mbox[i].label); if (j < 5) { memset(mbox[i].label + j, ' ', 5 - j); } } /* but always end after 5 characters */ mbox[i].label[6] = '\0'; /* set global loopinterval to boxes with 0 loop */ if (!mbox[i].loopinterval) { mbox[i].loopinterval = loopinterval; } } } } static char **LoadXPM(const char *pixmap_filename) { char **xpm; int success; success = XpmReadFileToData((char *) pixmap_filename, &xpm); switch (success) { case XpmOpenFailed: DMA(DEBUG_ERROR, "Unable to open %s\n", pixmap_filename); break; case XpmFileInvalid: DMA(DEBUG_ERROR, "%s is not a valid pixmap\n", pixmap_filename); break; case XpmNoMemory: DMA(DEBUG_ERROR, "Insufficient memory to read %s\n", pixmap_filename); break; default: break; } return (xpm); } /* tests as "test -f" would */ int exists(const char *filename) { struct stat st_buf; DMA(DEBUG_INFO, "looking for %s\n", filename); if (stat(filename, &st_buf) == 0 && S_ISREG(st_buf.st_mode)) { DMA(DEBUG_INFO, "found %s\n", filename); return (1); } return (0); } /* acts like execvp, with code inspired by it */ /* mustfree */ static char *search_path(const char *path, const char *find_me) { char *buf; const char *p; int len, pathlen; if (strchr(find_me, '/') != NULL) { return (strdup_ordie(find_me)); } pathlen = strlen(path); len = strlen(find_me) + 1; buf = malloc_ordie(pathlen + len + 1); memcpy(buf + pathlen + 1, find_me, len); buf[pathlen] = '/'; for (p = path; p != NULL; path = p, path++) { char *startp; p = strchr(path, ':'); if (p == NULL) { /* not found; p should point to the null char at the end */ startp = memcpy(buf + pathlen - strlen(path), path, strlen(path)); } else if (p == path) { /* double colon in a path apparently means try here */ startp = &buf[pathlen + 1]; } else { /* copy the part between the colons to the buffer */ startp = memcpy(buf + pathlen - (p - path), path, p - path); } if (exists(startp) != 0) { char *ret = strdup_ordie(startp); free(buf); return (ret); } } free(buf); return (NULL); } /* verifies that .wmbiffrc, is a file, is owned by the user, is not world writeable, and is not world readable. This is just to help keep passwords secure */ static int wmbiffrc_permissions_check(const char *wmbiffrc_fname) { struct stat st; if (stat(wmbiffrc_fname, &st) != 0) { DMA(DEBUG_ERROR, "Can't stat wmbiffrc: '%s'\n", wmbiffrc_fname); return (1); /* well, it's not a bad permission problem: if you can't find it, neither can the bad guys.. */ } if ((st.st_mode & S_IFDIR) != 0) { DMA(DEBUG_ERROR, ".wmbiffrc '%s' is a directory!\n" "exiting. don't do that.", wmbiffrc_fname); exit(EXIT_FAILURE); } if (st.st_uid != getuid()) { char *user = getenv("USER"); DMA(DEBUG_ERROR, ".wmbiffrc '%s' isn't owned by you.\n" "Verify its contents, then 'chown %s %s'\n", wmbiffrc_fname, ((user != NULL) ? user : "(your username)"), wmbiffrc_fname); return (0); } if ((st.st_mode & S_IWOTH) != 0) { DMA(DEBUG_ERROR, ".wmbiffrc '%s' is world writable.\n" "Verify its contents, then 'chmod 0600 %s'\n", wmbiffrc_fname, wmbiffrc_fname); return (0); } if ((st.st_mode & S_IROTH) != 0) { DMA(DEBUG_ERROR, ".wmbiffrc '%s' is world readable.\n" "Please run 'chmod 0600 %s' and consider changing your passwords.\n", wmbiffrc_fname, wmbiffrc_fname); return (0); } return (1); } static void ClearDigits(unsigned int i) { if (font) { eraseRect(39, mbox_y(i), 58, mbox_y(i + 1) - 1, background); } else { /* overwrite the colon */ copyXPMArea((10 * (CHAR_WIDTH + 1)), 64, (CHAR_WIDTH + 1), (CHAR_HEIGHT + 1), 35, mbox_y(i)); /* blank out the number fields. */ copyXPMArea(39, 84, (3 * (CHAR_WIDTH + 1)), (CHAR_HEIGHT + 1), 39, mbox_y(i)); } } /* Blits a string at given co-ordinates. If a ``new'' parameter is nonzero, all digits will be yellow */ static void BlitString(const char *name, int x, int y, int new) { if (font != NULL) { /* an alternate behavior - draw the string using a font instead of the pixmap. should allow pretty colors */ drawString(x, y + CHAR_HEIGHT + 1, name, new ? highlight : foreground, background, 0); } else { /* normal, LED-like behavior. */ int i, c, k = x; for (i = 0; name[i] != '\0'; i++) { c = toupper(name[i]); if (c >= 'A' && c <= 'Z') { /* it's a letter */ c -= 'A'; copyXPMArea(c * (CHAR_WIDTH + 1), (new ? 95 : 74), (CHAR_WIDTH + 1), (CHAR_HEIGHT + 1), k, y); k += (CHAR_WIDTH + 1); } else { /* it's a number or symbol */ c -= '0'; if (new) { copyXPMArea((c * (CHAR_WIDTH + 1)) + 65, 0, (CHAR_WIDTH + 1), (CHAR_HEIGHT + 1), k, y); } else { copyXPMArea((c * (CHAR_WIDTH + 1)), 64, (CHAR_WIDTH + 1), (CHAR_HEIGHT + 1), k, y); } k += (CHAR_WIDTH + 1); } } } } /* Blits number to give coordinates.. two 0's, right justified */ static void BlitNum(int num, int x, int y, int new) { char buf[32]; sprintf(buf, "%02i", num); if (font != NULL) { const char *color = (new) ? highlight : foreground; drawString(x + (CHAR_WIDTH * 2 + 4), y + CHAR_HEIGHT + 1, buf, color, background, 1); } else { int newx = x; if (num > 99) newx -= (CHAR_WIDTH + 1); if (num > 999) newx -= (CHAR_WIDTH + 1); BlitString(buf, newx, y, new); } } /* helper function for displayMsgCounters, which has outgrown its name */ static void blitMsgCounters(unsigned int i) { int y_row = mbox_y(i); /* constant for each mailbox */ ClearDigits(i); /* Clear digits */ if ((mbox[i].blink_stat & 0x01) == 0) { int newmail = (mbox[i].UnreadMsgs > 0) ? 1 : 0; if (mbox[i].TextStatus[0] != '\0') { BlitString(mbox[i].TextStatus, 39, y_row, newmail); } else { int mailcount = (newmail) ? mbox[i].UnreadMsgs : ( classic_mode ? mbox[i].TotalMsgs : 0 ); BlitNum(mailcount, 45, y_row, newmail); } } } /* * void execnotify(1) : runs notify command, if given (not null) */ static void execnotify( /*@null@ */ const char *notifycmd) { if (notifycmd != NULL) { /* need to call notify() ? */ if (classic_mode && !strcasecmp(notifycmd, "beep")) XBell(display, 100); else if (!strcasecmp(notifycmd, "true")) { /* Yes, nothing */ } else { /* Else call external notifyer, ignoring the pid */ (void) execCommand(notifycmd); } } } static void displayMsgCounters(unsigned int i, int mail_stat, int *Blink_Mode) { switch (mail_stat) { case 2: /* New mail has arrived */ /* Enter blink-mode for digits */ mbox[i].blink_stat = BLINK_TIMES * 2; *Blink_Mode |= (1 << i); /* Global blink flag set for this mailbox */ blitMsgCounters(i); execnotify(mbox[i].notify); break; case 1: /* mailbox has been rescanned/changed */ blitMsgCounters(i); break; case 0: break; case -1: /* Error was detected */ ClearDigits(i); /* Clear digits */ BlitString("XX", 45, mbox_y(i), 0); break; } } /** counts mail in spool-file Returned value: -1 : Error was encountered 0 : mailbox status wasn't changed 1 : mailbox was changed (NO new mail) 2 : mailbox was changed AND new mail has arrived **/ static int count_mail(unsigned int item) { int rc = 0; if (!mbox[item].checkMail) { return -1; } if (mbox[item].checkMail(&(mbox[item])) < 0) { /* we failed to obtain any numbers therefore set * them to -1's ensuring the next pass (even if * zero) will be captured correctly */ mbox[item].TotalMsgs = -1; mbox[item].UnreadMsgs = -1; mbox[item].OldMsgs = -1; mbox[item].OldUnreadMsgs = -1; return -1; } if (mbox[item].UnreadMsgs > mbox[item].OldUnreadMsgs && mbox[item].UnreadMsgs > 0) { rc = 2; /* New mail detected */ } else if (mbox[item].UnreadMsgs < mbox[item].OldUnreadMsgs || mbox[item].TotalMsgs != mbox[item].OldMsgs) { rc = 1; /* mailbox was changed - NO new mail */ } else { rc = 0; /* mailbox wasn't changed */ } mbox[item].OldMsgs = mbox[item].TotalMsgs; mbox[item].OldUnreadMsgs = mbox[item].UnreadMsgs; return rc; } static int periodic_mail_check(void) { int NeedRedraw = 0; static int Blink_Mode = 0; /* Bit mask, digits are in blinking mode or not. Each bit for separate mailbox */ int Sleep_Interval; /* either DEFAULT_SLEEP_INTERVAL or BLINK_SLEEP_INTERVAL */ int NewMail = 0; /* flag for global notify */ unsigned int i; time_t curtime = time(0); for (i = 0; i < num_mailboxes; i++) { if (mbox[i].label[0] != '\0') { if (curtime >= mbox[i].prevtime + mbox[i].loopinterval) { int mailstat = 0; NeedRedraw = 1; DM(&mbox[i], DEBUG_INFO, "working on [%u].label=>%s< [%u].path=>%s<\n", i, mbox[i].label, i, mbox[i].path); DM(&mbox[i], DEBUG_INFO, "curtime=%d, prevtime=%d, interval=%d\n", (int) curtime, (int) mbox[i].prevtime, mbox[i].loopinterval); mbox[i].prevtime = curtime; XDefineCursor(display, iconwin, busy_cursor); RedrawWindow(); mailstat = count_mail(i); XUndefineCursor(display, iconwin); /* Global notify */ if (mailstat == 2) NewMail = 1; displayMsgCounters(i, mailstat, &Blink_Mode); /* update our idea of current time, as it may have changed as we check. */ curtime = time(0); } if (mbox[i].blink_stat > 0) { if (--mbox[i].blink_stat <= 0) { Blink_Mode &= ~(1 << i); mbox[i].blink_stat = 0; } displayMsgCounters(i, 1, &Blink_Mode); NeedRedraw = 1; } if (mbox[i].fetchinterval > 0 && mbox[i].fetchcmd[0] != '\0' && curtime >= mbox[i].prevfetch_time + mbox[i].fetchinterval) { XDefineCursor(display, iconwin, busy_cursor); RedrawWindow(); (void) execCommand(mbox[i].fetchcmd); XUndefineCursor(display, iconwin); mbox[i].prevfetch_time = curtime; } } } /* exec globalnotify if there was any new mail */ if (NewMail == 1) execnotify(globalnotify); if (Blink_Mode == 0) { for (i = 0; i < num_mailboxes; i++) { mbox[i].blink_stat = 0; } Sleep_Interval = DEFAULT_SLEEP_INTERVAL; } else { Sleep_Interval = BLINK_SLEEP_INTERVAL; } if (NeedRedraw) { NeedRedraw = 0; RedrawWindow(); } return Sleep_Interval; } static int findTopOfMasterXPM(const char **skin_xpm) { int i; for (i = 0; skin_xpm[i] != NULL; i++) { if (strstr(skin_xpm[i], "++++++++") != NULL) return i; } DMA(DEBUG_ERROR, "couldn't find the top of the xpm file using the simple method\n"); exit(EXIT_FAILURE); } static char **CreateBackingXPM(int width, int height, const char **skin_xpm) { char **ret = malloc_ordie(sizeof(char *) * (height + 6) + sizeof(void *) /* trailing null space */ ); const int colors = 5; const int base = colors + 1; const int margin = 4; int i; int top = findTopOfMasterXPM(skin_xpm); ret[0] = malloc_ordie(30); sprintf(ret[0], "%d %d %d %d", width, height, colors, 1); ret[1] = (char *) " \tc #0000FF"; /* no color */ ret[2] = (char *) ".\tc #505075"; /* background gray */ ret[2] = malloc_ordie(30); sprintf(ret[2], ".\tc %s", background); ret[3] = (char *) "+\tc #000000"; /* shadowed */ ret[4] = (char *) "@\tc #C7C3C7"; /* highlight */ ret[5] = (char *) ":\tc #004941"; /* led off */ for (i = base; i < base + height; i++) { ret[i] = malloc_ordie(width); } for (i = base; i < base + margin; i++) { memset(ret[i], ' ', width); } for (i = base + margin; i < height + base - margin; i++) { memset(ret[i], ' ', margin); if (i == base + margin) { memset(ret[i] + margin, '+', width - margin - margin); } else if (i == base + height - margin - 1) { memset(ret[i] + margin, '@', width - margin - margin); } else { // " +..:::...:::...:::...:::...:::.......:::...:::...:::...@ " // " +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ " ", ret[i][margin] = '+'; memset(ret[i] + margin + 1, '.', width - margin - margin - 1); ret[i][width - margin - 1] = '@'; memcpy(ret[i], skin_xpm[((i - (base + margin) - 1) % 11) + top + 1], width); } memset(ret[i] + width - margin, ' ', margin); } for (i = base + height - margin; i < height + base; i++) { memset(ret[i], ' ', width); } ret[height + base] = NULL; /* not sure if this is necessary, it just seemed like a good idea */ return (ret); } /* * NOTE: this function assumes that the ConnectionNumber() macro * will return the file descriptor of the Display struct * (it does under XFree86 and solaris' openwin X) */ static void XSleep(int millisec) { #ifdef HAVE_POLL struct pollfd timeout; timeout.fd = ConnectionNumber(display); timeout.events = POLLIN; poll(&timeout, 1, millisec); #else struct timeval to; struct timeval *timeout = NULL; fd_set readfds; int max_fd; if (millisec >= 0) { timeout = &to; to.tv_sec = millisec / 1000; to.tv_usec = (millisec % 1000) * 1000; } FD_ZERO(&readfds); FD_SET(ConnectionNumber(display), &readfds); max_fd = ConnectionNumber(display); select(max_fd + 1, &readfds, NULL, NULL, timeout); #endif } const char **restart_args; static void restart_wmbiff(int sig #ifdef HAVE___ATTRIBUTE__ __attribute__ ((unused)) #endif ) { if (restart_args) { DMA(DEBUG_ERROR, "exec()'ing %s\n", restart_args[0]); sleep(1); execvp(restart_args[0], (char *const *) restart_args); DMA(DEBUG_ERROR, "exec of %s failed: %s\n", restart_args[0], strerror(errno)); exit(EXIT_FAILURE); } else fprintf(stderr, "Unable to restart wmbiff: missing restart arguments (NULL)!\n"); } extern int x_socket(void) { return ConnectionNumber(display); } extern void ProcessPendingEvents(void) { static int but_pressed_region = -1; /* static so click can be determined */ int but_released_region = -1; /* X Events */ while (XPending(display)) { XEvent Event; const char *press_action; XNextEvent(display, &Event); switch (Event.type) { case Expose: if (Event.xany.window != win && Event.xany.window != iconwin) { msglst_redraw(); } else { RedrawWindow(); } break; case DestroyNotify: XCloseDisplay(display); exit(EXIT_SUCCESS); break; case ButtonPress: but_pressed_region = CheckMouseRegion(Event.xbutton.x, Event.xbutton.y); switch (Event.xbutton.button) { case 1: press_action = mbox[but_pressed_region].action; break; case 2: press_action = mbox[but_pressed_region].button2; break; case 3: press_action = mbox[but_pressed_region].fetchcmd; break; default: press_action = NULL; break; } if (press_action && strcmp(press_action, "msglst") == 0) { msglst_show(&mbox[but_pressed_region], Event.xbutton.x_root, Event.xbutton.y_root); } break; case ButtonRelease: but_released_region = CheckMouseRegion(Event.xbutton.x, Event.xbutton.y); if (but_released_region == but_pressed_region && but_released_region >= 0) { const char *click_action, *extra_click_action = NULL; switch (Event.xbutton.button) { case 1: /* Left mouse-click */ /* C-S-left will restart wmbiff. */ if ((Event.xbutton.state & ControlMask) && (Event.xbutton.state & ShiftMask)) { restart_wmbiff(0); } /* do we need to run an extra action? */ if (mbox[but_released_region].UnreadMsgs == -1) { extra_click_action = mbox[but_released_region].actiondc; } else if (mbox[but_released_region].UnreadMsgs > 0) { extra_click_action = mbox[but_released_region].actionnew; } else { extra_click_action = mbox[but_released_region].actionnonew; } click_action = mbox[but_released_region].action; break; case 2: /* Middle mouse-click */ click_action = mbox[but_released_region].button2; break; case 3: /* Right mouse-click */ click_action = mbox[but_released_region].fetchcmd; break; default: click_action = NULL; break; } if (extra_click_action != NULL && extra_click_action[0] != 0 && strcmp(extra_click_action, "msglst")) { DM(&mbox[but_released_region], DEBUG_INFO, "runing: %s", extra_click_action); (void) execCommand(extra_click_action); } if (click_action != NULL && click_action[0] != '\0' && strcmp(click_action, "msglst")) { DM(&mbox[but_released_region], DEBUG_INFO, "running: %s", click_action); (void) execCommand(click_action); } } /* a button was released, hide the message list if open */ msglst_hide(); but_pressed_region = -1; /* RedrawWindow(); */ break; case MotionNotify: break; case KeyPress:{ XKeyPressedEvent *xkpe = (XKeyPressedEvent *) & Event; KeySym ks = XkbKeycodeToKeysym(display, xkpe->keycode, 0, 0); if (ks > XK_0 && ks < XK_0 + min(9U, num_mailboxes)) { const char *click_action = mbox[ks - XK_1].action; if (click_action != NULL && click_action[0] != '\0' && strcmp(click_action, "msglst")) { DM(&mbox[but_released_region], DEBUG_INFO, "running: %s", click_action); (void) execCommand(click_action); } } } break; default: break; } } } static void do_biff(int argc, const char **argv) { unsigned int i; int Sleep_Interval; const char **skin_xpm = NULL; const char **bkg_xpm = NULL; char *skin_file_path = search_path(skin_search_path, skin_filename); int wmbiff_mask_height = mbox_y(num_mailboxes) + 4; DMA(DEBUG_INFO, "running %u mailboxes w %d h %d\n", num_mailboxes, wmbiff_mask_width, wmbiff_mask_height); if (skin_file_path != NULL) { skin_xpm = (const char **) LoadXPM(skin_file_path); free(skin_file_path); } if (skin_xpm == NULL) { DMA(DEBUG_ERROR, "using built-in xpm; %s wasn't found in %s\n", skin_filename, skin_search_path); skin_xpm = (classic_mode ? wmbiff_classic_master_xpm : wmbiff_master_xpm); } bkg_xpm = (const char **) CreateBackingXPM(wmbiff_mask_width, wmbiff_mask_height, skin_xpm); createXBMfromXPM(wmbiff_mask_bits, (const char**)bkg_xpm, wmbiff_mask_width, wmbiff_mask_height); openXwindow(argc, argv, (const char**)bkg_xpm, skin_xpm, wmbiff_mask_bits, wmbiff_mask_width, wmbiff_mask_height, notWithdrawn); /* now that display is set, we can create the cursors (mouse pointer shapes) */ busy_cursor = XCreateFontCursor(display, XC_watch); ready_cursor = XCreateFontCursor(display, XC_left_ptr); if (font != NULL) { if (loadFont(font) < 0) { DMA(DEBUG_ERROR, "unable to load font. exiting.\n"); exit(EXIT_FAILURE); } } /* First time setup of button regions and labels */ for (i = 0; i < num_mailboxes; i++) { /* make it easy to recover the mbox index from a mouse click */ AddMouseRegion(i, x_origin, mbox_y(i), 58, mbox_y(i + 1) - 1); if (mbox[i].label[0] != '\0') { mbox[i].prevtime = mbox[i].prevfetch_time = 0; BlitString(mbox[i].label, x_origin, mbox_y(i), 0); } } do { Sleep_Interval = periodic_mail_check(); ProcessPendingEvents(); XSleep(Sleep_Interval); } while (forever); /* forever is usually true, but not when debugging with -exit */ if (skin_xpm != NULL && skin_xpm != wmbiff_master_xpm && skin_xpm != wmbiff_classic_master_xpm) { free(skin_xpm); // added 3 jul 02, appeasing valgrind } if (bkg_xpm != NULL) { // Allocated in CreateBackingXPM() free((void *)bkg_xpm[0]); free((void *)bkg_xpm[2]); int mem_block; for (mem_block = 6; mem_block < 6 + wmbiff_mask_height; mem_block++) free((void *)bkg_xpm[mem_block]); free(bkg_xpm); } } static void sigchld_handler(int sig #ifdef HAVE___ATTRIBUTE__ __attribute__ ((unused)) #endif ) { while (waitpid(0, NULL, WNOHANG) > 0); signal(SIGCHLD, sigchld_handler); } static void usage(void) { printf("\nwmBiff v%s" " - incoming mail checker\n" "Gennady Belyakov and others (see the README file)\n" "Please report bugs to %s\n" "\n" "usage:\n" " -bg background color\n" " -c use specified config file\n" " -debug enable debugging\n" " -display use specified X display\n" " -fg foreground color\n" " -font font instead of LED\n" " -geometry +XPOS+YPOS initial window position\n" " -h this help screen\n" " -hi highlight color for new mail\n" #ifdef USE_GNUTLS " -skip-certificate-check using TLS, don't validate the\n" " server's certificate\n" #endif " -relax assume the configuration is \n" " correct, parse it without paranoia, \n" " and assume hostnames are okay.\n" " -v print the version number\n" " +w not withdrawn: run as a window\n" "\n", PACKAGE_VERSION, PACKAGE_BUGREPORT); } static void printversion(void) { printf("wmbiff v%s\n", PACKAGE_VERSION); } static void parse_cmd(int argc, const char **argv, char *config_file) { int i; int fg = 0, bg = 0, hi = 0; config_file[0] = '\0'; /* Parse Command Line */ for (i = 1; i < argc; i++) { const char *arg = argv[i]; if (*arg == '-') { switch (arg[1]) { case 'b': if (strcmp(arg + 1, "bg") == 0) { if (argc > (i + 1)) { background = strdup_ordie(argv[i + 1]); bg = 1; DMA(DEBUG_INFO, "new background: '%s'\n", foreground); i++; if (font == NULL) font = DEFAULT_FONT; } } break; case 'd': if (strcmp(arg + 1, "debug") == 0) { debug_default = DEBUG_ALL; } else if (strcmp(arg + 1, "display") == 0) { /* passed to X's command line parser */ } else { usage(); exit(EXIT_FAILURE); } break; case 'f': if (strcmp(arg + 1, "fg") == 0) { if (argc > (i + 1)) { foreground = strdup_ordie(argv[i + 1]); fg = 1; DMA(DEBUG_INFO, "new foreground: '%s'\n", foreground); i++; if (font == NULL) font = DEFAULT_FONT; } } else if (strcmp(arg + 1, "font") == 0) { if (argc > (i + 1)) { if (strcmp(argv[i + 1], "default") == 0) { font = DEFAULT_FONT; } else { font = strdup_ordie(argv[i + 1]); } DMA(DEBUG_INFO, "new font: '%s'\n", font); i++; } } else { usage(); exit(EXIT_FAILURE); } break; case 'g': if (strcmp(arg + 1, "geometry") != 0) { usage(); exit(EXIT_FAILURE); } else { i++; /* gobble the argument */ if (i >= argc) { /* fail if there's nothing to gobble */ usage(); exit(EXIT_FAILURE); } } break; case 'h': if (strcmp(arg + 1, "hi") == 0) { if (argc > (i + 1)) { highlight = strdup_ordie(argv[i + 1]); hi = 1; DMA(DEBUG_INFO, "new highlight: '%s'\n", highlight); i++; if (font == NULL) font = DEFAULT_FONT; } } else if (strcmp(arg + 1, "h") == 0) { usage(); exit(EXIT_SUCCESS); } break; case 'v': printversion(); exit(EXIT_SUCCESS); break; case 's': if (strcmp(arg + 1, "skip-certificate-check") == 0) { SkipCertificateCheck = 1; } else { usage(); exit(EXIT_SUCCESS); } break; case 'r': if (strcmp(arg + 1, "relax") == 0) { Relax = 1; } else { usage(); exit(EXIT_SUCCESS); } break; case 'c': if (argc > (i + 1)) { strncpy(config_file, argv[i + 1], 255); i++; } break; case 'e': /* undocumented for debugging */ if (strcmp(arg + 1, "exit") == 0) { forever = 0; } break; case 'o': /* use classic behaviour/theme */ classic_mode = 1; break; default: usage(); exit(EXIT_SUCCESS); break; } } else if (*arg == '+') { switch (arg[1]) { case 'w': notWithdrawn = 1; break; default: usage(); exit(EXIT_SUCCESS); break; } } } if (classic_mode) { /* load classic colors if user did not override them */ if(!fg) foreground = foreground_classic; if(!bg) background = background_classic; if(!hi) highlight = highlight_classic; } } int main(int argc, const char *argv[]) { char uconfig_file[256]; /* hold on to the arguments we were started with; we will need them if we have to restart on sigusr1 */ restart_args = (const char **) malloc((argc + 1) * sizeof(const char *)); if (restart_args) { memcpy(restart_args, argv, (argc) * sizeof(const char *)); restart_args[argc] = NULL; } parse_cmd(argc, argv, uconfig_file); /* decide what the config file is */ if (uconfig_file[0] != '\0') { /* user-specified config file */ DMA(DEBUG_INFO, "Using user-specified config file '%s'.\n", uconfig_file); } else { const char *home = getenv("HOME"); if (home == NULL) { DMA(DEBUG_ERROR, "$HOME undefined. Use the -c option to specify a wmbiffrc\n"); exit(EXIT_FAILURE); } sprintf(uconfig_file, "%s/.wmbiffrc", home); } if (wmbiffrc_permissions_check(uconfig_file) == 0) { DMA(DEBUG_ERROR, "WARNING: In future versions of WMBiff, .wmbiffrc MUST be\n" "owned by the user, and not readable or writable by others.\n\n"); } init_biff(uconfig_file); signal(SIGCHLD, sigchld_handler); signal(SIGUSR1, restart_wmbiff); signal(SIGPIPE, SIG_IGN); /* write() may fail */ do_biff(argc, argv); // free resources if (restart_args) free(restart_args); if (custom_skin) free((void *)skin_filename); return 0; } dockapps/wmbiff/wmbiffrc.5.in000066400000000000000000000233431242751507200164400ustar00rootroot00000000000000.\" Hey, Emacs! This is an -*- nroff -*- source file. .\" $Id: wmbiffrc.5.in,v 1.18 2004/12/12 00:01:53 bluehal Exp $ .\" .\" @configure_input@ .\" .\" wmbiff.1 and wmbiffrc.5 are copyright 1999-2002 by .\" Jordi Mallach .\" .\" This is free documentation, see the latest version of the GNU .\" General Public License for copying conditions. There is NO warranty. .TH WMBIFFRC 5 "November 11, 2002" "wmbiff" .SH NAME wmbiffrc \- configuration file for .BR wmbiff (1) .SH DESCRIPTION \fBWMbiff\fP is a mail notification tool for the WindowMaker and AfterStep window managers. It can handle up to 5 mailboxes, more when run using other window managers. You can define actions on mouse clicks for the different mailboxes. This manpage explains the different options which can be specified in a user's wmbiffrc. .SH OPTIONS Each option takes the form .IR option[.mbox] " = " value . Comments must be preceded by pound signs (#). The supported configuration options are: .TP 3 \fBcertfile\fP File that holds TLS (SSL) certificates. If specified, wmbiff will check certificates and exit on a failure, so your password is secure. If not present, wmbiff will trust all certificates and may be vulnerable to a man-in-the-middle attack. WMbiff's will not prompt if you want to accept new certificates. Instead, wmbiff expects your mail client to keep certificates in a file. For example, if mutt is your mailreader, you may add: .RS certfile=/home//.muttsslcerts .RE .TP \fBtls\fP Specify cipher suite preferences on a TLS session. Can be a predefined value from gnults or a custom value. Default value is: \fINORMAL\fP. gnutls predefined values: .sp .RS 8 \fIPERFORMANCE\fP (gnutls >= 2.2.0) .RE .RS 8 \fINORMAL\fP (gnutls >= 2.2.0) .RE .RS 8 \fISECURE128\fP (gnutls >= 2.2.0) .RE .RS 8 \fISECURE192\fP (gnutls >= 3.0.0) .RE .RS 8 \fISECURE256\fP (gnutls >= 2.2.0) .RE .RS 8 \fISUITEB128\fP (gnutls >= 3.0.0) .RE .RS 8 \fISUITEB192\fP (gnutls >= 3.0.0) .RE .RS 8 \fIEXPORT\fP (gnutls >= 2.2.0) .RE .RS 8 \fINONE\fP (gnutls >= 2.2.0) .RE .RS .TP See \fBhttp://gnutls.org/manual/gnutls.html#Priority-Strings\fR for more details. .RE .TP \fBinterval\fP Global interval between mailbox checking. Value is the number of seconds, 5 is the default. .TP \fBaskpass\fP Program run to ask for IMAP passwords, if left empty in the configuration file. The default is @DEFAULT_ASKPASS@. Can be specified on a per-mailbox basis. .TP \fBskinfile\fP XPM pixmap file to load for the background. If not a full path, wmbiff will search @SKINDIR@, /usr/share/wmbiff, /usr/local/share/wmbiff, and the current directory for the pixmap file. .TP \fBglobalnotify\fP Command to be executed when new mail is received in any mailbox. Set notify.n to override this option for mailbox n. .TP \fBlabel.n\fP Specifies the displayed label for a mailbox. It can be up to five characters long. .TP \fBpath.n\fP Path to the mailbox, local or remote one. Path lines start with a prefix, which specifies the type of wmbiff box you're setting up. The following types are supported: .RS .TP .I mbox This is a local mbox mailbox. After the prefix, you only need to put the path to the mailbox wmbiff needs to read. Local mboxes may be specified using shell commands enclosed in back-ticks. (`s.) .\"This is also the default. .RS mbox:/path/to/mail/debian-devel .RE .\" let's stop making this available. .\" .RS .\" - or - .\" .RE .\" /path/to/mail/debian-devel .\" .RS .TP .I maildir This works just like \fImbox\fP above. .RS maildir:[:\fIflags\fP:]/path/to/mail/bugtraq/ .TP \fIflags\fP can one or more of: .TP .I F Flush directory caches by creating (then deleting) a temporary file in each maildir prior to checking. This hack speeds up checking network-mounted maildirs in cases where directory caching can cause unwanted delays (eg. SFS-mounted maildirs). .RE .TP .I pop3 Using this type, WMBiff will check for mail on a pop3 server using the specified username, password, host and an optional port number (defaulting to 110). If your password contains a special character, eg. '@' or ':', use the second path format. See Authentication below for a description of the auth field. .RS pop3:user:passwd@server[:port] [auth] .RE .RS pop3:user passwd server[ port] [auth] .RE .TP .I pop3s Exactly like pop3, only uses TLS (SSL) when built with gnutls and defaults to port 995. @GNUTLS_MAN_STATUS@ .TP .I imap These are IMAP4 boxes. As with pop3, WMBiff will report the status of an IMAP4 mbox using the given values. This type accepts user, optional password, host and optional path to mailbox and port number. See Authentication below for a description of the auth field. The password may be left empty: see askpass above for information on password prompting. If your password includes a @, use the space delimited form. If it contains a space or #, use the askpass option instead. The mailbox field may be quoted, e.g., server/"Mail/Eggs and Spam". Mailboxes in subfolders may be described as /INBOX.subfolder by some servers and /Mail/subfolder by others. .RS imap:user:passwd@server[/mailbox][:port] [auth] .RE .RS imap:user:@server[/mailbox][:port] [auth] .RE .RS imap:user passwd server[/mailbox][ port] [auth] .RE .RS imap:user:passwd@server[/"mail box"][:port] [auth] .RE .TP .I imaps These are IMAP4 boxes wrapped in a TLS (SSL) connection. @GNUTLS_MAN_STATUS@ Parameters are the same as those for ordinary IMAP4 boxes. Port defaults to 993. If 143 is specified, WMBiff will attempt to connect unencrypted but negotiate TLS using IMAP's STARTTLS command. TLS support uses GNUTLS, which is under development and may be insecure. See the imap format above for additional detail about specifying your password. .RS imaps:user:passwd@server[/mailbox][:port] [auth] .RE .RS imaps:user:@server[/mailbox][:port] [auth] .RE .RS imaps:user passwd server[/mailbox][ port] [auth] .RE .TP .I shell With this keyword, wmbiff will launch the specified shell command and read its output (STDOUT) expecting an integer message count or a three-character string. If "new" is in the first line, the string or number will be displayed in yellow. The behavior of this experimental keyword is likely to change in future revisions. .RS shell:::/path/to/command shell:::lpq | grep Queue | awk '{print $2}' .RE .RE .TP \fBnotify.n\fP Command to be executed on new mail arrival in the given mailbox. Accepts the special keyword "beep" to use the pc speaker. .TP \fBaction.n\fP Command to be executed on left mouse click on a mailbox label. Accepts the special keyword "msglst" to pop up a window of recent message headers from IMAP or POP3 mailboxes when the left mouse button is held. .TP \fBbuttontwo.n\fP Command to be executed on middle mouse click on a mailbox level. Accepts the special keyword "msglst" to pop up a window of recent message headers from IMAP or POP3 mailboxes when the middle mouse button is held. .TP \fBinterval.n\fP Per mailbox check interval. Value is the amount of seconds between checkings, default is the global interval. .TP \fBfetchinterval.n\fP Interval between mail auto-fetching. Values accept 0 to disable, \-1 for autofetching on new mail arrival, and positive values for a given interval in seconds. .TP \fBfetchcmd.n\fP Command to be executed to fetch mail. If not specified, fetching through wmbiff is disabled completely. Accepts the special keyword "msglst" to pop up a window of recent message headers from IMAP and POP3 mailboxes when the right mouse button is held down, though not when fetchinterval is nonzero. .TP \fBdebug.n\fP Show debugging messages from this mailbox. Currently supported values are "all" and "none". The \-debug option to wmbiff overrides this setting. Since IMAP uses a single connection per server, per-mailbox debugging may not .SH SIZING WMBiff will automatically size its window to the number of configured mailboxes. While WindowMaker's Dock and AfterStep's Wharf expect square, 64x64 applets, other window managers, such as Blackbox or Openbox do not have this limitation. This uncharacteristic "dockapp" behavior is intended to help those users who don't have exactly five mailboxes to watch. To preserve the old-style five-mailbox window even when you have only two, add .IR path.4= to configure a blank 5th mailbox. To use the new-style sizing, just configure as many mailboxes as you want. .SH AUTHENTICATION Authentication methods include "cram-md5", "apop" (for Pop3), and "plaintext". "cram-md5" and "apop" are only available when wmbiff is compiled with libgcrypt. @GCRYPT_MAN_STATUS@ Authentication methods are tried in the following order: cram-md5, apop, plaintext. Each authentication method will be tried unless a list is included in the [auth] field. For example, append "cram-md5 apop" if you don't want your password to be sent in cleartext over the network. Conversely, append "plaintext" if you don't want wmbiff to bother with other authentication methods. Leaving authentication methods unspecified should be reasonably safe. The order of entries in the [auth] list is not currently considered. .SH TROUBLESHOOTING For problems authenticating to servers, try specifying the authentication method explicitly as described above: sometimes a failed attempt to authenticate can cause later failures. Some servers claim to support cram-md5 but fail: telling wmbiff not to try can help. For other problems, run wmbiff with the \-debug option. See wmbiff(1) for details. While editing .wmbiffrc, you may find it useful to restart wmbiff using either control-shift mouse button 1, or killall \-USR1 wmbiff. .SH FILES .TP .I ~/.wmbiffrc per-user wmbiff configuration file. .SH AUTHOR This manual page was written by Jordi Mallach , originally for the Debian system (but may be used by others). .SH SEE ALSO .PD 0 .TP \fBwmbiff\fP(1) .PP \fI/usr/share/doc/wmbiff/examples/sample.wmbiffrc\fP (or equivalent on your system) dockapps/wmgeneral/000077500000000000000000000000001242751507200146505ustar00rootroot00000000000000dockapps/wmgeneral/Makefile.am000066400000000000000000000003451242751507200167060ustar00rootroot00000000000000noinst_LIBRARIES = libwmgeneral.a libwmgeneral_a_SOURCES = misc.c misc.h wmgeneral.c wmgeneral.h MAINTAINERCLEANFILES = Makefile.in indent: indent -npro -kr -i4 -ts4 $(libwmgeneral_a_SOURCES) || true dist-hook-local: indent dockapps/wmgeneral/misc.c000066400000000000000000000020711242751507200157470ustar00rootroot00000000000000/* dock.c- built-in Dock module for WindowMaker * * WindowMaker window manager * * Copyright (c) 1997 Alfredo K. Kojima * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include #include #include "misc.h" extern pid_t execCommand(const char *command) { pid_t pid; if ((pid = fork()) == 0) { execl("/bin/sh", "sh", "-c", command, (char *) 0); } return pid; } dockapps/wmgeneral/misc.h000066400000000000000000000002611242751507200157530ustar00rootroot00000000000000#ifndef __MISC_H #define __MISC_H #include extern void parse_command(char *, char ***, int *); extern pid_t execCommand(const char *); #endif /* __MISC_H */ dockapps/wmgeneral/wmgeneral.c000066400000000000000000000402061242751507200167770ustar00rootroot00000000000000/* Best viewed with vim5, using ts=4 wmgeneral was taken from wmppp. It has a lot of routines which most of the wm* programs use. ------------------------------------------------------------ Author: Martijn Pieterse (pieterse@xs4all.nl) --- CHANGES: --- 14/09/1998 (Dave Clark, clarkd@skyia.com) * Updated createXBMfromXPM routine * Now supports >256 colors 11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl) * Removed a bug from parse_rcfile. You could not use "start" in a command if a label was also start. * Changed the needed geometry string. We don't use window size, and don't support negative positions. 03/09/1998 (Martijn Pieterse, pieterse@xs4all.nl) * Added parse_rcfile2 02/09/1998 (Martijn Pieterse, pieterse@xs4all.nl) * Added -geometry support (untested) 28/08/1998 (Martijn Pieterse, pieterse@xs4all.nl) * Added createXBMfromXPM routine * Saves a lot of work with changing xpm's. 02/05/1998 (Martijn Pieterse, pieterse@xs4all.nl) * changed the read_rc_file to parse_rcfile, as suggested by Marcelo E. Magallon * debugged the parse_rc file. 30/04/1998 (Martijn Pieterse, pieterse@xs4all.nl) * Ripped similar code from all the wm* programs, and put them in a single file. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #ifdef HAVE_X11_XPM_H #include #endif #ifdef HAVE_XPM_H #include #endif #include /* needed for Region on solaris? */ #include #include "wmgeneral.h" /*****************/ /* X11 Variables */ /*****************/ Window Root; int screen; int x_fd; int d_depth; XSizeHints mysizehints; XWMHints mywmhints; Pixel back_pix, fore_pix; // static const char *Geometry = ""; Window iconwin, win; GC NormalGC; XpmIcon wmgen_bkg; XpmIcon wmgen_src; Pixmap pixmask; /*****************/ /* Mouse Regions */ /*****************/ typedef struct { int enable; int top; int bottom; int left; int right; } MOUSE_REGION; MOUSE_REGION mouse_region[MAX_MOUSE_REGION]; /***********************/ /* Function Prototypes */ /***********************/ static void GetXPM(XpmIcon *, const char **); Pixel GetColor(const char *); void RedrawWindow(void); int CheckMouseRegion(int, int); /*******************************************************************************\ |* parse_rcfile *| \*******************************************************************************/ void parse_rcfile(const char *filename, rckeys * keys) { char *p, *q; char temp[128]; const char *tokens = " :\t\n"; FILE *fp; int i, key; fp = fopen(filename, "r"); if (fp) { while (fgets(temp, 128, fp)) { key = 0; q = strdup(temp); q = strtok(q, tokens); while (key >= 0 && keys[key].label) { if ((!strcmp(q, keys[key].label))) { p = strstr(temp, keys[key].label); p += strlen(keys[key].label); p += strspn(p, tokens); if ((i = strcspn(p, "#\n"))) p[i] = 0; free(*keys[key].var); *keys[key].var = strdup(p); key = -1; } else key++; } free(q); } fclose(fp); } } /*******************************************************************************\ |* parse_rcfile2 *| \*******************************************************************************/ void parse_rcfile2(const char *filename, rckeys2 * keys) { char *p; char temp[128]; const char *tokens = " :\t\n"; FILE *fp; int i, key; char *family = NULL; fp = fopen(filename, "r"); if (fp) { while (fgets(temp, 128, fp)) { key = 0; while (key >= 0 && keys[key].label) { if ((p = strstr(temp, keys[key].label))) { p += strlen(keys[key].label); p += strspn(p, tokens); if ((i = strcspn(p, "#\n"))) p[i] = 0; free(*keys[key].var); *keys[key].var = strdup(p); key = -1; } else key++; } } fclose(fp); } free(family); } /*******************************************************************************\ |* GetXPM *| \*******************************************************************************/ static void GetXPM(XpmIcon * wmgen_local, const char *pixmap_bytes[]) { XWindowAttributes attributes; int err; /* For the colormap */ XGetWindowAttributes(display, Root, &attributes); /* despite the comment, I still don't understand... attributes is subsequently unused in this function -ns 11/2002 */ wmgen_local->attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions); err = XpmCreatePixmapFromData(display, Root, (char **) pixmap_bytes, &(wmgen_local->pixmap), &(wmgen_local->mask), &(wmgen_local->attributes)); if (err != XpmSuccess) { fprintf(stderr, "Not enough free colorcells to create pixmap from data (err=%d).\n", err); exit(1); } } /*******************************************************************************\ |* GetColor *| \*******************************************************************************/ Pixel GetColor(const char *name) { XColor color; XWindowAttributes attributes; XGetWindowAttributes(display, Root, &attributes); color.pixel = 0; if (!XParseColor(display, attributes.colormap, name, &color)) { fprintf(stderr, "wm.app: GetColor() can't parse %s.\n", name); } else if (!XAllocColor(display, attributes.colormap, &color)) { fprintf(stderr, "wm.app: GetColor() can't allocate %s.\n", name); } return color.pixel; } /*******************************************************************************\ |* flush_expose *| \*******************************************************************************/ static int flush_expose(Window w) { XEvent dummy; int i = 0; while (XCheckTypedWindowEvent(display, w, Expose, &dummy)) i++; return i; } /*******************************************************************************\ |* RedrawWindow *| \*******************************************************************************/ void RedrawWindow(void) { flush_expose(iconwin); XCopyArea(display, wmgen_bkg.pixmap, iconwin, NormalGC, 0, 0, wmgen_bkg.attributes.width, wmgen_bkg.attributes.height, 0, 0); flush_expose(win); XCopyArea(display, wmgen_bkg.pixmap, win, NormalGC, 0, 0, wmgen_bkg.attributes.width, wmgen_bkg.attributes.height, 0, 0); } /*******************************************************************************\ |* RedrawWindowXY *| \*******************************************************************************/ void RedrawWindowXY(int x, int y) { flush_expose(iconwin); XCopyArea(display, wmgen_bkg.pixmap, iconwin, NormalGC, x, y, wmgen_bkg.attributes.width, wmgen_bkg.attributes.height, 0, 0); flush_expose(win); XCopyArea(display, wmgen_bkg.pixmap, win, NormalGC, x, y, wmgen_bkg.attributes.width, wmgen_bkg.attributes.height, 0, 0); } /*******************************************************************************\ |* AddMouseRegion *| \*******************************************************************************/ void AddMouseRegion(unsigned int region_idx, int left, int top, int right, int bottom) { if (region_idx < MAX_MOUSE_REGION) { mouse_region[region_idx].enable = 1; mouse_region[region_idx].top = top; mouse_region[region_idx].left = left; mouse_region[region_idx].bottom = bottom; mouse_region[region_idx].right = right; } } /*******************************************************************************\ |* CheckMouseRegion *| \*******************************************************************************/ int CheckMouseRegion(int x, int y) { int i; int found; found = 0; for (i = 0; i < MAX_MOUSE_REGION && !found; i++) { if (mouse_region[i].enable && x <= mouse_region[i].right && x >= mouse_region[i].left && y <= mouse_region[i].bottom && y >= mouse_region[i].top) found = 1; } if (!found) return -1; return (i - 1); } /*******************************************************************************\ |* createXBMfromXPM *| \*******************************************************************************/ void createXBMfromXPM(char *xbm, const char **xpm, int sx, int sy) { int i, j, k; int width, height, numcol, depth; int zero = 0; unsigned char bwrite; int bcount; int curpixel; sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth); for (k = 0; k != depth; k++) { zero <<= 8; zero |= xpm[1][k]; } for (i = numcol + 1; i < numcol + sy + 1; i++) { bcount = 0; bwrite = 0; for (j = 0; j < sx * depth; j += depth) { bwrite >>= 1; curpixel = 0; for (k = 0; k != depth; k++) { curpixel <<= 8; curpixel |= xpm[i][j + k]; } if (curpixel != zero) { bwrite += 128; } bcount++; if (bcount == 8) { *xbm = bwrite; xbm++; bcount = 0; bwrite = 0; } } } } /*******************************************************************************\ |* copyXPMArea *| \*******************************************************************************/ void copyXPMArea(int src_x, int src_y, int width, int height, int dest_x, int dest_y) { XCopyArea(display, wmgen_src.pixmap, wmgen_bkg.pixmap, NormalGC, src_x, src_y, width, height, dest_x, dest_y); } /*******************************************************************************\ |* copyXBMArea *| \*******************************************************************************/ void copyXBMArea(int src_x, int src_y, int width, int height, int dest_x, int dest_y) { XCopyArea(display, wmgen_src.mask, wmgen_bkg.pixmap, NormalGC, src_x, src_y, width, height, dest_x, dest_y); } /* added for wmbiff */ XFontStruct *f; int loadFont(const char *fontname) { if (display != NULL) { f = XLoadQueryFont(display, fontname); if (f) { XSetFont(display, NormalGC, f->fid); return 0; } else { printf("couldn't set font!\n"); } } return -1; } void drawString(int dest_x, int dest_y, const char *string, const char *colorname, const char *bgcolorname, int right_justify) { int len = strlen(string); assert(colorname != NULL); XSetForeground(display, NormalGC, GetColor(colorname)); XSetBackground(display, NormalGC, GetColor(bgcolorname)); if (right_justify) dest_x -= XTextWidth(f, string, len); XDrawImageString(display, wmgen_bkg.pixmap, NormalGC, dest_x, dest_y, string, len); } void eraseRect(int x, int y, int x2, int y2, const char *bgcolorname) { XSetForeground(display, NormalGC, GetColor(bgcolorname)); XFillRectangle(display, wmgen_bkg.pixmap, NormalGC, x, y, x2 - x, y2 - y); } /* end wmbiff additions */ /*******************************************************************************\ |* setMaskXY *| \*******************************************************************************/ void setMaskXY(int x, int y) { XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet); XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet); } /*******************************************************************************\ |* openXwindow *| \*******************************************************************************/ void openXwindow(int argc, const char *argv[], const char *pixmap_bytes_bkg[], const char *pixmap_bytes_src[], char *pixmask_bits, int pixmask_width, int pixmask_height, int notWithdrawn) { unsigned int borderwidth = 1; XClassHint classHint; const char *display_name = NULL; char *wname = strdup(argv[0]); XTextProperty name; XGCValues gcv; unsigned long gcm; const char *geometry = NULL; char default_geometry[128]; int dummy = 0; int i; if (!wname) { fprintf(stderr, "Unable to allocate memory for window name!\n"); abort(); } for (i = 1; argv[i]; i++) { if (!strcmp(argv[i], "-display") && i < argc - 1) { display_name = argv[i + 1]; i++; } if (!strcmp(argv[i], "-geometry") && i < argc - 1) { geometry = argv[i + 1]; i++; } } sprintf(default_geometry, "%dx%d+0+0", pixmask_width, pixmask_height); if (!(display = XOpenDisplay(display_name))) { fprintf(stderr, "%s: can't open display %s\n", wname, XDisplayName(display_name)); exit(1); } screen = DefaultScreen(display); Root = RootWindow(display, screen); d_depth = DefaultDepth(display, screen); x_fd = XConnectionNumber(display); /* Convert XPM to XImage */ GetXPM(&wmgen_bkg, pixmap_bytes_bkg); GetXPM(&wmgen_src, pixmap_bytes_src); /* Create a window to hold the stuff */ mysizehints.flags = USSize | USPosition; mysizehints.x = 0; mysizehints.y = 0; back_pix = GetColor("black"); fore_pix = GetColor("cyan"); XWMGeometry(display, screen, geometry, default_geometry, borderwidth, &mysizehints, &mysizehints.x, &mysizehints.y, &mysizehints.width, &mysizehints.height, &dummy); mysizehints.width = pixmask_width; /* changed 11/2002 for wmbiff non 64x64-ness */ mysizehints.height = pixmask_height; /* was statically 64. */ win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y, mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix); iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y, mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix); /* Activate hints */ XSetWMNormalHints(display, win, &mysizehints); classHint.res_name = wname; classHint.res_class = wname; XSetClassHint(display, win, &classHint); /* Was PointerMotionMask instead of KeyPressMask, but pointer motion is irrelevant, and if the user went to the trouble of giving us keypresses, the least we can do is handle em... */ XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask | KeyPressMask | StructureNotifyMask); XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask | KeyPressMask | StructureNotifyMask); /* wname is argv[0] */ if (XStringListToTextProperty(&wname, 1, &name) == 0) { fprintf(stderr, "%s: can't allocate window name\n", wname); exit(1); } XSetWMName(display, win, &name); XFree(name.value); /* Create GC for drawing */ gcm = GCForeground | GCBackground | GCGraphicsExposures; gcv.foreground = fore_pix; gcv.background = back_pix; gcv.graphics_exposures = 0; NormalGC = XCreateGC(display, Root, gcm, &gcv); /* ONLYSHAPE ON */ pixmask = XCreateBitmapFromData(display, win, pixmask_bits, pixmask_width, pixmask_height); XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask, ShapeSet); XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet); /* ONLYSHAPE OFF */ mywmhints.initial_state = WithdrawnState; mywmhints.icon_window = iconwin; mywmhints.icon_x = mysizehints.x; mywmhints.icon_y = mysizehints.y; mywmhints.window_group = win; mywmhints.flags = (notWithdrawn ? 0 : StateHint) | IconWindowHint | IconPositionHint | WindowGroupHint; XSetWMHints(display, win, &mywmhints); XSetCommand(display, win, (char **) argv, argc); XMapWindow(display, win); if (geometry) { /* we'll silently drop width and height as well as negative positions */ /* mostly because I don't know how to deal with them */ /* int wx, wy, x, y; int specified = XParseGeometry(geometry, &x, &y, &wx, &wy); printf("%d %d %d %d\n", x, y, wx, wy); if( specified & XNegative ) { x = DisplayWidth(display, DefaultScreen(display)) - x - pixmask_width; } if( specified & YNegative ) { y = DisplayHeight(display, DefaultScreen(display)) - y - pixmask_height; } if( specified & XValue || specified & YValue ) { XMoveWindow(display, win, x, y); } */ /* if (sscanf(geometry, "+%d+%d", &wx, &wy) == 2) { XMoveWindow(display, win, wx, wy); } else if (sscanf(geometry, "%dx%d+%d+%d", &x, &y, &wx, &wy) == 4) { XMoveWindow(display, win, wx, wy); } else if (sscanf(geometry, "+%d-%d", &wx, &wy) == 2) { XMoveWindow(display, win, wx, 0 - wy); } else { fprintf(stderr, "Unsupported geometry string '%s'\n", geometry); exit(1); } */ } if (wname) free(wname); } dockapps/wmgeneral/wmgeneral.h000066400000000000000000000026771242751507200170160ustar00rootroot00000000000000#ifndef WMGENERAL_H_INCLUDED #define WMGENERAL_H_INCLUDED /***********/ /* Defines */ /***********/ #define MAX_MOUSE_REGION (40) /************/ /* Typedefs */ /************/ typedef struct _rckeys rckeys; struct _rckeys { const char *label; char **var; }; typedef struct _rckeys2 rckeys2; struct _rckeys2 { const char *family; const char *label; char **var; }; typedef struct { Pixmap pixmap; Pixmap mask; XpmAttributes attributes; } XpmIcon; /*******************/ /* Global variable */ /*******************/ Display *display; /***********************/ /* Function Prototypes */ /***********************/ void AddMouseRegion(unsigned int rgn_index, int left, int top, int right, int bottom); int CheckMouseRegion(int x, int y); void openXwindow(int argc, const char *argv[], const char **, const char **, char *, int, int, int); void RedrawWindow(void); void RedrawWindowXY(int x, int y); void createXBMfromXPM(char *, const char **, int, int); void copyXPMArea(int, int, int, int, int, int); void copyXBMArea(int, int, int, int, int, int); void setMaskXY(int, int); void parse_rcfile(const char *, rckeys *); /* for wmbiff */ int loadFont(const char *fontname); /* -1 on fail, 0 success. */ void drawString(int dest_x, int dest_y, const char *string, const char *colorname, const char *bgcolorname, int right_justify); void eraseRect(int x, int y, int x2, int y2, const char *bgcolorname); /* end wmbiff */ #endif