unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Unstandard?
@ 2007-03-24 18:36 Robert J. Chassell
  2007-03-24 20:59 ` Unstandard? Alfred M. Szmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Robert J. Chassell @ 2007-03-24 18:36 UTC (permalink / raw)
  To: emacs-devel

Does the following fail the GNU standards?

    # /usr/local/src/emacs/lib-src/movemail --help
    /usr/local/src/emacs/lib-src/movemail: invalid option -- -

According to

    Standards for Command Line Interfaces
    (standards.info)Command-Line Interfaces

    All programs should support two standard options: `--version' and
    `--help'.

A different movemail, not distributed with Emacs, shows this

    # /usr/bin/movemail --help
    Usage: movemail [-rvxkh] [-l lines ] [-m method ] [-i] 
               inbox [-o] destfile [[-p] POP-password]
    where method is one of: dot, lockf, flock
    Default is: dot

although it fails with  --version

    # /usr/bin/movemail --version
    /usr/bin/movemail: unrecognized option `--version'


>From this morning's (2007 Mar 24) update of both Debian testing and
CVS Emacs:

    # ls -al /usr/bin/movemail 
       26 2007-03-01 13:01 /usr/bin/movemail -> /etc/alternatives/movemail

    # ls -al /etc/alternatives/movemail
    55228 2007-03-22 06:04 /etc/alternatives/movemail

    # ls -al /usr/local/src/emacs/lib-src/movemail
    45949 2007-03-18 12:08 /usr/local/src/emacs/lib-src/movemail

-- 
    Robert J. Chassell                          GnuPG Key ID: 004B4AC8
    bob@rattlesnake.com                         bob@gnu.org
    http://www.rattlesnake.com                  http://www.teak.cc

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Unstandard?
  2007-03-24 18:36 Unstandard? Robert J. Chassell
@ 2007-03-24 20:59 ` Alfred M. Szmidt
  2007-03-24 21:38   ` emacs' movemail [was: Unstandard?] Thien-Thi Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Alfred M. Szmidt @ 2007-03-24 20:59 UTC (permalink / raw)
  To: bob; +Cc: emacs-devel

movemail tends to be installed in /usr/libexec, and isn't supposed to
be run by users and shouldn't be in PATH.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* emacs' movemail [was: Unstandard?]
  2007-03-24 20:59 ` Unstandard? Alfred M. Szmidt
@ 2007-03-24 21:38   ` Thien-Thi Nguyen
  0 siblings, 0 replies; 3+ messages in thread
From: Thien-Thi Nguyen @ 2007-03-24 21:38 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1601 bytes --]

   From: "Alfred M. Szmidt" <ams@gnu.org>
   Date: Sat, 24 Mar 2007 21:59:08 +0100 (CET)

   movemail tends to be installed in /usr/libexec, and isn't supposed to
   be run by users and shouldn't be in PATH.

btw, i see a message from 2003:

   From: Richard Stallman <rms@gnu.org>
   Subject: Re: APOP support in movemail
   Date: 2003-11-07 01:00:18 GMT
   
       Anyway, unless we are going to switch to pop3.el as the main
       means of fetching mail via POP3, movemail needs to be updated to
       support APOP, I think.
   
   In principle, I suppose we could switch to using pop3.el.  Are there
   any disadvantages of such a change?
   
   However, unless we decide to make that change, we do want movemail to
   be updated.

after some poking around, it seems to me there are two outstanding bugs
in emacs' movemail, if the goal is to get it to "full" pop3 support for
RMAIL (which uses movemail): no APOP support; no pop3s support.

for APOP, see the quick hack attached.  i wrote the code and then found
out i have no way to test it (the pop3 accounts i have access to do not
do APOP).  if someone can test it, that would be great.  whether or not
it should go into this release is another question (i'm indifferent,
personally, since the experience has nudged me closer to switching to
Gnus for mail...).

anyway, i will post a weird pop3s support scheme a little later on.
"weird" because it was designed to interoperate transparently w/ emacs
21.4 RMAIL, which is still very much in use locally.  more later...

thi


_________________________________________________________________

[-- Attachment #2: apop.diff --]
[-- Type: application/octet-stream, Size: 6525 bytes --]

for f in pop.[hc] ; do diff -c $f $f.WITH-APOP ; done
*** pop.c	Sun Mar 18 03:02:58 2007
--- pop.c.WITH-APOP	Thu Mar 15 14:41:46 2007
***************
*** 2,7 ****
--- 2,8 ----
     Copyright (C) 1991, 1993, 1996, 1997, 1999, 2001, 2002, 2003, 2004,
                   2005, 2006, 2007  Free Software Foundation, Inc.
     Written by Jonathan Kamens, jik@security.ov.com.
+    Thien-Thi Nguyen added APOP support.
  
  This file is part of GNU Emacs.
  
***************
*** 121,127 ****
  static int pop_getline __P((popserver, char **));
  static int sendline __P((popserver, char *));
  static int fullwrite __P((int, char *, int));
! static int getok __P((popserver));
  #if 0
  static int gettermination __P((popserver));
  #endif
--- 122,129 ----
  static int pop_getline __P((popserver, char **));
  static int sendline __P((popserver, char *));
  static int fullwrite __P((int, char *, int));
! static int actual_getok __P((popserver, int));
! #define getok(popserver)  actual_getok (popserver, 0)
  #if 0
  static int gettermination __P((popserver));
  #endif
***************
*** 294,302 ****
    server->buffer_size = GETLINE_MIN;
    server->in_multi = 0;
    server->trash_started = 0;
  
-   if (getok (server))
-     return (0);
  
    /*
     * I really shouldn't use the pop_error variable like this, but....
--- 296,356 ----
    server->buffer_size = GETLINE_MIN;
    server->in_multi = 0;
    server->trash_started = 0;
+   server->greeting_stamp = 0;
+ 
+   {
+     if (actual_getok (server, 1))
+       return (0);
+ 
+     /* Try APOP if the server seems to support it.  */
+     if (server->greeting_stamp)
+       {
+         int i;
+         unsigned char digest[16];
+         char *secret, *apop;
+ 
+         fprintf (stderr, "greeting: %s\n", server->greeting_stamp);
+ 
+         if (! (secret = malloc (strlen (server->greeting_stamp)
+                                 + strlen (password) + 1)))
+           {
+             strcpy (pop_error, "Out of memory in pop_open");
+             free (server->greeting_stamp);
+             return (0);
+           }
+         sprintf (secret, "%s%s", server->greeting_stamp, password);
+         free (server->greeting_stamp);
+         server->greeting_stamp = 0;
+ 
+         extern void *md5_buffer (const char *buffer, size_t len,
+                                  void *resblock);
+ 
+         md5_buffer (secret, strlen (secret), digest);
+         free (secret);
+ 
+         if (! (apop = malloc (5          /* "APOP " */
+                               + strlen (username)
+                               + 33      /* " DIGEST" */
+                               + 1)))
+           {
+             strcpy (pop_error, "Out of memory in pop_open");
+             free (server->greeting_stamp);
+             return (0);
+           }
+         sprintf (apop, "APOP %s ", username);
+         for (i = 0; i < 16; i++)
+           sprintf (apop + strlen (apop), "%02x", digest[i]);
+ 
+         {
+           int authp = (! sendline (server, apop) && ! getok (server));
+           free (apop);
+ 
+           if (authp)
+             return server;
+         }
+       }
+   }
  
  
    /*
     * I really shouldn't use the pop_error variable like this, but....
***************
*** 1066,1071 ****
--- 1120,1136 ----
  	}
      }
  #endif
+   {
+     char *env_pop_port = getenv ("POP_PORT");
+ 
+     if (env_pop_port)
+       {
+         if (pop_debug)
+           fprintf (stderr, "NOTE: POP port: %s\n", env_pop_port);
+         addr.sin_port = htons (atoi (env_pop_port));
+         found_port = 1;
+       }
+   }
    if (! found_port)
      {
        servent = getservbyname (service, "tcp");
***************
*** 1458,1489 ****
  }
  
  /*
!  * Procedure getok
   *
   * Purpose: Reads a line from the server.  If the return indicator is
   * 	positive, return with a zero exit status.  If not, return with
!  * 	a negative exit status.
   *
   * Arguments:
   * 	server	The server to read from.
   *
   * Returns: 0 for success, else for failure and puts error in pop_error.
   *
   * Side effects: On failure, may make the connection unusable.
   */
  static int
! getok (server)
       popserver server;
  {
    char *fromline;
  
!   if (pop_getline (server, &fromline) < 0)
      {
        return (-1);
      }
  
    if (! strncmp (fromline, "+OK", 3))
!     return (0);
    else if (! strncmp (fromline, "-ERR", 4))
      {
        strncpy (pop_error, fromline, ERROR_MAX);
--- 1523,1583 ----
  }
  
  /*
!  * Procedure actual_getok
   *
   * Purpose: Reads a line from the server.  If the return indicator is
   * 	positive, return with a zero exit status.  If not, return with
!  * 	a negative exit status.  Optionally, saves the greeting stamp.
   *
   * Arguments:
   * 	server	The server to read from.
+  * 	sgs_p	If 1, "save greeting stamp" (indicates APOP-support).
   *
   * Returns: 0 for success, else for failure and puts error in pop_error.
   *
   * Side effects: On failure, may make the connection unusable.
+  * 	Also, `server->greeting_stamp' may be modified.
   */
  static int
! actual_getok (server, sgs_p)
       popserver server;
+      int sgs_p;
  {
    char *fromline;
+   int len;
  
!   if ((len = pop_getline (server, &fromline)) < 0)
      {
        return (-1);
      }
  
    if (! strncmp (fromline, "+OK", 3))
!     {
!       if (sgs_p)
!         {
!           int i;
!           char *b = 0, *e = 0;          /* begin, end */
! 
!           for (i = 3; i < len; i++)
!             {
!               if (! b && '<' == fromline[i])
!                 b = fromline + i;
!               if (b && '>' == fromline[i])
!                 e = fromline + i + 1;
!             }
!           if (b && e)
!             {
!               server->greeting_stamp = malloc (1 + (e - b));
!               if (! server->greeting_stamp)
!                 {
!                   strcpy (pop_error, "Out of memory in getok");
!                   return (-1);
!                 }
!               strncpy (server->greeting_stamp, b, e - b);
!             }
!         }
!       return (0);
!     }
    else if (! strncmp (fromline, "-ERR", 4))
      {
        strncpy (pop_error, fromline, ERROR_MAX);
*** pop.h	Thu Mar 15 14:43:16 2007
--- pop.h.WITH-APOP	Thu Mar 15 14:42:40 2007
***************
*** 37,42 ****
--- 37,43 ----
    int buffer_size, buffer_index;
    int in_multi;
    int trash_started;
+   char *greeting_stamp;                 /* non-NULL => try APOP first */
  };
  
  typedef struct _popserver *popserver;


[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-03-24 21:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-24 18:36 Unstandard? Robert J. Chassell
2007-03-24 20:59 ` Unstandard? Alfred M. Szmidt
2007-03-24 21:38   ` emacs' movemail [was: Unstandard?] Thien-Thi Nguyen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).