For the purpose of enabling RPOP in nmh, included below is an edited
selection of my quickie patches.

After applying the patches, use --enable-nmh-pop and --enable-nmh-rpop
with the configure script.

Disclaimer department:

- These patches were made against nmh-0.27, so they might need to be
  tweaked to work with nmh-1.x.

- Some other stuff is mixed in as well, such as code to support a
  -nopop switch, so use these patches with caution.

- Note that RPOP is pretty insecure, which is probably why it's not
  enabled by default in nmh--or qpopper, for that matter.  For one
  thing, the "inc" and "msgchk" programs need to be setuid to root for
  RPOP to work, so that adds another dimension of possible insecurities.
  Not recommended for most sites.

- I promise nothing; your mileage may vary.  Keep a copy of your
  original source tree so that you can revert if something goes wrong.

========================================================================

*** nmh-0.27/config.h.in        Tue Jan 19 12:51:57 1999
--- nmh-0.27icc/config.h.in     Mon Jan 18 21:00:49 1999
***************
*** 233,238 ****
--- 233,246 ----
   * to correctly build the pop client support.
   */
  #undef POP
+ 
+ /*
+  * Define this to compile client-side support for RPOP into
+  * inc and msgchk.  Do not change this value manually.  You
+  * must run configure with the '--enable-nmh-rpop' option
+  * to correctly build the rpop client support.
+  */
+ #undef RPOP
  
  /*
   * Compile in support for the Emacs front-end mh-e.
*** nmh-0.27/acconfig.h Sun May 31 17:46:51 1998
--- nmh-0.27icc/acconfig.h      Mon Jan 18 21:00:13 1999
***************
*** 188,193 ****
--- 188,201 ----
   * to correctly build the pop client support.
   */
  #undef POP
+ 
+ /*
+  * Define this to compile client-side support for RPOP into
+  * inc and msgchk.  Do not change this value manually.  You
+  * must run configure with the '--enable-nmh-rpop' option
+  * to correctly build the rpop client support.
+  */
+ #undef RPOP
  
  /*
   * Compile in support for the Emacs front-end mh-e.
*** nmh-0.27/uip/Makefile.in    Tue Jan 19 12:51:57 1999
--- nmh-0.27icc/uip/Makefile.in Tue Jan 19 13:27:54 1999
***************
*** 240,245 ****
--- 240,247 ----
        $(LN) $(DESTDIR)/$(bindir)/folder $(DESTDIR)/$(bindir)/folders
        $(LN) $(DESTDIR)/$(bindir)/show   $(DESTDIR)/$(bindir)/prev
        $(LN) $(DESTDIR)/$(bindir)/show   $(DESTDIR)/$(bindir)/next
+       chown root.root $(DESTDIR)/$(bindir)/msgchk $(DESTDIR)/$(bindir)/inc
+       chmod a+rx,u+s $(DESTDIR)/$(bindir)/msgchk $(DESTDIR)/$(bindir)/inc
  
  # install misc support binaries
  install-misc:
*** nmh-0.27/uip/inc.c  Tue Jan 19 12:51:57 1999
--- nmh-0.27icc/uip/inc.c       Tue Jan 19 15:35:38 1999
***************
*** 106,111 ****
--- 106,113 ----
      { "help", 4 },
  #define SNOOPSW                   22
      { "snoop", -5 },
+ #define NPOPSW                    23
+     { "nopop", 0 },
      { NULL, 0 }
  };
  
***************
*** 160,166 ****
  {
      int chgflag = 1, trnflag = 1;
      int noisy = 1, width = 0, locked = 0;
!     int rpop = 0, i, hghnum, msgnum;
      char *cp, *maildir, *folder = NULL;
      char *format = NULL, *form = NULL;
      char *newmail, *host = NULL;
--- 162,174 ----
  {
      int chgflag = 1, trnflag = 1;
      int noisy = 1, width = 0, locked = 0;
! #ifdef RPOP
!     int rpop = 1;
! #else
!     int rpop = 0;
! #endif RPOP
!     int nopop = 0;
!     int i, hghnum, msgnum;
      char *cp, *maildir, *folder = NULL;
      char *format = NULL, *form = NULL;
      char *newmail, *host = NULL;
***************
*** 312,321 ****
--- 320,331 ----
                continue;
  
            case HOSTSW:
+               nopop = 0;
                if (!(host = *argp++) || *host == '-')
                    adios (NULL, "missing argument to %s", argp[-2]);
                continue;
            case USERSW:
+               nopop = 0;
                if (!(user = *argp++) || *user == '-')
                    adios (NULL, "missing argument to %s", argp[-2]);
                continue;
***************
*** 336,341 ****
--- 346,352 ----
                continue;
  
            case APOPSW:
+               nopop = 0;
                rpop = -1;
                continue;
            case NAPOPSW:
***************
*** 352,357 ****
--- 363,372 ----
            case SNOOPSW:
                snoop++;
                continue;
+ 
+           case NPOPSW:
+               nopop++;
+               continue;
            }
        }
        if (*cp == '+' || *cp == '@') {
***************
*** 370,376 ****
  #endif        /* MAILGROUP */
  
  #ifdef POP
!     if (host && !*host)
        host = NULL;
      if (from || !host || rpop <= 0)
        setuid (getuid ());
--- 385,391 ----
  #endif        /* MAILGROUP */
  
  #ifdef POP
!     if (host && !*host || nopop)
        host = NULL;
      if (from || !host || rpop <= 0)
        setuid (getuid ());
*** nmh-0.27/uip/msgchk.c       Tue Jan 19 12:51:57 1999
--- nmh-0.27icc/uip/msgchk.c    Tue Jan 19 15:35:37 1999
***************
*** 63,69 ****
--- 63,72 ----
      { "help", 4 },
  #define SNOOPSW                 12
      { "snoop", -5 },
+ #define NPOPSW                 13
+     { "nopop", 0 },
      { NULL, 0 }
+     
  };
  
  #define       NT_NONE 0x0
***************
*** 95,101 ****
  main (int argc, char **argv)
  {
      int datesw = 1, notifysw = NT_ALL;
!     int rpop = 0, status = 0;
      int snoop = 0, vecp = 0;
      uid_t uid;
      char *cp, *host = NULL, buf[80], **ap;
--- 98,110 ----
  main (int argc, char **argv)
  {
      int datesw = 1, notifysw = NT_ALL;
!     int nopop = 0;
! #ifdef RPOP
!     int rpop = 1;
! #else
!     int rpop = 0;
! #endif RPOP
!     int status = 0;
      int snoop = 0, vecp = 0;
      uid_t uid;
      char *cp, *host = NULL, buf[80], **ap;
***************
*** 167,176 ****
--- 176,187 ----
                    continue;
  
                case HOSTSW: 
+                   nopop = 0;
                    if (!(host = *argp++) || *host == '-')
                        adios (NULL, "missing argument to %s", argp[-2]);
                    continue;
                case USERSW: 
+                   nopop = 0;
                    if (!(cp = *argp++) || *cp == '-')
                        adios (NULL, "missing argument to %s", argp[-2]);
                    if (vecp < 50)
***************
*** 178,183 ****
--- 189,195 ----
                    continue;
  
                case APOPSW: 
+                   nopop = 0;
                    rpop = -1;
                    continue;
                case NAPOPSW:
***************
*** 186,199 ****
  
                case RPOPSW: 
                    rpop = 1;
                    continue;
                case NRPOPSW: 
                    rpop = 0;
                    continue;
- 
                case SNOOPSW:
                    snoop++;
                    continue;
            }
        if (vecp<50)
                vec[vecp++] = cp;
--- 198,215 ----
  
                case RPOPSW: 
                    rpop = 1;
+                   nopop = 0;
                    continue;
                case NRPOPSW: 
                    rpop = 0;
+                   nopop = 0;
                    continue;
                case SNOOPSW:
                    snoop++;
                    continue;
+               case NPOPSW:
+                   nopop++;
+                   continue;
            }
        if (vecp<50)
                vec[vecp++] = cp;
***************
*** 225,231 ****
        if (pophost && *pophost)
            host = pophost;
      }
!     if (!host || !*host)
        host = NULL;
      if (!host || rpop <= 0)
        setuid (uid);
--- 241,247 ----
        if (pophost && *pophost)
            host = pophost;
      }
!     if (!host || !*host || nopop)
        host = NULL;
      if (!host || rpop <= 0)
        setuid (uid);
***************
*** 373,378 ****
--- 389,395 ----
  
  #if defined(RPOP) || defined(APOP)
      /* open the POP connection */
+     /* fprintf(stderr, "msgchk: opening POP connection; RPOP=%d\n", rpop); */
      if (pop_init (host, user, pass, snoop, rpop) == NOTOK
  #else
      /* open the POP connection */
*** nmh-0.27/configure.in       Sat May 16 20:04:35 1998
--- nmh-0.27icc/configure.in    Mon Jan 18 18:09:08 1999
***************
*** 80,85 ****
--- 80,93 ----
  AC_SUBST(POPLIB)dnl
  AC_SUBST(POPSED)dnl
  
+ dnl Do you want client-side support for RPOP
+ undefine([nmh-rpop])dnl
+ AC_ARG_ENABLE(nmh-rpop,
+ [  --enable-nmh-rpop        enable client-side support for pop])
+ if test x$enable_nmh_rpop = xyes; then
+   AC_DEFINE(RPOP)dnl
+ fi
+ 
  dnl Do you want to debug nmh?
  undefine([nmh-debug])dnl
  AC_ARG_ENABLE(nmh-debug,

Reply via email to