diff -cNr qpopper3.0.1.orig/config.h.in qpopper3.0.1/config.h.in *** qpopper3.0.1.orig/config.h.in Thu Mar 9 15:59:07 2000 --- qpopper3.0.1/config.h.in Tue May 9 20:26:32 2000 *************** *** 167,172 **** --- 167,178 ---- #undef SPEC_POP_AUTH /* + * Defines DRAC_AUTH + * + */ + #undef DRAC_AUTH + + /* * Define and set to 1 or 2 to use hashed spool directories. Value * 1 hashes the first 4 characters; value 2 uses /<1st letter>/ * <2nd letter>. For example, if the spool directory is "/var/mail", diff -cNr qpopper3.0.1.orig/configure qpopper3.0.1/configure *** qpopper3.0.1.orig/configure Fri May 5 17:37:08 2000 --- qpopper3.0.1/configure Tue May 9 20:26:32 2000 *************** *** 61,66 **** --- 61,70 ---- ac_help="$ac_help --enable-group-bulls Group name is second part of bulletin file names " + ac_help="$ac_help + --enable-dracauth Enable drac relay authorization " + + # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. *************** *** 1568,1573 **** --- 1572,1595 ---- USE_REG_STRUCT_RET=no + # Check whether --enable-dracauth or --disable-dracauth was given. + if test "${enable_dracauth+set}" = set; then + enableval="$enable_dracauth" + dracauth="$enableval" + else + dracauth="no" + fi + + if test "$dracauth" != "no"; then + cat >> confdefs.h <&6 + LIBS="$LIBS -L/usr/lib/drac -ldrac" + DEFS="$DEFS -DDRAC_AUTH" + fi + + SYS_NAME="`uname -sr 2>/dev/null | sed 1q`" if test -z "\$SYS_NAME"; then SYS_NAME=unknown;fi *************** *** 3181,3187 **** 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} --- 3203,3209 ---- trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 ! DEFS="$DEFS -DHAVE_CONFIG_H" # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} diff -cNr qpopper3.0.1.orig/configure.in qpopper3.0.1/configure.in *** qpopper3.0.1.orig/configure.in Fri May 5 17:32:12 2000 --- qpopper3.0.1/configure.in Tue May 9 20:26:32 2000 *************** *** 387,392 **** --- 387,400 ---- AC_DEFINE(USE_BULL_GROUPS) fi + AC_ARG_ENABLE(dracauth, [ --enable-dracauth enable DRAC_AUTH ], + dracauth="$enableval", dracauth="no") + if test "$dracauth" != "no"; then + AC_MSG_RESULT(Enabled DRAC_AUTH) + AC_DEFINE(DRAC_AUTH) + fi + + dnl dnl ---------- Query for OS options ---------- dnl diff -cNr qpopper3.0.1.orig/popper/pop_pass.c qpopper3.0.1/popper/pop_pass.c *** qpopper3.0.1.orig/popper/pop_pass.c Thu Mar 16 16:28:32 2000 --- qpopper3.0.1/popper/pop_pass.c Tue May 9 21:13:05 2000 *************** *** 42,47 **** --- 42,54 ---- # include #endif + #ifdef DRAC_AUTH + #include + #include + #define DRACTIMEOUT 10*60 /* check every 10 minutes */ + time_t lastdrac = 0; /* time of last drac check */ + #endif /* DRAC_AUTH */ + #include #include "popper.h" *************** *** 1015,1020 **** --- 1022,1060 ---- p->AuthState = pass; /* plain or kerberos authenticated successfully */ + + #ifdef DRAC_AUTH + { + FILE *dracconf; + char host[100]; + char *drachost; + char *err; + char *x; + + if ( (dracconf = fopen("/etc/mail/dracd.host", "r")) == NULL) + { + pop_log ( p, POP_PRIORITY, HERE, "dracd: error opening /etc/mail/dracd.host config file"); + exit(1); + } + + fgets(host, 100, dracconf); + x = strchr(host, '\n'); + if(x != NULL) + *x = '\0'; + fclose(dracconf); + + if( drachost = (host) ) + { + lastdrac = time(0); + + if (dracauth(drachost, inet_addr(p->ipaddr), &err) != 0) + pop_log ( p, POP_PRIORITY, HERE, err); + else pop_log ( p, POP_PRIORITY, HERE, + "dracd: authorized ip %s", p->client); + } + } + #endif /* DRAC_AUTH */ + /* * Authorization completed successfully */