solid-pop3d-0.15/ 755 765 3173 0 7107253245 6710 5solid-pop3d-0.15/README 644 765 3173 10310 7077103545 7606 GENERAL INFORMATION The Solid POP3 Server is an implementation of a Post Office Protocol version 3 server that has flexibility as its main goal. The server is easily configurable and has support for few features such as: - APOP authentication scheme - virtual hosting - maildir and mailbox handling - bulletins - expiration of messages Each user can specify his maildrop (its position and type). The format used in specification of maildrop's position should handle almost all widely-used system configurations. The server also seems to be fast, however no tests have been performed, so it's rather relative feeling. The design used is very similar to the design of Solar Designer's POPA3D server. This solution let's minimalize size of code working with root privileges. The code was also heavily checked for buffer overflow leaks and file races. None have been found as for now. All operations on files are done with user privileges. There is no SUID APOP secrets database management program (as in QPOP). Each user can specify his secret in his own home directory. Default maildrop name is /var/spool/mail/%s (read spop3d(8) manual). Most Linux distributions work with this setting. However on other systems you should change this value (use "-n" option or edit src/const.h). The newest version of the server is available under: ftp://ftp.rudykot.pl/pub/solidpop3d ftp://sedez.iq.pl/pub/solidpop3d ftp://dione.ids.pl/pub/solidpop3d Homepage: http://solidpop3d.pld.org.pl/ Any suggestions, bug reports, information about successful ports should go to: Jerzy Balamut INSTALLING Consult INSTALL file for generic instructions about installing. Existance of the user "spop3d" in system is required. Big part of the server works with this user privileges. Following ./configure options are recognized: --enable-pam - add PAM support --enable-apop - add APOP authentication scheme support --enable-mailbox - add mailbox handling support --enable-maildir - add maildir handling support --enable-bulletins - add bulletins support --enable-expire - add support for message expiration --enable-standalone - compile server as a standalone server, not inetd server (which is default) --enable-configfile - add support for global configuration file --enable-userconfig - add support for user configuration file --enable-last - add support for LAST command --enable-mapping - add support for user names mapping --enable-nonip - add support for non-IP based virtuals --enable-allowroot - add support for "AllowRootLogin" option --enable-createmail - add support for "CreateMailDrop" option --enable-ipv6 - add support for IPv6 protocol --enable-resolve - log resolved host name with IP number --enable-connect - log "connect from xxx" message --enable-logextend - log peer IP number in few additional places Support for mailbox, maildir, expiration, configfile and userconfig is enabled by default. You can change in the file src/const.h default values for some options. WARNING: The global configuration file should be readable by the "spop3d" user!!! Simple installation process could look like this: $ ./configure $ make $ su # useradd -d /nonexistent -s /nonexistent -M spop3d # make install # echo pop3 stream tcp nowait root /usr/sbin/tcpd /usr/local/sbin/spop3d >> /etc/inetd.conf # killall -HUP inetd WARNING: On some systems you should replace "pop3" with "pop-3". BULLETINS Server looks for bulletins in directory ${localstatedir}/bulletins (default: /usr/local/var/bulletins). For each bulletin (file) its modification time is checked. If this modification time is more recent than the modification time of the file UserBullFile this bulletin is added to user's maildrop. Server touches the modification time of the file UserBullFile after all bulletins are checked. The directory ${localstatedir} and bulletins should be accessable by any user. Default value for UserBullFile is ".spop3d-bull". Read spop3d.conf(5) manual for details. APOP Warning: Use APOP only if you really need it (and probably you don't). It isn't such secure as it looks. COPYRIGHT The program is distributed under GNU General Public License. See the file COPYING for details. Jerzy Balamut solid-pop3d-0.15/AUTHORS 644 765 3173 247 7077103537 7747 Authors of The Solid POP3 Server: Jerzy Balamut. Everything as for now. Arkadiusz Miskiewicz. Automake support. First version of all ".am" and configure.in files. solid-pop3d-0.15/COPYING 644 765 3173 43110 7077103542 7762 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library General Public License instead of this License. solid-pop3d-0.15/ChangeLog 644 765 3173 4017 7107101360 10452 0.15 - changed UIDL calculation method for mailbox!!! - IPv6 code should be more portable now - accept mailboxes with invalid date in "From " envelope - mailbox isn't locked during retrieving - accept maildir messages created by procmail now - user will receive all bulletins if his user bulletin file is created - downcase user and domain name - added option "LogPriority" - added check for inet_aton in -lresolv - added option "RequiredMapping" - added qpopper-like statistics (./configure --enable-statistics and LogStatistics option) - existance of maildrop isn't required unless you want to add bulletins 0.14 - should work on 64-bit machines now - sizeof(int) != sizeof(size_t) - corrected dot-spop3d(5) manual page - APOP support compiles now :> - changed SP_IPV6 to SPIPV6 in main.c :> - pop_error() isn't called, when read() (reading from socket) returns 0 0.13 - added zeroing password before exit(1) calls in few places - fixed mb_readtime() in mailbox.c - few changes in logging code (added few options to ./configure) 0.12: - added user names mapping - added non-IP virtual hosting - changed PAM service name from "solidpop3d" to "spop3d" - fixed establishing credentials in PAM code - determining whether mailbox has been changed works now (there wasn't danger of damaging mailbox) - ftruncate() is called only when mailbox size has been changed - renamed option "ServerName" to "APOPServerName" - support for "AllowRootLogin" option is available as ./configure --enable option (not compiled in by default), if isn't compiled in, root login isn't allowed (if compiled in, root login isn't allowed by default too, but you can change it) - fixed read_loop() - changed size_t to ssize_t - rewrited global configuration file parser - fixed command line parsing - added options: "BulletinDirectory" and "AddBulletins" - added option "CreateMailDrop" - added support for IPv6 protocol solid-pop3d-0.15/INSTALL 644 765 3173 17227 7077103543 7773 Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. solid-pop3d-0.15/Makefile.in 644 765 3173 6211 7100101005 10730 # Makefile.in generated automatically by automake 1.4a from Makefile.am # Modified by Jerzy Balamut # $Id: Makefile.in,v 1.3 2000/04/21 16:37:02 jurekb Exp $ # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = @SHELL@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = . PACKAGE = @PACKAGE@ USERCONFIG_O = @USERCONFIG_O@ VERSION = @VERSION@ SUBDIRS = doc man src AUXFILES = config.guess config.sub install-sh missing mkinstalldirs EXTRA_DIST = THANKS DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.in \ acconfig.h config.h.in configure configure.in aclocal.m4 VIRTUALS CONFIGFILE DISTFILES = $(DIST_COMMON) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best .SUFFIXES: distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @SET_MAKE@ all: all-recursive all-recursive: @for subdir in $(SUBDIRS); do \ target=`echo $@ | sed s/-recursive//`; \ (cd $$subdir && $(MAKE) $$target) \ || exit 1; \ done clean: clean-recursive mostlyclean: clean clean-recursive: @for subdir in $(SUBDIRS); do \ (cd $$subdir && $(MAKE) clean) \ || exit 1; \ done distclean: distclean-recursive distclean-pwd distclean-pwd: rm -f config.h config.status config.cache config.log Makefile distclean-recursive: @for subdir in $(SUBDIRS); do \ (cd $$subdir && $(MAKE) distclean) \ || exit 1; \ done maintainer-clean: maintainer-clean-recursive distclean-pwd maintainer-clean-recursive: @for subdir in $(SUBDIRS); do \ (cd $$subdir && $(MAKE) maintainer-clean) \ || exit 1; \ done install-strip: $(MAKE) INSTALL_STRIP_FLAG=-s install install: install-recursive install-recursive: @for subdir in $(SUBDIRS); do \ (cd $$subdir && $(MAKE) install) \ || exit 1; \ done uninstall: uninstall-recursive uninstall-recursive: @for subdir in $(SUBDIRS); do \ (cd $$subdir && $(MAKE) uninstall) \ || exit 1; \ done dist: distdir GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) rm -rf $(distdir) distdir: $(DISTFILES) rm -rf $(distdir) mkdir $(distdir) chmod 755 $(distdir) here=`cd $(top_builddir) && pwd`; \ top_distdir=`cd $(distdir) && pwd`; \ distdir=`cd $(distdir) && pwd`; @for file in $(DISTFILES); do \ d=$(srcdir); \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file || :; \ done chmod 644 $(distdir)/* chmod 755 $(distdir)/configure @for subdir in $(SUBDIRS); do \ mkdir $(distdir)/$$subdir \ || exit 1; \ chmod 755 $(distdir)/$$subdir; \ (cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ || exit 1; \ chmod 644 $(distdir)/$$subdir/*; \ done @for file in $(AUXFILES); do \ cp -p $(srcdir)/$$file $(distdir); \ chmod 755 $(distdir)/$$file; \ done solid-pop3d-0.15/acconfig.h 644 765 3173 4320 7100101005 10604 /* $Id: acconfig.h,v 1.2 2000/04/21 16:37:02 jurekb Exp $ */ /* Define if you want to use PAM to authenticate user. */ #undef HAVE_PAM /* Define if you have shadow passwords in /etc/shadow (Solaris style). */ #undef HAVE_ETC_SHADOW /* Define if you have shadow passwords in /etc/security/passwd.adjunct (SunOS style). */ #undef HAVE_ETC_SECURITY_PASSWD_ADJUNCT /* Define this if compiling on Ultrix. Defining those does not actually require shadow passwords to be present; this just includes support for them. */ #undef HAVE_ULTRIX_SHADOW_PASSWORDS /* Define this if on SCO Unix */ #undef HAVE_SCO_ETC_SHADOW /* Define this for HP-UX 10.x shadow passwords */ #undef HAVE_HPUX_TCB_AUTH /* Define if you want to use APOP */ #undef APOP /* Define if you want to have mailbox support */ #undef MDMAILBOX /* Define if you want to have maildir support */ #undef MDMAILDIR /* Define if you want to have configuration file support */ #undef CONFIGFILE /* Define if you want to have user configuration support */ #undef USERCONFIG /* Define if you want to have bulletins support */ #undef BULLETINS /* Define if you want to have expiration support */ #undef EXPIRATION /* Define if you want to compile standalone server */ #undef STANDALONE /* Define if you want to have LAST command support */ #undef LASTCMD /* Define to `int' if doesn't define */ #undef ssize_t /* Define to `int' if doesn't define */ #undef socklen_t /* Define if you have the maillock() function */ #undef MAILOCK /* Define if you want to have support for user names mapping */ #undef MAPPING /* Define if you want to have support for non-IP virtual hosting */ #undef NONIPVIRTUALS /* Define if you want to have support for "AllowRootLogin" option */ #undef ALLOWROOTLOGIN /* Define if you want to have support for "CreateMailDrop" option */ #undef CREATEMAILDROP /* Define if you want to have support for IPv6 protocol */ #undef SPIPV6 /* Define if you want to have resolved peer name in logs */ #undef RESOLVE_HOSTNAME /* If defined server logs "connect" message */ #undef LOG_CONNECT /* Define if you want to have extended logging */ #undef LOG_EXTEND /* Define if you want to have support for statistics */ #undef STATISTICS solid-pop3d-0.15/config.h.in 644 765 3173 11731 7100072355 10750 /* config.h.in. Generated automatically from configure.in by autoheader. */ /* Define to empty if the keyword does not work. */ #undef const /* Define to `int' if doesn't define. */ #undef gid_t /* Define to `long' if doesn't define. */ #undef off_t /* Define to `int' if doesn't define. */ #undef pid_t /* Define as the return type of signal handlers (int or void). */ #undef RETSIGTYPE /* Define to `unsigned' if doesn't define. */ #undef size_t /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define to `int' if doesn't define. */ #undef uid_t /* Define if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN /* Define if you want to use PAM to authenticate user. */ #undef HAVE_PAM /* Define if you have shadow passwords in /etc/shadow (Solaris style). */ #undef HAVE_ETC_SHADOW /* Define if you have shadow passwords in /etc/security/passwd.adjunct (SunOS style). */ #undef HAVE_ETC_SECURITY_PASSWD_ADJUNCT /* Define this if compiling on Ultrix. Defining those does not actually require shadow passwords to be present; this just includes support for them. */ #undef HAVE_ULTRIX_SHADOW_PASSWORDS /* Define this if on SCO Unix */ #undef HAVE_SCO_ETC_SHADOW /* Define this for HP-UX 10.x shadow passwords */ #undef HAVE_HPUX_TCB_AUTH /* Define if you want to use APOP */ #undef APOP /* Define if you want to have mailbox support */ #undef MDMAILBOX /* Define if you want to have maildir support */ #undef MDMAILDIR /* Define if you want to have configuration file support */ #undef CONFIGFILE /* Define if you want to have user configuration support */ #undef USERCONFIG /* Define if you want to have bulletins support */ #undef BULLETINS /* Define if you want to have expiration support */ #undef EXPIRATION /* Define if you want to compile standalone server */ #undef STANDALONE /* Define if you want to have LAST command support */ #undef LASTCMD /* Define to `int' if doesn't define */ #undef ssize_t /* Define to `int' if doesn't define */ #undef socklen_t /* Define if you have the maillock() function */ #undef MAILOCK /* Define if you want to have support for user names mapping */ #undef MAPPING /* Define if you want to have support for non-IP virtual hosting */ #undef NONIPVIRTUALS /* Define if you want to have support for "AllowRootLogin" option */ #undef ALLOWROOTLOGIN /* Define if you want to have support for "CreateMailDrop" option */ #undef CREATEMAILDROP /* Define if you want to have support for IPv6 protocol */ #undef SPIPV6 /* Define if you want to have resolved peer name in logs */ #undef RESOLVE_HOSTNAME /* If defined server logs "connect" message */ #undef LOG_CONNECT /* Define if you want to have extended logging */ #undef LOG_EXTEND /* Define if you want to have support for statistics */ #undef STATISTICS /* Define if you have the flock function. */ #undef HAVE_FLOCK /* Define if you have the gethostname function. */ #undef HAVE_GETHOSTNAME /* Define if you have the memcpy function. */ #undef HAVE_MEMCPY /* Define if you have the mkdir function. */ #undef HAVE_MKDIR /* Define if you have the rmdir function. */ #undef HAVE_RMDIR /* Define if you have the setgroups function. */ #undef HAVE_SETGROUPS /* Define if you have the setsockopt function. */ #undef HAVE_SETSOCKOPT /* Define if you have the snprintf function. */ #undef HAVE_SNPRINTF /* Define if you have the strchr function. */ #undef HAVE_STRCHR /* Define if you have the strdup function. */ #undef HAVE_STRDUP /* Define if you have the strerror function. */ #undef HAVE_STRERROR /* Define if you have the strtol function. */ #undef HAVE_STRTOL /* Define if you have the utime function. */ #undef HAVE_UTIME /* Define if you have the vsnprintf function. */ #undef HAVE_VSNPRINTF /* Define if you have the header file. */ #undef HAVE_DIRENT_H /* Define if you have the header file. */ #undef HAVE_FCNTL_H /* Define if you have the header file. */ #undef HAVE_GRP_H /* Define if you have the header file. */ #undef HAVE_LIMITS_H /* Define if you have the header file. */ #undef HAVE_NDIR_H /* Define if you have the header file. */ #undef HAVE_SHADOW_H /* Define if you have the header file. */ #undef HAVE_SYS_DIR_H /* Define if you have the header file. */ #undef HAVE_SYS_FILE_H /* Define if you have the header file. */ #undef HAVE_SYS_NDIR_H /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define if you have the header file. */ #undef HAVE_SYSLOG_H /* Define if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Version number of package */ #undef VERSION solid-pop3d-0.15/configure 755 765 3173 321013 7107253177 10663 #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Defaults: ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help --enable-pam use PAM to authenticate user" ac_help="$ac_help --enable-apop compile server with APOP support" ac_help="$ac_help --enable-mailbox compile server with mailbox support" ac_help="$ac_help --enable-maildir compile server with maildir support" ac_help="$ac_help --enable-configfile compile server with configuration file support" ac_help="$ac_help --enable-expire compile server with message expiration support" ac_help="$ac_help --enable-userconfig compile server with user configuration support" ac_help="$ac_help --enable-bulletins compile server with bulletins support" ac_help="$ac_help --enable-standalone compile standalone server" ac_help="$ac_help --enable-last compile server with LAST command support" ac_help="$ac_help --enable-mapping compile server with user names mapping support" ac_help="$ac_help --enable-nonip compile server with non-IP based virtual hosting support" ac_help="$ac_help --enable-allowroot compile server with \"AllowRootLogin\" option support" ac_help="$ac_help --enable-createmail compile server with \"CreateMailDrop\" option support" ac_help="$ac_help --enable-ipv6 compile server with IPv6 support" ac_help="$ac_help --enable-resolve log resolved host name" ac_help="$ac_help --enable-connect log \"connect from x\" message" ac_help="$ac_help --enable-logextend compile server with extended logging support" ac_help="$ac_help --enable-statistics compile server with support for statistics" # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. build=NONE cache_file=./config.cache exec_prefix=NONE host=NONE no_create= nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= target=NONE verbose= x_includes=NONE x_libraries=NONE bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/share/info' mandir='${prefix}/share/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi case "$ac_option" in -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) ac_optarg= ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir="$ac_optarg" ;; -build | --build | --buil | --bui | --bu) ac_prev=build ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir="$ac_optarg" ;; -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` eval "enable_${ac_feature}=no" ;; -enable-* | --enable-*) ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "enable_${ac_feature}='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he) # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat << EOF Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] --bindir=DIR user executables in DIR [EPREFIX/bin] --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] --libexecdir=DIR program executables in DIR [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com] --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] --libdir=DIR object code libraries in DIR [EPREFIX/lib] --includedir=DIR C header files in DIR [PREFIX/include] --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] --infodir=DIR info documentation in DIR [PREFIX/info] --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names EOF cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] --target=TARGET configure for TARGET [TARGET=HOST] Features and packages: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR EOF if test -n "$ac_help"; then echo "--enable and --with options recognized:$ac_help" fi exit 0 ;; -host | --host | --hos | --ho) ac_prev=host ;; -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir="$ac_optarg" ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir="$ac_optarg" ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir="$ac_optarg" ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir="$ac_optarg" ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir="$ac_optarg" ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir="$ac_optarg" ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir="$ac_optarg" ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix="$ac_optarg" ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix="$ac_optarg" ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix="$ac_optarg" ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name="$ac_optarg" ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir="$ac_optarg" ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir="$ac_optarg" ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site="$ac_optarg" ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir="$ac_optarg" ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target="$ac_optarg" ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers) echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "with_${ac_package}='$ac_optarg'" ;; -without-* | --without-*) ac_package=`echo $ac_option|sed -e 's/-*without-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` eval "with_${ac_package}=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes="$ac_optarg" ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries="$ac_optarg" ;; -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: WARNING: $ac_option: invalid host type" 1>&2 fi if test "x$nonopt" != xNONE; then { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } fi nonopt="$ac_option" ;; esac done if test -n "$ac_prev"; then { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } fi trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 6 checking for... messages and results # 5 compiler messages saved in config.log if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>./config.log echo "\ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. " 1>&5 # Strip out --no-create and --no-recursion so they do not pile up. # Also quote any args containing shell metacharacters. ac_configure_args= for ac_arg do case "$ac_arg" in -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_arg" ;; esac done # Support of DJGPP port of bash. if test -n "$COMSPEC$ComSpec"; then ac_x=-x; else ac_x=-f; fi # NLS nuisances. # Only set these to C if already set. These must not be set unconditionally # because not all systems understand e.g. LANG=C (notably SCO). # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! # Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. ac_unique_file=src/authenticate.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } else { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } fi fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then echo "loading site script $ac_site_file" . "$ac_site_file" fi done if test -r "$cache_file"; then echo "loading cache $cache_file" . $cache_file else echo "creating cache $cache_file" > $cache_file fi ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross ac_exeext= ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi PACKAGE=solid-pop3d VERSION=0.15 ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break fi done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo "configure:602: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do if test $ac_x $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL="$ac_install_sh" fi fi echo "$ac_t""$INSTALL" 1>&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 echo "configure:655: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "$*" != "X $srcdir/configure conftestfile" \ && test "$*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { echo "configure: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" 1>&2; exit 1; } fi test "$2" = conftestfile ) then # Ok. : else { echo "configure: error: newly created file is older than distributed files! Check your system clock" 1>&2; exit 1; } fi rm -f conftest* echo "$ac_t""yes" 1>&6 if test "$program_transform_name" = s,x,x,; then program_transform_name= else # Double any \ or $. echo might interpret backslashes. cat <<\EOF_SED > conftestsed s,\\,\\\\,g; s,\$,$$,g EOF_SED program_transform_name="`echo $program_transform_name|sed -f conftestsed`" rm -f conftestsed fi test "$program_prefix" != NONE && program_transform_name="s,^,${program_prefix},; $program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" # sed with no file args requires a program. test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 echo "configure:712: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftestmake <<\EOF all: @echo 'ac_maketemp="${MAKE}"' EOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftestmake fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$ac_t""yes" 1>&6 SET_MAKE= else echo "$ac_t""no" 1>&6 SET_MAKE="MAKE=${MAKE-make}" fi PACKAGE=$PACKAGE VERSION=$VERSION if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } fi cat >> confdefs.h <> confdefs.h <&6 echo "configure:763: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test $ac_x $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:793: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test $ac_x $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" break fi done IFS="$ac_save_ifs" if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" "$@" shift ac_cv_prog_CC="$@" fi fi fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then case "`uname -s`" in *win32* | *WIN32*) # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:844: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test $ac_x $ac_dir/$ac_word; then ac_cv_prog_CC="cl" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi ;; esac fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 echo "configure:876: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF #line 887 "configure" #include "confdefs.h" main(){return(0);} EOF if { (eval echo configure:892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then ac_cv_prog_cc_cross=no else ac_cv_prog_cc_cross=yes fi else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_works=no fi rm -fr conftest* ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 echo "configure:918: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 echo "configure:923: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no fi fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes else GCC= fi ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 echo "configure:951: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ac_cv_prog_cc_g=yes else ac_cv_prog_cc_g=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo "configure:994: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do if test $ac_x $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL="$ac_install_sh" fi fi echo "$ac_t""$INSTALL" 1>&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Make sure we can run config.sub. if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 echo "configure:1053: checking host system type" >&5 host_alias=$host case "$host_alias" in NONE) case $nonopt in NONE) if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } fi ;; *) host_alias=$nonopt ;; esac ;; esac host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 SPOPLIBS="" case "$host" in *-*-sunos4.1.1*) os_sunos=yes ;; *-*-sunos*) os_sunos=yes ;; *-sgi-irix5*) cat >> confdefs.h <<\EOF #define HAVE_ETC_SHADOW 1 EOF no_shadow_password_checking=yes no_libsun=yes ;; *-sgi-irix6*) cat >> confdefs.h <<\EOF #define HAVE_ETC_SHADOW 1 EOF no_shadow_password_checking=yes no_libsun=yes ;; *-dec-ultrix*) cat >> confdefs.h <<\EOF #define HAVE_ULTRIX_SHADOW_PASSWORDS 1 EOF echo $ac_n "checking for authenticate_user in -lauth""... $ac_c" 1>&6 echo "configure:1104: checking for authenticate_user in -lauth" >&5 ac_lib_var=`echo auth'_'authenticate_user | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lauth $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 SPOPLIBS="$SPOPLIBS -lauth" else echo "$ac_t""no" 1>&6 fi no_shadow_password_checking=yes ;; *-*-hpux*) echo $ac_n "checking for HPUX tcb auth option""... $ac_c" 1>&6 echo "configure:1148: checking for HPUX tcb auth option" >&5 if test -f /tcb/files/auth/system/pw_id_map; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_HPUX_TCB_AUTH 1 EOF SPOPLIBS="$SPOPLIBS -lsec" no_shadow_password_checking=yes else echo "$ac_t""no" 1>&6 fi ;; *-*-linux*) echo $ac_n "checking for getspnam""... $ac_c" 1>&6 echo "configure:1163: checking for getspnam" >&5 if eval "test \"`echo '$''{'ac_cv_func_getspnam'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getspnam(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_getspnam) || defined (__stub___getspnam) choke me #else getspnam(); #endif ; return 0; } EOF if { (eval echo configure:1191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_getspnam=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_getspnam=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'getspnam`\" = yes"; then echo "$ac_t""yes" 1>&6 getspnam_found=yes else echo "$ac_t""no" 1>&6 fi if test -z "$getspnam_found" ; then echo $ac_n "checking for getspnam in -lshadow""... $ac_c" 1>&6 echo "configure:1213: checking for getspnam in -lshadow" >&5 ac_lib_var=`echo shadow'_'getspnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lshadow $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 getspnam_found=yes SPOPLIBS="$SPOPLIBS -lshadow" else echo "$ac_t""no" 1>&6 fi fi no_shadow_password_checking=yes cat >> confdefs.h <<\EOF #define HAVE_ETC_SHADOW 1 EOF ;; i*86-unknown-sco3.2v4*) cat >> confdefs.h <<\EOF #define HAVE_SCO_ETC_SHADOW 1 EOF no_shadow_password_checking=yes ;; i*86-unknown-sco3.2v5*) cat >> confdefs.h <<\EOF #define HAVE_SCO_ETC_SHADOW 1 EOF no_shadow_password_checking=yes ;; *-convex-bsd*) no_shadow_password_checking=yes ;; *-*-freebsd*) no_shadow_password_checking=yes ;; *-*-netbsd*|*-*-openbsd*) no_shadow_password_checking=yes ;; *) ;; esac ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 echo "configure:1293: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> int main() { DIR *dirp = 0; ; return 0; } EOF if { (eval echo configure:1306: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir""... $ac_c" 1>&6 echo "configure:1331: checking for opendir" >&5 if eval "test \"`echo '$''{'ac_cv_func_opendir'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_opendir) || defined (__stub___opendir) choke me #else opendir(); #endif ; return 0; } EOF if { (eval echo configure:1359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_opendir=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_opendir=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'opendir`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_opendir = no; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 echo "configure:1380: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="$LIBS -ldir" else echo "$ac_t""no" 1>&6 fi fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 echo "configure:1422: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="$LIBS -lx" else echo "$ac_t""no" 1>&6 fi fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 echo "configure:1464: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1485: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1502: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1519: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" else ac_cv_prog_CPP="$CPP" fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 echo "configure:1544: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1557: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* ac_cv_header_stdc=yes else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF if { (eval echo configure:1624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_header_stdc=no fi rm -fr conftest* fi fi fi echo "$ac_t""$ac_cv_header_stdc" 1>&6 if test $ac_cv_header_stdc = yes; then cat >> confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 echo "configure:1648: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include int main() { struct tm *tp; ; return 0; } EOF if { (eval echo configure:1662: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_time=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_header_time" 1>&6 if test $ac_cv_header_time = yes; then cat >> confdefs.h <<\EOF #define TIME_WITH_SYS_TIME 1 EOF fi echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 echo "configure:1683: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include int main() { #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN bogus endian macros #endif ; return 0; } EOF if { (eval echo configure:1701: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include int main() { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } EOF if { (eval echo configure:1716: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_c_bigendian=no fi rm -f conftest* else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* if test $ac_cv_c_bigendian = unknown; then if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_c_bigendian=yes fi rm -fr conftest* fi fi fi echo "$ac_t""$ac_cv_c_bigendian" 1>&6 if test $ac_cv_c_bigendian = yes; then cat >> confdefs.h <<\EOF #define WORDS_BIGENDIAN 1 EOF fi for ac_func in strchr memcpy setgroups flock do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:1775: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:1803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 fi done for ac_hdr in fcntl.h limits.h sys/file.h syslog.h unistd.h shadow.h grp.h sys/time.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "configure:1831: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1841: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done echo $ac_n "checking for working const""... $ac_c" 1>&6 echo "configure:1869: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } ; return 0; } EOF if { (eval echo configure:1923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_c_const=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_c_const" 1>&6 if test $ac_cv_c_const = no; then cat >> confdefs.h <<\EOF #define const EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 echo "configure:1944: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_size_t=yes else rm -rf conftest* ac_cv_type_size_t=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_size_t" 1>&6 if test $ac_cv_type_size_t = no; then cat >> confdefs.h <<\EOF #define size_t unsigned EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 echo "configure:1977: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_off_t=yes else rm -rf conftest* ac_cv_type_off_t=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_off_t" 1>&6 if test $ac_cv_type_off_t = no; then cat >> confdefs.h <<\EOF #define off_t long EOF fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 echo "configure:2010: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "uid_t" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_uid_t=yes else rm -rf conftest* ac_cv_type_uid_t=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_uid_t" 1>&6 if test $ac_cv_type_uid_t = no; then cat >> confdefs.h <<\EOF #define uid_t int EOF cat >> confdefs.h <<\EOF #define gid_t int EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 echo "configure:2044: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_pid_t=yes else rm -rf conftest* ac_cv_type_pid_t=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_pid_t" 1>&6 if test $ac_cv_type_pid_t = no; then cat >> confdefs.h <<\EOF #define pid_t int EOF fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 echo "configure:2077: checking for ssize_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "(^|[^a-zA-Z_0-9])ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_ssize_t=yes else rm -rf conftest* ac_cv_type_ssize_t=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_ssize_t" 1>&6 if test $ac_cv_type_ssize_t = no; then cat >> confdefs.h <<\EOF #define ssize_t int EOF fi echo $ac_n "checking for socklen_t""... $ac_c" 1>&6 echo "configure:2110: checking for socklen_t" >&5 cat > conftest.$ac_ext < #include int main() { socklen_t tmp; ; return 0; } EOF if { (eval echo configure:2122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cat >> confdefs.h <&6 fi rm -f conftest* echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 echo "configure:2140: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #ifdef signal #undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); #else void (*signal ()) (); #endif int main() { int i; ; return 0; } EOF if { (eval echo configure:2162: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_type_signal=int fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_signal" 1>&6 cat >> confdefs.h <&6 echo "configure:2183: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:2211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 fi done for ac_func in gethostname mkdir rmdir utime strdup strerror strtol setsockopt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:2238: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:2266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 fi done echo $ac_n "checking for authenticate""... $ac_c" 1>&6 echo "configure:2291: checking for authenticate" >&5 if eval "test \"`echo '$''{'ac_cv_func_authenticate'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char authenticate(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_authenticate) || defined (__stub___authenticate) choke me #else authenticate(); #endif ; return 0; } EOF if { (eval echo configure:2319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_authenticate=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_authenticate=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'authenticate`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for inet_aton""... $ac_c" 1>&6 echo "configure:2339: checking for inet_aton" >&5 if eval "test \"`echo '$''{'ac_cv_func_inet_aton'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char inet_aton(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_inet_aton) || defined (__stub___inet_aton) choke me #else inet_aton(); #endif ; return 0; } EOF if { (eval echo configure:2367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_inet_aton=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_inet_aton=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'inet_aton`\" = yes"; then echo "$ac_t""yes" 1>&6 inet_aton_found=yes else echo "$ac_t""no" 1>&6 echo $ac_n "checking for inet_aton in -lresolv""... $ac_c" 1>&6 echo "configure:2387: checking for inet_aton in -lresolv" >&5 ac_lib_var=`echo resolv'_'inet_aton | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 SPOPLIBS="$SPOPLIBS -lresolv" else echo "$ac_t""no" 1>&6 fi fi echo $ac_n "checking for t_accept in -lnsl""... $ac_c" 1>&6 echo "configure:2430: checking for t_accept in -lnsl" >&5 ac_lib_var=`echo nsl'_'t_accept | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 SPOPLIBS="$SPOPLIBS -lnsl" else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 echo "configure:2470: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 SPOPLIBS="$SPOPLIBS -lsocket" else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for maillock in -lmail""... $ac_c" 1>&6 echo "configure:2511: checking for maillock in -lmail" >&5 ac_lib_var=`echo mail'_'maillock | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lmail $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 SPOPLIBS="$SPOPLIBS -lmail"; cat >> confdefs.h <<\EOF #define MAILOCK 1 EOF else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for crypt""... $ac_c" 1>&6 echo "configure:2555: checking for crypt" >&5 if eval "test \"`echo '$''{'ac_cv_func_crypt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char crypt(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_crypt) || defined (__stub___crypt) choke me #else crypt(); #endif ; return 0; } EOF if { (eval echo configure:2583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_crypt=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_crypt=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'crypt`\" = yes"; then echo "$ac_t""yes" 1>&6 crypt_found=yes else echo "$ac_t""no" 1>&6 fi if test -z "$crypt_found"; then echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 echo "configure:2605: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 SPOPLIBS="$SPOPLIBS -lcrypt" crypt_found=yes else echo "$ac_t""no" 1>&6 fi fi if test -z "$getspnam_found"; then echo $ac_n "checking for getspnam""... $ac_c" 1>&6 echo "configure:2650: checking for getspnam" >&5 if eval "test \"`echo '$''{'ac_cv_func_getspnam'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getspnam(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_getspnam) || defined (__stub___getspnam) choke me #else getspnam(); #endif ; return 0; } EOF if { (eval echo configure:2678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_getspnam=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_getspnam=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'getspnam`\" = yes"; then echo "$ac_t""yes" 1>&6 getspnam_found=yes else echo "$ac_t""no" 1>&6 fi if test -z "$getspnam_found"; then echo $ac_n "checking for getspnam in -lsec""... $ac_c" 1>&6 echo "configure:2700: checking for getspnam in -lsec" >&5 ac_lib_var=`echo sec'_'getspnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lsec $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 SPOPLIBS="$SPOPLIBS -lsec" getspnam_found=yes else echo "$ac_t""no" 1>&6 fi fi fi echo $ac_n "checking for getpwnam""... $ac_c" 1>&6 echo "configure:2744: checking for getpwnam" >&5 if eval "test \"`echo '$''{'ac_cv_func_getpwnam'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getpwnam(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_getpwnam) || defined (__stub___getpwnam) choke me #else getpwnam(); #endif ; return 0; } EOF if { (eval echo configure:2772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_getpwnam=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_getpwnam=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'getpwnam`\" = yes"; then echo "$ac_t""yes" 1>&6 getpwnam_found=yes else echo "$ac_t""no" 1>&6 fi if test -z "$no_libsun"; then if test -z "$getpwnam_found"; then echo $ac_n "checking for getpwnam in -lsun""... $ac_c" 1>&6 echo "configure:2796: checking for getpwnam in -lsun" >&5 ac_lib_var=`echo sun'_'getpwnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lsun $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 getpwnam_found=yes LIBS="$LIBS -lsun" else echo "$ac_t""no" 1>&6 fi fi fi if test -z "$no_shadow_password_checking"; then echo $ac_n "checking for shadow passwords""... $ac_c" 1>&6 echo "configure:2841: checking for shadow passwords" >&5 if test -f /etc/shadow; then if test "$ac_cv_header_shadow_h" = "yes"; then cat >> confdefs.h <<\EOF #define HAVE_ETC_SHADOW 1 EOF echo "$ac_t""/etc/shadow" 1>&6 if test -z "$getspnam_found"; then echo $ac_n "checking for getspnam in -lshadow""... $ac_c" 1>&6 echo "configure:2851: checking for getspnam in -lshadow" >&5 ac_lib_var=`echo shadow'_'getspnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lshadow $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 SPOPLIBS="$SPOPLIBS -lshadow" else echo "$ac_t""no" 1>&6 fi fi else echo "$ac_t""no" 1>&6 fi elif test -n "$os_sunos"; then cat >> confdefs.h <<\EOF #define HAVE_ETC_SECURITY_PASSWD_ADJUNCT 1 EOF echo "$ac_t""/etc/security/passwd.adjunct" 1>&6 else echo "$ac_t""no" 1>&6 fi fi echo $ac_n "checking whether to use PAM""... $ac_c" 1>&6 echo "configure:2906: checking whether to use PAM" >&5 # Check whether --enable-pam or --disable-pam was given. if test "${enable_pam+set}" = set; then enableval="$enable_pam" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 else if test -f /usr/include/security/pam_appl.h; then cat >> confdefs.h <<\EOF #define HAVE_PAM 1 EOF SPOPLIBS="$SPOPLIBS -lpam -ldl" echo "$ac_t""yes" 1>&6 else echo "$ac_t""no" 1>&6 fi fi else echo "$ac_t""no" 1>&6 fi POP_AUTH="" APOP_O="" POP_AUTH_1="" echo $ac_n "checking whether to support APOP""... $ac_c" 1>&6 echo "configure:2935: checking whether to support APOP" >&5 # Check whether --enable-apop or --disable-apop was given. if test "${enable_apop+set}" = set; then enableval="$enable_apop" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 POP_AUTH="pop_auth" POP_AUTH_1="pop_auth.1" APOP_O="apop.o" cat >> confdefs.h <<\EOF #define APOP 1 EOF fi else echo "$ac_t""no" 1>&6 fi MAILBOX_O="mailbox.o" echo $ac_n "checking whether to support mailbox""... $ac_c" 1>&6 echo "configure:2963: checking whether to support mailbox" >&5 # Check whether --enable-mailbox or --disable-mailbox was given. if test "${enable_mailbox+set}" = set; then enableval="$enable_mailbox" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 MAILBOX_O="" else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define MDMAILBOX 1 EOF fi else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define MDMAILBOX 1 EOF fi MAILDIR_O="maildir.o" echo $ac_n "checking whether to support maildir""... $ac_c" 1>&6 echo "configure:2992: checking whether to support maildir" >&5 # Check whether --enable-maildir or --disable-maildir was given. if test "${enable_maildir+set}" = set; then enableval="$enable_maildir" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 MAILDIR_O="" else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define MDMAILDIR 1 EOF fi else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define MDMAILDIR 1 EOF fi CONFIGFILE_O="configfile.o" CONFIGSCAN_O="configscan.o" echo $ac_n "checking whether to support configuration file""... $ac_c" 1>&6 echo "configure:3022: checking whether to support configuration file" >&5 # Check whether --enable-configfile or --disable-configfile was given. if test "${enable_configfile+set}" = set; then enableval="$enable_configfile" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 CONFIGFILE_O="" CONFIGSCAN_O="" else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define CONFIGFILE 1 EOF fi else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define CONFIGFILE 1 EOF fi echo $ac_n "checking whether to support message expiration""... $ac_c" 1>&6 echo "configure:3052: checking whether to support message expiration" >&5 # Check whether --enable-expire or --disable-expire was given. if test "${enable_expire+set}" = set; then enableval="$enable_expire" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define EXPIRATION 1 EOF fi else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define EXPIRATION 1 EOF fi USERCONFIG_O="userconfig.o" echo $ac_n "checking whether to support user configuration""... $ac_c" 1>&6 echo "configure:3079: checking whether to support user configuration" >&5 # Check whether --enable-userconfig or --disable-userconfig was given. if test "${enable_userconfig+set}" = set; then enableval="$enable_userconfig" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 USERCONFIG_O="" else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define USERCONFIG 1 EOF fi else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define USERCONFIG 1 EOF fi echo $ac_n "checking whether to support bulletins""... $ac_c" 1>&6 echo "configure:3106: checking whether to support bulletins" >&5 # Check whether --enable-bulletins or --disable-bulletins was given. if test "${enable_bulletins+set}" = set; then enableval="$enable_bulletins" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define BULLETINS 1 EOF fi else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking whether to build standalone version""... $ac_c" 1>&6 echo "configure:3126: checking whether to build standalone version" >&5 STANDALONE_O="" # Check whether --enable-standalone or --disable-standalone was given. if test "${enable_standalone+set}" = set; then enableval="$enable_standalone" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 else STANDALONE_O="standalone.o" echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define STANDALONE 1 EOF fi else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking whether to add support for LAST command""... $ac_c" 1>&6 echo "configure:3149: checking whether to add support for LAST command" >&5 # Check whether --enable-last or --disable-last was given. if test "${enable_last+set}" = set; then enableval="$enable_last" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define LASTCMD 1 EOF fi else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking whether to add support for user names mapping""... $ac_c" 1>&6 echo "configure:3169: checking whether to add support for user names mapping" >&5 MAPPING_O="" # Check whether --enable-mapping or --disable-mapping was given. if test "${enable_mapping+set}" = set; then enableval="$enable_mapping" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 else MAPPING_O="mapping.o" echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define MAPPING 1 EOF fi else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking whether to add support for non-IP based virtual hosting""... $ac_c" 1>&6 echo "configure:3192: checking whether to add support for non-IP based virtual hosting" >&5 # Check whether --enable-nonip or --disable-nonip was given. if test "${enable_nonip+set}" = set; then enableval="$enable_nonip" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define NONIPVIRTUALS 1 EOF fi else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking whether to add support for AllowRootLogin option""... $ac_c" 1>&6 echo "configure:3212: checking whether to add support for AllowRootLogin option" >&5 # Check whether --enable-allowroot or --disable-allowroot was given. if test "${enable_allowroot+set}" = set; then enableval="$enable_allowroot" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define ALLOWROOTLOGIN 1 EOF fi else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking whether to add support for CreateMailDrop option""... $ac_c" 1>&6 echo "configure:3232: checking whether to add support for CreateMailDrop option" >&5 # Check whether --enable-createmail or --disable-createmail was given. if test "${enable_createmail+set}" = set; then enableval="$enable_createmail" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define CREATEMAILDROP 1 EOF fi else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking whether to add support for IPv6 protocol""... $ac_c" 1>&6 echo "configure:3252: checking whether to add support for IPv6 protocol" >&5 # Check whether --enable-ipv6 or --disable-ipv6 was given. if test "${enable_ipv6+set}" = set; then enableval="$enable_ipv6" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define SPIPV6 1 EOF fi else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking whether to log resolved host name""... $ac_c" 1>&6 echo "configure:3272: checking whether to log resolved host name" >&5 # Check whether --enable-resolve or --disable-resolve was given. if test "${enable_resolve+set}" = set; then enableval="$enable_resolve" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define RESOLVE_HOSTNAME 1 EOF fi else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking whether to log "connect from x" message""... $ac_c" 1>&6 echo "configure:3292: checking whether to log "connect from x" message" >&5 # Check whether --enable-connect or --disable-connect was given. if test "${enable_connect+set}" = set; then enableval="$enable_connect" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define LOG_CONNECT 1 EOF fi else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking whether to add extended logging""... $ac_c" 1>&6 echo "configure:3312: checking whether to add extended logging" >&5 # Check whether --enable-logextend or --disable-logextend was given. if test "${enable_logextend+set}" = set; then enableval="$enable_logextend" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define LOG_EXTEND 1 EOF fi else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking whether to add support for statistics""... $ac_c" 1>&6 echo "configure:3334: checking whether to add support for statistics" >&5 # Check whether --enable-statistics or --disable-statistics was given. if test "${enable_statistics+set}" = set; then enableval="$enable_statistics" if test "$enableval" = "no"; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define STATISTICS 1 EOF fi else echo "$ac_t""no" 1>&6 fi trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. # If there is a colon in the path, we need to keep it. if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 DEFS=-DHAVE_CONFIG_H # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} echo creating $CONFIG_STATUS rm -f $CONFIG_STATUS cat > $CONFIG_STATUS </dev/null | sed 1q`: # # $0 $ac_configure_args # # Compiler output produced by configure, useful for debugging # configure, is in ./config.log if it exists. ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" for ac_option do case "\$ac_option" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *) echo "\$ac_cs_usage"; exit 1 ;; esac done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "Makefile doc/Makefile man/Makefile src/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g s%@bindir@%$bindir%g s%@sbindir@%$sbindir%g s%@libexecdir@%$libexecdir%g s%@datadir@%$datadir%g s%@sysconfdir@%$sysconfdir%g s%@sharedstatedir@%$sharedstatedir%g s%@localstatedir@%$localstatedir%g s%@libdir@%$libdir%g s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@PACKAGE@%$PACKAGE%g s%@VERSION@%$VERSION%g s%@SET_MAKE@%$SET_MAKE%g s%@CC@%$CC%g s%@host@%$host%g s%@host_alias@%$host_alias%g s%@host_cpu@%$host_cpu%g s%@host_vendor@%$host_vendor%g s%@host_os@%$host_os%g s%@CPP@%$CPP%g s%@SPOPLIBS@%$SPOPLIBS%g s%@POP_AUTH@%$POP_AUTH%g s%@APOP_O@%$APOP_O%g s%@POP_AUTH_1@%$POP_AUTH_1%g s%@MAILBOX_O@%$MAILBOX_O%g s%@MAILDIR_O@%$MAILDIR_O%g s%@CONFIGFILE_O@%$CONFIGFILE_O%g s%@CONFIGSCAN_O@%$CONFIGSCAN_O%g s%@USERCONFIG_O@%$USERCONFIG_O%g s%@STANDALONE_O@%$STANDALONE_O%g s%@MAPPING_O@%$MAPPING_O%g CEOF EOF cat >> $CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_file=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file. ac_more_lines=: ac_sed_cmds="" while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file else sed "${ac_end}q" conftest.subs > conftest.s$ac_file fi if test ! -s conftest.s$ac_file; then ac_more_lines=false rm -f conftest.s$ac_file else if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f conftest.s$ac_file" else ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" fi ac_file=`expr $ac_file + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_cmds` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` else ac_dir_suffix= ac_dots= fi case "$ac_given_srcdir" in .) srcdir=. if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; /*|[A-z]:/*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; *) # Relative path. srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" top_srcdir="$ac_dots$ac_given_srcdir" ;; esac case "$ac_given_INSTALL" in [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;; *) INSTALL="$ac_dots$ac_given_INSTALL" ;; esac echo creating "$ac_file" rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in *Makefile*) ac_comsub="1i\\ # $configure_input" ;; *) ac_comsub= ;; esac ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ac_dC='\3' ac_dD='%g' # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='\([ ]\)%\1#\2define\3' ac_uC=' ' ac_uD='\4%g' # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_eB='$%\1#\2define\3' ac_eC=' ' ac_eD='%g' if test "${CONFIG_HEADERS+set}" != set; then EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF fi for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac echo creating $ac_file rm -f conftest.frag conftest.in conftest.out ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"` cat $ac_file_inputs > conftest.in EOF # Transform confdefs.h into a sed script conftest.vals that substitutes # the proper values into config.h.in to produce config.h. And first: # Protect against being on the right side of a sed subst in config.status. # Protect against being in an unquoted here document in config.status. rm -f conftest.vals cat > conftest.hdr <<\EOF s/[\\&%]/\\&/g s%[\\$`]%\\&%g s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp s%ac_d%ac_u%gp s%ac_u%ac_e%gp EOF sed -n -f conftest.hdr confdefs.h > conftest.vals rm -f conftest.hdr # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >> conftest.vals <<\EOF s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% EOF # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. rm -f conftest.tail while : do ac_lines=`grep -c . conftest.vals` # grep -c gives empty output for an empty file on some AIX systems. if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi # Write a limited-size here document to conftest.frag. echo ' cat > conftest.frag <> $CONFIG_STATUS sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS echo 'CEOF sed -f conftest.frag conftest.in > conftest.out rm -f conftest.in mv conftest.out conftest.in ' >> $CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail rm -f conftest.vals mv conftest.tail conftest.vals done rm -f conftest.vals cat >> $CONFIG_STATUS <<\EOF rm -f conftest.frag conftest.h echo "/* $ac_file. Generated automatically by configure. */" > conftest.h cat conftest.in >> conftest.h rm -f conftest.in if cmp -s $ac_file conftest.h 2>/dev/null; then echo "$ac_file is unchanged" rm -f conftest.h else # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" fi rm -f $ac_file mv conftest.h $ac_file fi fi; done EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 solid-pop3d-0.15/configure.in 644 765 3173 24650 7107101360 11236 dnl $Id: configure.in,v 1.8 2000/05/12 15:40:10 jurekb Exp $ dnl Process this file with autoconf to produce a configure script. AC_INIT(src/authenticate.c) PACKAGE=solid-pop3d VERSION=0.15 AC_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE($PACKAGE,$VERSION) dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_CANONICAL_HOST dnl Checks for authenticate methods (mostly ripped from SSH) SPOPLIBS="" case "$host" in *-*-sunos4.1.1*) os_sunos=yes ;; *-*-sunos*) os_sunos=yes ;; *-sgi-irix5*) AC_DEFINE(HAVE_ETC_SHADOW) no_shadow_password_checking=yes no_libsun=yes ;; *-sgi-irix6*) AC_DEFINE(HAVE_ETC_SHADOW) no_shadow_password_checking=yes no_libsun=yes ;; *-dec-ultrix*) AC_DEFINE(HAVE_ULTRIX_SHADOW_PASSWORDS) AC_CHECK_LIB(auth, authenticate_user, [ SPOPLIBS="$SPOPLIBS -lauth"] ) no_shadow_password_checking=yes ;; *-*-hpux*) AC_MSG_CHECKING(for HPUX tcb auth option) if test -f /tcb/files/auth/system/pw_id_map; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_HPUX_TCB_AUTH) SPOPLIBS="$SPOPLIBS -lsec" no_shadow_password_checking=yes else AC_MSG_RESULT(no) fi ;; *-*-linux*) AC_CHECK_FUNC(getspnam, [ getspnam_found=yes]) if test -z "$getspnam_found" ; then AC_CHECK_LIB(shadow, getspnam, [ getspnam_found=yes SPOPLIBS="$SPOPLIBS -lshadow"] ) fi no_shadow_password_checking=yes AC_DEFINE(HAVE_ETC_SHADOW) ;; i*86-unknown-sco3.2v4*) AC_DEFINE(HAVE_SCO_ETC_SHADOW) no_shadow_password_checking=yes ;; i*86-unknown-sco3.2v5*) AC_DEFINE(HAVE_SCO_ETC_SHADOW) no_shadow_password_checking=yes ;; *-convex-bsd*) no_shadow_password_checking=yes ;; *-*-freebsd*) no_shadow_password_checking=yes ;; *-*-netbsd*|*-*-openbsd*) no_shadow_password_checking=yes ;; *) ;; esac dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_TIME AC_C_BIGENDIAN AC_CHECK_FUNCS(strchr memcpy setgroups flock) AC_CHECK_HEADERS(fcntl.h limits.h sys/file.h syslog.h unistd.h shadow.h grp.h sys/time.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T AC_TYPE_OFF_T AC_TYPE_UID_T AC_TYPE_PID_T AC_CHECK_TYPE(ssize_t, int) AC_MSG_CHECKING(for socklen_t) AC_TRY_COMPILE( [ #include #include ], [ socklen_t tmp;],[ AC_MSG_RESULT(yes)], [ AC_DEFINE_UNQUOTED(socklen_t, int) AC_MSG_RESULT(no)]) dnl Simple AC_CHECK_TYPE doesn't work. dnl Checks for library functions. AC_TYPE_SIGNAL AC_CHECK_FUNCS(vsnprintf snprintf) AC_CHECK_FUNCS(gethostname mkdir rmdir utime strdup strerror strtol setsockopt) AC_CHECK_FUNC(authenticate) AC_CHECK_FUNC(inet_aton, [ inet_aton_found=yes], [ AC_CHECK_LIB(resolv, inet_aton, SPOPLIBS="$SPOPLIBS -lresolv") ] ) AC_CHECK_LIB(nsl, t_accept, SPOPLIBS="$SPOPLIBS -lnsl") AC_CHECK_LIB(socket, socket, SPOPLIBS="$SPOPLIBS -lsocket") dnl Check for maillock() - ripped from qpopper AC_CHECK_LIB(mail, maillock, SPOPLIBS="$SPOPLIBS -lmail"; AC_DEFINE(MAILOCK)) dnl Checks for authentication methods (mostly ripped from SSH) AC_CHECK_FUNC(crypt, [ crypt_found=yes] ) if test -z "$crypt_found"; then AC_CHECK_LIB(crypt, crypt, [ SPOPLIBS="$SPOPLIBS -lcrypt" crypt_found=yes] ) fi if test -z "$getspnam_found"; then AC_CHECK_FUNC(getspnam, [ getspnam_found=yes] ) if test -z "$getspnam_found"; then AC_CHECK_LIB(sec, getspnam, [ SPOPLIBS="$SPOPLIBS -lsec" getspnam_found=yes] ) fi fi AC_CHECK_FUNC(getpwnam, [ getpwnam_found=yes] ) if test -z "$no_libsun"; then if test -z "$getpwnam_found"; then AC_CHECK_LIB(sun, getpwnam, [ getpwnam_found=yes LIBS="$LIBS -lsun"] ) fi fi if test -z "$no_shadow_password_checking"; then AC_MSG_CHECKING(for shadow passwords) if test -f /etc/shadow; then if test "$ac_cv_header_shadow_h" = "yes"; then AC_DEFINE(HAVE_ETC_SHADOW) AC_MSG_RESULT(/etc/shadow) if test -z "$getspnam_found"; then AC_CHECK_LIB(shadow, getspnam, SPOPLIBS="$SPOPLIBS -lshadow") fi else AC_MSG_RESULT(no) fi elif test -n "$os_sunos"; then AC_DEFINE(HAVE_ETC_SECURITY_PASSWD_ADJUNCT) AC_MSG_RESULT(/etc/security/passwd.adjunct) else AC_MSG_RESULT(no) fi fi AC_MSG_CHECKING(whether to use PAM) AC_ARG_ENABLE(pam, [ --enable-pam use PAM to authenticate user], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) else if test -f /usr/include/security/pam_appl.h; then AC_DEFINE(HAVE_PAM) SPOPLIBS="$SPOPLIBS -lpam -ldl" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi fi ], AC_MSG_RESULT(no) ) AC_SUBST(SPOPLIBS) POP_AUTH="" APOP_O="" POP_AUTH_1="" AC_MSG_CHECKING(whether to support APOP) AC_ARG_ENABLE(apop, [ --enable-apop compile server with APOP support], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) POP_AUTH="pop_auth" POP_AUTH_1="pop_auth.1" APOP_O="apop.o" AC_DEFINE(APOP) fi ], AC_MSG_RESULT(no) ) AC_SUBST(POP_AUTH) AC_SUBST(APOP_O) AC_SUBST(POP_AUTH_1) MAILBOX_O="mailbox.o" AC_MSG_CHECKING(whether to support mailbox) AC_ARG_ENABLE(mailbox, [ --enable-mailbox compile server with mailbox support], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) MAILBOX_O="" else AC_MSG_RESULT(yes) AC_DEFINE(MDMAILBOX) fi ], [ AC_MSG_RESULT(yes) AC_DEFINE(MDMAILBOX) ] ) AC_SUBST(MAILBOX_O) MAILDIR_O="maildir.o" AC_MSG_CHECKING(whether to support maildir) AC_ARG_ENABLE(maildir, [ --enable-maildir compile server with maildir support], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) MAILDIR_O="" else AC_MSG_RESULT(yes) AC_DEFINE(MDMAILDIR) fi ], [ AC_MSG_RESULT(yes) AC_DEFINE(MDMAILDIR) ] ) AC_SUBST(MAILDIR_O) CONFIGFILE_O="configfile.o" CONFIGSCAN_O="configscan.o" AC_MSG_CHECKING(whether to support configuration file) AC_ARG_ENABLE(configfile, [ --enable-configfile compile server with configuration file support], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) CONFIGFILE_O="" CONFIGSCAN_O="" else AC_MSG_RESULT(yes) AC_DEFINE(CONFIGFILE) fi ], [ AC_MSG_RESULT(yes) AC_DEFINE(CONFIGFILE) ] ) AC_SUBST(CONFIGFILE_O) AC_SUBST(CONFIGSCAN_O) AC_MSG_CHECKING(whether to support message expiration) AC_ARG_ENABLE(expire, [ --enable-expire compile server with message expiration support], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) AC_DEFINE(EXPIRATION) fi ], [ AC_MSG_RESULT(yes) AC_DEFINE(EXPIRATION) ] ) USERCONFIG_O="userconfig.o" AC_MSG_CHECKING(whether to support user configuration) AC_ARG_ENABLE(userconfig, [ --enable-userconfig compile server with user configuration support], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) USERCONFIG_O="" else AC_MSG_RESULT(yes) AC_DEFINE(USERCONFIG) fi ], [ AC_MSG_RESULT(yes) AC_DEFINE(USERCONFIG) ] ) AC_SUBST(USERCONFIG_O) AC_MSG_CHECKING(whether to support bulletins) AC_ARG_ENABLE(bulletins, [ --enable-bulletins compile server with bulletins support], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) AC_DEFINE(BULLETINS) fi ], AC_MSG_RESULT(no) ) AC_MSG_CHECKING(whether to build standalone version) STANDALONE_O="" AC_ARG_ENABLE(standalone, [ --enable-standalone compile standalone server], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) else STANDALONE_O="standalone.o" AC_MSG_RESULT(yes) AC_DEFINE(STANDALONE) fi ], AC_MSG_RESULT(no) ) AC_SUBST(STANDALONE_O) AC_MSG_CHECKING(whether to add support for LAST command) AC_ARG_ENABLE(last, [ --enable-last compile server with LAST command support], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) AC_DEFINE(LASTCMD) fi ], AC_MSG_RESULT(no) ) AC_MSG_CHECKING(whether to add support for user names mapping) MAPPING_O="" AC_ARG_ENABLE(mapping, [ --enable-mapping compile server with user names mapping support], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) else MAPPING_O="mapping.o" AC_MSG_RESULT(yes) AC_DEFINE(MAPPING) fi ], AC_MSG_RESULT(no) ) AC_SUBST(MAPPING_O) AC_MSG_CHECKING(whether to add support for non-IP based virtual hosting) AC_ARG_ENABLE(nonip, [ --enable-nonip compile server with non-IP based virtual hosting support], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) AC_DEFINE(NONIPVIRTUALS) fi ], AC_MSG_RESULT(no) ) AC_MSG_CHECKING(whether to add support for AllowRootLogin option) AC_ARG_ENABLE(allowroot, [ --enable-allowroot compile server with \"AllowRootLogin\" option support], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) AC_DEFINE(ALLOWROOTLOGIN) fi ], AC_MSG_RESULT(no) ) AC_MSG_CHECKING(whether to add support for CreateMailDrop option) AC_ARG_ENABLE(createmail, [ --enable-createmail compile server with \"CreateMailDrop\" option support], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) AC_DEFINE(CREATEMAILDROP) fi ], AC_MSG_RESULT(no) ) AC_MSG_CHECKING(whether to add support for IPv6 protocol) AC_ARG_ENABLE(ipv6, [ --enable-ipv6 compile server with IPv6 support], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) AC_DEFINE(SPIPV6) fi ], AC_MSG_RESULT(no) ) AC_MSG_CHECKING(whether to log resolved host name) AC_ARG_ENABLE(resolve, [ --enable-resolve log resolved host name], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) AC_DEFINE(RESOLVE_HOSTNAME) fi ], AC_MSG_RESULT(no) ) AC_MSG_CHECKING(whether to log "connect from x" message) AC_ARG_ENABLE(connect, [ --enable-connect log \"connect from x\" message], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) AC_DEFINE(LOG_CONNECT) fi ], AC_MSG_RESULT(no) ) AC_MSG_CHECKING(whether to add extended logging) AC_ARG_ENABLE(logextend, [ --enable-logextend compile server with extended logging support], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) AC_DEFINE(LOG_EXTEND) fi ], [ AC_MSG_RESULT(no) ] ) AC_MSG_CHECKING(whether to add support for statistics) AC_ARG_ENABLE(statistics, [ --enable-statistics compile server with support for statistics], [ if test "$enableval" = "no"; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) AC_DEFINE(STATISTICS) fi ], [ AC_MSG_RESULT(no) ] ) AC_OUTPUT(Makefile doc/Makefile man/Makefile src/Makefile) solid-pop3d-0.15/aclocal.m4 644 765 3173 6642 7031201633 10546 dnl aclocal.m4 generated automatically by aclocal 1.4a dnl Modified by Jerzy Balamut dnl $Id: aclocal.m4,v 1.4 1999/12/25 17:49:15 jurekb Exp $ dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. # serial 1 dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) AC_DEFUN(AM_INIT_AUTOMAKE, [AC_REQUIRE([AC_PROG_INSTALL]) dnl We require 2.13 because we rely on SHELL being computed by configure. AC_PREREQ([2.13]) PACKAGE=[$1] AC_SUBST(PACKAGE) VERSION=[$2] AC_SUBST(VERSION) dnl test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi ifelse([$3],, AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) AC_REQUIRE([AM_SANITY_CHECK]) AC_REQUIRE([AC_ARG_PROGRAM]) dnl FIXME This is truly gross. missing_dir=`cd $ac_aux_dir && pwd` AC_REQUIRE([AC_PROG_MAKE_SET])]) # # Check to make sure that the build environment is sane. # AC_DEFUN(AM_SANITY_CHECK, [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftestfile # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "[$]*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "[$]*" != "X $srcdir/configure conftestfile" \ && test "[$]*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "[$]2" = conftestfile ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi rm -f conftest* AC_MSG_RESULT(yes)]) dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. AC_DEFUN(AM_MISSING_PROG, [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if ($2 --version) < /dev/null > /dev/null 2>&1; then $1=$2 AC_MSG_RESULT(found) else $1="$3/missing $2" AC_MSG_RESULT(missing) fi AC_SUBST($1)]) solid-pop3d-0.15/VIRTUALS 644 765 3173 4243 7077103546 10113 There are 2 types of virtual hosting implemented in this server: - IP based virtual hosting: read spop3d(5).conf manual for details. - non-IP based virtual hosting: user is logged as username@host.name.com or username%host.name.com if POP3 client doesn't allow to use '@' in username. host.name.com is called "virtual domain name". Virtual hosting is available only if you support for configuration file is compiled in (./configure --enable-configfile). If you want to have support for non-IP based virtual hosting, run ./configure with --enable-nonip option. Configuration file is parsed before authentication state (VirtualHosts blocks with right IP address are parsed). If in authentication state user specifies virtual domain name (username%host.name.com) and non-IP based virtual hosting is allowed (AllowNonIP option), configuration is parsed second time (VirtualHosts blocks with right virtual domain name are parsed too). User names mapping: User names mapping file contains username:maptousername pairs. Each pair in separate line. Example (stupid): jurek:jurekb balamut:jurekb ktostam:jakis You can enable user names mapping through DoMapping option. You can use user name and mapped user name in MailDropName option (and others too). Example (non-IP and based virtual hosting, user names mapping): /usr/local/etc/spop3d.conf: AllowNonIP true MailDropName /var/mail/%m-%s MailDropType mailbox AllowNonIP false DoMapping true MapUserFile /usr/local/etc/pop3/mapped.users /usr/local/etc/pop3/mapped.users: jurek:jurekb balamut:jurekb ktostam:jakis If you are connected to 192.168.1.1, you can't use non-IP based virtual hosting (AllowNonIP false), but if you are connected to other adress, you can specify virtual domain name. For example: if you log in as balamut%jakis.tam.host.w.pl, maildrop name will be /var/mail/jurekb-balamut If you connect to 192.168.1.1, and log in as balamut, maildrop name will be /var/mail/jurekb-balamut too. Some options (APOPServerName) have no effect in non-IP based virtual hosting, because they are parsed after authentication state. solid-pop3d-0.15/CONFIGFILE 644 765 3173 1326 7100077451 10236 ./configure --enable-allowroot options: AllowRootLogin ./configure --enable-userconfig (enabled by default) options: UserOverride ./configure --enable-apop options: AllowAPOP, APOPServerName ./configure --enable-bulletins options: UserBullFile, BulletinDirectory, AddBulletins ./configure --enable-expire (enabled by default) options: ReadExpire, UnreadExpire ./configure --enable-mapping options: UserMapFile, DoMapping, RequiredMapping ./configure --enable-nonip options: AllowNonIP ./configure --enable-createmail options: CreateMailDrop ./configure --enable-statistics options: LogStatistics Left options (always available): MailDropName, MailDropType, AutoLogoutTime, ChangeGID, WrongCommandsLimit, LogPriority solid-pop3d-0.15/THANKS 644 765 3173 442 7103116762 7601 Thanks go to (alphabetical order): Danilo Aghemo Kamil Andrusz Krzysztof Czerwinski Pawel Krawczyk Roman Marcinek Michal Matusiewicz Robert 'Shadow' Pajak solid-pop3d-0.15/doc/ 755 765 3173 0 7107253244 7454 5solid-pop3d-0.15/doc/Makefile.in 644 765 3173 2662 7077103553 11532 # Makefile.in generated automatically by automake 1.4a from Makefile.am # Modified by Jerzy Balamut # $Id: Makefile.in,v 1.1.1.1 2000/04/12 20:52:25 jurekb Exp $ # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. srcdir = @srcdir@ VPATH = @srcdir@ DESTDIR = top_builddir = .. EXTRA_DIST = spop3d config.example DIST_COMMON = Makefile.in DISTFILES = $(DIST_COMMON) $(EXTRA_DIST) .SUFFIXES: all: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = doc distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done clean: distclean: -rm -f Makefile maintainer-clean: distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." install: uninstall: solid-pop3d-0.15/doc/spop3d 644 765 3173 155 7077103553 10573 #%PAM-1.0 auth required /lib/security/pam_pwdb.so shadow account required /lib/security/pam_pwdb.so solid-pop3d-0.15/doc/config.example 644 765 3173 753 7077103553 12266 /* This example is very stupid. Don't use it as a base for your own configuration file */ AllowRootLogin yes MailDropName Maildir MailDropType maildir UserBullFile .spop3d-blurp /* It's just an example */ ReadExpire 0 UnreadExpire never APOPServerName jakis.tam.host.w.pl MailDropName "/var/spool/mail/%s" /* It is a comment */ MailDropType mailbox AutoLogoutTime 5s UserOverride yes AllowAPOP yes ChangeGID true solid-pop3d-0.15/man/ 755 765 3173 0 7107253244 7462 5solid-pop3d-0.15/man/Makefile.in 644 765 3173 12556 7077103553 11563 # Makefile.in generated automatically by automake 1.4a from Makefile.am # Modified by Jerzy Balamut # $Id: Makefile.in,v 1.2 2000/04/17 19:38:03 jurekb Exp $ # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ mandir = @mandir@ DESTDIR = top_builddir = .. INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_FLAG = transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : PACKAGE = @PACKAGE@ VERSION = @VERSION@ man_MANS = spop3d.8 spop3d.conf.5 dot-spop3d.5 @POP_AUTH_1@ EXTRA_DIST = spop3d.8 spop3d.conf.5 dot-spop3d.5 pop_auth.1 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs man1dir = $(mandir)/man1 man5dir = $(mandir)/man5 man8dir = $(mandir)/man8 MANS = $(man_MANS) NROFF = nroff DIST_COMMON = Makefile.in DISTFILES = $(DIST_COMMON) $(EXTRA_DIST) all: $(MANS) .SUFFIXES: install-man1: $(mkinstalldirs) $(DESTDIR)$(man1dir) @list='$(man1_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ done uninstall-man1: @list='$(man1_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ rm -f $(DESTDIR)$(man1dir)/$$inst; \ done install-man5: $(mkinstalldirs) $(DESTDIR)$(man5dir) @list='$(man5_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.5*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst"; \ $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst; \ done uninstall-man5: @list='$(man5_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.5*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f $(DESTDIR)$(man5dir)/$$inst"; \ rm -f $(DESTDIR)$(man5dir)/$$inst; \ done install-man8: $(mkinstalldirs) $(DESTDIR)$(man8dir) @list='$(man8_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.8*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \ $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \ done uninstall-man8: @list='$(man8_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.8*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \ rm -f $(DESTDIR)$(man8dir)/$$inst; \ done install-man: $(MANS) @$(NORMAL_INSTALL) $(MAKE) install-man1 install-man5 install-man8 uninstall-man: @$(NORMAL_UNINSTALL) $(MAKE) uninstall-man1 uninstall-man5 uninstall-man8 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = man distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done install: install-man uninstall: uninstall-man installdirs: $(mkinstalldirs) $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man5 \ $(DESTDIR)$(mandir)/man8 mostlyclean: clean: distclean: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean: distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." solid-pop3d-0.15/man/spop3d.8 644 765 3173 6417 7077103554 10777 .\" -*-nroff-*- .\" .\" $Id: spop3d.8,v 1.1.1.1 2000/04/12 20:52:25 jurekb Exp $ .\" .\" Solid POP3 - a POP3 server .\" Copyright (C) 1999 Jerzy Balamut .\" .\" 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA .\" .\" .TH spop3d 8 "OCTOBER 1999" Unix "System Administrator's Manual" .SH NAME .PP spop3d \- The Solid POP3 Server .SH SYNOPSIS .PP .B spop3d [-rd] [-n \fImaildropfile\fP] [-t \fImaildroptype\fP] [-a \fItime\fP] [-f \fIconfigfile\fP] .SH DESCRIPTION .PP The Solid POP3 Server is an implementation of the Post Office Protocol server that has flexibility on mind. It has support for mailbox, maildir, APOP, bulletins and few other things. It can work as inetd or standalone server. See README for more details. .SH OPTIONS .PP .IP "-n \fImaildropfile\fP" Specify a maildrop file (or directory). The following strings beginning with .BR % character are recognized and replaced: .RS .TP .B %s replace it with user name .TP .B %dN replace it with N-th character of user name .TP .B %% replace it with single .BR % character .TP .B %m replace it with mapped user name (read VIRTUALS file) .PP If specified path is not absolute it is treated as relative to user home directory. For example: .I /var/mail/%d1/%d2/%s is expanded to .I /var/mail/j/u/jurekb\fP and .I Mail/bugtraq is expanded to .I /home/jurekb/Mail/bugtraq for "jurekb" user on my system. The default is .I /var/spool/mail/%s or .I Maildir when mailbox support is not compiled in. .RE .IP "-t \fImaildroptype\fP" Specify a maildrop type. .I mailbox and .I maildir are supported. The default is .I mailbox or .I maildir when mailbox support is not compiled in. .IP "-a \fItime\fP" Specify an autologout time. The following suffixes are recognized: .RS .TP .BR s the time is specified in seconds .TP .BR m the time is specified in minutes .TP .BR h the time is specified in hours .TP .BR d the time is specified in days .TP .BR w the time is specified in weeks .PP Seconds are used if no suffix is present. The default value is 2 minutes. .RE .IP "-f \fIconfigfile\fP" Specify a configuration file. The default is .I ${sysconfdir}/spop3d.conf .IP "-d" Set server into debugging mode. .IP "-r" Allow root login. This feature is disabled by default and shouldn't be used. .SH FILES .PP .IP "~/.spop3d" User configuration file. .IP "~/.spop3d-bull" This file is used by bulletin code to determine last bulletin received by user. .IP ${localstatedir}/bulletins" Bulletins directory. .IP ${sysconfdir}/spop3d.conf" Global configuration file. .SH SEE ALSO .PP .BR spop3d.conf (5), .BR pop_auth (1), .BR dot-spop3d (5), .SH AUTHOR Jerzy Balamut solid-pop3d-0.15/man/spop3d.conf.5 644 765 3173 16346 7103116762 11735 .\" -*-nroff-*- .\" .\" $Id: spop3d.conf.5,v 1.5 2000/04/28 16:58:55 jurekb Exp $ .\" .\" Solid POP3 - a POP3 server .\" Copyright (C) 1999 Jerzy Balamut .\" .\" 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA .\" .\" .TH spop3d.conf 5 "OCTOBER 1999" Unix "System Administrator's Manual" .SH NAME .PP spop3d.conf \- configuration data for The Solid POP3 Server. .SH DESCRIPTION .PP A configuration file consists of zero or more blocks. There are two kinds of these blocks: .I Global and \fIVirtualHost\fP. .I Global block begins with .B and ends with .B line. .I VirtualHost block begins with one of: .RS .TP .B .TP .B .TP .B .RE .PP lines, where .B xx.xx.xx.xx is an IPv4 (or IPv6) address and .B host.name.com is a virtual domain name (read VIRTUALS file). .I VirtualHost block ends with .B line. Each such block consists of zero or more options. Each option is specified in separate line and has 2 parts: option name and option argument, separated by a white space character (one or more). There are 4 types of options: .RS .TP .BR boolean its argument can be "yes" (or "true") and "no" (or "false") .TP .BR string its argument is string. String should be quoted (read the section \fBBUGS\fP). .TP .BR period its argument is number which can be followed by one of these suffixes: \fBs\fP (for seconds), \fBm\fP (for minutes), \fBh\fP (for hours), \fBd\fP (for days), \fBw\fP (for weeks). This argument specifies some period of time or some number. .TP .BR expire exactly the same as \fBperiod\fP, but its argument can also be \fInever\fP. .RE .PP Every text between \fB/*\fP and \fB*/\fP is treated as a comment and is ignored, unless it's inside quoted string. .PP Options from all .I Global and some .I VirtualHost (when their IPv4 (or IPv6) address is equal to socket address or their block virtual domain name is equal to virtual domain name specified by user) blocks are used. Options from left .I VirtualHost blocks are ignored. Configuration file is parsed two times, if user specify virtual domain name (read VIRTUALS file). .PP Following options are recognized: .RS .TP .B AllowRootLogin boolean Allow root login. It's disabled by default and shouldn't be changed. .TP .B UserOverride boolean Allow users specify their maildrops (path and type) and APOP secrets. It's enabled by default. .TP .B AllowAPOP boolean Users can authenticate themselves with APOP scheme. It's enabled by default. .TP .B MailDropName string Specify path to maildrop. The format is the same as for \fB-n\fP option in \fBspop3d\fP (8). Default value is .I /var/spool/mail/%s .TP .B MailDropType string Specify type of maildrop. The allowed values are \fImailbox\fP and \fImaildir\fP. Default value is \fImailbox\fP (or \fImaildir\fP if support for \fImailbox\fP isn't compiled in server). .TP .B APOPServerName string Specify the server name which is used for APOP authentication. Default value is a name obtained from gethostname() call. .TP .B AutoLogoutTime period Specify the autologout time. The server quit when client is idle for specified period. Default value is 2 minutes. .TP .B ChangeGID boolean If enabled server changes his GID to GID of logged user. It's enabled by default. .TP .B WrongCommandsLimit period Specify the limit of wrong commands. The server quit when this limit is exceeded. Limit is ignored when 0 is specified. Default value is 5. .TP .B ReadExpire expire Expire read (in this instance of daemon) messages that are older than \fBexpire\fP. Default value is \fInever\fP. .TP .B UnreadExpire expire Expire unread (in this instance of daemon) messages that are older than \fBexpire\fP. Default value is \fInever\fP. .TP .B DoMapping boolean If enabled mapping of user names (read VIRTUALS file) is allowed. Option is disabled by default. .TP .B UserMapFile string Specify path to user names mapping file (read VIRTUALS file). There is no default value. .TP .B AllowNonIP boolean If enabled user is allowed to specify virtual domain name in when logging. Read VIRTUALS file for details. Option is enabled by default. .TP .B UserBullFile string Specify path to user bulletin file (read the section BULLETINS in README). The format is the same as for \fB-n\fP option in \fBspop3d\fP (8). Default value is \fI.spop3d-bull\fP. .TP .B BulletinDirectory string Specify path to bulletin directory. Default value is ${localstatedir}/bulletins (/usr/local/var/bulletins). .TP .B LogPriority string Set logging facility and priority. Default value is local0.notice. Known facilities: daemon, local0, local1, ..., local7, mail, user. Known priorities: emerg, alert, crit, err, warning, notice, info, debug. facility or facility.priority combination are recognized. .TP .B AddBuletins boolean Server checks for new bulletins in BulletinDirectory if enabled. Option is enabled by default. .TP .B RequiredMapping boolean If DoMapping and RequiredMapping are enabled user _MUST_ have entry in user mapping file. If DoMapping is enabled and RequiredMapping is disabled user needn't have entry in user mapping file (no mapping is performed then). Option has no effect when DoMapping is disabled. Option is enabled by default. .TP .B LogStatistics boolean If enabled qpopper-like statistics are logged. At the end of each session username, number of deleted messages, size (in bytes) of deleted messages, number of messages left on server, size (in bytes) of messages left on server are logged. Option is enabled by default. .TP .B CreateMailDrop boolean If enabled maildrop (mailbox or maildir) will be created, when it doesn't exist. Option is disabled by default. .TP .RE .SH EXAMPLE .RS .nf LogPriority daemon.info AllowRootLogin yes MailDropName Maildir MailDropType maildir UserBullFile .spop3d-blurp /* It's just an example */ ReadExpire 0 UnreadExpire 2w LogPriority local0 UserMapFile /etc/pop3/192.168.1.1.mapping DoMapping true UnreadExpire never APOPServerName jakis.tam.host.w.pl MailDropName "/var/spool/mail/%s" /* It is a comment */ MailDropType mailbox AutoLogoutTime 5s UserOverride yes AllowAPOP yes ChangeGID true .fi .RE .SH WARNINGS .PP spop3d.conf should be readable by "spop3d" user!!! The server exits when syntax error occurs in a configuration file. If a configuration file doesn't exist (stat() failed), the server logs this fact only when in debugging mode. .SH FILES .IP "${sysconfdir}/spop3d.conf" Global configuration file. .SH SEE ALSO .PP .BR spop3d (8), .BR pop_auth (1), .BR dot-spop3d (5), .SH AUTHOR Jerzy Balamut solid-pop3d-0.15/man/dot-spop3d.5 644 765 3173 3736 7077103554 11561 .\" -*-nroff-*- .\" .\" $Id: dot-spop3d.5,v 1.1.1.1 2000/04/12 20:52:25 jurekb Exp $ .\" .\" Solid POP3 - a POP3 server .\" Copyright (C) 1999 Jerzy Balamut .\" .\" 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA .\" .\" .TH dot-spop3d 5 "OCTOBER 1999" Unix "User's Manual" .SH NAME .PP dot-spop3d \- user configuration data for The Solid POP3 Server. .SH DESCRIPTION .PP User can specify his maildrop (location and type) and APOP secret in ~/.spop3d configuration file. You must set right mode (0600 - -rw-------) for ~/.spop3d!!! Maildrop specification consists of 3 parts, separated by white space character: .TP \fIMailDrop\fP \fBpath type\fP .PP \fBPath\fP argument should be specified in the same format as \fI-n\fP option in .BR spop3d (8). \fBType\fP argument should be \fImailbox\fP or \fImaildir\fP. .PP APOP secret specification contains word \fIAPOPSecret\fP followed by encrypted secret. You shouldn't change this secret manually. Use .BR pop_auth (1) to do this. See .BR pop_auth (1) manual for more details on secret encryption!!! .SH EXAMPLE .RS .nf MailDrop Mail/bugtraq mailbox APOPSecret 0123456789 .fi .RE .SH FILES .IP "~/.spop3d" User configuration file. .SH SEE ALSO .PP .BR spop3d (8), .BR pop_auth (1), .BR spop3d.conf (5), .SH AUTHOR Jerzy Balamut solid-pop3d-0.15/man/pop_auth.1 644 765 3173 3100 7077103554 11361 .\" -*-nroff-*- .\" .\" $Id: pop_auth.1,v 1.1.1.1 2000/04/12 20:52:25 jurekb Exp $ .\" .\" Solid POP3 - a POP3 server .\" Copyright (C) 1999 Jerzy Balamut .\" .\" 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA .\" .\" .TH pop_auth 1 "OCTOBER 1999" Unix "User's Manual" .SH NAME .PP pop_auth \- set an user's APOP secret .SH SYNOPSIS .PP .B pop_auth .SH DESCRIPTION .PP .B Pop_auth asks user for his APOP secret and stores this secret after encryption in ~/.spop3d file. Used encryption is very weak and protects only from curious system administrator who accidentialy looks at ~/.spop3d file. Don't use your account password as the APOP secret!!! .SH OPTIONS No options are recognized. .SH FILES .IP "~/.spop3d" User configuration file. APOP secret is writed here. .SH SEE ALSO .PP .BR spop3d (8), .BR spop3d.conf (5), .BR dot-spop3d (5), .SH AUTHOR Jerzy Balamut solid-pop3d-0.15/src/ 755 765 3173 0 7107253245 7477 5solid-pop3d-0.15/src/Makefile.in 644 765 3173 14612 7077667320 11601 # Makefile.in generated automatically by automake 1.4a from Makefile.am # Modified by Jerzy Balamut # $Id: Makefile.in,v 1.3 2000/04/20 21:02:47 jurekb Exp $ # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ sysconfdir = @sysconfdir@ localstatedir = @localstatedir@ DESTDIR = top_builddir = .. INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_STRIP_FLAG = transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : APOP_O = @APOP_O@ STANDALONE_O = @STANDALONE_O@ SPOPLIBS = @SPOPLIBS@ CC = @CC@ CONFIGFILE_O = @CONFIGFILE_O@ MAILBOX_O = @MAILBOX_O@ MAILDIR_O = @MAILDIR_O@ PACKAGE = @PACKAGE@ POP_AUTH = @POP_AUTH@ USERCONFIG_O = @USERCONFIG_O@ VERSION = @VERSION@ sbin_PROGRAMS = spop3d bin_PROGRAMS = @POP_AUTH@ noinst_HEADERS = apop.h authenticate.h cmds.h configfile.h const.h fdfgets.h \ log.h mailbox.h maildir.h maildrop.h md5.h includes.h options.h response.h \ userconfig.h mapping.h spipv6.h spop3d_SOURCES = authenticate.c cmds.c log.c fdfgets.c maildrop.c main.c md5.c \ memops.c options.c response.c vsnprintf.c EXTRA_spop3d_SOURCES = apop.c mailbox.c maildir.c userconfig.c configfile.c \ standalone.c mapping.c spop3d_DEPENDENCIES = @APOP_O@ @MAILBOX_O@ @MAILDIR_O@ @USERCONFIG_O@ \ @CONFIGFILE_O@ @STANDALONE_O@ @MAPPING_O@ spop3d_LDADD = @APOP_O@ @MAILBOX_O@ @MAILDIR_O@ @USERCONFIG_O@ @CONFIGFILE_O@ \ @STANDALONE_O@ @MAPPING_O@ @SPOPLIBS@ pop_auth_SOURCES = pop_auth.c fdfgets.c vsnprintf.c CLEANFILES = pop_auth mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) DEFS = @DEFS@ -DDEFCONFIGFILENAME=\"$(sysconfdir)/spop3d.conf\" \ -DBULLDIR=\"$(localstatedir)/bulletins/\" -I. -I$(srcdir) -I.. LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ pop_auth_OBJECTS = pop_auth.o fdfgets.o vsnprintf.o spop3d_OBJECTS = authenticate.o cmds.o log.o fdfgets.o maildrop.o main.o \ md5.o memops.o options.o response.o vsnprintf.o CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(CFLAGS) $(LDFLAGS) -o $@ HEADERS = $(noinst_HEADERS) DIST_COMMON = Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(EXTRA_DIST) SOURCES = $(pop_auth_SOURCES) $(spop3d_SOURCES) $(EXTRA_spop3d_SOURCES) OBJECTS = $(pop_auth_OBJECTS) $(spop3d_OBJECTS) all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .o .s clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) distclean-binPROGRAMS: maintainer-clean-binPROGRAMS: install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) list='$(bin_PROGRAMS)'; for p in $$list; do \ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ done clean-sbinPROGRAMS: -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) distclean-sbinPROGRAMS: maintainer-clean-sbinPROGRAMS: install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(sbindir) @list='$(sbin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ else :; fi; \ done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) list='$(sbin_PROGRAMS)'; for p in $$list; do \ rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ done .c.o: $(COMPILE) -c $< .s.o: $(COMPILE) -c $< .S.o: $(COMPILE) -c $< clean-compile: -rm -f *.o core *.core distclean-compile: -rm -f *.tab.c maintainer-clean-compile: pop_auth: $(pop_auth_OBJECTS) $(pop_auth_DEPENDENCIES) @rm -f pop_auth $(LINK) $(pop_auth_OBJECTS) $(LIBS) spop3d: $(spop3d_OBJECTS) $(spop3d_DEPENDENCIES) @rm -f spop3d $(LINK) $(spop3d_OBJECTS) $(spop3d_LDADD) $(LIBS) distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = src distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done install-exec: install-binPROGRAMS install-sbinPROGRAMS install: all install-exec uninstall: uninstall-binPROGRAMS uninstall-sbinPROGRAMS all-redirect: Makefile $(PROGRAMS) $(HEADERS) installdirs: $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-binPROGRAMS clean-sbinPROGRAMS clean-compile \ clean-generic distclean: distclean-binPROGRAMS distclean-sbinPROGRAMS \ distclean-compile distclean-generic \ clean maintainer-clean: maintainer-clean-binPROGRAMS \ maintainer-clean-sbinPROGRAMS maintainer-clean-compile \ maintainer-clean-generic distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." solid-pop3d-0.15/src/pop_auth.c 644 765 3173 16115 7103116765 11507 static const char rcsid[] = "$Id: pop_auth.c,v 1.2 2000/04/28 16:58:55 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "includes.h" #include #include #ifdef TIME_WITH_SYS_TIME #include #include #else #ifdef HAVE_SYS_TIME_H #include #else #include #endif #endif #include #include #include #include #include "const.h" #include "maildrop.h" #include "fdfgets.h" int main(int argc, char **argv) { int fd, md_set = 0, linenr, fret; ssize_t tmp; struct passwd *pwentry; char username[9]; char *pass; char passcopy[MAXARGLN + 1]; char txtbuff[256], buf[128]; struct rlimit corelimit = {0, 0}; char cfgfile[PATH_MAX]; struct stat stbuf; char *tmp2; char tmpmaildrop_type[MAXMDTYPENAMELENGTH], tmpmaildrop_name[PATH_MAX]; static char digits[] = "0123456789abcdef"; if (setrlimit(RLIMIT_CORE, &corelimit) < 0) { perror("setrlimit"); return 1; }; if ((pwentry = getpwuid(getuid())) == NULL) { fprintf(stderr, "can't find user with UID: %u\n", getuid()); return 1; }; username[0] = 0; strncat(username, pwentry->pw_name, 8); if (strlen(pwentry->pw_name) > 8) fprintf(stderr, "Warning: username truncated\n"); snprintf(txtbuff, sizeof(txtbuff), "Enter NEW password for user %.40s: ", username); pass = getpass(txtbuff); passcopy[0] = 0; strncat(passcopy, pass, sizeof(passcopy) - 1); memset(pass, 0, strlen(pass)); snprintf(txtbuff, sizeof(txtbuff), "Reenter NEW password for user %.40s: ", username); pass = getpass(txtbuff); fret = strcmp(pass, passcopy); memset(pass, 0, strlen(pass)); if (fret != 0) { memset(passcopy, 0, strlen(passcopy)); fprintf(stderr, "Passwords don't match\n"); return 1; }; if (stat(pwentry->pw_dir, &stbuf) < 0) { memset(passcopy, 0, strlen(passcopy)); fprintf(stderr, "can't stat user home directory: %.1024s", pwentry->pw_dir); perror("stat"); return 1; }; if (stbuf.st_mode & 2) { memset(passcopy, 0, strlen(passcopy)); fprintf(stderr, "user home directory is world writable"); return 1; }; if ((strlen(pwentry->pw_dir) + strlen(USERCFG) + 2) > sizeof(cfgfile)) { memset(passcopy, 0, strlen(passcopy)); fprintf(stderr, "home directory name too long"); return 1; }; strcpy(cfgfile, pwentry->pw_dir); strcat(cfgfile, "/"); strcat(cfgfile, USERCFG); if ((fd = open(cfgfile, O_RDWR | O_CREAT, 0600)) < 0) { memset(passcopy, 0, strlen(passcopy)); fprintf(stderr, "can't open user config file"); perror("open"); return 1; }; if (fstat(fd, &stbuf) < 0) { memset(passcopy, 0, strlen(passcopy)); close(fd); fprintf(stderr, "can't stat user config file"); perror("fstat"); return 1; }; if (!S_ISREG(stbuf.st_mode)) { memset(passcopy, 0, strlen(passcopy)); close(fd); fprintf(stderr, "user config file is not regular file"); return 1; }; if (stbuf.st_mode & 0177) { memset(passcopy, 0, strlen(passcopy)); close(fd); fprintf(stderr, "user config file has wrong mode"); return 1; }; fd_initfgets(); linenr = 0; while (1) { linenr++; if ((tmp = fd_fgets(buf, sizeof(buf), fd)) < 0) { memset(passcopy, 0, strlen(passcopy)); close(fd); fprintf(stderr, "can't read user config file"); perror("read"); return 1; }; if (tmp == 0) break; if ((tmp == sizeof(buf)) && (buf[sizeof(buf) - 1] != '\n')) { memset(passcopy, 0, strlen(passcopy)); close(fd); fprintf(stderr, "line too long in user config file"); return 1; }; if ((tmp == 1) && (buf[0] == '\n')) continue; if (buf[tmp - 1] == '\n') buf[tmp - 1] = 0; strtok(buf, " \t"); if (strcasecmp(buf, "maildrop") == 0) { if (md_set == 1) { memset(passcopy, 0, strlen(passcopy)); close(fd); fprintf(stderr, "maildrop already set in user config file"); return 1; }; if ((tmp2 = strtok(NULL, " \t")) == NULL) { memset(passcopy, 0, strlen(passcopy)); close(fd); fprintf(stderr, "argument missing in maildrop declaration in user config file, line: %u", linenr); return 1; }; if (strlen(tmp2) >= sizeof(tmpmaildrop_name)) { memset(passcopy, 0, strlen(passcopy)); close(fd); fprintf(stderr, "maildrop file name in user config file is too long"); return 1; }; strcpy(tmpmaildrop_name, tmp2); if ((tmp2 = strtok(NULL, " \t")) == NULL) { memset(passcopy, 0, strlen(passcopy)); close(fd); fprintf(stderr, "argument missing in maildrop declaration in user config file, line: %u", linenr); return 1; }; if (strlen(tmp2) >= sizeof(tmpmaildrop_type)) { memset(passcopy, 0, strlen(passcopy)); close(fd); fprintf(stderr, "maildrop type in user config file is too long"); return 1; }; #ifdef MDMAILBOX if (strcasecmp(tmp2, "mailbox") != 0) #endif #ifdef MDMAILDIR if (strcasecmp(tmp2, "maildir") != 0) #endif { memset(passcopy, 0, strlen(passcopy)); close(fd); fprintf(stderr, "no such maildrop type: %.40s", tmp2); return 1; }; strcpy(tmpmaildrop_type, tmp2); md_set = 1; continue; }; if (strcasecmp(buf, "APOPSecret") == 0) continue; memset(passcopy, 0, strlen(passcopy)); close(fd); fprintf(stderr, "unknown option name, line: %u", linenr); return 1; }; if (lseek(fd, 0, SEEK_SET) < 0) { memset(passcopy, 0, strlen(passcopy)); close(fd); perror("lseek"); return 1; }; if (md_set == 1) { snprintf(txtbuff, sizeof(txtbuff), "MailDrop %.100s %.100s\n", tmpmaildrop_name, tmpmaildrop_type); if (write(fd, txtbuff, strlen(txtbuff)) < 0) { memset(passcopy, 0, strlen(passcopy)); close(fd); perror("write"); return 1; }; }; memset(txtbuff, 0, sizeof(txtbuff)); strcpy(txtbuff, "APOPSecret "); tmp2 = txtbuff + strlen(txtbuff); for (tmp = 0; tmp < strlen(passcopy); tmp++) { passcopy[tmp] ^= 0xff; tmp2[tmp * 2] = digits[(passcopy[tmp] >> 4) & 0x0f]; tmp2[(tmp * 2) + 1] = digits[passcopy[tmp] & 0x0f]; }; memset(passcopy, 0, strlen(passcopy)); strcat(txtbuff, "\n"); if (write(fd, txtbuff, strlen(txtbuff)) < 0) { memset(txtbuff, 0, strlen(txtbuff)); close(fd); perror("write"); return 1; }; memset(txtbuff, 0, strlen(txtbuff)); if ((tmp = lseek(fd, 0, SEEK_CUR)) < 0) { close(fd); perror("lseek"); return 1; }; if (ftruncate(fd, tmp) < 0) { close(fd); perror("ftruncate"); return 1; }; if (close(fd) < 0) { perror("close"); return 1; }; return 0; } solid-pop3d-0.15/src/fdfgets.c 644 765 3173 4255 7103116764 11273 static const char rcsid[] = "$Id: fdfgets.c,v 1.2 2000/04/28 16:58:55 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "includes.h" #include "fdfgets.h" char fgets_buf[10240], *fgets_where; size_t fgets_count, fgets_empty; void fd_initfgets(void) { fgets_count = fgets_empty = 0; fgets_where = fgets_buf; } ssize_t fd_fgets(char *s, size_t size, int fd) { size_t tmp, tmp2; ssize_t cread; char *newline; tmp = 0; tmp2 = ((size < fgets_count) ? size : fgets_count); newline = NULL; if (size > sizeof(fgets_buf)) return -1; /* FIXME */ if ((tmp2 == 0) || ((newline = memchr(fgets_where, '\n', tmp2)) == NULL)) { tmp = tmp2; if (tmp > 0) { memcpy(s, fgets_where, tmp); fgets_count -= tmp; fgets_empty += tmp; }; if (fgets_count == 0) { fgets_where = fgets_buf; fgets_empty = 0; } else fgets_where = fgets_buf + fgets_empty; if (tmp == size) return size; size -= tmp; fgets_empty = 0; fgets_where = fgets_buf; if ((cread = read(fd, fgets_buf, sizeof(fgets_buf))) < 0) return -1; fgets_count = cread; if (fgets_count == 0) return tmp; }; if (size > fgets_count) size = fgets_count; if (newline == NULL) newline = memchr(fgets_where, '\n', size); if (newline != NULL) size = newline - fgets_where + 1; memcpy(s + tmp, fgets_where, size); fgets_count -= size; fgets_empty += size; fgets_where = fgets_buf + fgets_empty; return size + tmp; } solid-pop3d-0.15/src/vsnprintf.c 644 765 3173 15400 7077667324 11731 static const char rcsid[] = "$Id: vsnprintf.c,v 1.1 2000/04/20 21:02:47 jurekb Exp $"; /* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ /* Included from ProFTPd 1.2.0pre10. Modified by Jerzy Balamut All bugs introduced probably by me (jurekb) */ #include "includes.h" #if !defined(HAVE_VSNPRINTF) || !defined(HAVE_SNPRINTF) static size_t strnlen(const char *s, size_t count) { const char *sc; for(sc = s; count-- && *sc != '\0'; ++sc) ; return sc - s; } static int skip_atoi(const char **s) { int i = 0; while(isdigit(**s)) i = i * 10 + *((*s)++) - '0'; return i; } #define ZEROPAD 1 #define SIGN 2 #define PLUS 4 #define SPACE 8 #define LEFT 16 #define SPECIAL 32 #define LARGE 64 static char *number(char *str, long num, int base, int size, int precision, int type, size_t *max_size) { char c,sign,tmp[66]; const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; int i; size_t msize; msize = *max_size; if(type & LARGE) digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if(type & LEFT) type &= ~ZEROPAD; if(base < 2 || base > 36) return 0; c = (type & ZEROPAD) ? '0' : ' '; sign = 0; if(type & SIGN) { if(num < 0) { sign = '-'; num = -num; size--; } else if(type & PLUS) { sign = '+'; size--; } else if(type & SPACE) { sign = ' '; size--; } } if(type & SPECIAL) { if(base == 16) size -= 2; else if(base == 8) size--; } i = 0; if(num == 0) tmp[i++] = '0'; else while(num != 0) { tmp[i++] = digits[((unsigned long) num) % (unsigned) base]; num /= base; } if(i > precision) precision = i; size -= precision; if(!(type & (ZEROPAD+LEFT))) while(size-- > 0 && msize) { *str++ = ' '; msize--; } if(sign && msize) { *str++ = sign; msize--; } if(msize) { if(type & SPECIAL) if(base == 8) { *str++ = '0'; msize--; } else if(base == 16) { *str++ = '0'; msize--; if(msize) { *str++ = digits[33]; msize--; } } } if(!(type & LEFT)) while(size-- > 0 && msize) { *str++ = c; msize--; } while(i < precision-- && msize) { *str++ = '0'; msize--; } while(i-- > 0 && msize) { *str++ = tmp[i]; msize--; } while(size-- > 0 && msize) { *str++ = ' '; msize--; } *max_size = msize; return str; } int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) { int len; unsigned long num; int i, base; char *str; const char *s; int flags; int field_width; int precision; int qualifier; size--; for(str = buf; *fmt && size; ++fmt) { if(*fmt != '%') { *str++ = *fmt; size--; continue; } flags = 0; repeat: ++fmt; switch(*fmt) { case '-': flags |= LEFT; goto repeat; case '+': flags |= PLUS; goto repeat; case ' ': flags |= SPACE; goto repeat; case '#': flags |= SPECIAL; goto repeat; case '0': flags |= ZEROPAD; goto repeat; } field_width = -1; if(isdigit(*fmt)) field_width = skip_atoi(&fmt); else if(*fmt == '*') { ++fmt; field_width = va_arg(args,int); if(field_width < 0) { field_width = - field_width; flags |= LEFT; } } precision = -1; if(*fmt == '.') { ++fmt; if(isdigit(*fmt)) precision = skip_atoi(&fmt); else if(*fmt == '*') { ++fmt; precision = va_arg(args,int); } if(precision < 0) precision = 0; } qualifier = -1; if(*fmt == 'h' || *fmt == 'l' || *fmt == 'L') { qualifier = *fmt; ++fmt; } base = 10; switch(*fmt) { case 'c': if(!(flags & LEFT)) while(--field_width > 0 && size) { *str++ = ' '; size--; } if(size) { *str++ = (unsigned char)va_arg(args,int); size--; } while(--field_width > 0 && size) { *str++ = ' '; size--; } continue; case 's': s = va_arg(args,char*); if(!s) s = "(null)"; len = strnlen(s, precision); if(!(flags & LEFT)) while(len < field_width-- && size) { *str++ = ' '; size--; } for(i = 0; i < len && size; ++i) { *str++ = *s++; size--; } while(len < field_width-- && size) { *str++ = ' '; size--; } continue; case 'p': if(field_width == -1) { field_width = 2 * sizeof(void*); flags |= ZEROPAD; } str = number(str, (unsigned long)va_arg(args,void*),16, field_width, precision, flags, &size); continue; case 'n': if(qualifier == 'l') { long *ip = va_arg(args,long*); *ip = (str - buf); } else { int *ip = va_arg(args,int*); *ip = (str - buf); } continue; case 'o': base = 8; break; case 'X': flags |= LARGE; case 'x': base = 16; break; case 'd': case 'i': flags |= SIGN; case 'u': break; default: if(*fmt != '%') *str++ = '%'; if(*fmt && size) { *str++ = *fmt; size--; } else --fmt; continue; } if(qualifier == 'l') num = va_arg(args,unsigned long); else if(qualifier == 'h') { if(flags & SIGN) num = va_arg(args,short); else num = va_arg(args,unsigned short); } else if(flags & SIGN) num = va_arg(args,int); else num = va_arg(args, unsigned int); str = number(str,num,base,field_width,precision,flags,&size); } *str = '\0'; return str - buf; } #ifndef HAVE_SNPRINTF int snprintf(char *buf, size_t size, const char *fmt, ...) { va_list args; int i; va_start(args,fmt); i = vsnprintf(buf,size,fmt,args); va_end(args); return i; } #endif /* HAVE_SNPRINTF */ #endif /* HAVE_VSNPRINTF */ solid-pop3d-0.15/src/authenticate.c 644 765 3173 22301 7103116763 12336 static const char rcsid[] = "$Id: authenticate.c,v 1.3 2000/04/28 16:58:55 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Code from this file works with root privileges */ #include "includes.h" #include #ifdef HAVE_PAM #include #else /* HAVE_PAM */ #ifdef HAVE_ETC_SHADOW #include extern char *crypt(const char *key, const char *salt); #else /* HAVE_ETC_SHADOW */ #ifdef HAVE_SCO_ETC_SHADOW #include #include #include #else /* HAVE_SCO_ETC_SHADOW */ #ifdef HAVE_HPUX_TCB_AUTH #include #include #else /* HAVE_HPUX_TCB_AUTH */ #ifdef HAVE_ETC_SECURITY_PASSWD_ADJUNCT #include #include #include extern char *crypt(const char *key, const char *salt); #else /* HAVE_ETC_SECURITY_PASSWD_ADJUNCT */ #ifdef HAVE_ULTRIX_SHADOW_PASSWORDS #include #include #else /* HAVE_ULTRIX_SHADOW_PASSWORDS */ extern char *crypt(const char *key, const char *salt); #endif /* HAVE_ULTRIX_SHADOW_PASSWORDS */ #endif /* HAVE_ETC_SECURITY_PASSWD_ADJUNCT */ #endif /* HAVE_HPUX_TCB_AUTH */ #endif /* HAVE_SCO_ETC_SHADOW */ #endif /* HAVE_ETC_SHADOW */ #endif /* HAVE_PAM */ #include "authenticate.h" #include "const.h" #include "log.h" #include extern ssize_t write_loop(int, void *, size_t); #ifdef HAVE_PAM void freeresp(int numresp, struct pam_response *resp) { int respcount; for (respcount = 0; respcount < numresp; respcount++) if (resp[respcount].resp != NULL) free(resp[respcount].resp); free(resp); } int pconv(int num_msg, const struct pam_message **msg, struct pam_response **result, void *appdata_ptr) { int acount; struct pam_response *resp; resp = (struct pam_response *) calloc(num_msg, sizeof(struct pam_response)); if (resp == NULL) return PAM_CONV_ERR; for (acount = 0; acount < num_msg; acount++) switch (msg[acount]->msg_style) { case PAM_PROMPT_ECHO_OFF: resp[acount].resp = strdup(((char **)appdata_ptr)[1]); if (resp[acount].resp == NULL) { freeresp(acount, resp); return PAM_CONV_ERR; }; resp[acount].resp_retcode = PAM_SUCCESS; break; case PAM_PROMPT_ECHO_ON: resp[acount].resp = strdup(((char **)appdata_ptr)[0]); if (resp[acount].resp == NULL) { freeresp(acount, resp); return PAM_CONV_ERR; }; resp[acount].resp_retcode = PAM_SUCCESS; break; case PAM_TEXT_INFO: case PAM_ERROR_MSG: resp[acount].resp_retcode = PAM_SUCCESS; resp[acount].resp = NULL; break; default: freeresp(acount, resp); return PAM_CONV_ERR; }; *result = resp; return PAM_SUCCESS; } int _sp_authenticate_user(char *ausername, char *apassword) { pam_handle_t *pamhandle; char *app_data[2]; struct pam_conv pamconv = {&pconv, &app_data}; app_data[0] = ausername; app_data[1] = apassword; if (pam_start(SERVICE_NAME, ausername, &pamconv, &pamhandle) != PAM_SUCCESS) return -1; if (pam_authenticate(pamhandle, 0) != PAM_SUCCESS) { pam_end(pamhandle, PAM_SUCCESS); return -1; }; if (pam_acct_mgmt(pamhandle, 0) != PAM_SUCCESS) { pam_end(pamhandle, PAM_SUCCESS); return -1; }; if (pam_setcred(pamhandle, PAM_ESTABLISH_CRED) != PAM_SUCCESS) { pam_end(pamhandle, PAM_SUCCESS); return -1; }; pam_end(pamhandle, PAM_SUCCESS); return 0; } #else /* HAVE_PAM */ #if defined(_AIX) && defined(HAVE_AUTHENTICATE) int _sp_authenticate_user(char *ausername, char *apassword) { char *message = NULL; int reenter = 1; if (authenticate(ausername, apassword, &reenter, &message) == 0) return 0; if (message != NULL) pop_log(pop_priority, "auth: %.200s", message); return -1; }; #else /* defined(_AIX) && defined(HAVE_AUTHENTICATE) */ int _sp_authenticate_user(char *ausername, char *apassword) { #ifdef HAVE_ETC_SHADOW struct spwd *sp; #else /* HAVE_ETC_SHADOW */ #if defined(HAVE_SCO_ETC_SHADOW) || defined(HAVE_HPUX_TCB_AUTH) struct pr_passwd *pr; #else /* defined(HAVE_SCO_ETC_SHADOW) || defined(HAVE_HPUX_TCB_AUTH) */ #ifdef HAVE_ETC_SECURITY_PASSWD_ADJUNCT struct passwd_adjunct *sp; #else /* HAVE_ETC_SECURITY_PASSWD_ADJUNCT */ #ifdef HAVE_ULTRIX_SHADOW_PASSWORDS struct svcinfo *svp; #endif /* HAVE_ULTRIX_SHADOW_PASSWORDS */ #endif /* HAVE_ETC_SECURITY_PASSWD_ADJUNCT */ #endif /* defined(HAVE_SCO_ETC_SHADOW) || defined(HAVE_HPUX_TCB_AUTH) */ #endif /* HAVE_ETC_SHADOW */ char correct_passwd[128]; char *encrypted_passwd; struct passwd *pwentry; if ((pwentry = getpwnam(ausername)) == NULL) { pop_log(pop_priority, "auth: getpwnam() failed"); return -1; }; if (strcmp(pwentry->pw_passwd, "") == 0) { pop_log(pop_priority, "auth: null password entry in password file, user: %.40s", ausername); return -1; }; correct_passwd[0] = 0; if (strlen(pwentry->pw_passwd) != 1) strncat(correct_passwd, pwentry->pw_passwd, sizeof(correct_passwd) - 1); else { #ifdef HAVE_ETC_SHADOW if ((sp = getspnam(ausername)) == NULL) { endspent(); pop_log(pop_priority, "auth: getspnam() failed"); return -1; }; correct_passwd[0] = 0; strncat(correct_passwd, sp->sp_pwdp, sizeof(correct_passwd) - 1); endspent(); #else /* HAVE_ETC_SHADOW */ #if defined(HAVE_SCO_ETC_SHADOW) || defined(HAVE_HPUX_TCB_AUTH) if ((pr = getprpwnam(ausername)) == NULL) { endprpwent(); pop_log(pop_priority, "auth: getprpwnam() failed"); return -1; }; correct_passwd[0] = 0; strncat(correct_passwd, pr->ufld.fd_encrypt, sizeof(correct_passwd) - 1); endprpwent(); #else /* defined(HAVE_SCO_ETC_SHADOW) || defined(HAVE_HPUX_TCB_AUTH) */ #ifdef HAVE_ETC_SECURITY_PASSWD_ADJUNCT if ((sp = getpwanam(ausername)) == NULL) { endpwaent(); pop_log(pop_priority, "auth: getpwanam() failed"); return -1; }; correct_passwd[0] = 0; strncat(correct_passwd, sp->pwa_passwd, sizeof(correct_passwd) - 1); endpwaent(); #else /* HAVE_ETC_SECURITY_PASSWD_ADJUNCT */ #ifdef HAVE_ULTRIX_SHADOW_PASSWORDS if ((svp = getsvc()) == NULL) { pop_log(pop_priority, "auth: getsvc() failed"); return -1; }; if (((svp->svcauth.seclevel == SEC_UPGRADE) && (strcmp(pwentry->pw_passwd, "*") == 0)) || (svp->svcauth.seclevel == SEC_ENHANCED)) return ((authenticate_user(pwentry, apassword, "/dev/ttypXX") >= 0) ? 0 : -1); pop_log(pop_priority, "auth: can't authenticate user"); return -1; #else /* HAVE_ULTRIX_SHADOW_PASSWORDS */ pop_log(pop_priority, "auth: no shadow password handling compiled in server"); return -1; #endif /* HAVE_ULTRIX_SHADOW_PASSWORDS */ #endif /* HAVE_ETC_SECURITY_PASSWD_ADJUNCT */ #endif /* defined(HAVE_SCO_ETC_SHADOW) || defined(HAVE_HPUX_TCB_AUTH) */ #endif /* HAVE_ETC_SHADOW */ }; if (strcmp(correct_passwd, "") == 0) { pop_log(pop_priority, "auth: null password entry in shadow file"); return -1; }; #if defined(HAVE_SCO_ETC_SHADOW) || defined (HAVE_HPUX_TCB_AUTH) if (correct_passwd[0] && correct_passwd[1]) encrypted_passwd = bigcrypt(apassword, correct_passwd); else encrypted_passwd = bigcrypt(apassword, "xx"); #else /* defined(HAVE_SCO_ETC_SHADOW) || defined (HAVE_HPUX_TCB_AUTH) */ if (correct_passwd[0] && correct_passwd[1]) encrypted_passwd = crypt(apassword, correct_passwd); else encrypted_passwd = crypt(apassword, "xx"); #endif /* defined(HAVE_SCO_ETC_SHADOW) || defined (HAVE_HPUX_TCB_AUTH) */ return ((strcmp(encrypted_passwd, correct_passwd) == 0) ? 0 : -1); } #endif /* defined(_AIX) && defined(HAVE_AUTHENTICATE) */ #endif /* HAVE_PAM */ extern ssize_t read_loop(int, void *, size_t); int sp_authenticate_user(char *ausername, char *apassword) { #ifdef HAVE_PAM int tmp2; tmp2 = _sp_authenticate_user(ausername, apassword); memset(apassword, 0, strlen(apassword)); return tmp2; } #else int tunnel[2], tmp2; if (pipe(tunnel) < 0) { pop_error("auth: pipe"); return -1; }; switch (fork()) { case -1: pop_error("auth: fork"); return -1; case 0: /* child process */ close(tunnel[0]); tmp2 = (_sp_authenticate_user(ausername, apassword) == 0) ? 1 : 0; memset(apassword, 0, strlen(apassword)); if (write_loop(tunnel[1], &tmp2, sizeof(tmp2)) != sizeof(tmp2)) { pop_error("auth: write"); close(tunnel[1]); exit(1); }; exit(0); default: ; }; close(tunnel[1]); memset(apassword, 0, strlen(apassword)); if (read_loop(tunnel[0], &tmp2, sizeof(tmp2)) != sizeof(tmp2)) { close(tunnel[0]); wait(NULL); pop_error("auth: read"); return -1; }; close(tunnel[0]); wait(NULL); if ((tmp2 != 0) && (tmp2 != 1)) { pop_log(pop_priority, "auth: child process corupted"); return -1; }; return ((tmp2 == 1) ? 0 : -1); } #endif /* HAVE_PAM */ solid-pop3d-0.15/src/cmds.c 644 765 3173 3375 7103116763 10600 static const char rcsid[] = "$Id: cmds.c,v 1.2 2000/04/28 16:58:55 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "includes.h" #include "cmds.h" #include "response.h" extern void check_wccount(void); char upcase(char what) { /* * toupper() uses locale so is slower */ if ((what <= 'z') && (what >= 'a')) return what - ('a' - 'A'); else return what; } const struct s_cmd * cmd_lookup(const struct s_cmd *cmdtbl, char *cmd) { int actual = 0, length, tmp; while (cmdtbl[actual].name != NULL) { length = strlen(cmdtbl[actual].name); if (strlen(cmd) < length) { actual++; continue; }; tmp = 0; while (cmdtbl[actual].name[tmp] == upcase(cmd[tmp])) tmp++; if ((tmp > length) || ((tmp == length) && (cmd[length] == ' '))) return &cmdtbl[actual]; actual++; }; return NULL; } void ignore_cmd(char *arg) { send_ok("command ignored"); } void not_implemented(char *arg) { send_error("command not implemented yet"); check_wccount(); } solid-pop3d-0.15/src/log.c 644 765 3173 6363 7103116764 10434 static const char rcsid[] = "$Id: log.c,v 1.3 2000/04/28 16:58:55 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Code from this file sometimes works with root privileges */ #include "includes.h" #include #include #include #include "log.h" struct log_struct { char *name; int num; }; const struct log_struct log_facilities[] = { {"daemon", LOG_DAEMON}, {"local0", LOG_LOCAL0}, {"local1", LOG_LOCAL1}, {"local2", LOG_LOCAL2}, {"local3", LOG_LOCAL3}, {"local4", LOG_LOCAL4}, {"local5", LOG_LOCAL5}, {"local6", LOG_LOCAL6}, {"local7", LOG_LOCAL7}, {"mail", LOG_MAIL}, {"user", LOG_USER}, {NULL, 0} }; const struct log_struct log_priorities[] = { {"emerg", LOG_EMERG}, {"alert", LOG_ALERT}, {"crit", LOG_CRIT}, {"err", LOG_ERR}, {"warning", LOG_WARNING}, {"notice", LOG_NOTICE}, {"info", LOG_INFO}, {"debug", LOG_DEBUG}, {NULL, 0} }; int pop_debug = 0; int pop_facility = POP_FACILITY; int pop_priority = POP_PRIORITY; char logpriority[64]; void pop_openlog(void) { openlog(POP_IDENT, LOG_PID, pop_facility); } void pop_closelog() { closelog(); } void pop_log(int priority, const char *format, ...) { char tmp[1536]; va_list lst; va_start(lst, format); vsnprintf(tmp, sizeof(tmp), format, lst); va_end(lst); syslog(priority, "%s", tmp); } void pop_log_dbg(int priority, const char *format, ...) { char tmp[1536]; va_list lst; if (!pop_debug) return; va_start(lst, format); vsnprintf(tmp, sizeof(tmp), format, lst); va_end(lst); syslog(priority, "%s", tmp); } void pop_error(const char *name) { pop_log(pop_priority, "%.200s: %.200s", name, strerror(errno)); } void pop_error_dbg(const char *name) { if (pop_debug) pop_error(name); } int search_log_struct(char *name, const struct log_struct table[]) { int i = 0; while ((table[i].name != NULL)) { if (strcasecmp(table[i].name, name) == 0) break; i++; }; return (table[i].name == NULL) ? -1 : table[i].num; } int check_logpriority(void *priority) { char *tmp; int tmp_facility = pop_facility, tmp_priority = pop_priority; if ((tmp = strchr((char *) priority, '.')) != NULL) { *tmp = 0; tmp++; }; if ((tmp_facility = search_log_struct((char *) priority, \ log_facilities)) < 0) return -1; if (tmp) if ((tmp_priority = search_log_struct(tmp, \ log_priorities)) < 0) return -1; pop_priority = tmp_priority; if (pop_facility != tmp_facility) { pop_facility = tmp_facility; pop_closelog(); pop_openlog(); }; return 0; } solid-pop3d-0.15/src/maildrop.c 644 765 3173 24003 7103116764 11471 static const char rcsid[] = "$Id: maildrop.c,v 1.3 2000/04/28 16:58:55 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "cmds.h" #include "includes.h" #include "const.h" #include "maildrop.h" #ifdef MDMAILBOX #include "mailbox.h" extern struct str_maildrop mb_maildrop; #endif #ifdef MDMAILDIR #include "maildir.h" extern struct str_maildrop mdir_maildrop; #endif #include "log.h" #include "fdfgets.h" #include #include #include extern void check_wccount(void); struct message *messages = NULL; char *specific = NULL; int msgnr, msgdel = 0, maxmsgnr; extern char maildrop_name[]; extern char username[]; struct str_maildrop_name maildrops[] = { #ifdef MDMAILBOX {"mailbox", &mb_maildrop}, #endif #ifdef MDMAILDIR {"maildir", &mdir_maildrop}, #endif {NULL, NULL} }; struct str_maildrop *find_maildrop(char *name) { int tmp = 0; while (maildrops[tmp].name != NULL) if (strcasecmp(maildrops[tmp++].name, name) == 0) break; return (strcasecmp(maildrops[tmp - 1].name, name) == 0) ? (maildrops[tmp - 1].mdrop) : NULL; } int md_alloc(int size) { int tmp; if ((messages = (struct message *) malloc(sizeof(struct message) * 100)) == NULL) return -1; if ((specific = ((char *)malloc(size * 100))) == NULL) return -1; maxmsgnr = 100; msgnr = 0; for (tmp = 0; tmp < 100; tmp++) { messages[tmp].md_specific = specific + (tmp * size); memset(messages[tmp].md_specific, 0, size); }; return 0; } int md_realloc(int size) { struct message *tmp; char *tmp2; int tmp3; if (msgnr < maxmsgnr) return 0; maxmsgnr += 100; if (maxmsgnr > MAXMSGNR) return -1; if ((tmp = (struct message *) realloc(messages, maxmsgnr * sizeof(struct message))) == NULL) return -1; messages = tmp; if ((tmp2 = ((char *)realloc(specific, maxmsgnr * size))) == NULL) return -1; specific = tmp2; for (tmp3 = 0; tmp3 < maxmsgnr; tmp3++) { messages[tmp3].md_specific = specific + (tmp3 * size); if (tmp3 >= msgnr) memset(messages[tmp3].md_specific, 0, size); }; return 0; } void md_free(void) { if (messages) free(messages); if (specific) free(specific); } void md_stat(void) { int tmp, totalmsgs = msgnr - msgdel; size_t totalsize = 0; for (tmp = 0; tmp < msgnr; tmp++) if (!messages[tmp].deleted) totalsize += messages[tmp].crlfsize; send_ok("%u %u", totalmsgs, totalsize); } void md_reset(void) { int tmp; for (tmp = 0; tmp < msgnr; tmp++) messages[tmp].deleted = 0; msgdel = 0; send_ok("all messages unmarked"); } void md_delete(unsigned int nr) { if (nr > msgnr) { send_error("no such message"); check_wccount(); return; }; if (messages[--nr].deleted) { send_error("message %u already marked as deleted", nr + 1); check_wccount(); return; }; messages[nr].deleted = 1; msgdel++; send_ok("message %u marked as deleted", nr + 1); } char *md_print_uidl(unsigned int nr, _md_md5_uidl_message md5_uidl_message, char *result) { static char digits[16]="0123456789abcdef"; char digest[16]; int tmp; md5_uidl_message(nr, digest); for (tmp = 0; tmp < 16; tmp++) { result[tmp*2] = digits[(digest[tmp] >> 4) & 0x0F]; result[(tmp*2) + 1] = digits[digest[tmp] & 0x0F]; }; result[32] = 0; return result; } void md_uidl(unsigned int nr, _md_md5_uidl_message md5_uidl_message) { int tmp; char result[33]; char mbuf[128]; if (nr > msgnr) { send_error("no such message"); check_wccount(); return; }; if (nr == 0) { send_ok(""); for (tmp = 0; tmp < msgnr; tmp++) { if (messages[tmp].deleted) continue; snprintf(mbuf, sizeof(mbuf), "%u %.33s\r\n", tmp + 1, md_print_uidl(tmp, md5_uidl_message, result)); if (write(1, mbuf, strlen(mbuf)) != strlen(mbuf)) { pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; }; if (write(1, ".\r\n", 3) != 3) { pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; return; }; if (messages[--nr].deleted) { send_error("message %u is marked as deleted", nr + 1); check_wccount(); return; }; send_ok("%u %.33s", nr + 1, md_print_uidl(nr, md5_uidl_message, result)); } void md_list(unsigned int nr) { int tmp; char mbuf[128]; if (nr > msgnr) { send_error("no such message"); check_wccount(); return; }; if (nr == 0) { send_ok("scan listing follows"); for (tmp = 0; tmp < msgnr; tmp++) { if (messages[tmp].deleted) continue; snprintf(mbuf, sizeof(mbuf), "%u %u\r\n", tmp + 1, messages[tmp].crlfsize); if (write(1, mbuf, strlen(mbuf)) != strlen(mbuf)) { pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; }; if (write(1, ".\r\n", 3) != 3) { pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; return; }; if (messages[--nr].deleted) { send_error("message %u is marked as deleted", nr + 1); check_wccount(); return; }; send_ok("%u %u", nr + 1, messages[nr].crlfsize); } void md_top(unsigned int nr, unsigned int lcount, int fd, _md_cleanup cleanup) { ssize_t size, tmp; int newline; char mbuf[128]; /* send header */ fd_initfgets(); size = messages[nr].size; newline = 1; send_ok(""); while (((tmp = fd_fgets(mbuf, sizeof(mbuf), fd)) > 0) && (size > 0)) { size -= tmp; if (size < 0) { cleanup(); pop_log(pop_priority, "maildrop: maildrop content has been changed"); exit(1); }; if ((newline) && mbuf[0] == '.') if (write(1, ".", 1) != 1) { cleanup(); pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; if ((newline) && (tmp == 1) && mbuf[0] == '\n') break; if (mbuf[tmp - 1] == '\n') { newline = 1; if (write(1, mbuf, tmp - 1) != (tmp - 1)) { cleanup(); pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; if (write(1, "\r\n", 2) != 2) { cleanup(); pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; } else { if (write(1, mbuf, tmp) != tmp) { cleanup(); pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; newline = 0; }; }; if (tmp < 0) { cleanup(); pop_log(pop_priority, "maildrop: can't read message"); pop_error("maildrop: read"); exit(1); }; newline = 1; if (write(1, "\r\n", 2) != 2) { cleanup(); pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; /* First lcount lines of message */ while (((tmp = fd_fgets(mbuf, sizeof(mbuf), fd)) > 0) && (size > 0) && (lcount > 0)) { size -= tmp; if (size < 0) { cleanup(); pop_log(pop_priority, "maildrop: maildrop content has been changed"); exit(1); }; if ((newline) && mbuf[0] == '.') if (write(1, ".", 1) != 1) { cleanup(); pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; if (mbuf[tmp - 1] == '\n') { lcount--; newline = 1; if (write(1, mbuf, tmp - 1) != (tmp - 1)) { cleanup(); pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; if (write(1, "\r\n", 2) != 2) { cleanup(); pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; } else { if (write(1, mbuf, tmp) != tmp) { cleanup(); pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; newline = 0; }; }; if (tmp < 0) { cleanup(); pop_log(pop_priority, "maildrop: can't read message"); pop_error("maildrop: read"); exit(1); }; } void md_retrieve(unsigned int nr, int fd, _md_cleanup cleanup) { ssize_t size, mcount; int newline; char mbuf[128]; messages[nr].cread = 1; size = messages[nr].size; send_ok("%u octets", messages[nr].crlfsize); newline = 1; fd_initfgets(); while (size > 0) { if ((mcount = fd_fgets(mbuf, sizeof(mbuf), fd)) <= 0) { cleanup(); pop_log(pop_priority, "maildrop: can't read message"); if (mcount < 0) pop_error("maildrop: read"); exit(1); }; size -= mcount; if ((newline) && (mbuf[0] == '.')) if (write(1, ".", 1) != 1) { cleanup(); pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; if ((mbuf[mcount - 1]) == '\n') { newline = 1; if (write(1, mbuf, mcount - 1) != (mcount - 1)) { cleanup(); pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; if (write(1, "\r\n", 2) != 2) { cleanup(); pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; } else { newline = 0; if (write(1, mbuf, mcount) != mcount) { cleanup(); pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; }; }; if (size != 0) { cleanup(); pop_log(pop_priority, "maildrop: maildrop content has been changed"); exit(1); }; } void md_end_reply(_md_cleanup cleanup) { if (write(1, ".\r\n", 3) != 3) { cleanup(); pop_log(pop_priority, "maildrop: can't write to socket"); pop_error("maildrop: write"); exit(1); }; } solid-pop3d-0.15/src/main.c 644 765 3173 112334 7107253060 10626 static const char rcsid[] = "$Id: main.c,v 1.8 2000/05/13 13:25:52 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "includes.h" #ifdef TIME_WITH_SYS_TIME #include #include #else #ifdef HAVE_SYS_TIME_H #include #else #include #endif #endif #include #include #include #include #include #include #include #include #include #ifdef HAVE_GRP_H #include #endif #if HAVE_DIRENT_H #include #define NAMLEN(dirent) (strlen((dirent)->d_name)) #else #define dirent direct #define NAMLEN(dirent) ((dirent)->d_namlen) #if HAVE_SYS_NDIR_H #include #endif #if HAVE_SYS_DIR_H #include #endif #if HAVE_NDIR_H #include #endif #endif #ifdef BULLETINS #ifdef HAVE_UTIME #include #endif #endif #if defined(LOG_EXTEND) || defined(LOG_CONNECT) #ifdef RESOLVE_HOSTNAME #include #endif #endif #include #include "response.h" #include "const.h" #include "cmds.h" #include "maildrop.h" #ifdef MDMAILBOX #include "mailbox.h" #endif #ifdef MDMAILDIR #include "maildir.h" #endif #include "options.h" #include "log.h" #include "userconfig.h" #ifdef APOP #include "apop.h" #endif #ifdef MAPPING #include "mapping.h" #endif #ifdef SPIPV6 #include "spipv6.h" #endif #include "configfile.h" #include "authenticate.h" void get_username(char *); void end_auth_state(char *); void do_authentication(char *); void do_stat(char *); void do_list(char *); void do_retrieve(char *); void do_delete(char *); void do_reset(char *); void last_hack(char *); void do_top(char *); void do_uidl(char *); #ifdef APOP void do_apop(char *); #endif void end_trans_state(char *); const struct s_cmd auth_cmds[] = { {"USER", get_username}, {"PASS", do_authentication}, {"AUTH", not_implemented}, #ifdef APOP {"APOP", do_apop}, #endif {"QUIT", end_auth_state}, {NULL, NULL}}; const struct s_cmd transaction_cmds[] = { {"STAT", do_stat}, {"LIST", do_list}, {"RETR", do_retrieve}, {"DELE", do_delete}, {"NOOP", ignore_cmd}, #ifdef LASTCMD {"LAST", last_hack}, #endif {"RSET", do_reset}, {"TOP", do_top}, {"UIDL", do_uidl}, {"QUIT", end_trans_state}, {NULL, NULL}}; const struct s_cmd *cmds[] = {auth_cmds, transaction_cmds}; struct str_option options_set[] = { #ifdef ALLOWROOTLOGIN {"AllowRootLogin", OP_BOOLEAN, &allow_root, 0, NULL}, #endif #ifdef USERCONFIG {"UserOverride", OP_BOOLEAN, &useroverride, 0, NULL}, #endif #ifdef APOP {"AllowAPOP", OP_BOOLEAN, &allowapop, 0, NULL}, #endif {"MailDropName", OP_STRING, &maildrop_name, PATH_MAX, NULL}, #ifdef CONFIGFILE {"MailDropType", OP_STRING, &maildrop_type, MAXMDTYPENAMELENGTH, &check_maildrop_type}, #else {"MailDropType", OP_STRING, &maildrop_type, MAXMDTYPENAMELENGTH, NULL}, #endif #ifdef APOP {"APOPServerName", OP_STRING, &apopservername, 256, NULL}, #endif {"AutoLogoutTime", OP_PERIOD, &autologout_time, 0, NULL}, {"ChangeGID", OP_BOOLEAN, &changegid, 0, NULL}, {"WrongCommandsLimit", OP_PERIOD, &wccount, 0, NULL}, #ifdef BULLETINS {"UserBullFile", OP_STRING, &userbullfile, PATH_MAX, NULL}, {"BulletinDirectory", OP_STRING, &bulldir, PATH_MAX, NULL}, {"AddBulletins", OP_BOOLEAN, &addbulletins, 0, NULL}, #endif #ifdef EXPIRATION {"ReadExpire", OP_EXPIRE, &rexp, 0, NULL}, {"UnreadExpire", OP_EXPIRE, &unrexp, 0, NULL}, #endif #ifdef MAPPING {"UserMapFile", OP_STRING, &sp_mapfile, PATH_MAX, NULL}, {"DoMapping", OP_BOOLEAN, &domapping, 0, NULL}, {"RequiredMapping", OP_BOOLEAN, &reqmapping, 0, NULL}, #endif #ifdef NONIPVIRTUALS {"AllowNonIP", OP_BOOLEAN, &allownonip, 0, NULL}, #endif #ifdef CREATEMAILDROP {"CreateMailDrop", OP_BOOLEAN, &createmaildrop, 0, NULL}, #endif #ifdef STATISTICS {"LogStatistics", OP_BOOLEAN, &logstatistics, 0, NULL}, #endif {"LogPriority", OP_STRING, &logpriority, 64, check_logpriority}, {NULL, 0, NULL, 0, NULL} }; int connection_state; char username[MAXARGLN + 1]; char password[MAXARGLN + 1]; char buf[MAXCMDLN + 1]; size_t count = 0; struct str_maildrop *maildrop; #ifdef BULLETINS char userbullfile[PATH_MAX]; char bulldir[PATH_MAX]; int addbulletins = 1; #endif #ifdef EXPIRATION struct expiration rexp = {0, 0}, unrexp ={0, 0}; #endif char maildrop_name[PATH_MAX]; char maildrop_type[MAXMDTYPENAMELENGTH]; #ifdef MAPPING char sp_mapfile[PATH_MAX]; int domapping = 0, reqmapping = 1; char mapusername[MAXARGLN + 1]; #endif #ifdef APOP char apop_secret[MAXARGLN + 1]; char apoptimestamp[MAXRESPLN]; int allowapop = 1; #endif #ifdef APOP char apopservername[256] = {0, }; #endif unsigned int autologout_time = DEFAUTOLOGOUTTIME, wccount = DEFWCCOUNT; #ifdef ALLOWROOTLOGIN int allow_root = 0; #endif #ifdef USERCONFIG int useroverride = 1; #endif #ifdef NONIPVIRTUALS int allownonip = 1; #endif int auth_finished = 0; int changegid = 1; int tunnel[2]; extern int msgnr; extern struct message *messages; #ifdef NONIPVIRTUALS char *tmpvname; #endif #ifdef CREATEMAILDROP int createmaildrop = 0; #endif #if defined(LOG_EXTEND) || defined(LOG_CONNECT) char ahname[384]; #endif #ifdef STATISTICS int logstatistics = 1; #endif void check_wccount(void) { if (wccount != 0) if ((--wccount) == 0) { #ifdef LOG_EXTEND pop_log(pop_priority, "wrong commands limit exceeded - %.384s", ahname); #else pop_log(pop_priority, "wrong commands limit exceeded"); #endif exit(1); }; } int expand_dir(char *dir, char *homedir) { char filename[PATH_MAX], *tmp, *tmp2; int breakwhile = 0; filename[0] = 0; tmp = dir; while(1) { if ((tmp2 = strchr(tmp, '%')) == NULL) { if ((strlen(filename) + strlen(tmp) + 1) > sizeof(filename)) { tmp2 = filename; break; }; strcat(filename, tmp); break; }; switch (tmp2[1]) { case '%': *(tmp2+1) = 0; if ((strlen(filename) + strlen(tmp) + 1) > sizeof(filename)) { breakwhile = 1; break; }; strcat(filename, tmp); tmp = tmp2 + 2; break; case 's': *tmp2 = 0; if ((strlen(filename) + strlen(tmp) + strlen(username) + 1) > sizeof(filename)) { breakwhile = 1; break; }; strcat(filename, tmp); strcat(filename, username); tmp = tmp2 + 2; break; #ifdef MAPPING case 'm': *tmp2 = 0; if ((strlen(filename) + strlen(tmp) + strlen(mapusername) + 1) > sizeof(filename)) { breakwhile = 1; break; }; strcat(filename, tmp); strcat(filename, mapusername); tmp = tmp2 + 2; break; #endif case 'd': if ((tmp2[2] < '1') || (tmp2[2] > '8')) { breakwhile = 1; break; }; *tmp2 = 0; if ((strlen(filename) + strlen(tmp) + 2) > sizeof(filename)) { breakwhile = 1; break; }; strcat(filename, tmp); filename[(breakwhile = strlen(filename))] = username[tmp2[2] - '1']; /* if username is too short, just ignore it - username is padded with NULs */ filename[breakwhile + 1] = 0; breakwhile = 0; tmp = tmp2 + 3; break; default: ; }; if (breakwhile) break; }; if (tmp2 != NULL) return -1; dir[0] = 0; if (filename[0] != '/') { if ((strlen(homedir) + 2) > PATH_MAX) return -1; strcpy(dir, homedir); strcat(dir, "/"); }; if ((strlen(dir) + strlen(filename) + 1) > PATH_MAX) return -1; strcat(dir, filename); return 0; } #ifdef BULLETINS void add_bulletins(char *homedir) { char bullmsg[PATH_MAX]; struct stat stbuf; int fd; DIR *dirstream; struct dirent *dentry; char *tmp; time_t modtime, actime; #ifdef HAVE_UTIME struct utimbuf newmtime; #else struct timeval newmtime[2]; #endif if (!addbulletins) { maildrop->md_end_of_adding(); return; }; if ((strlen(bulldir) + 1) >= sizeof(bullmsg)) { pop_log(pop_priority, "unexpected error - contact author of program"); send_error("fatal error"); exit(1); }; strcpy(bullmsg, bulldir); strcat(bullmsg, "/"); tmp = bullmsg + strlen(bullmsg); if (expand_dir(userbullfile, homedir) < 0) { pop_log(pop_priority, "file name too long"); send_error("fatal error"); exit(1); }; modtime = 1; fd = open(userbullfile, O_RDONLY); if ((fd < 0) && (errno == ENOENT)) { fd = open(userbullfile, O_RDONLY | O_CREAT | O_EXCL, 0600); modtime = 0; }; if (fd < 0) { /* It runs with user privileges, so users can do what they want */ pop_log(pop_priority, "can't open or create file: %.1024s", userbullfile); pop_error("open"); send_error("fatal error"); exit(1); }; if (fstat(fd, &stbuf) < 0) { close(fd); pop_log(pop_priority, "can't stat file: %.1024s", userbullfile); pop_error("stat"); send_error("fatal error"); exit(1); }; if (modtime) modtime = stbuf.st_mtime; actime = stbuf.st_atime; close(fd); /* We have modification time of user bulletin file */ if (!S_ISREG(stbuf.st_mode) || (stbuf.st_mode & 2) || (getuid() != stbuf.st_uid)) { pop_log(pop_priority, "user bulletin file has wrong mode"); send_error("fatal error"); exit(1); }; if ((dirstream = opendir(bulldir)) == NULL) { pop_log(pop_priority, "opendir failed: %.1024s", bulldir); pop_error("opendir"); send_error("fatal error"); exit(1); }; while ((dentry = readdir(dirstream)) != NULL) { if ((NAMLEN(dentry) + strlen(bullmsg) + 1) > sizeof(bullmsg)) { closedir(dirstream); pop_log(pop_priority, "file name too long"); send_error("fatal error"); exit(1); }; strcpy(tmp, dentry->d_name); if (stat(bullmsg, &stbuf) < 0) { closedir(dirstream); pop_log(pop_priority, "stat failed: %.1024s", bullmsg); pop_error("stat"); send_error("fatal error"); exit(1); }; if (!S_ISREG(stbuf.st_mode)) continue; if ((fd = open(bullmsg, O_RDONLY)) < 0) { closedir(dirstream); pop_log(pop_priority, "can't open file: %.1024s", bullmsg); pop_error("open"); send_error("fatal error"); exit(1); }; if (modtime > stbuf.st_mtime) { close(fd); continue; }; if (maildrop->md_add_message(fd) == 0) { close(fd); break; }; close(fd); }; closedir(dirstream); maildrop->md_end_of_adding(); #ifdef HAVE_UTIME newmtime.actime = actime; newmtime.modtime = time(NULL); if (utime(userbullfile, &newmtime) < 0) { pop_log(pop_priority, "can't set modification time of the file: %.1024s", userbullfile); pop_error("utime"); #else newmtime[0].tv_usec = newmtime[1].tv_usec = 0; newmtime[0].tv_sec = actime; newmtime[1].tv_sec = time(NULL); if (utimes(userbullfile, newmtime) < 0) { pop_error("utimes"); #endif send_error("fatal error"); exit(1); }; } #endif void at_transaction_end(void) { maildrop->md_release(); } void end_trans_state(char *arg) { #ifdef STATISTICS int deleted = 0, deletedsize = 0, left = 0, leftsize = 0; #endif #ifdef EXPIRATION int tmp; struct expiration *curexp; time_t acttime = time(NULL); for (tmp = 0; tmp < msgnr; tmp++) { if (messages[tmp].cread) curexp = &rexp; else curexp = &unrexp; if (curexp->enabled == 0) continue; if ((messages[tmp].msg_time == -1) || (messages[tmp].msg_time > acttime)) /* Clock skew??? */ continue; if ((acttime - messages[tmp].msg_time) >= curexp->expperiod) messages[tmp].deleted = 1; }; maildrop->md_update(); #endif /* EXPIRATION */ #ifdef STATISTICS for (tmp = 0; tmp < msgnr; tmp++) if (messages[tmp].deleted) { deleted++; deletedsize += messages[tmp].crlfsize; } else { left++; leftsize += messages[tmp].crlfsize; } if (logstatistics) pop_log(pop_priority, "Stats: %.40s %d %d %d %d", username, deleted, deletedsize, \ left, leftsize); #endif #ifdef MAPPING if (domapping) #ifdef LOG_EXTEND pop_log(pop_priority, "session ended for mapped user %.40s - %.384s", username, ahname); #else pop_log(pop_priority, "session ended for mapped user %.40s", username); #endif else #ifdef LOG_EXTEND pop_log(pop_priority, "session ended for user %.40s - %.384s", username, ahname); #else pop_log(pop_priority, "session ended for user %.40s", username); #endif #else /* MAPPING */ #ifdef LOG_EXTEND pop_log(pop_priority, "session ended for user %.40s - %.384s", username, ahname); #else pop_log(pop_priority, "session ended for user %.40s", username); #endif #endif /* MAPPING */ send_ok("session ended"); exit(0); } void end_auth_state(char *arg) { #ifdef LOG_EXTEND pop_log(pop_priority, "session ended - %.384s", ahname); #else pop_log(pop_priority, "session ended"); #endif send_ok("session ended"); exit(0); } void get_username(char *arg) { int tmp = 0; if (strlen(arg) >= sizeof(username)) { send_error("username too long"); check_wccount(); } else if (arg[0] == 0) { send_error("missing argument"); check_wccount(); } else if (username[0] == 0) { strncpy(username, arg, sizeof(username)); /* Pad with NULs, strlen(arg) < sizeof(username) */ while (username[tmp] != 0) { username[tmp] = tolower(username[tmp]); tmp++; }; send_ok("username accepted"); } else { send_error("username already set"); check_wccount(); }; } #ifdef LASTCMD void last_hack(char *arg) { send_ok("0"); } #endif void do_stat(char *arg) { md_stat(); } void do_list(char *arg) { unsigned int number = 1; if (arg[0]) { if ((sscanf(arg, "%u", &number) != 1) || number == 0) { send_error("incorrect argument"); check_wccount(); } else md_list(number); } else md_list(0); } void do_retrieve(char *arg) { unsigned int number = 1; if (!arg[0]) { send_error("argument required"); check_wccount(); return; }; if ((sscanf(arg, "%u", &number) != 1) || number == 0) { send_error("incorrect argument"); check_wccount(); } else maildrop->md_retrieve(number); } void do_delete(char *arg) { unsigned int number = 1; if (!arg[0]) { send_error("argument required"); check_wccount(); return; }; if ((sscanf(arg, "%u", &number) != 1) || number == 0) { send_error("incorrect argument"); check_wccount(); } else md_delete(number); } void do_reset(char *arg) { md_reset(); } void do_top(char *arg) { unsigned int number, lcount; if (!maildrop->md_top) { /* TOP operation not supported by this maildrop */ send_error("operation not supported by maildrop"); check_wccount(); return; }; if ((sscanf(arg, "%u %u", &number, &lcount) != 2) || (number == 0)) { send_error("incorrect arguments"); check_wccount(); return; }; maildrop->md_top(number, lcount); } void do_uidl(char *arg) { unsigned int number = 1; if (!maildrop->md_md5_uidl_message) { /* UIDL operation not supported by this maildrop */ send_error("operation not supported by maildrop"); check_wccount(); return; }; if (arg[0]) { if ((sscanf(arg, "%u", &number) != 1) || number == 0) { send_error("incorrect argument"); check_wccount(); } else md_uidl(number, maildrop->md_md5_uidl_message); } else md_uidl(0, maildrop->md_md5_uidl_message); } char *findcrlf(char *where, size_t length) { /* * strstr stops on NUL character */ size_t tmp; if (length == 0) return NULL; for (tmp = 0; tmp < (length - 1); tmp++) if ((where[tmp] == '\r') && (where[tmp + 1] == '\n')) return &where[tmp]; return NULL; } void read_command(char *cmd) { ssize_t cread; char *tmp; alarm(autologout_time); while (1) { while (((tmp = findcrlf(buf, count)) == NULL) && (count < MAXCMDLN)) { if ((cread = read(0, buf + count, sizeof(buf) - count - 1)) <= 0) { if (cread < 0) pop_error("read"); exit(1); }; count += cread; }; if (tmp == NULL) { /* * command is too long */ do { buf[0] = buf[count - 1]; if ((cread = read(0, buf + 1, sizeof(buf) - 2)) <= 0) { if (cread < 0) pop_error("read"); exit(1); }; count = cread + 1; } while ((tmp = findcrlf(buf, count)) == NULL); memmove(buf, tmp + 2, count - (tmp - buf + 2)); count -= (tmp - buf + 2); send_error("command too long"); check_wccount(); continue; }; *tmp = 0; if ((buf + strlen(buf)) != tmp) { send_error("NULL character in command"); memmove(buf, tmp + 2, count - (tmp - buf + 2)); count -= (tmp - buf + 2); /* * discard \r\n */ check_wccount(); continue; }; strcpy(cmd, buf); /* strlen(buf) < sizeof(cmd) sizeof(buf) = sizeof(cmd) + 1 and \r\n in buf are discarded */ memmove(buf, tmp + 2, count - (tmp - buf + 2)); count -= (tmp - buf + 2); /* * discard \r\n */ break; }; alarm(0); } void sig_handler(int number) { if (number == SIGALRM) #ifdef LOG_EXTEND pop_log(pop_priority, "autologout time elapsed - %.384s", ahname); #else pop_log(pop_priority, "autologout time elapsed"); #endif exit(1); } ssize_t write_loop(int fd, void *abuf, size_t acount) { char *tmpbuf = (char *) abuf; size_t writed = 0; ssize_t tmp; if (acount == 0) return 0; while ((tmp = write(fd, tmpbuf + writed, acount - writed)) > 0) { writed += tmp; if (writed == acount) return writed; }; if (tmp < 0) return -1; return writed; } int write_string(int fd, char *abuf) { size_t tmp = strlen(abuf); if (write_loop(fd, &tmp, sizeof(tmp)) != sizeof(tmp)) return -1; if (write_loop(fd, abuf, tmp) != tmp) return -1; return 0; } void do_authentication(char *pass) { #ifdef APOP int tmp = 0; #endif if (username[0] == 0) { memset(pass, 0, strlen(pass)); send_error("unknown username"); check_wccount(); return; }; #ifdef APOP if (write_loop(tunnel[1], &tmp, sizeof(tmp)) != sizeof(tmp)) { memset(pass, 0, strlen(pass)); close(tunnel[1]); pop_log(pop_priority, "can't write to pipe"); pop_error("write"); send_error("fatal error"); exit(1); }; #endif #ifdef NONIPVIRTUALS tmpvname = strchr(username, '%'); if (tmpvname == NULL) tmpvname = strchr(username, '@'); if (tmpvname != NULL) *tmpvname = 0; #endif if (write_string(tunnel[1], username) < 0) { memset(pass, 0, strlen(pass)); close(tunnel[1]); pop_log(pop_priority, "can't write to pipe"); pop_error("write"); send_error("fatal error"); exit(1); }; if (write_string(tunnel[1], pass) < 0) { memset(pass, 0, strlen(pass)); close(tunnel[1]); pop_log(pop_priority, "can't write to pipe"); pop_error("write"); send_error("fatal error"); exit(1); }; memset(pass, 0, strlen(pass)); auth_finished = 1; return; } #ifdef APOP void do_apop(char *arg) { char *tmp; int tmp2; if (!allowapop) { memset(arg, 0, strlen(arg)); send_error("you are not allowed to authenticate yourself through APOP"); check_wccount(); return; }; if ((tmp = strchr(arg, ' ')) == NULL) { memset(arg, 0, strlen(arg)); send_error("argument missing"); check_wccount(); return; }; *tmp = 0; tmp++; if ((strlen(arg) + 1) > sizeof(username)) { memset(tmp, 0, strlen(tmp)); send_error("username too long"); check_wccount(); return; }; strncpy(username, arg, sizeof(username)); /* Pad with NULs */ if (strlen(tmp) != 32) { memset(tmp, 0, strlen(tmp)); send_error("wrong digest length"); check_wccount(); return; }; for (tmp2 = 0; tmp2 < 16; tmp2++) if ((((tmp[tmp2 * 2] > 'f') || (tmp[tmp2 * 2] < 'a')) && (!isdigit(tmp[tmp2 * 2]))) || (((tmp[(tmp2 * 2) + 1] > 'f') || (tmp[(tmp2 * 2) + 1] < 'a')) && (!isdigit(tmp[(tmp2 * 2) + 1])))) { memset(tmp, 0, strlen(tmp)); send_error("wrong character in digest"); check_wccount(); return; }; tmp2 = 1; if (write_loop(tunnel[1], &tmp2, sizeof(tmp2)) != sizeof(tmp2)) { close(tunnel[1]); memset(tmp, 0, strlen(tmp)); pop_log(pop_priority, "can't write to pipe"); pop_error("write"); send_error("fatal error"); exit(1); }; if (write_string(tunnel[1], apoptimestamp) < 0) { close(tunnel[1]); memset(tmp, 0, strlen(tmp)); pop_log(pop_priority, "can't write to pipe"); pop_error("write"); send_error("fatal error"); exit(1); }; #ifdef NONIPVIRTUALS tmpvname = strchr(username, '%'); if (tmpvname == NULL) tmpvname = strchr(username, '@'); if (tmpvname != NULL) *tmpvname = 0; #endif if (write_string(tunnel[1], username) < 0) { close(tunnel[1]); memset(tmp, 0, strlen(tmp)); pop_log(pop_priority, "can't write to pipe"); pop_error("write"); send_error("fatal error"); exit(1); }; if (write_string(tunnel[1], tmp) < 0) { close(tunnel[1]); memset(tmp, 0, strlen(tmp)); pop_log(pop_priority, "can't write to pipe"); pop_error("write"); send_error("fatal error"); exit(1); }; memset(tmp, 0, strlen(tmp)); auth_finished = 1; return; } #endif /* APOP */ ssize_t read_loop(int fd, void *abuf, size_t acount) { /* This function works with root privileges */ char *tmpbuf = (char *) abuf; ssize_t tmp, cread = 0; if (acount == 0) return 0; while ((tmp = read(fd, tmpbuf + cread, acount - cread)) > 0) { cread += tmp; if (cread == acount) return cread; }; if (tmp < 0) return -1; return cread; } void child_corrupted(void) { /* This function works with root privileges */ memset(password, 0, sizeof(password)); close(tunnel[0]); pop_log(pop_priority, "child process corrupted"); wait(NULL); exit(1); } int read_string(int fd, char *abuf, size_t acount) { /* This function works with root privileges */ size_t tmp2; if (read_loop(fd, &tmp2, sizeof(tmp2)) != sizeof(tmp2)) return -1; if ((tmp2 >= acount) || (tmp2 < 0)) /* tmp2 is an unsigned number, so there wasn't security hole, however "szczezonego Pan Bog szczeze" */ return -1; if (read_loop(fd, abuf, tmp2) != tmp2) return -1; abuf[tmp2] = 0; if (strlen(abuf) != tmp2) return -1; return 0; } int set_privileges(uid_t auid, gid_t agid) { /* This function works with root privileges */ #ifdef HAVE_SETGROUPS gid_t groups[2]; groups[0] = groups[1] = agid; if (setgroups(1, groups) < 0) { pop_error("setgroups"); return -1; }; #endif if (setgid(agid) < 0) { pop_error("setgid"); return -1; }; if (setuid(auid) < 0) { pop_error("setuid"); return -1; }; return 0; /* I see no reason why this function could fail */ } #ifdef STANDALONE int do_session(int argc, char **argv) #else int main(int argc, char **argv) #endif { char cmd[MAXCMDLN]; const struct s_cmd *act_cmd; #ifdef SPIPV6 union sp_sockaddr peeraddr; #else struct sockaddr_in peeraddr; #endif socklen_t addrln; struct rlimit corelimit = {0, 0}; struct passwd *spop3d, *userentry; int tmp, tmp2; gid_t tmpgid; #ifdef APOP int useapop; #endif #if defined(LOG_EXTEND) || defined(LOG_CONNECT) #ifdef RESOLVE_HOSTNAME struct hostent *hentname; #endif #ifdef SPIPV6 char ntopbuff[100]; #endif #endif /* That below works as root */ signal(SIGHUP, sig_handler); signal(SIGINT, sig_handler); signal(SIGQUIT, sig_handler); signal(SIGILL, sig_handler); signal(SIGABRT, sig_handler); signal(SIGFPE, sig_handler); signal(SIGSEGV, sig_handler); signal(SIGPIPE, SIG_IGN); signal(SIGALRM, sig_handler); signal(SIGTERM, sig_handler); signal(SIGUSR1, sig_handler); signal(SIGUSR2, sig_handler); memset(username, 0, sizeof(username)); memset(password, 0, sizeof(username)); #ifdef MAPPING memset(mapusername, 0, sizeof(mapusername)); #endif alarm(0); umask(0077); chdir("/"); #ifndef STANDALONE pop_openlog(); if (atexit(pop_closelog) < 0) exit(1); #endif if (setrlimit(RLIMIT_CORE, &corelimit) < 0) { pop_error("setrlimit"); exit(1); }; #ifdef SPIPV6 addrln = sizeof(union sp_sockaddr); if (getpeername(0, (struct sockaddr *)&peeraddr.saddr_in6, &addrln) < 0) { #else addrln = sizeof(struct sockaddr_in); if (getpeername(0, (struct sockaddr *)&peeraddr, &addrln) < 0) { #endif pop_error("getpeername"); exit(1); }; #ifdef SPIPV6 if ((peeraddr.saddr_in6.sin6_family != AF_INET) && (peeraddr.saddr_in6.sin6_family != AF_INET6)) { #else if (peeraddr.sin_family != AF_INET) { #endif pop_log(pop_priority, "peer address is not an IP address"); exit(1); }; #if defined(LOG_EXTEND) || defined(LOG_CONNECT) #ifdef RESOLVE_HOSTNAME #ifdef SPIPV6 if (peeraddr.saddr_in6.sin6_family == AF_INET6) { if ((hentname = gethostbyaddr((char *)&peeraddr.saddr_in6.sin6_addr, addrln, AF_INET6)) != NULL) snprintf(ahname, sizeof(ahname), "%.256s (%.100s)", hentname->h_name, (strncmp(inet_ntop(AF_INET6, &peeraddr.saddr_in6.sin6_addr, ntopbuff, \ sizeof(ntopbuff)), "::ffff:", 7) == 0) ? ntopbuff + 7 : ntopbuff); else snprintf(ahname, sizeof(ahname), "%.100s", (strncmp(inet_ntop(AF_INET6, &peeraddr.saddr_in6.sin6_addr, ntopbuff, \ sizeof(ntopbuff)), "::ffff:", 7) == 0) ? ntopbuff + 7 : ntopbuff); } else { if ((hentname = gethostbyaddr((char *)&peeraddr.saddr_in.sin_addr.s_addr, sizeof(peeraddr.saddr_in.sin_addr.s_addr), AF_INET)) != NULL) snprintf(ahname, sizeof(ahname), "%.256s (%.100s)", hentname->h_name, inet_ntoa(peeraddr.saddr_in.sin_addr)); else snprintf(ahname, sizeof(ahname), "%.100s", inet_ntoa(peeraddr.saddr_in.sin_addr)); }; #else if ((hentname = gethostbyaddr((char *)&peeraddr.sin_addr.s_addr, sizeof(peeraddr.sin_addr.s_addr), AF_INET)) != NULL) snprintf(ahname, sizeof(ahname), "%.256s (%.100s)", hentname->h_name, inet_ntoa(peeraddr.sin_addr)); else snprintf(ahname, sizeof(ahname), "%.100s", inet_ntoa(peeraddr.sin_addr)); #endif #else /* RESOLVE_HOSTNAME */ #ifdef SPIPV6 if (peeraddr.saddr_in6.sin6_family == AF_INET6) snprintf(ahname, sizeof(ahname), "%.100s", (strncmp(inet_ntop(AF_INET6, &peeraddr.saddr_in6.sin6_addr, ntopbuff, \ sizeof(ntopbuff)), "::ffff:", 7) == 0) ? ntopbuff + 7 : ntopbuff); else snprintf(ahname, sizeof(ahname), "%.100s", inet_ntoa(peeraddr.saddr_in.sin_addr)); #else snprintf(ahname, sizeof(ahname), "%.100s", inet_ntoa(peeraddr.sin_addr)); #endif #endif /* RESOLVE_HOSTNAME */ #ifdef LOG_CONNECT #ifndef STANDALONE pop_log(pop_priority, "connect from %.384s", ahname); #endif #endif #endif /* LOG_EXTEND || LOG_CONNECT */ if (pipe(tunnel) < 0) { pop_error("pipe"); exit(1); }; switch (fork()) { case -1: pop_error("fork"); exit(1); case 0: close(tunnel[0]); if ((spop3d = getpwnam(POPUSER)) == NULL) { pop_log(pop_priority, "user %.40s not found", POPUSER); pop_error("getpwnam"); exit(1); }; if (set_privileges(spop3d->pw_uid, spop3d->pw_gid) < 0) exit(1); /* Code below works as spop3d user */ strcpy(maildrop_name, DEFMAILDROPNAME); strcpy(maildrop_type, DEFMAILDROPTYPE); #ifdef BULLETINS strcpy(userbullfile, USERBULL); strcpy(bulldir, BULLDIR); #endif #ifdef NONIPVIRTUALS if (parse_options(argc, argv, NULL) < 0) #else if (parse_options(argc, argv) < 0) #endif exit(1); #ifdef APOP if (allowapop) { if (apopservername[0] == 0) if (gethostname(apopservername, sizeof(apopservername)) < 0) exit(1); snprintf(apoptimestamp, sizeof(apoptimestamp), "<%lu.%lu@%.256s>", (unsigned long int) getpid(), (unsigned long int)time(NULL), apopservername); send_ok("%.100s %.400s", SERVER_GREETING, apoptimestamp); } else send_ok("%.100s", SERVER_GREETING); #else send_ok(SERVER_GREETING); #endif connection_state = AUTH_STATE; while (!auth_finished) { read_command(cmd); if ((act_cmd = cmd_lookup(cmds[connection_state], cmd)) == NULL) { send_error("unknown command"); check_wccount(); continue; }; if (strlen(cmd) == strlen(act_cmd->name)) act_cmd->handler(cmd + strlen(act_cmd->name)); else act_cmd->handler(cmd + strlen(act_cmd->name) + 1); }; #ifdef NONIPVIRTUALS /* reread configuration file if needed */ if (tmpvname != NULL) { if (!allownonip) pop_log(pop_priority, "unallowed non-IP based virtual hosting request rejected"); else if (parse_options(argc, argv, tmpvname + 1) < 0) { send_error("fatal error"); exit(1); }; }; #endif #ifdef MAPPING mapusername[0] = 0; if (domapping) { /* map_finduser() doesn't overflow mapusername - sizeof(mapusername) = MAXARGLN + 1 */ if (((tmp = map_finduser(sp_mapfile, username, mapusername)) < 0) && \ (reqmapping)) { #ifdef LOG_EXTEND pop_log(pop_priority, "authentication failed: can't map user name: %.40s - %.384s", username, ahname); #else pop_log(pop_priority, "authentication failed: can't map user name: %.40s", username); #endif sleep(1); send_error("authentication failed"); exit(1); }; if (tmp < 0) /* && !reqmapping */ domapping = 0; else if ((strlen(mapusername) + 1) > sizeof(mapusername)) { pop_log(pop_priority, "map: unexpected error - contact author of program!!!"); send_error("fatal error"); exit(1); }; }; if (write_string(tunnel[1], mapusername) < 0) { close(tunnel[1]); pop_error("write"); send_error("fatal error"); exit(1); }; #endif tmp = 0; while (options_set[tmp].name != NULL) { /* This loop sends configuration */ switch (options_set[tmp].op_type) { case OP_STRING: if (write_string(tunnel[1], (char *)options_set[tmp].value) < 0) { close(tunnel[1]); pop_error("write"); send_error("fatal error"); exit(1); }; break; case OP_BOOLEAN: if (write_loop(tunnel[1], options_set[tmp].value, sizeof(int)) != sizeof(int)) { close(tunnel[1]); pop_error("write"); send_error("fatal error"); exit(1); }; break; case OP_PERIOD: if (write_loop(tunnel[1], options_set[tmp].value, sizeof(unsigned int)) != sizeof(unsigned int)) { close(tunnel[1]); pop_error("write"); send_error("fatal error"); exit(1); }; break; #ifdef EXPIRATION case OP_EXPIRE: if (write_loop(tunnel[1], options_set[tmp].value, sizeof(struct expiration)) != sizeof(struct expiration)) { close(tunnel[1]); pop_error("write"); send_error("fatal error"); exit(1); }; #endif }; tmp++; }; close(tunnel[1]); exit(0); default: /* Code below reads configuration from child process. Code below works with root privileges */ close(tunnel[1]); #ifdef APOP if (read_loop(tunnel[0], &useapop, sizeof(int)) != sizeof(int)) { close(tunnel[0]); wait(NULL); exit(1); }; if ((useapop != 0) && (useapop != 1)) child_corrupted(); if (useapop) if (read_string(tunnel[0], apoptimestamp, sizeof(apoptimestamp)) < 0) child_corrupted(); #endif if (read_string(tunnel[0], username, sizeof(username)) < 0) { #ifdef APOP child_corrupted(); #else close(tunnel[0]); wait(NULL); exit(1); #endif }; if (read_string(tunnel[0], password, sizeof(password)) < 0) child_corrupted(); #ifdef MAPPING memset(mapusername, 0, sizeof(mapusername)); if (read_string(tunnel[0], mapusername, sizeof(mapusername)) < 0) child_corrupted(); #endif tmp = 0; while (options_set[tmp].name != NULL) { switch (options_set[tmp].op_type) { case OP_STRING: if (read_string(tunnel[0], (char *)options_set[tmp].value, options_set[tmp].valuesize) < 0) child_corrupted(); break; case OP_BOOLEAN: if (read_loop(tunnel[0], options_set[tmp].value, sizeof(int)) != sizeof(int)) child_corrupted(); tmp2 = *((int *)(options_set[tmp].value)); if ((tmp2 != 0) && (tmp2 != 1)) child_corrupted(); break; case OP_PERIOD: if (read_loop(tunnel[0], options_set[tmp].value, sizeof(unsigned int)) != sizeof(unsigned int)) child_corrupted(); break; #ifdef EXPIRATION case OP_EXPIRE: if (read_loop(tunnel[0], options_set[tmp].value, sizeof(struct expiration)) != sizeof(struct expiration)) child_corrupted(); break; #endif }; tmp++; }; close(tunnel[0]); wait(NULL); check_logpriority(logpriority); #ifdef MAPPING if (domapping) userentry = getpwnam(mapusername); else userentry = getpwnam(username); #else userentry = getpwnam(username); #endif if (userentry == NULL) { memset(password, 0, strlen(password)); #ifdef MAPPING if (domapping) #ifdef LOG_EXTEND pop_log(pop_priority, "authentication failed: no such user: %.40s - %.384s", mapusername, ahname); #else pop_log(pop_priority, "authentication failed: no such user: %.40s", mapusername); #endif else #ifdef LOG_EXTEND pop_log(pop_priority, "authentication failed: no such user: %.40s - %.384s", username, ahname); #else pop_log(pop_priority, "authentication failed: no such user: %.40s", username); #endif #else /* MAPPING */ #ifdef LOG_EXTEND pop_log(pop_priority, "authentication failed: no such user: %.40s - %.384s", username, ahname); #else pop_log(pop_priority, "authentication failed: no such user: %.40s", username); #endif #endif /* MAPPING */ sleep(1); send_error("authentication failed"); exit(1); }; #ifdef APOP apop_secret[0] = 0; if (!useapop) { #endif #ifdef MAPPING if (domapping) tmp = sp_authenticate_user(mapusername, password); else tmp = sp_authenticate_user(username, password); #else tmp = sp_authenticate_user(username, password); #endif /* sp_authenticate_user clears password */ if (tmp < 0) { #ifdef MAPPING if (domapping) #ifdef LOG_EXTEND pop_log(pop_priority, "authentication failed for mapped user %.40s - %.384s", username, ahname); #else pop_log(pop_priority, "authentication failed for mapped user %.40s", username); #endif else #ifdef LOG_EXTEND pop_log(pop_priority, "authentication failed for user %.40s - %.384s", username, ahname); #else pop_log(pop_priority, "authentication failed for user %.40s", username); #endif #else /* MAPPING */ #ifdef LOG_EXTEND pop_log(pop_priority, "authentication failed for user %.40s - %.384s", username, ahname); #else pop_log(pop_priority, "authentication failed for user %.40s", username); #endif #endif /* MAPPING */ sleep(1); send_error("authentication failed"); exit(1); }; #ifdef MAPPING if (domapping) #ifdef LOG_EXTEND pop_log(pop_priority, "mapped user %.40s authenticated - %.384s", username, ahname); #else pop_log(pop_priority, "mapped user %.40s authenticated", username); #endif else #ifdef LOG_EXTEND pop_log(pop_priority, "user %.40s authenticated - %.384s", username, ahname); #else pop_log(pop_priority, "user %.40s authenticated", username); #endif #else /* MAPPING */ #ifdef LOG_EXTEND pop_log(pop_priority, "user %.40s authenticated - %.384s", username, ahname); #else pop_log(pop_priority, "user %.40s authenticated", username); #endif #endif /* MAPPING */ #ifdef APOP }; #endif #ifdef ALLOWROOTLOGIN if ((userentry->pw_uid == 0) && (!allow_root)) { #else if (userentry->pw_uid == 0) { #endif memset(password, 0, strlen(password)); #ifdef LOG_EXTEND pop_log(pop_priority, "root login not allowed - %.384s", ahname); #else pop_log(pop_priority, "root login not allowed"); #endif sleep(1); send_error("authentication failed"); exit(1); }; if (changegid) tmpgid = userentry->pw_gid; else tmpgid = getgid(); if (set_privileges(userentry->pw_uid, tmpgid) < 0) { memset(password, 0, strlen(password)); send_error("fatal error"); exit(1); }; /* Code below works with user privileges */ #ifdef USERCONFIG if (useroverride) parse_user_cfg(userentry->pw_dir); #endif #ifdef APOP if (useapop) { if (apop_secret[0] == 0) { memset(password, 0, strlen(password)); #ifdef LOG_EXTEND pop_log(pop_priority, "can't find APOP secret for user %.40s - %.384s", username, ahname); #else pop_log(pop_priority, "can't find APOP secret for user %.40s", username); #endif sleep(1); send_error("authentication failed"); exit(1); }; if (apop_authenticate(username, apoptimestamp, password) < 0) { memset(password, 0, strlen(password)); memset(apop_secret, 0, strlen(apop_secret)); #ifdef LOG_EXTEND pop_log(pop_priority, "APOP authentication failed for user %.40s - %.384s", username, ahname); #else pop_log(pop_priority, "APOP authentication failed for user %.40s", username); #endif sleep(1); send_error("authentication failed"); exit(1); }; #ifdef LOG_EXTEND pop_log(pop_priority, "user %.40s authenticated through APOP - %.384s", username, ahname); #else pop_log(pop_priority, "user %.40s authenticated through APOP", username); #endif }; memset(apop_secret, 0, sizeof(apop_secret)); #endif memset(password, 0, strlen(password)); if (expand_dir(maildrop_name, userentry->pw_dir) < 0) { pop_log(pop_priority, "maildrop name too long"); sleep(1); send_error("authentication failed"); exit(1); }; maildrop = find_maildrop(maildrop_type); maildrop->md_init(); if (atexit(at_transaction_end) < 0) { pop_log(pop_priority, "weird error"); send_error("fatal error"); exit(1); }; #ifdef BULLETINS add_bulletins(userentry->pw_dir); #endif connection_state = TRANSACTION_STATE; send_ok("authentication successful"); while (1) { read_command(cmd); if ((act_cmd = cmd_lookup(cmds[connection_state], cmd)) == NULL) { send_error("unknown command"); check_wccount(); continue; }; if (strlen(cmd) == strlen(act_cmd->name)) act_cmd->handler(cmd + strlen(act_cmd->name)); else act_cmd->handler(cmd + strlen(act_cmd->name) + 1); }; }; } solid-pop3d-0.15/src/md5.c 644 765 3173 31111 7077103607 10347 /* md5.c - Functions to compute MD5 message digest of files or memory blocks according to the definition of MD5 in RFC 1321 from April 1992. Copyright (C) 1995, 1996 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Written by Ulrich Drepper , 1995. */ #include #if 0 /* Get rid of implicit bcopy declaration warnings */ #if STDC_HEADERS || defined _LIBC #include #endif #include #if 0 #else #ifndef HAVE_MEMCPY #define memcpy(d, s, n) bcopy ((s), (d), (n)) #endif #endif #endif #include "md5.h" #ifdef _LIBC #include #if __BYTE_ORDER == __BIG_ENDIAN #define WORDS_BIGENDIAN 1 #endif #endif #ifdef WORDS_BIGENDIAN #define SWAP(n) \ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) #else #define SWAP(n) (n) #endif /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. (RFC 1321, 3.1: Step 1) */ static const unsigned char fillbuf[64] = {0x80, 0 /* , 0, 0, ... */ }; /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ void md5_init_ctx (ctx) struct md5_ctx *ctx; { ctx->A = 0x67452301; ctx->B = 0xefcdab89; ctx->C = 0x98badcfe; ctx->D = 0x10325476; ctx->total[0] = ctx->total[1] = 0; ctx->buflen = 0; } /* Put result from CTX in first 16 bytes following RESBUF. The result must be in little endian byte order. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * md5_read_ctx (ctx, resbuf) const struct md5_ctx *ctx; void *resbuf; { ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A); ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B); ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C); ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D); return resbuf; } /* Process the remaining bytes in the internal buffer and the usual prolog according to the standard and write the result to RESBUF. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * md5_finish_ctx (ctx, resbuf) struct md5_ctx *ctx; void *resbuf; { /* Take yet unprocessed bytes into account. */ md5_uint32 bytes = ctx->buflen; size_t pad; /* Now count remaining bytes. */ ctx->total[0] += bytes; if (ctx->total[0] < bytes) ++ctx->total[1]; pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; memcpy (&ctx->buffer[bytes], fillbuf, pad); /* Put the 64-bit file length in *bits* at the end of the buffer. */ *(md5_uint32 *) & ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3); *(md5_uint32 *) & ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); /* Process last bytes. */ md5_process_block (ctx->buffer, bytes + pad + 8, ctx); return md5_read_ctx (ctx, resbuf); } /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ int md5_stream (stream, resblock) FILE *stream; void *resblock; { /* Important: BLOCKSIZE must be a multiple of 64. */ #define BLOCKSIZE 4096 struct md5_ctx ctx; char buffer[BLOCKSIZE + 72]; size_t sum; /* Initialize the computation context. */ md5_init_ctx (&ctx); /* Iterate over full file contents. */ while (1) { /* We read the file in blocks of BLOCKSIZE bytes. One call of the computation function processes the whole buffer so that with the next round of the loop another block can be read. */ size_t n; sum = 0; /* Read block. Take care for partial reads. */ do { n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); sum += n; } while (sum < BLOCKSIZE && n != 0); if (n == 0 && ferror (stream)) return 1; /* If end of file is reached, end the loop. */ if (n == 0) break; /* Process buffer with BLOCKSIZE bytes. Note that BLOCKSIZE % 64 == 0 */ md5_process_block (buffer, BLOCKSIZE, &ctx); } /* Add the last bytes if necessary. */ if (sum > 0) md5_process_bytes (buffer, sum, &ctx); /* Construct result in desired memory. */ md5_finish_ctx (&ctx, resblock); return 0; } /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ void * md5_buffer (buffer, len, resblock) const char *buffer; size_t len; void *resblock; { struct md5_ctx ctx; /* Initialize the computation context. */ md5_init_ctx (&ctx); /* Process whole buffer but last len % 64 bytes. */ md5_process_bytes (buffer, len, &ctx); /* Put result in desired memory area. */ return md5_finish_ctx (&ctx, resblock); } void md5_process_bytes (buffer, len, ctx) const void *buffer; size_t len; struct md5_ctx *ctx; { /* When we already have some bits in our internal buffer concatenate both inputs first. */ if (ctx->buflen != 0) { size_t left_over = ctx->buflen; size_t add = 128 - left_over > len ? len : 128 - left_over; memcpy (&ctx->buffer[left_over], buffer, add); ctx->buflen += add; if (left_over + add > 64) { md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx); /* The regions in the following copy operation can't overlap. */ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], (left_over + add) & 63); ctx->buflen = (left_over + add) & 63; } buffer = (const char *) buffer + add; len -= add; } /* Process available complete blocks. */ if (len > 64) { md5_process_block (buffer, len & ~63, ctx); buffer = (const char *) buffer + (len & ~63); len &= 63; } /* Move remaining bytes in internal buffer. */ if (len > 0) { memcpy (ctx->buffer, buffer, len); ctx->buflen = len; } } /* These are the four functions used in the four steps of the MD5 algorithm and defined in the RFC 1321. The first function is a little bit optimized (as found in Colin Plumbs public domain implementation). */ /* #define FF(b, c, d) ((b & c) | (~b & d)) */ #define FF(b, c, d) (d ^ (b & (c ^ d))) #define FG(b, c, d) FF (d, b, c) #define FH(b, c, d) (b ^ c ^ d) #define FI(b, c, d) (c ^ (b | ~d)) /* Process LEN bytes of BUFFER, accumulating context into CTX. It is assumed that LEN % 64 == 0. */ void md5_process_block (buffer, len, ctx) const void *buffer; size_t len; struct md5_ctx *ctx; { md5_uint32 correct_words[16]; const md5_uint32 *words = buffer; size_t nwords = len / sizeof (md5_uint32); const md5_uint32 *endp = words + nwords; md5_uint32 A = ctx->A; md5_uint32 B = ctx->B; md5_uint32 C = ctx->C; md5_uint32 D = ctx->D; /* First increment the byte count. RFC 1321 specifies the possible length of the file up to 2^64 bits. Here we only compute the number of bytes. Do a double word increment. */ ctx->total[0] += len; if (ctx->total[0] < len) ++ctx->total[1]; /* Process all bytes in the buffer with 64 bytes in each round of the loop. */ while (words < endp) { md5_uint32 *cwp = correct_words; md5_uint32 A_save = A; md5_uint32 B_save = B; md5_uint32 C_save = C; md5_uint32 D_save = D; /* First round: using the given function, the context and a constant the next context is computed. Because the algorithms processing unit is a 32-bit word and it is determined to work on words in little endian byte order we perhaps have to change the byte order before the computation. To reduce the work for the next steps we store the swapped words in the array CORRECT_WORDS. */ #define OP(a, b, c, d, s, T) \ do \ { \ a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ ++words; \ CYCLIC (a, s); \ a += b; \ } \ while (0) /* It is unfortunate that C does not provide an operator for cyclic rotation. Hope the C compiler is smart enough. */ #define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) /* Before we start, one word to the strange constants. They are defined in RFC 1321 as T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 */ /* Round 1. */ OP (A, B, C, D, 7, 0xd76aa478); OP (D, A, B, C, 12, 0xe8c7b756); OP (C, D, A, B, 17, 0x242070db); OP (B, C, D, A, 22, 0xc1bdceee); OP (A, B, C, D, 7, 0xf57c0faf); OP (D, A, B, C, 12, 0x4787c62a); OP (C, D, A, B, 17, 0xa8304613); OP (B, C, D, A, 22, 0xfd469501); OP (A, B, C, D, 7, 0x698098d8); OP (D, A, B, C, 12, 0x8b44f7af); OP (C, D, A, B, 17, 0xffff5bb1); OP (B, C, D, A, 22, 0x895cd7be); OP (A, B, C, D, 7, 0x6b901122); OP (D, A, B, C, 12, 0xfd987193); OP (C, D, A, B, 17, 0xa679438e); OP (B, C, D, A, 22, 0x49b40821); /* For the second to fourth round we have the possibly swapped words in CORRECT_WORDS. Redefine the macro to take an additional first argument specifying the function to use. */ #undef OP #define OP(f, a, b, c, d, k, s, T) \ do \ { \ a += f (b, c, d) + correct_words[k] + T; \ CYCLIC (a, s); \ a += b; \ } \ while (0) /* Round 2. */ OP (FG, A, B, C, D, 1, 5, 0xf61e2562); OP (FG, D, A, B, C, 6, 9, 0xc040b340); OP (FG, C, D, A, B, 11, 14, 0x265e5a51); OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); OP (FG, A, B, C, D, 5, 5, 0xd62f105d); OP (FG, D, A, B, C, 10, 9, 0x02441453); OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); OP (FG, D, A, B, C, 14, 9, 0xc33707d6); OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); OP (FG, B, C, D, A, 8, 20, 0x455a14ed); OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); OP (FG, C, D, A, B, 7, 14, 0x676f02d9); OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); /* Round 3. */ OP (FH, A, B, C, D, 5, 4, 0xfffa3942); OP (FH, D, A, B, C, 8, 11, 0x8771f681); OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); OP (FH, B, C, D, A, 14, 23, 0xfde5380c); OP (FH, A, B, C, D, 1, 4, 0xa4beea44); OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); OP (FH, B, C, D, A, 6, 23, 0x04881d05); OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); /* Round 4. */ OP (FI, A, B, C, D, 0, 6, 0xf4292244); OP (FI, D, A, B, C, 7, 10, 0x432aff97); OP (FI, C, D, A, B, 14, 15, 0xab9423a7); OP (FI, B, C, D, A, 5, 21, 0xfc93a039); OP (FI, A, B, C, D, 12, 6, 0x655b59c3); OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); OP (FI, C, D, A, B, 10, 15, 0xffeff47d); OP (FI, B, C, D, A, 1, 21, 0x85845dd1); OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); OP (FI, C, D, A, B, 6, 15, 0xa3014314); OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); OP (FI, A, B, C, D, 4, 6, 0xf7537e82); OP (FI, D, A, B, C, 11, 10, 0xbd3af235); OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); OP (FI, B, C, D, A, 9, 21, 0xeb86d391); /* Add the starting values of the context. */ A += A_save; B += B_save; C += C_save; D += D_save; } /* Put checksum in context given as argument. */ ctx->A = A; ctx->B = B; ctx->C = C; ctx->D = D; } solid-pop3d-0.15/src/memops.c 644 765 3173 2203 7077103613 11137 static const char rcsid[] = "$Id: memops.c,v 1.1.1.1 2000/04/12 20:52:25 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "includes.h" #ifndef STDC_HEADERS #ifndef HAVE_MEMCPY void *memchr(void *s, int c, size_t n) { size_t tmp; for (tmp = 0; tmp < n; tmp++) if (*((char *)(s + tmp)) == c) return (s + tmp); return (void *)0; }; #endif #endif solid-pop3d-0.15/src/options.c 644 765 3173 11217 7103116765 11361 static const char rcsid[] = "$Id: options.c,v 1.3 2000/04/28 16:58:55 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "includes.h" #include "options.h" #include "maildrop.h" #ifdef MDMAILBOX #include "mailbox.h" #endif #ifdef MDMAILDIR #include "maildir.h" #endif #include "const.h" #include "log.h" extern int optopt, opterr; extern char *optarg; extern char maildrop_name[]; extern char maildrop_type[]; extern unsigned int autologout_time; #ifdef ALLOWROOTLOGIN extern int allow_root; #endif extern int pop_debug; #ifdef NONIPVIRTUALS extern int parse_config_file(char *, char *); #else extern int parse_config_file(char *); #endif #ifdef NONIPVIRTUALS int parse_options(int argc, char **argv, char *vname) { #else int parse_options(int argc, char **argv) { #endif int c; char *tmp2; long int tmp3; #ifdef CONFIGFILE char configfile[PATH_MAX] = DEFCONFIGFILENAME; #endif char tmpmaildrop_name[PATH_MAX], tmpmaildrop_type[MAXMDTYPENAMELENGTH]; unsigned int tmpautologout_time = 0; #ifdef ALLOWROOTLOGIN int tmpallow_root, used_allow_root = 0; #endif int used_autologout_time = 0; opterr = 0; tmpmaildrop_name[0] = tmpmaildrop_type[0] = 0; #ifdef CONFIGFILE while ((c = getopt(argc, argv, "n:t:a:r:f:d")) != EOF) { #else while ((c = getopt(argc, argv, "n:t:a:r:d")) != EOF) { #endif switch(c) { case 'n': if (strlen(optarg) >= PATH_MAX) { pop_log(pop_priority, "command line: maildrop name too long"); return -1; }; strcpy(tmpmaildrop_name, optarg); break; case 't': if (strlen(optarg) >= MAXMDTYPENAMELENGTH) { pop_log(pop_priority, "command line: maildrop type name too long"); return -1; }; if (find_maildrop(optarg) == NULL) { pop_log(pop_priority, "command line: no such maildrop type: %.40s", optarg); return -1; }; strcpy(tmpmaildrop_type, optarg); break; case 'a': tmp3 = strtol(optarg, &tmp2, 0); if ((tmp3 == LONG_MIN) || (tmp3 == LONG_MAX)) { pop_log(pop_priority, "command line: autologout time value out of range"); return -1; }; if (tmp3 < 0) { pop_log(pop_priority, "command line: autologout time value out of range"); return -1; }; used_autologout_time = 1; switch (*tmp2) { case 0: case 's': tmpautologout_time = tmp3; used_autologout_time = 1; break; case 'm': tmpautologout_time = tmp3 * 60; used_autologout_time = 1; break; case 'h': tmpautologout_time = tmp3 * 3600; used_autologout_time = 1; break; case 'd': tmpautologout_time = tmp3 * 3600 * 24; used_autologout_time = 1; break; case 'w': tmpautologout_time = tmp3 * 3600 * 24 * 7; used_autologout_time = 1; break; default: pop_log(pop_priority, "command line: wrong suffix in \"-a\" option: %c", *tmp2); return -1; }; break; #ifdef ALLOWROOTLOGIN case 'r': tmpallow_root = used_allow_root = 1; break; #endif #ifdef CONFIGFILE case 'f': if ((strlen(optarg) + 1) >= sizeof(configfile)) { pop_log(pop_priority, "command line: config file name too long"); return -1; }; strcpy(configfile, optarg); break; #endif case 'd': pop_debug = 1; break; case '?': pop_log(pop_priority, "command line: unknown option: %c", optopt); return -1; default: pop_log(pop_priority, "command line: unexpected error - contact author of program"); return -1; }; }; #ifdef CONFIGFILE #ifdef NONIPVIRTUALS if (parse_config_file(configfile, vname) < 0) #else if (parse_config_file(configfile) < 0) #endif return -1; #endif if (tmpmaildrop_name[0] != 0) strcpy(maildrop_name, tmpmaildrop_name); if (tmpmaildrop_type[0] != 0) strcpy(maildrop_type, tmpmaildrop_type); if (used_autologout_time) autologout_time = tmpautologout_time; #ifdef ALLOWROOTLOGIN if (used_allow_root) allow_root = allow_root; #endif return 0; } solid-pop3d-0.15/src/response.c 644 765 3173 3336 7103116765 11507 static const char rcsid[] = "$Id: response.c,v 1.3 2000/04/28 16:58:55 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Code from this file sometimes works with root privileges */ #include "includes.h" #include "response.h" #include "const.h" #include "log.h" void send_error(const char *fmt,...) { va_list args; char buf[MAXRESPLN]; va_start(args, fmt); strcpy(buf, "-ERR "); vsnprintf(buf + 5, (sizeof(buf) - 5), fmt, args); va_end(args); strcat(buf, "\r\n"); if (write(1, buf, strlen(buf)) <= 0) { pop_log(pop_priority, "send_error(): can't write to socket"); pop_error("write"); exit(1); }; } void send_ok(const char *fmt,...) { va_list args; char buf[MAXRESPLN]; va_start(args, fmt); strcpy(buf, "+OK "); vsnprintf(buf + 4, (sizeof(buf) - 4), fmt, args); va_end(args); strcat(buf, "\r\n"); if (write(1, buf, strlen(buf)) <= 0) { pop_log(pop_priority, "send_ok(): can't write to socket"); pop_error("write"); exit(1); }; } solid-pop3d-0.15/src/apop.c 644 765 3173 3406 7103116762 10603 static const char rcsid[] = "$Id: apop.c,v 1.2 2000/04/28 16:58:55 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "includes.h" #include "apop.h" #include "const.h" #include "md5.h" #include "log.h" #include #include extern char apop_secret[]; int apop_authenticate(char *username, char *apoptimestamp, char *udigest) { char adigest[16], digest[16]; struct md5_ctx context; int tmp; for (tmp = 0; tmp < 16; tmp++) { if (isdigit(udigest[tmp * 2])) digest[tmp] = ((udigest[tmp * 2] - '0') << 4); else digest[tmp] = ((udigest[tmp * 2] - 'a' + 10) << 4); if (isdigit(udigest[(tmp * 2) + 1])) digest[tmp] |= (udigest[(tmp * 2) + 1] - '0'); else digest[tmp] |= (udigest[(tmp * 2) + 1] - 'a' + 10); }; md5_init_ctx(&context); md5_process_bytes(apoptimestamp, strlen(apoptimestamp), &context); md5_process_bytes(apop_secret, strlen(apop_secret), &context); md5_finish_ctx(&context, &adigest); return (memcmp(digest, adigest, 16) == 0) ? 0 : -1; } solid-pop3d-0.15/src/mailbox.c 644 765 3173 53344 7107253051 11322 static const char rcsid[] = "$Id: mailbox.c,v 1.6 2000/05/13 13:25:52 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "cmds.h" #include "includes.h" #include "maildrop.h" #include "mailbox.h" #include "const.h" #include "md5.h" #include "log.h" #include "fdfgets.h" #include #include #include #include #ifdef MAILOCK #include #endif #ifdef TIME_WITH_SYS_TIME #include #include #else #ifdef HAVE_SYS_TIME_H #include #else #include #endif #endif extern void check_wccount(void); extern char maildrop_name[]; extern char username[]; int mailboxfd; off_t mailboxsize, lastmailboxsize; time_t mailboxmtime; #ifdef CREATEMAILDROP extern int createmaildrop; #endif extern int msgnr, maxmsgnr, msgdel; extern struct message *messages; char months[][3] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "xxx"}; struct str_maildrop mb_maildrop = { mb_init, mb_update, mb_release, mb_retrieve, mb_top, #ifndef BULLETINS mb_md5_uidl_message #else mb_md5_uidl_message, mb_add_message, mb_end_of_adding #endif }; int unlock_mailbox(void) { int retcode; #ifdef HAVE_FLOCK #define MLNAME "mailbox: flock" retcode = flock(mailboxfd, LOCK_UN); #else #if defined(F_SETLK) && defined(F_SETLKW) #define MLNAME "mailbox: fcntl" struct flock arg; arg.l_type = F_UNLCK; arg.l_whence = arg.l_start = arg.l_len = arg.l_pid = 0; retcode = fcntl(mailboxfd, F_SETLKW, &arg); #else #define MLNAME "mailbox: lockf" retcode = lockf(mailboxfd, F_ULOCK, 0); #endif /* defined(F_SETLK) && defined(F_SETLKW) */ #endif /* HAVE_FLOCK */ #ifdef MAILOCK mailunlock(); #endif return retcode; } int lock_mailbox(void) { #if defined(F_SETLK) && defined(F_SETLKW) && !defined(HAVE_FLOCK) struct flock arg; #endif #ifdef MAILOCK if (maillock(username, 1) != 0) { pop_error("mailbox: maillock"); return -1; }; #endif #ifdef HAVE_FLOCK return flock(mailboxfd, LOCK_EX); #else #if defined(F_SETLK) && defined(F_SETLKW) arg.l_type = F_WRLCK; arg.l_whence = arg.l_start = arg.l_len = arg.l_pid = 0; return fcntl(mailboxfd, F_SETLKW, &arg); #else return lockf(mailboxfd, F_LOCK, 0); #endif /* defined(F_SETLK) && defined(F_SETLKW) */ #endif /* HAVE_FLOCK */ } long int mb_dec(char *in) { long int value; value = strtol(in, NULL, 10); return (((value == LONG_MIN) || (value == LONG_MAX)) ? -1 : value); } time_t mb_readtime(char *in) { int m; struct tm vtm; for (m = 0; m < 13; m++) if (strncmp(in, months[m], 3) == 0) break; if ((m == 12) || (in[3] != ' ')) return -1; vtm.tm_mon = m; vtm.tm_mday = mb_dec(in += 4); if (in[2] != ' ') return -1; vtm.tm_hour = mb_dec(in += 3); if (in[2] != ':') return -1; vtm.tm_min = mb_dec(in += 3); if (in[2] != ':') return -1; vtm.tm_sec = mb_dec(in += 3); if (in[2] != ' ') return -1; vtm.tm_year = mb_dec(in += 3) - 1900; vtm.tm_isdst = -1; return mktime(&vtm); } int mb_compare(const char *a, const char *b, int alength) { if (alength < strlen(b)) return 0; return (strncmp(a, b, strlen(b)) == 0) ? 1 : 0; } int mb_fixed(const char *what, int alength) { return (mb_compare(what, "Received:", alength) || mb_compare(what, "Date:", alength) || mb_compare(what, "Message-Id:", alength) || mb_compare(what, "Subject:", alength)); } #ifdef BULLETINS void mb_end_of_adding(void) { struct stat stbuf; if (mailboxfd < 0) return; if (fstat(mailboxfd, &stbuf) < 0) { unlock_mailbox(); pop_error("mailbox: fstat"); send_error("fatal error"); exit(1); }; if (unlock_mailbox() < 0) { pop_error(MLNAME); send_error("fatal error"); exit(1); }; mailboxmtime = stbuf.st_mtime; lastmailboxsize = mailboxsize = stbuf.st_size; } int mb_add_message(int fd) { off_t tmpwhere; ssize_t mcount, tmp; char linebuf[128]; char msgdate[21]; struct mb_message *mbspecific; struct md5_ctx context; int header = 1, fixed = 0, newline = 1; if (mailboxfd < 0) { pop_log(pop_priority, "mailbox: can't add bulletin to mailbox - \ mailbox doesn't exist"); return 0; } if ((tmpwhere = lseek(mailboxfd, 0, SEEK_END)) < 0) { unlock_mailbox(); close(fd); pop_error("mailbox: lseek"); send_error("fatal error"); exit(1); }; fd_initfgets(); if ((mcount = fd_fgets(linebuf, sizeof(linebuf), fd)) < 0) { unlock_mailbox(); close(fd); pop_log(pop_priority, "mailbox: can't read message"); pop_error("mailbox: read"); send_error("fatal error"); exit(1); }; if (mcount < (5 + 2 + sizeof(msgdate))) { /* "From " + username + DATE */ unlock_mailbox(); close(fd); pop_log(pop_priority, "mailbox: message is too short"); send_error("fatal error"); exit(1); }; if (strncmp(linebuf, "From ", 5) != 0) { unlock_mailbox(); close(fd); pop_log(pop_priority, "mailbox: missing \"From \""); send_error("fatal error"); exit(1); }; if (md_realloc(sizeof(struct mb_message)) < 0) { unlock_mailbox(); close(fd); pop_log(pop_priority, "mailbox: no memory available"); send_error("no memory available"); exit(1); }; msgnr++; messages[msgnr - 1].deleted = messages[msgnr - 1].crlfsize = messages[msgnr - 1].size = 0; mbspecific = ((struct mb_message *)(messages[msgnr - 1].md_specific)); mbspecific->from_where = tmpwhere; mbspecific->from_size = 0; while (mcount > 0) { if (mcount < (sizeof(msgdate))) { memmove(msgdate, msgdate + mcount, (sizeof(msgdate) - mcount)); memcpy(msgdate + (sizeof(msgdate) - mcount), linebuf, mcount); } else memcpy(msgdate, linebuf + mcount - sizeof(msgdate), sizeof(msgdate)); tmpwhere += mcount; mbspecific->from_size += mcount; if (write(mailboxfd, linebuf, mcount) != mcount) { unlock_mailbox(); close(fd); pop_log(pop_priority, "mailbox: can't write to mailbox: %.1024s", maildrop_name); pop_error("mailbox: write"); send_error("fatal error"); exit(1); }; if (linebuf[mcount - 1] == '\n') break; mcount = fd_fgets(linebuf, sizeof(linebuf), fd); }; if (mcount < 0) { unlock_mailbox(); close(fd); pop_log(pop_priority, "mailbox: can't read from message file"); pop_error("mailbox: read"); send_error("message file is damaged"); exit(1); }; if (msgdate[sizeof(msgdate) - 1] != '\n') { unlock_mailbox(); close(fd); pop_log(pop_priority, "mailbox: message file is damaged"); send_error("can't read from message file"); exit(1); }; msgdate[sizeof(msgdate) - 1] = 0; messages[msgnr - 1].msg_time = mb_readtime(msgdate); mbspecific->where = tmpwhere; md5_init_ctx(&context); while ((mcount = fd_fgets(linebuf, sizeof(linebuf), fd)) > 0) { if (write(mailboxfd, linebuf, mcount) != mcount) { unlock_mailbox(); close(fd); pop_log(pop_priority, "mailbox: can't write to mailbox: %.1024s", maildrop_name); pop_error("mailbox: write"); send_error("fatal error"); exit(1); }; if (header && newline) fixed = mb_fixed(linebuf, mcount); if (fixed) md5_process_bytes(linebuf, mcount, &context); messages[msgnr - 1].crlfsize += mcount; messages[msgnr - 1].size += mcount; mbspecific->from_size += mcount; if (linebuf[mcount - 1] == '\n') { messages[msgnr - 1].crlfsize++; if ((mcount == 1) && newline) header = 0; newline = 1; } tmp = mcount; }; md5_finish_ctx(&context, mbspecific->digest); close(fd); if (mcount < 0) { unlock_mailbox(); pop_log(pop_priority, "mailbox: can't read from message file"); pop_error("mailbox: read"); send_error("can't read from message file"); exit(1); }; return 1; } #endif int mb_parse(int compare) { ssize_t tmp2; char mbuf[128]; ssize_t mcount; off_t act_ofs = 0; char msgdate[21]; struct mb_message *tmp; struct md5_ctx context; int tmpmsgnr = 0; time_t tmpmsg_time; off_t tmpfrom_where = 0, tmpwhere = 0; size_t tmpfrom_size = 0, tmpsize = 0, tmpcrlfsize = 0; char tmpdigest[16]; int newline = 1, header, fixed; if (compare) if (lseek(mailboxfd, 0, SEEK_SET) < 0) { pop_error("mailbox: lseek"); return -1; }; /* parse mailbox */ if (!compare) if (md_alloc(sizeof(struct mb_message)) < 0) { unlock_mailbox(); mb_release(); pop_log(pop_priority, "mailbox: no memory available"); send_error("no memory available"); exit(1); }; fd_initfgets(); if ((mcount = fd_fgets(mbuf, sizeof(mbuf), mailboxfd)) < 0) { if (!compare) { unlock_mailbox(); mb_release(); }; pop_log(pop_priority, "mailbox: mailbox %.1024s is damaged", maildrop_name); pop_error("mailbox: read"); if (!compare) { send_error("mailbox is damaged"); exit(1); }; return -1; }; if (mcount == 0) { if (!compare) { msgnr = 0; return 0; } else return ((msgnr == 0) ? 0 : -1); }; if ((mcount > 0) && (mcount < (5 + 2 + sizeof(msgdate)))) { if (!compare) { unlock_mailbox(); mb_release(); }; pop_log(pop_priority, "mailbox: mailbox %.1024s is damaged", maildrop_name); if (!compare) { send_error("mailbox is damaged"); exit(1); }; return -1; }; if ((mcount > 0) && (strncmp(mbuf, "From ", 5) != 0)) { if (!compare) { unlock_mailbox(); mb_release(); }; pop_log(pop_priority, "mailbox: mailbox %.1024s is damaged", maildrop_name); if (!compare) { send_error("mailbox is damaged"); exit(1); }; return -1; }; tmp2 = mcount; while (mcount > 0) { act_ofs += mcount; if ((newline) && (mcount >= (5 + 2 + sizeof(msgdate))) && (strncmp(mbuf, "From ", 5) == 0)) { header = 1; fixed = 0; if (!compare) messages[tmpmsgnr].deleted = messages[tmpmsgnr].cread = 0; if (tmpmsgnr > 0) { tmp = (struct mb_message *)(messages[tmpmsgnr - 1].md_specific); md5_finish_ctx(&context, tmpdigest); if (!compare) { tmp->from_where = tmpfrom_where; messages[tmpmsgnr - 1].size = tmpsize; messages[tmpmsgnr - 1].crlfsize = tmpcrlfsize; tmp->where = tmpwhere; tmp->from_size = tmpfrom_size; memcpy(tmp->digest, tmpdigest, 16); messages[tmpmsgnr - 1].msg_time = tmpmsg_time; } else { if ((tmp->from_where != tmpfrom_where) || (messages[tmpmsgnr - 1].size != tmpsize) || (messages[tmpmsgnr - 1].crlfsize != tmpcrlfsize) || (tmp->where != tmpwhere) || (tmp->from_size != tmpfrom_size) || (memcmp(tmp->digest, tmpdigest, 16) != 0) || (messages[tmpmsgnr - 1].msg_time != tmpmsg_time)) return -1; }; }; if (compare && (tmpmsgnr >= msgnr)) return 0; /* messages added only */ tmpfrom_where = act_ofs - mcount; tmpmsgnr++; if (!compare) msgnr = tmpmsgnr; if (!compare) if (md_realloc(sizeof(struct mb_message)) < 0) { unlock_mailbox(); mb_release(); pop_log(pop_priority, "mailbox: no memory available"); send_error("no memory available"); exit(1); }; md5_init_ctx(&context); tmpfrom_size = mcount; if (mcount < (sizeof(msgdate))) { memmove(msgdate, msgdate + mcount, (sizeof(msgdate) - mcount)); memcpy(msgdate + (sizeof(msgdate) - mcount), mbuf, mcount); } else memcpy(msgdate, mbuf + mcount - sizeof(msgdate), sizeof(msgdate)); while (mbuf[mcount - 1] != '\n') { mcount = fd_fgets(mbuf, sizeof(mbuf), mailboxfd); if (mcount <= 0) break; if (mcount < (sizeof(msgdate))) { memmove(msgdate, msgdate + mcount, (sizeof(msgdate) - mcount)); memcpy(msgdate + (sizeof(msgdate) - mcount), mbuf, mcount); } else memcpy(msgdate, mbuf + mcount - sizeof(msgdate), sizeof(msgdate)); act_ofs += mcount; tmpfrom_size += mcount; }; msgdate[sizeof(msgdate) - 1] = 0; tmpmsg_time = mb_readtime(msgdate); if (mcount <= 0) { if (!compare) { unlock_mailbox(); mb_release(); }; pop_log(pop_priority, "mailbox: mailbox is damaged: %.1024s", maildrop_name); if (!compare) { send_error("mailbox is damaged"); exit(1); }; return -1; }; newline = 1; tmpwhere = act_ofs; tmpsize = tmpcrlfsize = 0; } else { tmpsize += mcount; tmpcrlfsize += mcount; tmpfrom_size += mcount; if (header && newline) fixed = mb_fixed(mbuf, mcount); if (fixed) md5_process_bytes(mbuf, mcount, &context); if (mbuf[mcount - 1] == '\n') { tmpcrlfsize++; if (newline && (mcount == 1)) header = 0; newline = 1; } else newline = 0; }; tmp2 = mcount; mcount = fd_fgets(mbuf, sizeof(mbuf), mailboxfd); }; if (mcount < 0) { if (!compare) { unlock_mailbox(); mb_release(); }; pop_log(pop_priority, "mailbox: mailbox is damaged: %.1024s", maildrop_name); pop_error("mailbox: read"); if (!compare) { send_error("mailbox is damaged"); exit(1); }; return -1; }; if (tmp2 > 0) if (mbuf[tmp2 - 1] != '\n') { if (!compare) { unlock_mailbox(); mb_release(); }; pop_log(pop_priority, "mailbox: mailbox is damaged: %.1024s", maildrop_name); if (!compare) { send_error("mailbox is damaged"); exit(1); }; return -1; }; tmp = (struct mb_message *)(messages[tmpmsgnr - 1].md_specific); md5_finish_ctx(&context, tmpdigest); if (!compare) { messages[tmpmsgnr - 1].deleted = messages[tmpmsgnr - 1].cread = 0; tmp->from_where = tmpfrom_where; messages[tmpmsgnr - 1].size = tmpsize; messages[tmpmsgnr - 1].crlfsize = tmpcrlfsize; tmp->where = tmpwhere; tmp->from_size = tmpfrom_size; memcpy(tmp->digest, tmpdigest, 16); msgnr = tmpmsgnr; messages[tmpmsgnr - 1].msg_time = tmpmsg_time; } else { if ((tmp->from_where != tmpfrom_where) || (messages[tmpmsgnr - 1].size != tmpsize) || (messages[tmpmsgnr - 1].crlfsize != tmpcrlfsize) || (tmp->where != tmpwhere) || (tmp->from_size != tmpfrom_size) || (memcmp(tmp->digest, tmpdigest, 16) != 0) || (messages[tmpmsgnr - 1].msg_time != tmpmsg_time)) return -1; }; return 0; } void mb_init(void) { struct stat stbuf; msgnr = 0; if ((mailboxfd = open(maildrop_name, O_RDWR)) < 0) { #ifdef CREATEMAILDROP if ((errno == ENOENT) && (createmaildrop)) mailboxfd = open(maildrop_name, O_RDWR | O_CREAT | O_EXCL, 0600); if ((mailboxfd < 0) && (createmaildrop)) { pop_log(pop_priority, "mailbox: can't open mailbox file: %.1024s", maildrop_name); pop_error("mailbox: open"); send_error("can't open mailbox file"); exit(1); }; #endif if ((mailboxfd < 0) && (errno != ENOENT)) { pop_log(pop_priority, "mailbox: can't open mailbox file: %.1024s", maildrop_name); pop_error("mailbox: open"); send_error("can't open mailbox file"); exit(1); }; }; if (mailboxfd > 0) { if (lock_mailbox() < 0) { pop_log(pop_priority, "mailbox: can't set lock on mailbox file: %.1024s", maildrop_name); pop_error(MLNAME); send_error("can't lock mailbox file"); exit(1); }; if (fstat(mailboxfd, &stbuf) < 0) { unlock_mailbox(); pop_error("mailbox: fstat"); send_error("fstat failed"); exit(1); }; if (!S_ISREG(stbuf.st_mode)) { unlock_mailbox(); pop_log(pop_priority, "mailbox: mailbox is not regular file: %.1024s", maildrop_name); send_error("mailbox is not regular file"); exit(1); }; } #ifndef BULLETINS mailboxmtime = stbuf.st_mtime; lastmailboxsize = mailboxsize = stbuf.st_size; #endif if (mailboxfd > 0) mb_parse(0); #ifndef BULLETINS if (mailboxfd > 0) if (unlock_mailbox() < 0) { pop_log(pop_priority, "mailbox: can't remove lock from mailbox file: %.1024s", maildrop_name); pop_error(MLNAME); send_error("can't unlock mailbox file"); exit(1); }; #endif } void mb_release(void) { if (mailboxfd > 0) close(mailboxfd); md_free(); } void mb_reparse(void) { struct stat stbuf; if (mailboxfd < 0) return; if (fstat(mailboxfd, &stbuf) < 0) { pop_error("mailbox: fstat"); exit(1); }; if ((stbuf.st_size != lastmailboxsize) || (stbuf.st_mtime != mailboxmtime)) { if (lock_mailbox() < 0) { pop_log(pop_priority, "mailbox: can't set lock on mailbox file: %.1024s", maildrop_name); pop_error(MLNAME); exit(1); }; if (fstat(mailboxfd, &stbuf) < 0) { unlock_mailbox(); pop_error("mailbox: fstat"); exit(1); }; if (stbuf.st_size < mailboxsize) { unlock_mailbox(); pop_log(pop_priority, "mailbox: mailbox content has been changed"); exit(1); }; if (mb_parse(1) < 0) { unlock_mailbox(); pop_log(pop_priority, "mailbox: mailbox content has been changed"); exit(1); }; lastmailboxsize = stbuf.st_size; mailboxmtime = stbuf.st_mtime; if (unlock_mailbox() < 0) { pop_log(pop_priority, "mailbox: can't remove lock from mailbox file: %.1024s", maildrop_name); pop_error(MLNAME); exit(1); }; }; } void mb_cleanup(void) { if (mailboxfd > 0) unlock_mailbox(); } void mb_retrieve(unsigned int nr) { if (nr > msgnr) { send_error("no such message"); check_wccount(); return; }; if (messages[--nr].deleted) { send_error("message %u already marked as deleted", nr + 1); check_wccount(); return; }; mb_reparse(); if (lseek(mailboxfd, ((struct mb_message *) (messages[nr].md_specific))->where, SEEK_SET) < 0) { unlock_mailbox(); pop_error("mailbox: lseek"); exit(1); }; md_retrieve(nr, mailboxfd, &mb_cleanup); mb_reparse(); md_end_reply(&mb_cleanup); } void mb_copy(off_t ofs, size_t length) { char mb_buf[10240]; ssize_t tmp; off_t curofs; if ((curofs = lseek(mailboxfd, 0, SEEK_CUR)) < 0) { unlock_mailbox(); pop_error("mailbox: lseek"); send_error("fatal error"); exit(1); }; if (curofs == ofs) { if (lseek(mailboxfd, ofs + length, SEEK_SET) < 0) { unlock_mailbox(); pop_error("mailbox: lseek"); send_error("fatal error"); exit(1); }; return; }; while (length > 0) { if (length > sizeof(mb_buf)) { length -= sizeof(mb_buf); tmp = sizeof(mb_buf); } else { tmp = length; length = 0; }; if (lseek(mailboxfd, ofs, SEEK_SET) < 0) { unlock_mailbox(); pop_error("mailbox: lseek"); send_error("fatal error"); exit(1); }; if (read(mailboxfd, mb_buf, tmp) != tmp) { unlock_mailbox(); pop_error("mailbox: read"); send_error("read error"); exit(1); }; ofs += tmp; if (lseek(mailboxfd, curofs, SEEK_SET) < 0) { unlock_mailbox(); pop_error("mailbox: lseek"); send_error("fatal error"); exit(1); }; if (write(mailboxfd, mb_buf, tmp) != tmp) { unlock_mailbox(); pop_error("mailbox: write"); send_error("write error"); exit(1); }; curofs += tmp; }; } void mb_update(void) { unsigned int tmp; off_t newsize; struct stat stbuf; if (mailboxfd < 0) return; if (lock_mailbox() < 0) { pop_log(pop_priority, "mailbox: can't set lock on mailbox: %.1024s", maildrop_name); pop_error(MLNAME); send_error("can't set lock on mailbox"); exit(1); }; if (fstat(mailboxfd, &stbuf) < 0) { unlock_mailbox(); pop_error("mailbox: fstat"); send_error("fstat failed"); exit(1); }; if (((newsize = stbuf.st_size) != lastmailboxsize) || (stbuf.st_mtime != mailboxmtime)) { if (stbuf.st_size < mailboxsize) { unlock_mailbox(); pop_log(pop_priority, "mailbox: mailbox content has been changed: %.1024s", maildrop_name); send_error("fatal error"); exit(1); }; if (mb_parse(1) < 0) { unlock_mailbox(); pop_log(pop_priority, "mailbox: mailbox content has been changed: %.1024s", maildrop_name); send_error("fatal error"); exit(1); }; lastmailboxsize = stbuf.st_size; mailboxmtime = stbuf.st_mtime; }; if (lseek(mailboxfd, 0, SEEK_SET) < 0) { unlock_mailbox(); pop_error("mailbox: lseek"); send_error("fatal error"); exit(1); }; for (tmp = 0; tmp < msgnr; tmp++) { if ((messages[tmp].deleted)) continue; mb_copy(((struct mb_message *) (messages[tmp].md_specific))->from_where, ((struct mb_message *) (messages[tmp].md_specific))->from_size); }; if (newsize > mailboxsize) mb_copy(mailboxsize, newsize - mailboxsize); if ((newsize = lseek(mailboxfd, 0, SEEK_CUR)) < 0) { unlock_mailbox(); pop_error("mailbox: lseek"); send_error("fatal error"); exit(1); }; if ((mailboxsize = lseek(mailboxfd, 0, SEEK_END)) < 0) { unlock_mailbox(); pop_error("mailbox: lseek"); send_error("fatal error"); exit(1); }; if (mailboxsize != newsize) if (ftruncate(mailboxfd, newsize) < 0) { unlock_mailbox(); pop_error("mailbox: ftruncate"); send_error("fatal error"); exit(1); }; if (unlock_mailbox() < 0) { pop_log(pop_priority, "mailbox: can't remove lock from mailbox: %.1024s", maildrop_name); pop_error(MLNAME); send_error("can't remove lock from mailbox"); exit(1); }; if (close(mailboxfd) < 0) { pop_log(pop_priority, "mailbox: can't close mailbox: %.1024s", maildrop_name); pop_error("mailbox: close"); send_error("can't close mailbox"); exit(1); }; } void mb_top(unsigned int nr, unsigned int lcount) { if (nr > msgnr) { send_error("no such message"); check_wccount(); return; }; if (messages[--nr].deleted) { send_error("message %u is marked as deleted", nr + 1); check_wccount(); return; }; mb_reparse(); if (lseek(mailboxfd, ((struct mb_message *) (messages[nr].md_specific))->where, SEEK_SET) < 0) { unlock_mailbox(); pop_error("mailbox: lseek"); exit(1); }; md_top(nr, lcount, mailboxfd, &mb_cleanup); mb_reparse(); md_end_reply(&mb_cleanup); } char *mb_md5_uidl_message(unsigned int number, char *result) { memcpy(result, ((struct mb_message *)(messages[number].md_specific))->digest, 16); return result; } solid-pop3d-0.15/src/maildir.c 644 765 3173 43060 7107253053 11304 static const char rcsid[] = "$Id: maildir.c,v 1.5 2000/05/13 13:25:52 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "includes.h" #include "maildrop.h" #include "maildir.h" #include "const.h" #include "md5.h" #include "log.h" #include "fdfgets.h" #include "cmds.h" #include #include #include #include #if HAVE_DIRENT_H #include #define NAMLEN(dirent) (strlen((dirent)->d_name)) #else #define dirent direct #define NAMLEN(dirent) ((dirent)->d_namlen) #if HAVE_SYS_NDIR_H #include #endif #if HAVE_SYS_DIR_H #include #endif #if HAVE_NDIR_H #include #endif #endif #ifdef TIME_WITH_SYS_TIME #include #include #else #ifdef HAVE_SYS_TIME_H #include #else #include #endif #endif extern void check_wccount(void); extern char maildrop_name[]; extern char username[]; extern int msgnr, maxmsgnr, msgdel; extern struct message *messages; int msgfd; int mdir_exists; #ifdef BULLETINS pid_t nomsg = 0, nnomsg = 0; #endif #ifdef CREATEMAILDROP extern int createmaildrop; #endif struct str_maildrop mdir_maildrop = { mdir_init, mdir_update, mdir_release, mdir_retrieve, mdir_top, #ifndef BULLETINS mdir_md5_uidl_message #else mdir_md5_uidl_message, mdir_add_message, mdir_end_of_adding #endif }; int mdir_compare(const void *arg1, const void *arg2) { long int d1, d2; d1 = ((const struct message *)(arg1))->msg_time; d2 = ((const struct message *)(arg2))->msg_time; if (d1 < d2) return -1; if (d1 == d2) return 0; return 1; } #ifdef BULLETINS void mdir_end_of_adding(void) { if (mdir_exists == 0) return; qsort(messages, msgnr, sizeof(struct message), mdir_compare); } int mdir_add_message(int fd) { char filename[PATH_MAX]; char nfilename[PATH_MAX]; char msgname[100 + 256]; char hstname[256]; pid_t tmppid = getpid() + nomsg; pid_t ntmppid = getpid() + nnomsg; time_t tmptime = time(NULL); int nmsgfd; ssize_t mcount, tmp; char linebuf[128]; if (mdir_exists == 0) { pop_log(pop_priority, "maildir: can't add bulletin - maildir \ doesn't exist"); return 0; } if (gethostname(hstname, sizeof(hstname)) < 0) { close(fd); pop_log(pop_priority, "maildir: can't get name of host"); pop_error("maildir: gethostname"); send_error("fatal error"); exit(1); }; do { snprintf(msgname, sizeof(msgname), "tmp/%u.%u.%.256s", tmptime, tmppid, hstname); if ((strlen(msgname) + strlen(maildrop_name) + 2) > sizeof(filename)) { close(fd); pop_log(pop_priority, "maildir: message file name is too long"); send_error("fatal error"); exit(1); }; strcpy(filename, maildrop_name); strcat(filename, "/"); strcat(filename, msgname); nmsgfd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0600); if ((nmsgfd < 0) && (errno == EEXIST)) { tmppid++; nomsg++; if (nomsg > 500) { close(fd); pop_log(pop_priority, "maildir: can't found unused message file name"); send_error("fatal error"); exit(1); }; continue; /* try next message file name */ }; if (nmsgfd < 0) { close(fd); pop_log(pop_priority, "maildir: can't create message file: %.1024s", filename); pop_error("maildir: open"); send_error("fatal error"); exit(1); }; break; } while(1); fd_initfgets(); if ((mcount = fd_fgets(linebuf, sizeof(linebuf), fd)) < 0) { close(nmsgfd); close(fd); unlink(filename); pop_log(pop_priority, "maildir: can't read message"); pop_error("maildir: read"); send_error("fatal error"); exit(1); }; if (mcount > 5) if (strncmp(linebuf, "From ", 5) == 0) { while (linebuf[mcount - 1] != '\n') { if ((mcount = fd_fgets(linebuf, sizeof(linebuf), fd)) < 0) { close(nmsgfd); close(fd); unlink(filename); pop_log(pop_priority, "maildir: can't read message"); pop_error("maildir: read"); send_error("fatal error"); exit(1); }; if (mcount == 0) break; }; if (mcount == 0) { /* null message */ close(nmsgfd); close(fd); unlink(filename); pop_log(pop_priority, "maildir: empty message"); send_error("fatal error"); exit(1); }; mcount = fd_fgets(linebuf, sizeof(linebuf), fd); }; if (md_realloc(sizeof(struct mdir_message)) < 0) { close(nmsgfd); close(fd); unlink(filename); pop_log(pop_priority, "maildir: no memory available"); send_error("no memory available"); exit(1); }; msgnr++; messages[msgnr - 1].msg_time = tmptime; messages[msgnr - 1].deleted = messages[msgnr - 1].crlfsize =\ messages[msgnr - 1].size = messages[msgnr - 1].cread = 0; while (mcount > 0) { if (write(nmsgfd, linebuf, mcount) != mcount) { close(nmsgfd); close(fd); unlink(filename); pop_log(pop_priority, "maildir: can't write to message file: %.1024s", filename); pop_error("maildir: write"); send_error("fatal errror"); exit(1); }; tmp = mcount; messages[msgnr - 1].crlfsize += mcount; messages[msgnr - 1].size += mcount; if (linebuf[mcount - 1] == '\n') messages[msgnr - 1].crlfsize++; mcount = fd_fgets(linebuf, sizeof(linebuf), fd); }; if (mcount < 0) { close(nmsgfd); close(fd); unlink(filename); pop_log(pop_priority, "maildir: can't read from message file: %.1024s", filename); pop_error("maildir: read"); send_error("can't read from message file"); exit(1); }; if (tmp > 0) if (linebuf[tmp - 1] != '\n') { close(nmsgfd); close(fd); unlink(filename); pop_log(pop_priority, "maildir: message is damaged: %.1024s", filename); send_error("message is damaged"); exit(1); }; if (close(nmsgfd) < 0) { close(fd); unlink(filename); pop_log(pop_priority, "maildir: can't close message file: %.1024s", filename); pop_error("maildir: close"); send_error("can't close message file"); exit(1); }; do { snprintf(msgname, sizeof(msgname), "new/%u.%u.%.256s", tmptime, ntmppid, hstname); if ((strlen(msgname) + strlen(maildrop_name) + 2) > sizeof(nfilename)) { close(fd); unlink(filename); pop_log(pop_priority, "maildir: message file name is too long"); send_error("fatal error"); exit(1); }; strcpy(nfilename, maildrop_name); strcat(nfilename, "/"); strcat(nfilename, msgname); nmsgfd = link(filename, nfilename); if ((nmsgfd < 0) && (errno == EEXIST)) { ntmppid++; nnomsg++; if (nnomsg > 500) { close(fd); unlink(filename); pop_log(pop_priority, "maildir: can't found unused message file name"); send_error("fatal error"); exit(1); }; continue; /* try next message file name */ }; if (nmsgfd < 0) { close(fd); unlink(filename); pop_log(pop_priority, "maildir: can't link message file: %.1024s", nfilename); pop_error("maildir: link"); send_error("fatal error"); exit(1); }; break; } while(1); unlink(filename); if ((((struct mdir_message *) (messages[msgnr - 1].md_specific))->filename = (char *) malloc(strlen(msgname) + 1)) == NULL) { close(nmsgfd); close(fd); unlink(nfilename); /* remove message */ pop_log(pop_priority, "maildir: no memory available"); send_error("no memory available"); exit(1); }; strcpy(((struct mdir_message *) (messages[msgnr - 1].md_specific))->filename, msgname); return 1; } #endif void mdir_clean(void) { struct stat stat_buf; DIR *dir; struct dirent *d_entry; char filename[PATH_MAX], *tmp; time_t act_time; if ((strlen(maildrop_name) + 7) > sizeof(filename)) return; strcpy(filename, maildrop_name); strcat(filename, "/tmp/"); tmp = filename + strlen(filename); act_time = time(NULL); if ((dir = opendir(filename)) == NULL) return; while ((d_entry = readdir(dir)) != NULL) { if (d_entry->d_name[0] == '.') continue; *tmp = 0; if ((strlen(filename) + NAMLEN(d_entry) + 1) > sizeof(filename)) break; strcpy(tmp, d_entry->d_name); if (stat(filename, &stat_buf) < 0) { continue; }; if (act_time > (stat_buf.st_atime + (36*3600))) unlink(filename); }; closedir(dir); } void mdir_append(const char *directory) { DIR *dirstream; struct dirent *direntry; char filename[PATH_MAX]; char mbuf[128]; char *tmp; int messagefd; ssize_t tmp4, mcount; char *fname; struct stat stbuf; if ((strlen(directory) + strlen(maildrop_name) + 4) > sizeof(filename)) { mdir_release(); pop_log(pop_priority, "maildir: maildir name too long"); send_error("maildir name too long"); exit(1); }; strcpy(filename, maildrop_name); strcat(filename, "/"); fname = filename + strlen(filename); strcat(filename, directory); if ((dirstream = opendir(filename)) == NULL) { #ifdef CREATEMAILDROP if ((createmaildrop) || (errno != ENOENT)) { #else if (errno != ENOENT) { #endif mdir_release(); pop_log(pop_priority, "maildir: can't open maildir: %.1024s", filename); pop_error("maildir: opendir"); send_error("can't open maildir"); exit(1); } mdir_exists = 0; return; } strcat(filename, "/"); tmp = filename + strlen(filename); while ((direntry = readdir(dirstream)) != NULL) { if (direntry->d_name[0] == '.') continue; if ((NAMLEN(direntry) + strlen(filename) + 1) > sizeof(filename)) { closedir(dirstream); mdir_release(); pop_log(pop_priority, "maildir: message file name too long"); send_error("message file name too long"); exit(1); }; strcpy(tmp, direntry->d_name); if (md_realloc(sizeof(struct mdir_message)) < 0) { closedir(dirstream); mdir_release(); pop_log(pop_priority, "maildir: no memory available"); send_error("no memory available"); exit(1); }; if ((((struct mdir_message *) (messages[msgnr].md_specific))->filename = (char *) malloc(strlen(fname) + 1)) == NULL) { closedir(dirstream); mdir_release(); pop_log(pop_priority, "maildir: no memory available"); send_error("no memory available"); exit(1); }; strcpy(((struct mdir_message *) (messages[msgnr].md_specific))->filename, fname); messages[msgnr].deleted = messages[msgnr].crlfsize =\ messages[msgnr].size = messages[msgnr].cread = 0; if ((messagefd = open(filename, O_RDONLY)) < 0) { closedir(dirstream); mdir_release(); pop_log(pop_priority, "maildir: can't open message file: %.1024s", filename); pop_error("maildir: open"); send_error("can't open message file"); exit(1); }; if (fstat(messagefd, &stbuf) < 0) { closedir(dirstream); mdir_release(); pop_log(pop_priority, "maildir: fstat failed: %.1024s", filename); pop_error("maildir: fstat"); send_error("fatal error"); exit(1); }; messages[msgnr].msg_time = stbuf.st_mtime; msgnr++; *tmp = 0; fd_initfgets(); tmp4 = 0; while ((mcount = fd_fgets(mbuf, sizeof(mbuf), messagefd)) > 0) { tmp4 = mcount; messages[msgnr - 1].crlfsize += mcount; messages[msgnr - 1].size += mcount; if (mbuf[mcount - 1] == '\n') messages[msgnr - 1].crlfsize++; }; if (mcount < 0) { close(messagefd); closedir(dirstream); mdir_release(); pop_log(pop_priority, "maildir: can't read from message file: %.1024s", filename); pop_error("maildir: read"); send_error("can't read from message file"); exit(1); }; if (tmp4 > 0) if (mbuf[tmp4 - 1] != '\n') { close(messagefd); closedir(dirstream); mdir_release(); pop_log(pop_priority, "maildir: message is damaged: %.1024s", filename); send_error("message is damaged"); exit(1); }; if (close(messagefd) < 0) { closedir(dirstream); mdir_release(); pop_log(pop_priority, "maildir: can't close message file: %.1024s", filename); pop_error("maildir: close"); send_error("can't close message file"); exit(1); }; }; closedir(dirstream); } #ifdef CREATEMAILDROP void mdir_mkdir(char *dirname) { if (mkdir(dirname, 0700) < 0) { pop_log(pop_priority, "maildir: can't create directory: %.1024s", dirname); pop_error("maildir: mkdir"); send_error("fatal error"); exit(1); }; } void mdir_create(void) { char mdrop[PATH_MAX], *tmp; struct stat stbuf; if ((strlen(maildrop_name) + 5) > sizeof(mdrop)) { mdir_release(); pop_log(pop_priority, "maildir: maildrop name too long"); send_error("fatal error"); exit(1); }; strcpy(mdrop, maildrop_name); tmp = mdrop + strlen(mdrop); if (stat(mdrop, &stbuf) == 0) return; mdir_mkdir(mdrop); strcpy(tmp, "/new"); mdir_mkdir(mdrop); strcpy(tmp, "/cur"); mdir_mkdir(mdrop); strcpy(tmp, "/tmp"); mdir_mkdir(mdrop); } #endif void mdir_init() { mdir_exists = 1; msgnr = 0; mdir_clean(); if (md_alloc(sizeof(struct mdir_message)) < 0) { mdir_release(); pop_log(pop_priority, "maildir: no memory available"); send_error("no memory available"); exit(1); }; #ifdef CREATEMAILDROP if (createmaildrop) mdir_create(); #endif mdir_append("new"); if (mdir_exists) mdir_append("cur"); #ifndef BULLETINS if (mdir_exists) qsort(messages, msgnr, sizeof(struct message), mdir_compare); #endif } void mdir_release() { size_t number; if (messages == NULL) return; for (number = 0; number < msgnr; number++) free(((struct mdir_message *) (messages[number].md_specific))->filename); md_free(); } void mdir_cleanup(void) { close(msgfd); } void mdir_retrieve(unsigned int nr) { char msgfile[PATH_MAX]; if (nr > msgnr) { send_error("no such message"); check_wccount(); return; }; if (messages[--nr].deleted) { send_error("message %u already marked as deleted", nr + 1); check_wccount(); return; }; if ((strlen(maildrop_name) + strlen(((struct mdir_message *)(messages[nr].md_specific))->filename) + 2) > sizeof(msgfile)) { /* it was alredy checked in md_append, but "szczezonego Pan Bog szczeze" */ pop_log(pop_priority, "maildir: unexpected error"); exit(1); }; strcpy(msgfile, maildrop_name); strcat(msgfile, "/"); strcat(msgfile, ((struct mdir_message *)(messages[nr].md_specific))->filename); if ((msgfd = open(msgfile, O_RDONLY)) < 0) { pop_log(pop_priority, "maildir: maildir content probably has been changed"); pop_error("maildir: open"); exit(1); }; md_retrieve(nr, msgfd, &mdir_cleanup); md_end_reply(&mdir_cleanup); close(msgfd); } void mdir_update() { int tmp; char filename[PATH_MAX], newfilename[PATH_MAX], *tmp2; if (mdir_exists == 0) return; if ((strlen(maildrop_name) + 3) > sizeof(filename)) { /* no overflow, already checked in mdir_append but "szczezonego Pan Bog szczeze" */ mdir_release(); pop_log(pop_priority, "maildir: unexpected error - send info to author of program"); send_error("fatal error"); exit(1); }; strcpy(filename, maildrop_name); strcat(filename, "/"); tmp2 = filename + strlen(filename); for (tmp = 0; tmp < msgnr; tmp++) { *tmp2 = 0; if ((strlen(filename) + strlen(((struct mdir_message *) (messages[tmp].md_specific))->filename) + 1) > sizeof(filename)) { /* no overflow, already checked in mdir_append but "szczezonego Pan Bog szczeze" */ mdir_release(); pop_log(pop_priority, "maildir: unexpected error - send info to author of program"); send_error("fatal error"); exit(1); }; strcpy(tmp2, ((struct mdir_message *) (messages[tmp].md_specific))->filename); if (messages[tmp].deleted) unlink(filename); else { if (strncmp(tmp2, "new/", 4) != 0) continue; if ((strlen(filename) + 4) > sizeof(newfilename)) continue; strcpy(newfilename, maildrop_name); strcat(newfilename, "/cur/"); strcat(newfilename,((char *) (((struct mdir_message *) (messages[tmp].md_specific))->filename)) + 4); strcat(newfilename, ":2,"); /* no overflow, already checked few lines above */ rename(filename, newfilename); }; }; *tmp2 = 0; } void mdir_top(unsigned int nr, unsigned int lcount) { char msgfile[PATH_MAX]; if (nr > msgnr) { send_error("no such message"); check_wccount(); return; }; if (messages[--nr].deleted) { send_error("message %u is marked as deleted", nr + 1); check_wccount(); return; }; if ((strlen(maildrop_name) + strlen(((struct mdir_message *)(messages[nr].md_specific))->filename) + 2) > sizeof(msgfile)) { /* it was alredy checked in md_append, but "szczezonego Pan Bog szczeze" */ pop_log(pop_priority, "maildir: unexpected error"); exit(1); }; strcpy(msgfile, maildrop_name); strcat(msgfile, "/"); strcat(msgfile, ((struct mdir_message *)(messages[nr].md_specific))->filename); if ((msgfd = open(msgfile, O_RDONLY)) < 0) { pop_log(pop_priority, "maildir: maildir content probably has been changed"); pop_error("maildir: open"); exit(1); }; md_top(nr, lcount, msgfd, &mdir_cleanup); md_end_reply(&mdir_cleanup); close(msgfd); } char *mdir_md5_uidl_message(unsigned int number, char *result) { size_t length; char *tmp2, *tmp3; struct md5_ctx context; md5_init_ctx(&context); tmp2 = ((struct mdir_message *) (messages[number].md_specific))->filename; if ((tmp3 = strrchr(tmp2,'/')) == NULL) tmp3 = tmp2; else tmp3 = tmp3 + 1; length = strlen(tmp3); if ((tmp2 = strchr(tmp3, ':')) != NULL) length -= strlen(tmp2); md5_process_bytes(tmp3, length, &context); md5_finish_ctx(&context, result); return result; } solid-pop3d-0.15/src/userconfig.c 644 765 3173 15551 7103116765 12037 static const char rcsid[] = "$Id: userconfig.c,v 1.3 2000/04/28 16:58:55 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "includes.h" #include #include #include #include "maildrop.h" #include "const.h" #include "log.h" #include "fdfgets.h" extern char maildrop_name[]; extern char maildrop_type[]; #ifdef APOP extern char apop_secret[]; #endif void parse_user_cfg(char *homedir) { struct stat stbuf; char tmpmaildrop_name[PATH_MAX]; char tmpmaildrop_type[MAXMDTYPENAMELENGTH]; #ifdef APOP char tmpapop_secret[MAXARGLN + 1]; #endif char cfgfile[PATH_MAX]; char buf[128]; int fd, md_set = 0; #ifdef APOP int as_set = 0; #endif int linenr; ssize_t tmp; #ifdef APOP size_t tmp3; #endif char *tmp2; if (stat(homedir, &stbuf) < 0) { pop_log_dbg(pop_priority, "user config: can't stat user home directory: %.1024s", homedir); pop_error_dbg("user config: stat"); return; }; if (stbuf.st_mode & 2) { pop_log(pop_priority, "user config: user home directory is world writable"); return; }; if ((strlen(homedir) + strlen(USERCFG) + 2) > sizeof(cfgfile)) { pop_log(pop_priority, "user config: home directory name too long"); return; }; strcpy(cfgfile, homedir); strcat(cfgfile, "/"); strcat(cfgfile, USERCFG); if ((fd = open(cfgfile, O_RDONLY)) < 0) { pop_log_dbg(pop_priority, "user config: can't open user config file"); pop_error_dbg("user config: open"); return; }; if (fstat(fd, &stbuf) < 0) { close(fd); pop_log(pop_priority, "user config: can't stat user config file"); pop_error("user config: fstat"); return; }; if (!S_ISREG(stbuf.st_mode)) { close(fd); pop_log(pop_priority, "user config: user config file is not regular file"); return; }; if (stbuf.st_mode & 0177) { close(fd); pop_log(pop_priority, "user config: user config file has wrong mode"); return; }; if (stbuf.st_size == 0) { close(fd); pop_log(pop_priority, "user config: user config file is empty"); return; }; fd_initfgets(); linenr = 0; while (1) { linenr++; if ((tmp = fd_fgets(buf, sizeof(buf), fd)) < 0) { memset(buf, 0, sizeof(buf)); close(fd); pop_log(pop_priority, "user config: can't read user config file"); pop_error("user config: read"); return; }; if (tmp == 0) break; if ((tmp == sizeof(buf)) && (buf[sizeof(buf) - 1] != '\n')) { memset(buf, 0, sizeof(buf)); close(fd); pop_log(pop_priority, "user config: line too long in user config file"); return; }; if ((tmp == 1) && (buf[0] == '\n')) continue; if (buf[tmp - 1] == '\n') buf[tmp - 1] = 0; strtok(buf, " \t"); if (strcasecmp(buf, "maildrop") == 0) { if (md_set == 1) { memset(buf, 0, sizeof(buf)); close(fd); pop_log(pop_priority, "user config: maildrop already set in user config file"); return; }; if ((tmp2 = strtok(NULL, " \t")) == NULL) { memset(buf, 0, sizeof(buf)); close(fd); pop_log(pop_priority, "user config: argument missing in maildrop declaration in user config file, line: %u", linenr); return; }; if (strlen(tmp2) >= sizeof(tmpmaildrop_name)) { memset(buf, 0, sizeof(buf)); close(fd); pop_log(pop_priority, "user config: maildrop file name in user config file is too long"); return; }; strcpy(tmpmaildrop_name, tmp2); if ((tmp2 = strtok(NULL, " \t")) == NULL) { memset(buf, 0, sizeof(buf)); close(fd); pop_log(pop_priority, "user config: argument missing in maildrop declaration in user config file, line: %u", linenr); return; }; if (strlen(tmp2) >= sizeof(tmpmaildrop_type)) { memset(buf, 0, sizeof(buf)); close(fd); pop_log(pop_priority, "user config: maildrop type in user config file is too long"); return; }; #ifdef MDMAILBOX if (strcasecmp(tmp2, "mailbox") != 0) #endif #ifdef MDMAILDIR if (strcasecmp(tmp2, "maildir") != 0) #endif { memset(buf, 0, sizeof(buf)); close(fd); pop_log(pop_priority, "user config: no such maildrop type: %.40s", tmp2); return; }; strcpy(tmpmaildrop_type, tmp2); md_set = 1; continue; }; #ifdef APOP if (strcasecmp(buf, "APOPsecret") == 0) { if (as_set == 1) { memset(buf, 0, sizeof(buf)); close(fd); pop_log(pop_priority, "user config: APOP secret already set in user config file"); return; }; if ((tmp2 = strtok(NULL, " \t")) == NULL) { memset(buf, 0, sizeof(buf)); close(fd); pop_log(pop_priority, "user config: argument missing, line: %u", linenr); return; }; tmp3 = strlen(tmp2); if (tmp3 & 1) { memset(buf, 0, sizeof(buf)); close(fd); pop_log(pop_priority, "user config: length of encrypted APOP secret should be even number"); return; }; if ((tmp3/2) >= sizeof(tmpapop_secret)) { memset(buf, 0, sizeof(buf)); close(fd); pop_log(pop_priority, "user config: encrypted APOP secret is too long"); return; }; for (tmp3 = 0; tmp3 < strlen(tmp2); tmp3++) if (((tmp2[tmp3] < 'a') || (tmp2[tmp3] > 'z')) && (!isdigit(tmp2[tmp3]))) { memset(buf, 0, sizeof(buf)); close(fd); pop_log(pop_priority, "user config: wrong character in encrypted APOP secret"); return; }; memset(tmpapop_secret, 0, sizeof(tmpapop_secret)); for (tmp3 = 0; tmp3 < (strlen(tmp2) / 2); tmp3++) { if (isdigit(tmp2[tmp3 * 2])) tmpapop_secret[tmp3] = (tmp2[tmp3 * 2] - '0') << 4; else tmpapop_secret[tmp3] = (tmp2[tmp3 * 2] - 'a' + 10) << 4; if (isdigit(tmp2[(tmp3 * 2) + 1])) tmpapop_secret[tmp3] |= (tmp2[(tmp3 * 2) + 1] - '0'); else tmpapop_secret[tmp3] |= (tmp2[(tmp3 * 2) + 1] - 'a' + 10); tmpapop_secret[tmp3] ^= 0xff; }; as_set = 1; continue; }; memset(tmpapop_secret, 0, sizeof(tmpapop_secret)); #endif memset(buf, 0, sizeof(buf)); close(fd); pop_log(pop_priority, "user config: unknown option name, line: %u", linenr); return; }; close(fd); if (md_set == 1) { strcpy(maildrop_name, tmpmaildrop_name); strcpy(maildrop_type, tmpmaildrop_type); }; #ifdef APOP if (as_set == 1) strcpy(apop_secret, tmpapop_secret); memset(tmpapop_secret, 0, sizeof(tmpapop_secret)); #endif return; } solid-pop3d-0.15/src/configfile.c 644 765 3173 33070 7103116764 11773 static const char rcsid[] = "$Id: configfile.c,v 1.3 2000/04/28 16:58:55 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "includes.h" #include "configfile.h" #include "log.h" #include "maildrop.h" #include #include #include #include #include #include #ifdef SPIPV6 #include "spipv6.h" #endif #ifdef NONIPVIRTUALS char *cf_vhostname; #endif char *cf_name; int cf_line, cf_column, ocf_line, ocf_column, oocf_column; #ifdef SPIPV6 union sp_sockaddr skaddress; #else struct sockaddr_in skaddress; #endif int cf_fd; char tbuf[1024]; int mcount, mwhere; int cf_special; void cf_error(char *cf_message) { pop_log(pop_priority, "config file: line %d, column %d: %.200s", ocf_line, ocf_column, cf_message); } int cf_get_char(void) { int tmp; if (mcount == 0) { if ((mcount = read(cf_fd, tbuf, sizeof(tbuf))) < 0) { pop_log(pop_priority, "config file: can't read from configuration file: %.1024s", cf_name); pop_error("config file: read"); return -1; /* error */ }; if (mcount == 0) return -2; /* end of file */ mwhere = 0; }; mcount--; if ((tmp = tbuf[mwhere++]) == '\n') { cf_line++; oocf_column = cf_column; cf_column = 1; } else cf_column++; return tmp; } void cf_put_char(char what) { /* no error, it's called after cf_get_char() */ tbuf[--mwhere] = what; mcount++; if (what == '\n') { cf_line--; cf_column = oocf_column; } else cf_column--; } int cf_skip_comment(void) { int tmp, tmp2; tmp = 0; while ((tmp2 = cf_get_char()) >= 0) { if ((tmp == '*') && (tmp2 == '/')) return 0; tmp = tmp2; }; if (tmp == -2) cf_error("missing \"*/\""); return -1; } int cf_get_token(struct cf_token *result) { int tmp, tmp2, tokenlength = 0, quoted, maxlength; ocf_line = cf_line; ocf_column = cf_column; do { if ((tmp = cf_get_char()) < 0) return ((tmp == -1) ? -1 : 0); } while ((tmp == ' ') || (tmp == '\t')); if (tmp == '\n') { result->res_type = EOL; return 1; }; if (tmp == '/') { if ((tmp2 = cf_get_char()) < 0) if (tmp2 == -1) return -1; if (tmp2 != -2) { if (tmp2 == '*') { if (cf_skip_comment() < 0) return -1; return -2; /* call again */ } else cf_put_char(tmp2); }; }; quoted = ((tmp == '\"') ? 1 : 0); if (quoted) if ((tmp = cf_get_char()) < 0) { result->res_string[tokenlength] = 0; if (tmp == -2) cf_error("missing '\"'"); return -1; }; result->res_type = STRING; maxlength = (result->max_size - 1); while (((quoted) || ((tmp != ' ') && (tmp != '\t') && (tmp != '\n'))) && (tmp != '\"') && ((tokenlength == 0) || (quoted) || (!cf_special) || (tmp != '>'))) { if (tmp == '\\') { if ((tmp = cf_get_char()) < 0) { result->res_string[tokenlength] = 0; if (tmp == -2) cf_error("some character after '\\' expected"); return -1; }; if (tmp == '\n') { if ((tmp = cf_get_char()) < 0) { result->res_string[tokenlength] = 0; if (quoted) { if (tmp == -2) cf_error("missing '\"'"); return -1; }; return ((tmp == -1) ? -1 : 1); }; continue; }; }; if (maxlength == 0) { cf_error("argument too long"); return -1; }; maxlength--; result->res_string[tokenlength++] = tmp; if ((tmp = cf_get_char()) < 0) { result->res_string[tokenlength] = 0; if (quoted) { if (tmp == -2) cf_error("missing '\"'"); return -1; }; return ((tmp == -1) ? -1 : 1); }; }; result->res_string[tokenlength] = 0; if ((tmp == '\n') || ((tmp == '\"') && (!quoted)) || (tmp == '>')) cf_put_char(tmp); return 1; } int get_token(struct cf_token *result) { int tmp; while ((tmp = cf_get_token(result)) == -2); return tmp; } int parse_options_block(int thishost) { int tmp, opind; long int num; char *stolptr; struct cf_token p_token; char linebuf[PATH_MAX + 1]; char numsuffix; p_token.max_size = sizeof(linebuf) - 1; p_token.res_string = linebuf; linebuf[0] = linebuf[PATH_MAX] = 0; if ((tmp = get_token(&p_token)) < 0) return -1; if (tmp == 0) { cf_error("option name expected"); return -1; }; do { while (p_token.res_type == EOL) { if ((tmp = get_token(&p_token)) < 0) return -1; if (tmp == 0) { cf_error("option name expected"); return -1; }; }; if (p_token.res_type != STRING) { cf_error("option name expected"); return -1; }; if ((strcasecmp(linebuf, "") == 0) || (strcasecmp(linebuf, "") == 0)) return 0; opind = 0; while (options_set[opind].name != NULL) { if (strcasecmp(options_set[opind].name, linebuf) == 0) break; opind++; }; if (options_set[opind].name == NULL) { cf_error("unknown option name"); return -1; }; if ((tmp = get_token(&p_token)) < 0) return -1; if ((tmp == 0) || (p_token.res_type != STRING)) { cf_error("argument expected"); return -1; }; switch (options_set[opind].op_type) { case OP_STRING: if (strlen(linebuf) >= options_set[opind].valuesize) { cf_error("argument is too long"); return -1; }; if (options_set[opind].check_value != NULL) if (options_set[opind].check_value(linebuf) < 0) { cf_error("wrong argument"); return -1; }; if (thishost) strcpy((char *)options_set[opind].value, linebuf); tmp = get_token(&p_token); break; case OP_BOOLEAN: if ((strcasecmp(linebuf, "yes") == 0) || (strcasecmp(linebuf, "true") == 0)) { if (thishost) *((int *)(options_set[opind].value)) = 1; } else { if ((strcasecmp(linebuf, "no") == 0) || (strcasecmp(linebuf, "false") == 0)) { if (thishost) *((int *)(options_set[opind].value)) = 0; } else { cf_error("\"yes\", \"no\", \"true\" or \"false\" expected"); return -1; }; }; tmp = get_token(&p_token); break; #ifdef EXPIRATION case OP_EXPIRE: if (strcasecmp(linebuf, "never") == 0) { if (thishost) ((struct expiration *)(options_set[opind].value))->enabled = 0; tmp = get_token(&p_token); break; }; /* no break here !!! */ #endif case OP_PERIOD: num = strtol(linebuf, &stolptr, 10); if (((stolptr[0] != 0) && (stolptr[1] != 0)) || (num == LONG_MIN) || (num == LONG_MAX) || (num < 0)) { cf_error("wrong argument"); return -1; }; tmp = get_token(&p_token); numsuffix = *stolptr; if (*stolptr == 0) { if (tmp < 0) return -1; if (tmp == 0) { cf_error("\"end of line\" expected"); return -1; }; if (p_token.res_type == STRING) { if (strlen(linebuf) != 1) { cf_error("suffix too long"); return -1; }; numsuffix = linebuf[0]; tmp = get_token(&p_token); }; }; switch (numsuffix) { case 0: case 's': break; case 'm': num *= 60; break; case 'h': num *= 3600; break; case 'd': num *= (24*3600); break; case 'w': num *= (7*24*3600); break; default: cf_error("unknown suffix"); return -1; }; #ifdef EXPIRATION if (options_set[opind].op_type == OP_EXPIRE) { if (thishost) { ((struct expiration *)(options_set[opind].value))->enabled = 1; ((struct expiration *)(options_set[opind].value))->expperiod = num; }; } else #endif if (thishost) *((unsigned int *)(options_set[opind].value)) = num; }; if (tmp < 0) return -1; if ((tmp == 0) || (p_token.res_type != EOL)) { cf_error("\"end of line\" expected"); return -1; }; if ((tmp = get_token(&p_token)) < 0) return -1; if (tmp == 0) { cf_error("option name expected"); return -1; }; } while(1); } #ifdef SPIPV6 int sp_inet_aton(char *cp, struct in6_addr *buf) { struct in_addr tmp; if (inet_aton(cp, &tmp) > 0) { memset(buf, 0, sizeof(struct in6_addr)); memcpy(&buf->s6_addr[12], &tmp, sizeof(tmp)); buf->s6_addr[10] = buf->s6_addr[11] = 0xff; return 1; }; return (inet_pton(AF_INET6, cp, buf) == 0) ? 0 : 1; } #endif int cf_parse(void) { struct cf_token p_token; char linebuf[PATH_MAX]; int tmp, thishost; #ifdef NONIPVIRTUALS int nonipvh; #endif #ifdef SPIPV6 struct in6_addr ipaddr; #else struct in_addr ipaddr; #endif p_token.max_size = sizeof(linebuf); p_token.res_string = linebuf; linebuf[0] = 0; mcount = mwhere = cf_special = 0; while(1) { if ((tmp = get_token(&p_token)) <= 0) return tmp; /* configuration file can end here */ if (p_token.res_type == EOL) continue; if ((p_token.res_type != STRING) || ((strncasecmp(linebuf, "", 8) != 0))) { cf_error(" or expected"); return -1; }; if (strncasecmp(linebuf, "", 8) == 0) { /* global */ if ((tmp = get_token(&p_token)) < 0) return -1; if ((tmp == 0) || (p_token.res_type != EOL)) { if (tmp == 0) cf_error("\"end of line\" character expected"); return -1; }; if (parse_options_block(1) < 0) return -1; } else { /* virtualhost */ cf_special = 1; if ((tmp = get_token(&p_token)) < 0) return -1; if ((tmp == 0) || (p_token.res_type != STRING)) { #ifdef NONIPVIRTUALS cf_error("an IP address or virtual domain name expected"); #else cf_error("an IP address expected"); #endif return -1; }; #ifdef NONIPVIRTUALS nonipvh = 0; #endif #ifdef SPIPV6 if (sp_inet_aton(linebuf, &ipaddr) == 0) { #else if (inet_aton(linebuf, &ipaddr) == 0) { #endif #ifndef NONIPVIRTUALS cf_error("an IP address expected"); return -1; #else nonipvh = 1; if ((allownonip) && (cf_vhostname != NULL)) thishost = (strcasecmp(cf_vhostname, linebuf) == 0) ? 1 : 0; else thishost = 0; if ((!allownonip) && (cf_vhostname != NULL)) pop_log(pop_priority, "unallowed non-IP based virtual hosting request rejected"); #endif } else #ifdef SPIPV6 thishost = (memcmp(&skaddress.saddr_in6.sin6_addr, &ipaddr, sizeof(ipaddr)) == 0) ? 1 : 0; #else thishost = (memcmp(&skaddress.sin_addr, &ipaddr, sizeof(ipaddr)) == 0) ? 1 : 0; #endif if ((tmp = get_token(&p_token)) < 0) return -1; if (tmp == 0) { cf_error("not ended VirtualHost declaration"); return -1; }; if (p_token.res_type != STRING) { #ifdef NONIPVIRTUALS if (!nonipvh) cf_error("a virtual domain name or '>' character expected"); else cf_error("a '>' character expected"); return -1; #else cf_error("a '>' character expected"); #endif }; #ifdef NONIPVIRTUALS if (!nonipvh) { if (strcmp(linebuf, ">") != 0) { if (cf_vhostname != NULL) thishost |= ((strcasecmp(cf_vhostname, linebuf) == 0) ? 1 : 0); if ((tmp = get_token(&p_token)) < 0) return -1; }; if ((tmp == 0) || (p_token.res_type != STRING)) { cf_error("a '>' character expected"); return -1; }; }; #endif cf_special = 0; if (strcmp(linebuf, ">") != 0) { cf_error("a '>' character expected"); return -1; }; if ((tmp = get_token(&p_token)) < 0) return -1; if ((tmp == 0) || (p_token.res_type != EOL)) { cf_error("\"end of line\" expected"); return -1; }; if (parse_options_block(thishost) < 0) return -1; }; }; } #ifdef NONIPVIRTUALS int parse_config_file(char *name, char *vhostname) { #else int parse_config_file(char *name) { #endif #ifdef SPIPV6 socklen_t addrln = sizeof(union sp_sockaddr); #else socklen_t addrln = sizeof(struct sockaddr_in); #endif int result; #ifdef NONIPVIRTUALS cf_vhostname = vhostname; #endif cf_name = name; if (getsockname(0, (struct sockaddr *) &skaddress, &addrln) < 0) { pop_error("config file: getsockname"); return -1; }; #ifdef SPIPV6 if ((skaddress.saddr_in.sin_family != AF_INET) && (skaddress.saddr_in6.sin6_family != AF_INET6)) { #else if (skaddress.sin_family != AF_INET) { #endif pop_log(pop_priority, "config file: socket address is not an IP address"); return -1; }; #ifdef SPIPV6 if (skaddress.saddr_in.sin_family == AF_INET) { /* change to IPv6 */ struct in_addr tmpaddr; skaddress.saddr_in6.sin6_family = AF_INET6; tmpaddr = skaddress.saddr_in.sin_addr; memset(&skaddress.saddr_in6.sin6_addr, 0, sizeof(skaddress.saddr_in6.sin6_addr)); memcpy(&skaddress.saddr_in6.sin6_addr.s6_addr[12], &tmpaddr, sizeof(tmpaddr)); skaddress.saddr_in6.sin6_addr.s6_addr[10] = 0xff; skaddress.saddr_in6.sin6_addr.s6_addr[11] = 0xff; }; #endif if ((cf_fd = open(name, O_RDONLY)) < 0) { if (errno != ENOENT) { pop_log(pop_priority, "config file: can't open configuration file: %.1024s", name); pop_error("open"); return -1; } else { pop_log_dbg(pop_priority, "config file: can't open configuration file: %.1024s", name); pop_error_dbg("open"); return 0; }; }; cf_line = cf_column = 1; result = cf_parse(); close(cf_fd); return result; } int check_maildrop_type(void *name) { return (find_maildrop((char*) name) != NULL) ? 0 : -1; } solid-pop3d-0.15/src/standalone.c 644 765 3173 17673 7103116765 12032 static const char rcsid[] = "$Id: standalone.c,v 1.3 2000/04/28 16:58:55 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* The code is mostly ripped from popa3d. All bugs are probably introduced by me. */ #include "includes.h" #include #include #include #include #ifdef TIME_WITH_SYS_TIME #include #include #else #ifdef HAVE_SYS_TIME_H #include #else #include #endif #endif #include #include #include #include #include #include #include "log.h" #ifdef SPIPV6 #include "spipv6.h" #endif extern int do_session(int, char **); static volatile int blocked; static volatile int pending; int sckt; struct session { #ifdef SPIPV6 struct in6_addr addr; #else struct in_addr addr; #endif pid_t pid; time_t start, log; } sessions[MAX_SESSIONS]; void chld_handler(void) { pid_t spid; int tmp; if (blocked) { pending = 1; return; }; while ((spid = waitpid(0, NULL, WNOHANG)) > 0) for (tmp = 0; tmp < MAX_SESSIONS; tmp++) if (sessions[tmp].pid == spid) { (volatile pid_t) sessions[tmp].pid = 0; break; }; } void sa_sig_handler(int num) { if (num == SIGCHLD) { chld_handler(); signal(SIGCHLD, sa_sig_handler); }; } int main(int argc, char **argv) { #ifdef SPIPV6 char ntopbuff[24]; union sp_sockaddr address; #else struct sockaddr_in address; #endif struct rlimit core_limit = {0, 0}; int session_socket; int tmp, persource, freeentry; #ifdef SPIPV6 socklen_t tmpaddrln = sizeof(struct sockaddr_in6); #else socklen_t tmpaddrln = sizeof(struct sockaddr_in); #endif time_t now; pid_t spid; pop_openlog(); if (atexit(pop_closelog) < 0) { pop_error("atexit"); pop_closelog(); exit(1); }; if (setrlimit(RLIMIT_CORE, &core_limit) < 0) { pop_error("setrlimit"); exit(1); }; chdir("/"); signal(SIGCHLD, sa_sig_handler); #ifdef SPIPV6 address.saddr_in6.sin6_port = htons(POP3_PORT); address.saddr_in6.sin6_family = AF_INET6; address.saddr_in6.sin6_addr = in6addr_any; #else address.sin_port = htons(POP3_PORT); address.sin_family = AF_INET; address.sin_addr.s_addr = htonl(INADDR_ANY); #endif #ifdef SPIPV6 if ((sckt = socket(AF_INET6, SOCK_STREAM, 0)) < 0) { sckt = socket(AF_INET, SOCK_STREAM, 0); address.saddr_in.sin_port = htons(POP3_PORT); address.saddr_in.sin_family = AF_INET; address.saddr_in.sin_addr.s_addr = htonl(INADDR_ANY); if (sckt < 0) { pop_error("socket"); exit(1); }; }; #else if ((sckt = socket(PF_INET, SOCK_STREAM, 0)) < 0) { pop_error("socket"); exit(1); }; #endif tmp = 1; #ifdef HAVE_SETSOCKOPT if (setsockopt(sckt, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp)) < 0) { pop_error("setsockopt"); exit(1); }; #endif #ifdef SPIPV6 if (bind(sckt, (struct sockaddr *)&address.saddr_in6, sizeof(union sp_sockaddr)) < 0) { #else if (bind(sckt, (struct sockaddr *)&address, sizeof(struct sockaddr_in)) < 0) { #endif pop_error("bind"); exit(1); }; if (listen(sckt, SOCKET_SYN_QUEUE) < 0) { pop_error("listen"); exit(1); }; switch (fork()) { case -1: pop_error("fork"); close(sckt); exit(1); case 0: break; default: close(sckt); exit(0); }; if (setsid() < 0) { pop_error("setsid"); close(sckt); exit(0); }; memset(sessions, 0, sizeof(struct session) * MAX_SESSIONS); pending = session_socket = 0; while (1) { blocked = 0; if (pending) { pending = 0; chld_handler(); }; if (session_socket > 0) if (close(session_socket) < 0) { pop_error("close"); close(sckt); exit(1); }; #ifdef SPIPV6 if ((session_socket = accept(sckt, (struct sockaddr*)&address.saddr_in6, &tmpaddrln)) < 0) #else if ((session_socket = accept(sckt, (struct sockaddr*)&address, &tmpaddrln)) < 0) #endif continue; /* Log it? Exit? */ now = time(NULL); /* Check connection limits */ persource = 0; freeentry = -1; blocked = 1; #ifdef SPIPV6 if (address.saddr_in6.sin6_family == AF_INET) { /* change to IPv6 */ struct in_addr tmpaddr; address.saddr_in6.sin6_family = AF_INET6; tmpaddr = address.saddr_in.sin_addr; memset(&address.saddr_in6.sin6_addr, 0, sizeof(address.saddr_in6.sin6_addr)); memcpy(&address.saddr_in6.sin6_addr.s6_addr[12], &tmpaddr, sizeof(tmpaddr)); address.saddr_in6.sin6_addr.s6_addr[10] = 0xff; address.saddr_in6.sin6_addr.s6_addr[11] = 0xff; }; #endif for (tmp = 0; tmp < MAX_SESSIONS; tmp++) { if ((sessions[tmp].pid) || ((sessions[tmp].start) && ((now - sessions[tmp].start) < MIN_DELAY))) { #ifdef SPIPV6 if (memcmp(&sessions[tmp].addr, &address.saddr_in6.sin6_addr.s6_addr, sizeof(struct in6_addr)) == 0) #else if (sessions[tmp].addr.s_addr == address.sin_addr.s_addr) #endif if ((++persource) > PER_SOURCE) break; } else if (freeentry < 0) freeentry = tmp; }; if (persource > PER_SOURCE) { if ((!sessions[tmp].log) || ((now - sessions[tmp].log) >= MIN_DELAY)) { #ifdef SPIPV6 pop_log(pop_priority, "per source limit exceeded: %.1024s", \ (strncmp(inet_ntop(AF_INET6, &address.saddr_in6.sin6_addr, ntopbuff, \ sizeof(ntopbuff)), "::ffff:", 7) == 0) ? ntopbuff + 7 : ntopbuff); #else pop_log(pop_priority, "per source limit exceeded: %.1024s", inet_ntoa(address.sin_addr)); #endif sessions[tmp].log = now; }; continue; }; if (freeentry < 0) { #ifdef SPIPV6 pop_log(pop_priority, "session limit exceeded: %.1024s", \ (strncmp(inet_ntop(AF_INET6, &address.saddr_in6.sin6_addr, ntopbuff, \ sizeof(ntopbuff)), "::ffff:", 7) == 0) ? ntopbuff + 7 : ntopbuff); #else pop_log(pop_priority, "session limit exceeded: %.1024s", inet_ntoa(address.sin_addr)); #endif continue; }; switch ((spid = fork())) { case -1: close(session_socket); pop_error("fork"); break; case 0: #ifdef SPIPV6 pop_log(pop_priority, "connect from %.1024s", \ (strncmp(inet_ntop(AF_INET6, &address.saddr_in6.sin6_addr, ntopbuff, \ sizeof(ntopbuff)), "::ffff:", 7) == 0) ? ntopbuff + 7 : ntopbuff); #else pop_log(pop_priority, "connect from %.1024s", inet_ntoa(address.sin_addr)); #endif if (close(sckt) < 0) { close(session_socket); pop_error("close"); exit(1); }; pop_closelog(); if (session_socket != 0) if (dup2(session_socket, 0) < 0) { close(session_socket); exit(1); }; if (session_socket != 1) if (dup2(session_socket, 1) < 0) { close(0); close(session_socket); exit(1); }; if (session_socket != 2) if (dup2(session_socket, 2) < 0) { close(0); close(1); close(session_socket); exit(1); }; if (session_socket > 2) if (close(session_socket) < 0) { close(0); close(1); close(2); exit(1); }; pop_openlog(); do_session(argc, argv); /* fd: 0,1,2 - socket, 3 - syslog */ pop_log(pop_priority, "Unexpected error - send info to author of program"); exit(1); /* do_session() shouldn't return */ default: #ifdef SPIPV6 sessions[freeentry].addr = address.saddr_in6.sin6_addr; #else sessions[freeentry].addr = address.sin_addr; #endif (volatile pid_t) sessions[freeentry].pid = spid; sessions[freeentry].start = now; sessions[freeentry].log = 0; }; }; } solid-pop3d-0.15/src/mapping.c 644 765 3173 5177 7077103602 11305 static const char rcsid[] = "$Id: mapping.c,v 1.2 2000/04/17 19:38:04 jurekb Exp $"; /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "includes.h" #include "mapping.h" #include "fdfgets.h" #include "log.h" #include #include #ifdef HAVE_GRP_H #include #endif /* result should be a (MAXARGLN+1)-byte buffer */ int map_finduser(char *mapfile, char *username, char *result) { int fd, linenr = 1, tmp2, tmp3; ssize_t lcount; char linebuf[MAXARGLN + 1 + MAXARGLN + 1]; /* username:maptouser\n */ char *tmp; if ((fd = open(mapfile, O_RDONLY)) < 0) { pop_log(pop_priority, "map: can't open file: %.1024s", mapfile); pop_error("map: open"); return -1; }; fd_initfgets(); while ((lcount = fd_fgets(linebuf, sizeof(linebuf), fd)) > 0) { if ((linebuf[lcount - 1] != '\n') && (lcount == sizeof(linebuf))) { /* line too long */ pop_log(pop_priority, "map: line %d in %.1024s is too long", linenr, mapfile); lcount = -1; break; }; if (linebuf[lcount - 1] == '\n') linebuf[lcount - 1] = 0; else linebuf[lcount] = 0; /* lcount < sizeof(linebuf) */ tmp3 = 0; for (tmp2 = 0; tmp2 < lcount; tmp2++) if (linebuf[tmp2] == ':') tmp3++; if (tmp3 != 1) { pop_log(pop_priority, "map: syntax error in line nr %d in file %.1024s", linenr, mapfile); lcount = -1; break; }; *(tmp = strchr(linebuf, ':')) = 0; if (strlen(linebuf) > MAXARGLN) { pop_log(pop_priority, "map: user name too long in line %d in %.1024s", linenr, mapfile); lcount = -1; break; }; if (strcmp(linebuf, username) == 0) { /* parse line */ if (strlen(++tmp) > MAXARGLN) { pop_log(pop_priority, "map: wrong mapped user name entry in line %d in %.1024s", linenr, mapfile); lcount = -1; break; }; strcpy(result, tmp); break; }; linenr++; }; close(fd); memset(linebuf, 0, sizeof(linebuf)); return (lcount <= 0) ? -1 : 0; }; solid-pop3d-0.15/src/apop.h 644 765 3173 1767 7077103557 10630 /* $Id: apop.h,v 1.1.1.1 2000/04/12 20:52:26 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _APOP_H #define _APOP_H int apop_authenticate(char *username, char *apoptimestamp, char *digest); #endif /* apop.h */ solid-pop3d-0.15/src/authenticate.h 644 765 3173 2025 7077103560 12325 /* $Id: authenticate.h,v 1.1.1.1 2000/04/12 20:52:26 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AUTHENTICATE_H #define _AUTHENTICATE_H int sp_authenticate_user(char *username, char *password); #endif /* * authenticate.h */ solid-pop3d-0.15/src/cmds.h 644 765 3173 2267 7077103561 10606 /* $Id: cmds.h,v 1.1.1.1 2000/04/12 20:52:26 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _CMDS_H #define _CMDS_H #include "response.h" typedef void (*cmd_handler) (char *); struct s_cmd { char *name; cmd_handler handler; }; const struct s_cmd *cmd_lookup(const struct s_cmd *cmdtbl, char *cmd); void ignore_cmd(char *arg); void not_implemented(char *arg); #endif /* * cmds.h */ solid-pop3d-0.15/src/configfile.h 644 765 3173 4533 7103116764 11762 /* $Id: configfile.h,v 1.5 2000/04/28 16:58:55 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _CONFIGFILE_H #define _CONFIGFILE_H #include "includes.h" #include "const.h" #include "maildrop.h" #define OP_BOOLEAN 0 #define OP_STRING 1 #define OP_PERIOD 2 #define OP_EXPIRE 3 /* "never" or OP_PERIOD */ int check_maildrop_type(void *); #ifdef EXPIRATION struct expiration { time_t expperiod; int enabled; }; extern struct expiration rexp; extern struct expiration unrexp; #endif extern char maildrop_name[]; extern char maildrop_type[]; #ifdef BULLETINS extern char userbullfile[]; extern char bulldir[]; extern int addbulletins; #endif #ifdef APOP extern char apopservername[]; extern char apopfile[]; #endif extern unsigned int autologout_time; #ifdef USERCONFIG extern int useroverride; #endif #ifdef ALLOWROOTLOGIN extern int allow_root; #endif #ifdef APOP extern int allowapop; #endif extern int changegid; extern unsigned int wccount; #ifdef MAPPING extern int domapping; extern int reqmapping; extern char sp_mapfile[]; extern char mapfileowner[]; #endif #ifdef NONIPVIRTUALS extern int allownonip; #endif #ifdef CREATEMAILDROP extern int createmaildrop; #endif extern char logpriority[]; #ifdef STATISTICS extern int logstatistics; #endif struct str_option { char *name; int op_type; void *value; size_t valuesize; /* used only with string */ int (*check_value)(void *); }; extern struct str_option options_set[]; typedef enum {STRING, EOL} tok_type; struct cf_token { char *res_string; int res_number; int max_size; tok_type res_type; }; #endif /* configfile.h */ solid-pop3d-0.15/src/const.h 644 765 3173 3345 7077103565 11010 /* $Id: const.h,v 1.1.1.1 2000/04/12 20:52:26 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _CONST_H #define _CONST_H #include "includes.h" #define MAXRESPLN 512 #define MAXCMDLN 255 #define MAXARGLN 40 #define AUTH_STATE 0 #define TRANSACTION_STATE 1 #define SERVICE_NAME "spop3d" #define MAXMSGNR 10000 #define SERVER_GREETING "Solid POP3 server ready" #define DEFAUTOLOGOUTTIME 60 #define DEFWCCOUNT 5 #ifdef MDMAILBOX #define DEFMAILDROPNAME "/var/spool/mail/%s" #else #define DEFMAILDROPNAME "Maildir" #endif #ifdef MDMAILBOX #define DEFMAILDROPTYPE "mailbox" #else #define DEFMAILDROPTYPE "maildir" #endif #define MAXMDTYPENAMELENGTH 40 #define USERCFG ".spop3d" #define USERBULL ".spop3d-bull" #define POPUSER "spop3d" #define PER_SOURCE 5 #define MAX_SESSIONS 50 #define SOCKET_SYN_QUEUE 5 #define MIN_DELAY 50 #define POP3_PORT 110 #define POP_IDENT "spop3d" #define POP_PRIORITY LOG_NOTICE #define POP_FACILITY LOG_LOCAL0 #endif /* const.h */ solid-pop3d-0.15/src/fdfgets.h 644 765 3173 2176 7077103565 11305 /* $Id: fdfgets.h,v 1.1.1.1 2000/04/12 20:52:26 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _FDFGETS_H #define _FDFGETS_H #include "includes.h" /* fgets works with streams, this works with file descriptors */ /* fd must be descriptor of file */ void fd_initfgets(void); ssize_t fd_fgets(char *s, size_t size, int fd); #endif /* fdfgets.h */ solid-pop3d-0.15/src/log.h 644 765 3173 2364 7077103565 10443 /* $Id: log.h,v 1.2 2000/04/17 19:38:03 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _LOG_H #define _LOG_H #include #include "includes.h" void pop_openlog(void); void pop_closelog(void); void pop_log(int priority, const char *format, ...); void pop_log_dbg(int priority, const char *format, ...); void pop_error(const char *name); void pop_error_dbg(const char *name); extern int pop_priority; int check_logpriority(void *name); #endif /* log.h */ solid-pop3d-0.15/src/mailbox.h 644 765 3173 2514 7107253051 11300 /* $Id: mailbox.h,v 1.2 2000/05/13 13:25:52 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MAILBOX_H #define _MAILBOX_H #include "includes.h" #include "maildrop.h" void mb_init(void); void mb_update(void); void mb_release(void); void mb_retrieve(unsigned int); void mb_top(unsigned int, unsigned int); char *mb_md5_uidl_message(unsigned int, char *); #ifdef BULLETINS int mb_add_message(int); void mb_end_of_adding(void); #endif struct mb_message { off_t from_where; off_t where; size_t from_size; char digest[16]; }; #endif /* mailbox.h */ solid-pop3d-0.15/src/maildir.h 644 765 3173 2426 7107253053 11272 /* $Id: maildir.h,v 1.3 2000/05/13 13:25:52 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MAILDIR_H #define _MAILDIR_H #include "maildrop.h" void mdir_init(void); void mdir_update(void); void mdir_release(void); void mdir_retrieve(unsigned int); void mdir_top(unsigned int, unsigned int); char *mdir_md5_uidl_message(unsigned int, char *); #ifdef BULLETINS int mdir_add_message(int fd); void mdir_end_of_adding(void); #endif struct mdir_message { char *filename; }; #endif /* maildir.h */ solid-pop3d-0.15/src/maildrop.h 644 765 3173 5013 7107253054 11454 /* $Id: maildrop.h,v 1.3 2000/05/13 13:25:52 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MAILDROP_H #define _MAILDROP_H #include "includes.h" #ifdef TIME_WITH_SYS_TIME #include #include #else #ifdef HAVE_SYS_TIME_H #include #else #include #endif #endif typedef void (*_md_cleanup) (void); typedef void (*_md_init) (void); typedef void (*_md_update) (void); /* Remove marked messages */ typedef void (*_md_release) (void); /* Release any locks */ typedef void (*_md_retrieve) (unsigned int); typedef void (*_md_top) (unsigned int, unsigned int); /* optional */ typedef char *(*_md_md5_uidl_message) (unsigned int, char *); /* optional */ #ifdef BULLETINS typedef int (*_md_add_message)(int fd); typedef void (*_md_end_of_adding)(void); #endif struct str_maildrop { _md_init md_init; _md_update md_update; _md_release md_release; _md_retrieve md_retrieve; _md_top md_top; _md_md5_uidl_message md_md5_uidl_message; #ifdef BULLETINS _md_add_message md_add_message; _md_end_of_adding md_end_of_adding; #endif }; struct message { size_t crlfsize; size_t size; int deleted; void *md_specific; time_t msg_time; int cread; }; struct str_maildrop_name { char *name; struct str_maildrop *mdrop; }; int md_alloc(int size); int md_realloc(int size); struct str_maildrop *find_maildrop(char *name); void md_free(void); void md_stat(void); void md_reset(void); void md_delete(unsigned int nr); void md_uidl(unsigned int nr, _md_md5_uidl_message md_md5_uidl_message); void md_list(unsigned int nr); void md_top(unsigned int nr, unsigned int lcount, int fd, _md_cleanup cleanup); void md_retrieve(unsigned int nr, int fd, _md_cleanup cleanup); void md_end_reply(_md_cleanup cleanup); #endif /* maildrop.h */ solid-pop3d-0.15/src/md5.h 644 765 3173 11622 7077103610 10353 /* md5.h - Declaration of functions and data types used for MD5 sum computing library functions. Copyright (C) 1995, 1996 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _MD5_H #define _MD5_H 1 #include #if defined HAVE_LIMITS_H || _LIBC #include #endif /* The following contortions are an attempt to use the C preprocessor to determine an unsigned integral type that is 32 bits wide. An alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but doing that would require that the configure script compile and *run* the resulting executable. Locally running cross-compiled executables is usually not possible. */ #ifdef _LIBC #include typedef u_int32_t md5_uint32; #else #if defined __STDC__ && __STDC__ #define UINT_MAX_32_BITS 4294967295U #else #define UINT_MAX_32_BITS 0xFFFFFFFF #endif /* If UINT_MAX isn't defined, assume it's a 32-bit type. This should be valid for all systems GNU cares about because that doesn't include 16-bit systems, and only modern systems (that certainly have ) have 64+-bit integral types. */ #ifndef UINT_MAX #define UINT_MAX UINT_MAX_32_BITS #endif #if UINT_MAX == UINT_MAX_32_BITS typedef unsigned int md5_uint32; #else #if USHRT_MAX == UINT_MAX_32_BITS typedef unsigned short md5_uint32; #else #if ULONG_MAX == UINT_MAX_32_BITS typedef unsigned long md5_uint32; #else /* The following line is intended to evoke an error. Using #error is not portable enough. */ "Cannot determine unsigned 32-bit data type." #endif #endif #endif #endif #undef __P #if defined (__STDC__) && __STDC__ #define __P(x) x #else #define __P(x) () #endif /* Structure to save state of computation between the single steps. */ struct md5_ctx { md5_uint32 A; md5_uint32 B; md5_uint32 C; md5_uint32 D; md5_uint32 total[2]; md5_uint32 buflen; char buffer[128]; }; /* * The following three functions are build up the low level used in * the functions `md5_stream' and `md5_buffer'. */ /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ extern void md5_init_ctx __P ((struct md5_ctx * ctx)); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is necessary that LEN is a multiple of 64!!! */ extern void md5_process_block __P ((const void *buffer, size_t len, struct md5_ctx * ctx)); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ extern void md5_process_bytes __P ((const void *buffer, size_t len, struct md5_ctx * ctx)); /* Process the remaining bytes in the buffer and put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *md5_finish_ctx __P ((struct md5_ctx * ctx, void *resbuf)); /* Put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *md5_read_ctx __P ((const struct md5_ctx * ctx, void *resbuf)); /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ extern int md5_stream __P ((FILE * stream, void *resblock)); /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ extern void *md5_buffer __P ((const char *buffer, size_t len, void *resblock)); #endif solid-pop3d-0.15/src/includes.h 644 765 3173 4244 7103116764 11462 /* $Id: includes.h,v 1.2 2000/04/28 16:58:55 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _INCLUDES_H #define _INCLUDES_H #ifdef HAVE_CONFIG_H #include #else /* HAVE_CONFIG_H */ #error "config.h file required. run ./configure first" #endif /* HAVE_CONFIG_H */ #include "const.h" #ifndef MDMAILBOX #ifndef MDMAILDIR #error "you must compile server with support for at least one maildrop type" #endif #endif #ifdef APOP #ifndef USERCONFIG #error "you must compile server with user configuration support if you want to use APOP" #endif #endif #include #include #ifdef STDC_HEADERS #include #include #include #else /* STDC_HEADERS */ #include #ifndef HAVE_STRCHR #define strchr index #define strrchr rindex #endif /* HAVE_STRCHR */ char *strchr(), *strrchr(); #ifndef HAVE_MEMCPY #define memcpy(d, s, n) bcopy((s), (d), (n)) #define memmove(d, s, n) bcopy((s), (d), (n)) #define memset(d, ch, n) bzero((d), (n)) /* We use memset() only to zeroing. */ #define memcmp(a, b, n) bcmp((a), (b), (n)) void *memchr(void *s, int c, size_t n); #endif /* HAVE_MEMCPY */ #endif /* STDC_HEADERS */ #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifdef HAVE_LIMITS_H #include #endif /* HAVE_LIMITS_H */ #ifndef PATH_MAX #define PATH_MAX 1024 #endif /* PATH_MAX */ #include #endif /* includes.h */ solid-pop3d-0.15/src/options.h 644 765 3173 2151 7077103614 11342 /* $Id: options.h,v 1.1.1.1 2000/04/12 20:52:26 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _OPTIONS_H #define _OPTIONS_H #include "includes.h" #include "maildrop.h" #ifdef NONIPVIRTUALS int parse_options(int argc, char **argv, char *vname); #else int parse_options(int argc, char **argv); #endif #endif /* options.h */ solid-pop3d-0.15/src/response.h 644 765 3173 2030 7077103617 11504 /* $Id: response.h,v 1.1.1.1 2000/04/12 20:52:26 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _RESPONSE_H #define _RESPONSE_H void send_error(const char *fmt,...); void send_ok(const char *fmt,...); #endif /* * response.h */ solid-pop3d-0.15/src/userconfig.h 644 765 3173 1751 7077103621 12016 /* $Id: userconfig.h,v 1.1.1.1 2000/04/12 20:52:26 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _USERCONFIG_H #define _USERCONFIG_H void parse_user_cfg(char *homedir); #endif /* userconfig.h */ solid-pop3d-0.15/src/mapping.h 644 765 3173 2017 7077103602 11300 /* $Id: mapping.h,v 1.1.1.1 2000/04/12 20:52:26 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MAPPING_H #define _MAPPING_H #include "includes.h" int map_finduser(char *mapfile, char *username, char *result); #endif /* mapping.h */ solid-pop3d-0.15/src/spipv6.h 644 765 3173 2151 7077103617 11101 /* $Id: spipv6.h,v 1.1.1.1 2000/04/12 20:52:26 jurekb Exp $ */ /* * Solid POP3 - a POP3 server * Copyright (C) 1999 Jerzy Balamut * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _SPIPV6_H #define _SPIPV6_H #include "includes.h" #include #include #include union sp_sockaddr { struct sockaddr_in saddr_in; struct sockaddr_in6 saddr_in6; }; #endif /* spipv6.h */ solid-pop3d-0.15/config.guess 755 765 3173 65320 6754667277 11303 #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. # # This file 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Written by Per Bothner . # The master version of this file is at the FSF in /home/gd/gnu/lib. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit system type (host/target name). # # Only a few systems have been added to this list; please add others # (but try to keep the structure clean). # # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 8/24/94.) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown dummy=dummy-$$ trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s .globl main .ent main main: .frame \$30,0,\$26,0 .prologue 0 .long 0x47e03d80 # implver $0 lda \$2,259 .long 0x47e20c21 # amask $2,$1 srl \$1,8,\$2 sll \$2,2,\$2 sll \$0,3,\$0 addl \$1,\$0,\$0 addl \$2,\$0,\$0 ret \$31,(\$26),1 .end main EOF ${CC-cc} $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then ./$dummy case "$?" in 7) UNAME_MACHINE="alpha" ;; 15) UNAME_MACHINE="alphaev5" ;; 14) UNAME_MACHINE="alphaev56" ;; 10) UNAME_MACHINE="alphapca56" ;; 16) UNAME_MACHINE="alphaev6" ;; esac fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-cbm-sysv4 exit 0;; amiga:NetBSD:*:*) echo m68k-cbm-netbsd${UNAME_RELEASE} exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; arc64:OpenBSD:*:*) echo mips64el-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hkmips:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; arm32:NetBSD:*:*) echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; SR2?01:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; atari*:NetBSD:*:*) echo m68k-atari-netbsd${UNAME_RELEASE} exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3*:NetBSD:*:*) echo m68k-sun-netbsd${UNAME_RELEASE} exit 0 ;; sun3*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:NetBSD:*:*) echo m68k-apple-netbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; macppc:NetBSD:*:*) echo powerpc-apple-netbsd${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) sed 's/^ //' << EOF >$dummy.c int main (argc, argv) int argc; char **argv; { #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF ${CC-cc} $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ -o ${TARGET_BINARY_INTERFACE}x = x ] ; then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i?86:AIX:*:*) echo i386-ibm-aix exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF ${CC-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:4) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=4.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/6?? | 9000/7?? | 9000/80[24] | 9000/8?[13679] | 9000/892 ) sed 's/^ //' << EOF >$dummy.c #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (${CC-cc} $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` rm -f $dummy.c $dummy esac HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF ${CC-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i?86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*X-MP:*:*:*) echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} exit 0 ;; CRAY*T3E:*:*:*) echo t3e-cray-unicosmk${UNAME_RELEASE} exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F300:UNIX_System_V:*:*) FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; F301:UNIX_System_V:*:*) echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` exit 0 ;; hp3[0-9][05]:NetBSD:*:*) echo m68k-hp-netbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; i?86:BSD/386:*:* | i?86:BSD/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:NetBSD:*:*) echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:Linux:*:*) # uname on the ARM produces all sorts of strangeness, and we need to # filter it out. case "$UNAME_MACHINE" in arm* | sa110*) UNAME_MACHINE="arm" ;; esac # The BFD linker knows what the default object file format is, so # first see if it will tell us. ld_help_string=`ld --help 2>&1` ld_supported_emulations=`echo $ld_help_string \ | sed -ne '/supported emulations:/!d s/[ ][ ]*/ /g s/.*supported emulations: *// s/ .*// p'` case "$ld_supported_emulations" in i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; esac if test "${UNAME_MACHINE}" = "alpha" ; then sed 's/^ //' <$dummy.s .globl main .ent main main: .frame \$30,0,\$26,0 .prologue 0 .long 0x47e03d80 # implver $0 lda \$2,259 .long 0x47e20c21 # amask $2,$1 srl \$1,8,\$2 sll \$2,2,\$2 sll \$0,3,\$0 addl \$1,\$0,\$0 addl \$2,\$0,\$0 ret \$31,(\$26),1 .end main EOF LIBC="" ${CC-cc} $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then ./$dummy case "$?" in 7) UNAME_MACHINE="alpha" ;; 15) UNAME_MACHINE="alphaev5" ;; 14) UNAME_MACHINE="alphaev56" ;; 10) UNAME_MACHINE="alphapca56" ;; 16) UNAME_MACHINE="alphaev6" ;; esac objdump --private-headers $dummy | \ grep ld.so.1 > /dev/null if test "$?" = 0 ; then LIBC="libc1" fi fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 elif test "${UNAME_MACHINE}" = "mips" ; then cat >$dummy.c </dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy else # Either a pre-BFD a.out linker (linux-gnuoldld) # or one that does not give us useful --help. # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. # If ld does not provide *any* "supported emulations:" # that means it is gnuoldld. echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 case "${UNAME_MACHINE}" in i?86) VENDOR=pc; ;; *) VENDOR=unknown; ;; esac # Determine whether the default compiler is a.out or elf cat >$dummy.c < main(argc, argv) int argc; char *argv[]; { #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); # else printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); # endif # else printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); # endif #else printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); #endif return 0; } EOF ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy fi ;; # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions # are messed up and put the nodename in both sysname and nodename. i?86:DYNIX/ptx:4*:*) echo i386-sequent-sysv4 exit 0 ;; i?86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} fi exit 0 ;; i?86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; i?86:UnixWare:*:*) if /bin/uname -X 2>/dev/null >/dev/null ; then (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 fi echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION} exit 0 ;; pc:*:*:*) # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i?86:LynxOS:2.*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:*:6*) echo mips-sony-newsos6 exit 0 ;; R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) printf ("vax-dec-bsd\n"); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi #echo '(Unable to guess system type)' 1>&2 exit 1 solid-pop3d-0.15/config.sub 755 765 3173 46737 6754667277 10761 #! /bin/sh # Configuration validation subroutine script, version 1.1. # Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file 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., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. if [ x$1 = x ] then echo Configuration name missing. 1>&2 echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 echo "or $0 ALIAS" 1>&2 echo where ALIAS is a recognized configuration type. 1>&2 exit 1 fi # First pass through any local machine types. case $1 in *local*) echo $1 exit 0 ;; *) ;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in linux-gnu*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple) os= basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm* \ | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \ | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \ | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ | mipstx39 | mipstx39el \ | sparc | sparclet | sparclite | sparc64 | v850) basic_machine=$basic_machine-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i[34567]86) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm*-* | c[123]* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \ | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \ | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ | sparc64-* | mips64-* | mipsel-* \ | mips64el-* | mips64orion-* | mips64orionel-* \ | mipstx39-* | mipstx39el-* \ | f301-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-cbm ;; amigaos | amigados) basic_machine=m68k-cbm os=-amigaos ;; amigaunix | amix) basic_machine=m68k-cbm os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | ymp) basic_machine=ymp-cray os=-unicos ;; cray2) basic_machine=cray2-cray os=-unicos ;; [ctj]90-cray) basic_machine=c90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; i370-ibm* | ibm*) basic_machine=i370-ibm os=-mvs ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i[34567]86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i[34567]86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i[34567]86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i[34567]86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; miniframe) basic_machine=m68000-convergent ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu ;; mips*-linux*) basic_machine=mips-unknown os=-linux-gnu ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netwinder) basic_machine=armv4l-ccc os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; np1) basic_machine=np1-gould ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | nexen) basic_machine=i586-pc ;; pentiumpro | p6 | k6 | 6x86) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | nexen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | k6-* | 6x86-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=rs6000-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; symmetry) basic_machine=i386-sequent os=-dynix ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; xmp) basic_machine=xmp-cray os=-unicos ;; xps | xps100) basic_machine=xps100-honeywell ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown else basic_machine=mips-mips fi ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sparc) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -rhapsody* \ | -openstep*) # Remember, each alternative MUST END IN *, to match a version number. ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -xenix) os=-xenix ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-ccc) os=-linux ;; arm*-semi) os=-aout ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f301-fujitsu) os=-uxpv ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -hpux*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks*) vendor=wrs ;; -aux*) vendor=apple ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os solid-pop3d-0.15/install-sh 755 765 3173 12736 6751715102 10744 #!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 solid-pop3d-0.15/missing 755 765 3173 14213 6751715102 10327 #! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997 Free Software Foundation, Inc. # Franc,ois Pinard , 1996. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing - GNU libit 0.0" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 solid-pop3d-0.15/mkinstalldirs 755 765 3173 1322 6751715102 11513 #! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here