diff -cprN qpopper4.0.2.orig/popper/Makefile.in qpopper4.0.2/popper/Makefile.in *** qpopper4.0.2.orig/popper/Makefile.in Sun Apr 22 23:59:15 2001 --- qpopper4.0.2/popper/Makefile.in Thu May 10 15:17:27 2001 *************** common_library: *** 181,191 **** popper: ${OBJS} mangler_library common_library ${CC} ${OBJS} -o popper ${mmangle_dir}/libmangle.a \ -I${common_srcdir} ${common_dir}/libcommon.a \ ! ${LIBS} popauth: ${POPAUTHOBJS} ${CC} -o popauth ${POPAUTHOBJS} ${NETWORK_LIBS} ${DBM_LIBS} \ ! ${common_dir}/libcommon.a poppassd: common_library cd ${password_dir} && ${MAKE} all --- 181,191 ---- popper: ${OBJS} mangler_library common_library ${CC} ${OBJS} -o popper ${mmangle_dir}/libmangle.a \ -I${common_srcdir} ${common_dir}/libcommon.a \ ! ${LIBS} -lvsd popauth: ${POPAUTHOBJS} ${CC} -o popauth ${POPAUTHOBJS} ${NETWORK_LIBS} ${DBM_LIBS} \ ! ${common_dir}/libcommon.a -lvsd poppassd: common_library cd ${password_dir} && ${MAKE} all diff -cprN qpopper4.0.2.orig/popper/pop_dropcopy.c qpopper4.0.2/popper/pop_dropcopy.c *** qpopper4.0.2.orig/popper/pop_dropcopy.c Wed Apr 4 01:23:30 2001 --- qpopper4.0.2/popper/pop_dropcopy.c Thu May 10 15:17:27 2001 *************** struct passwd * pwp; *** 1465,1470 **** --- 1465,1474 ---- # endif /* BINMAIL_IS_SETGID > 1 */ #endif /* BINMAIL_IS_SETGID */ + #if 0 + /* freeVSD Hack: If a user is close to his disk quota, then qpopper will + fail. */ + /* * Now we run as the user. */ *************** struct passwd * pwp; *** 1477,1482 **** --- 1481,1487 ---- (void) setgroups ( 1, (GID_T *) &pwp->pw_gid ); /* Set the supplementary groups list */ (void) setuid ( (UID_T) pwp->pw_uid ); #endif /* __bsdi__) && _BSDI_VERSION >= 199608 */ + #endif /* freeVSD Hack */ DEBUG_LOG4 ( p, "uid = %lu, gid = %lu, euid = %lu, egid = %lu", (long unsigned) getuid(), *************** struct passwd * pwp; *** 1501,1512 **** --- 1506,1521 ---- DEBUG_LOG2 ( p, "Opened temp drop %s (%d)", p->temp_drop, dfd ); fstat ( dfd, &mybuf ); + #if 0 + /* FreeVSD quota hack */ if ( mybuf.st_uid != pwp->pw_uid ) { close ( dfd ); return ( pop_msg ( p, POP_FAILURE, HERE, "[SYS/PERM] Temporary drop %s not owned by %s.", p->temp_drop, p->user) ); } + #endif + #ifdef NEXT if ( mybuf.st_mode & (0x7) ) #else /* not NEXT */ diff -cprN qpopper4.0.2.orig/popper/pop_pass.c qpopper4.0.2/popper/pop_pass.c *** qpopper4.0.2.orig/popper/pop_pass.c Wed Apr 4 01:23:34 2001 --- qpopper4.0.2/popper/pop_pass.c Thu May 10 15:17:27 2001 *************** POP * p; *** 1260,1265 **** --- 1260,1300 ---- *secretkey = '\0'; #endif /* SECURENISPLUS */ + /* freeVSD: additional subroutine */ + static void fix_ip_allow (POP *p) + { + FILE *stream; + char temp[256]; + + #if 0 + /* Check IP address is not in ip_allow before adding it. */ + stream = fopen ("/etc/mail/ip_allow", "r"); + if (stream == NULL) + return; + + while (fgets (temp, sizeof (temp), stream) != NULL) + { + /* Exit if IP address exists. `temp' will have a newline + tacked on the end by fgets, so ignore it. */ + if (strncmp (temp, p->ipaddr, strlen (temp) - 1) == 0) + { + fclose (stream); + return; + } + } + fclose (stream); + #endif + + stream = fopen ("/etc/mail/ip_allow", "a"); + /* Couldn't open the file for writing. Probably a problem with the + file permissions. */ + if (stream == NULL) + return; + + fprintf (stream, "\n%s", p->ipaddr); + fclose (stream); + }/* end freeVSD sub. */ + /* * Is the user not authorized to use POP? */ *************** POP * p; *** 1431,1436 **** --- 1466,1472 ---- /* * Authorization completed successfully */ + fix_ip_allow (p); if ( p->pLog_login != NULL ) do_log_login ( p ); diff -cprN qpopper4.0.2.orig/popper/pop_user.c qpopper4.0.2/popper/pop_user.c *** qpopper4.0.2.orig/popper/pop_user.c Wed Apr 4 01:23:39 2001 --- qpopper4.0.2/popper/pop_user.c Thu May 10 15:17:27 2001 *************** *** 91,96 **** --- 91,97 ---- #include "popper.h" #include "string_util.h" + #include /* * When AUTHON is defined, SCRAM and/or APOP authentication is available. *************** POP * p; *** 149,154 **** --- 150,166 ---- */ if ( p->bDowncase_user ) downcase_uname ( p, p->pop_parm[1] ); + + /* freeVSD: test for mail priveledges */ + if (vsd_priv_access (p->pop_parm[1], "mail")) + { + pop_log (p, LOG_WARNING, HERE, "%s: auth failed: user %s does not have mail rights", + p->client, p->pop_parm[1]); + return pop_auth_fail (p, POP_FAILURE, HERE, + "Access denied. User %s has no mail rights", + p->pop_parm[1]); + } + /* end freeVSD test */ /* * Trim domain name