diff -Nurd vm-pop3d-1.1.4.orig/user.c vm-pop3d-1.1.4/user.c --- vm-pop3d-1.1.4.orig/user.c Tue Jun 12 07:12:45 2001 +++ vm-pop3d-1.1.4/user.c Tue Sep 11 13:52:41 2001 @@ -82,12 +82,24 @@ /* TODO: pop3_user() is too long -- break it up */ #ifdef USE_VIRTUAL +/*** VSD++ ***/ +#if 0 int pop3_user(const char *arg, const char *domainname) +#endif +int +pop3_user(const char *arg, const char *domainname, const char *peer_ip) + /*** VSD-- ***/ #else +/*** VSD++ ***/ +#if 0 int pop3_user(const char *arg) #endif +int +pop3_user(const char *arg, const char *peer_ip) +/*** VSD-- ***/ +#endif { char *buf, pass[POP_MAXCMDLEN], *tmp, *cmd; int rc; @@ -288,10 +300,21 @@ fprintf(ofile, "+OK opened mailbox for %s\r\n", username); #ifdef USE_VIRTUAL if (domainname) + /*** VSD++ ***/ +#if 0 syslog(LOG_INFO, "User '%s' of '%s' logged in", username, domainname); +#endif + syslog(LOG_INFO, "User '%s' of '%s' logged in from %s", username, domainname, peer_ip); + /*** VSD-- ***/ else #endif + /*** VSD++ ***/ +#if 0 syslog(LOG_INFO, "User '%s' logged in", username); +#endif + syslog(LOG_INFO, "User '%s' of 'localhost' logged in from %s", username, peer_ip); + /*** VSD-- ***/ + cursor = 0; return OK; diff -Nurd vm-pop3d-1.1.4.orig/vm-pop3d-1.1.4vsd.spec vm-pop3d-1.1.4/vm-pop3d-1.1.4vsd.spec --- vm-pop3d-1.1.4.orig/vm-pop3d-1.1.4vsd.spec Thu Jan 1 01:00:00 1970 +++ vm-pop3d-1.1.4/vm-pop3d-1.1.4vsd.spec Tue Sep 11 14:11:45 2001 @@ -0,0 +1,105 @@ +Name: vm-pop3d +Version: 1.1.4 +Release: 1vsd +Copyright: GPL +Group: Networking/Daemons +Source: ftp://sunsite.unc.edu/pub/Linux/system/mail/pop/%{name}-%{version}.tar.gz +Summary: vm-pop3d POP3 server +#Requires: pam >= 0.59 +#Prereq: /sbin/chkconfig +Obsoletes: gnu-pop3d +Vendor: ReedMedia +Packager: Nigel Marett +BuildRoot: /tmp/%{name}-%{version}-root +Patch: vm-pop3d-1.1.4-vsd.patch + +%description +vm-pop3d is a POP3 server. + +It supports alternative password files and mail spool directories; +it can be used for setting up virtual email accounts -- mailboxes +without real Unix owners for each. This will allow you to have +multiple email accounts with the same name on one system. +The POP3 protocol (by itself) is not secure. +vm-pop3d is based on Jakob Kaivo's gnu-pop3d (formerly called ids-pop3d). +I developed ten patches for gnu-pop3d version 0.9.8; accordingly, +the first release of vm-pop3d is version 1.0.8. The code for vm-pop3d +version 1.0.8 should be identical to a virtual mail version 1.0-patched +gnu-pop3d 0.9.8. + +%changelog +* Fri Jun 22 2001 Nigel Marett + Tweeked code to enable use with POPauthd (pop before SMTP authentication) and modified spec file to + exculde chkconfig - to enable tidy installation into a freeVSD skel. + Code changes add the IP adress of a sucessful login to the end of the 'User * from * logged in' many thanks to + Tim Sellar for the changes. + Package came from ReedMedia, and was packaged by Radek Libovicky. + +* Mon Jun 11 2001 Jeremy C. Reed + At startup, make sure UID used for virtual exists (vm-pop3d.c). + Documentation: Explained --user and --group options in manual page and INSTALL document; added FAQ entry about running as non-root. + Feature: Added command-line option (-u or --user) to set user UID for setuid for virtual users (vm-pop3d.c and virtual.c). + Feature: Added command-line option (-g or --group) to set GID for setgid (vm-pop3d.c). + pop3_abquit now logs if fdopen() doesn't work for output stream (extra.c). + If setuid didn't work then don't allow log in and log problem (user.c). + Bug Fix: Creation of lockfile is checked. Before, if not created, it would seg fault at end of session. (Thanks to Rok Papez.) + Bug Fix: When concurrent children exited or stopped at same time, the correct amount of new children wouldn't start. Status is collected for waitpid. SIGCHLD signal is set to SIG_DFL (the default) instead of ignoring it (vm-pop3d.c). (Thanks to Rok Papez.) + +* Wed Jun 06 2001 Jeremy C. Reed + Feature: logs IP address of client. + +* Wed May 30 2001 Jeremy C. Reed + Documentation: Explained "inetd looping" in FAQ. + Documentation: Updated webpage to add various examples for MDA mail delivery, password files, and using POP3 client. + +* Sat May 23 2001 Jeremy C. Reed + Documentation: added information about mailing lists to README. + If user doesn't exist, debug level 3 reports non-existent user. + +* Sat Apr 14 2001 Jeremy C. Reed + Replaced gnu-pop3d.spec with vm-pop3d.spec; this spec file is used for creating a RPM. (Thanks to Radek Libovicky libovicky @ lirais.cz.) + +%prep +%setup +%patch -p1 +./configure --prefix=/usr --enable-debug --enable-virtual + +%build +make ROOT=$RPM_BUILD_ROOT +/usr/bin/strip --strip-all vm-pop3d + +%clean +rm -rf $RPM_BUILD_ROOT + +%install +rm -rf $RPM_BUILD_ROOT +#mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d +make ROOT=$RPM_BUILD_ROOT install +mkdir -p $RPM_BUILD_ROOT/etc/pam.d +cp -f vm-pop3d.pamd $RPM_BUILD_ROOT/etc/pam.d/vm-pop3d +#cp -f vm-pop3d.init $RPM_BUILD_ROOT/etc/rc.d/init.d/vm-pop3d + + +%pre +if [ -f /var/lock/subsys/vm-pop3d ]; then + /etc/rc.d/init.d/vm-pop3d stop +fi + +%post +#/sbin/chkconfig --add vm-pop3d + +%preun +if [ $1 = 0 ]; then + if [ -f /var/lock/subsys/vm-pop3d ]; then + /etc/rc.d/init.d/vm-pop3d stop + fi +# /sbin/chkconfig --del vm-pop3d +fi + +%files +%defattr(0644,root,root,0755) +%doc COPYING README* AUTHORS TODO INSTALL ./RFC/RFC*.txt +%attr(0755,root,root) /usr/sbin/vm-pop3d +#%attr(0755,root,root) /etc/rc.d/init.d/vm-pop3d +%config /etc/pam.d/vm-pop3d + diff -Nurd vm-pop3d-1.1.4.orig/vm-pop3d.c vm-pop3d-1.1.4/vm-pop3d.c --- vm-pop3d-1.1.4.orig/vm-pop3d.c Tue Jun 12 07:58:48 2001 +++ vm-pop3d-1.1.4/vm-pop3d.c Tue Sep 11 12:29:57 2001 @@ -250,11 +250,20 @@ int namelen = sizeof(name); #ifdef USE_VIRTUAL + /*** VSD++ ***/ +#if 0 char *temp_domain; +#endif + char *temp_domain = NULL; + /*** VSD-- ***/ const char domain_delimiters[] = ";!:@"; int i; #endif + /*** VSD++ ***/ + char *peer_ip = NULL; + /*** VSD-- ***/ + #ifdef IP_BASED_VIRTUAL struct hostent *hostent_info; #endif @@ -309,6 +318,11 @@ virtualdomain = NULL; #endif + /*** VSD++ ***/ + if (temp_domain) + peer_ip = (char *) strdup (temp_domain); + /*** VSD-- ***/ + while (state != UPDATE) { fflush(ofile); status = OK; @@ -388,13 +402,19 @@ } } #endif /* IP_BASED_VIRTUAL */ - status = pop3_user(arg, virtualdomain); + status = pop3_user(arg, virtualdomain, peer_ip); if (virtualdomain) { free(virtualdomain); virtualdomain = NULL; } + /*** VSD++ ***/ + if (peer_ip) { + free(peer_ip); + peer_ip = NULL; + } + /*** VSD-- ***/ #else - status = pop3_user(arg); + status = pop3_user(arg, peer_ip); #endif /* USE_VIRTUAL */ } else if (strncasecmp(cmd, "QUIT", 4) == 0) diff -Nurd vm-pop3d-1.1.4.orig/vm-pop3d.h vm-pop3d-1.1.4/vm-pop3d.h --- vm-pop3d-1.1.4.orig/vm-pop3d.h Tue Jun 12 04:15:46 2001 +++ vm-pop3d-1.1.4/vm-pop3d.h Mon Jul 9 12:14:37 2001 @@ -238,8 +238,12 @@ #ifdef USE_VIRTUAL struct passwd *getvirtualpwnam(const char *username, const char *domainname); +/*** VSD++ ***/ +#if 0 int pop3_user(const char *arg, const char *domainname); - +#endif +int pop3_user(const char *arg, const char *domainname, const char *peer_ip); +/*** VSD-- ***/ #else int pop3_user(const char *arg); diff -Nurd vm-pop3d-1.1.4.orig/vm-pop3d.pamd vm-pop3d-1.1.4/vm-pop3d.pamd --- vm-pop3d-1.1.4.orig/vm-pop3d.pamd Wed Apr 11 22:03:19 2001 +++ vm-pop3d-1.1.4/vm-pop3d.pamd Thu Jul 5 16:48:28 2001 @@ -1,3 +1,4 @@ #%PAM-1.0 auth required /lib/security/pam_pwdb.so shadow account required /lib/security/pam_pwdb.so +auth required /lib/security/pam_vsd.so priv=mail diff -Nurd vm-pop3d-1.1.4.orig/vm-pop3d.spec vm-pop3d-1.1.4/vm-pop3d.spec --- vm-pop3d-1.1.4.orig/vm-pop3d.spec Wed Apr 25 00:42:15 2001 +++ vm-pop3d-1.1.4/vm-pop3d.spec Thu Jan 1 01:00:00 1970 @@ -1,79 +0,0 @@ -Name: vm-pop3d -Version: 1.1.3 -Release: 1 -Copyright: GPL -Group: Networking/Daemons -Source: ftp://sunsite.unc.edu/pub/Linux/system/mail/pop/%{name}-%{version}.tar.gz -Summary: vm-pop3d POP3 server -#Requires: pam >= 0.59 -Prereq: /sbin/chkconfig -Obsoletes: gnu-pop3d -Vendor: ReedMedia -Packager: Radek Libovicky -BuildRoot: /tmp/%{name}-%{version}-root - -%description -vm-pop3d is a POP3 server. - -It supports alternative password files and mail spool directories; -it can be used for setting up virtual email accounts -- mailboxes -without real Unix owners for each. This will allow you to have -multiple email accounts with the same name on one system. -The POP3 protocol (by itself) is not secure. -vm-pop3d is based on Jakob Kaivo's gnu-pop3d (formerly called ids-pop3d). -I developed ten patches for gnu-pop3d version 0.9.8; accordingly, -the first release of vm-pop3d is version 1.0.8. The code for vm-pop3d -version 1.0.8 should be identical to a virtual mail version 1.0-patched -gnu-pop3d 0.9.8. - -%changelog -* Sat Mar 17 2001 Jeremy C. Reed - vm-pop3d version 1.0.8 is gnu-pop3d 0.9.8 with virtual - mail patch 1.0 integrated. In addition, the README and INSTALL - documents are changed. All references to gnu-pop3d are changed - (except for history or license). vm-pop3d 1.0.8 codewise is the - same as a virtual mail 1.0-patched gnu-pop3d 0.9.8. - -%prep -%setup -./configure --prefix=/usr - -%build -make ROOT=$RPM_BUILD_ROOT -/usr/bin/strip --strip-all vm-pop3d - -%clean -rm -rf $RPM_BUILD_ROOT - -%install -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d -make ROOT=$RPM_BUILD_ROOT install -mkdir -p $RPM_BUILD_ROOT/etc/pam.d -cp -f vm-pop3d.pamd $RPM_BUILD_ROOT/etc/pam.d/vm-pop3d -cp -f vm-pop3d.init $RPM_BUILD_ROOT/etc/rc.d/init.d/vm-pop3d - - -%pre -if [ -f /var/lock/subsys/vm-pop3d ]; then - /etc/rc.d/init.d/vm-pop3d stop -fi - -%post -/sbin/chkconfig --add vm-pop3d - -%preun -if [ $1 = 0 ]; then - if [ -f /var/lock/subsys/vm-pop3d ]; then - /etc/rc.d/init.d/vm-pop3d stop - fi - /sbin/chkconfig --del vm-pop3d -fi - -%files -%defattr(0644,root,root,0755) -%doc COPYING README* AUTHORS TODO INSTALL ./RFC/RFC*.txt -%attr(0755,root,root) /usr/sbin/vm-pop3d -%attr(0755,root,root) /etc/rc.d/init.d/vm-pop3d -%config /etc/pam.d/vm-pop3d -