]> Pileus Git - ~andy/fetchmail/commitdiff
Added port-specification option.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 12 Sep 1996 11:59:39 +0000 (11:59 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 12 Sep 1996 11:59:39 +0000 (11:59 -0000)
svn path=/trunk/; revision=87

Makefile.in
NEWS
README
driver.c
fetchmail.c
fetchmail.h
fetchmail.man
options.c
pop2.c
rcfile_l.l
rcfile_y.y

index 4b40f40fba57d0ed0278a333a2902065f2434aa8..1b21e6fc95fc8149ed84db8587f5e4cfd9f73800 100644 (file)
@@ -41,10 +41,10 @@ instname = popclient
 bindir = $(exec_prefix)/bin
 # Directory to install the Info files in.
 infodir = $(prefix)/info
-# Directory to install the man page in.
-mandir = $(prefix)/man/man$(manext)
 # Number to put on the man page filename.
 manext = 1
+# Directory to install the man page in.
+mandir = $(prefix)/man/man$(manext)
 
 # Program to install `make'.
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
diff --git a/NEWS b/NEWS
index c8fe25a28a92f629a9df5377748a4c056001d962..411c72519156c07aadfb9d0d612feb5106f06de8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,7 @@ To-do list:
 
 Option to enable EMACS-like user folder versioning on each run.
 
-S/key for secure challenge-response.
+IMAP extensions for secure challenge-response.
 
 Recode POP2 to use the same driver/method strategy as POP3/IMAP, so 
 all three protocols will be able to forward messages through the generic
@@ -16,14 +16,19 @@ driver to SMTP.  (This requires that we find a POP2 server to test with.)
 
 * Sendmail delivery from background seems to work now.
 
-* We have IMAP2bis/IMAP4 suppport.
+* We have IMAP2bis/IMAP4 support.
 
 * Code now autoprobes for a POP3, IMAP, or POP2 server if no protocol is
   specified.
 
 * SMTP forwarding support.  Thanks to Harry Hochheiser <harry@tigger.jvnc.net>
-  for this simple but very clever idea.  
+  for this simple but clever idea.  
+
+* If no UNIX From line is found, popclient will now synthesize a correct
+  line from the RFC822 From line.
+
+* It is now possible to specify the host TCP/IP port number to connect to.
+
 3.05:
 
 * Experimental support for RFC1725-compliant POP servers with the UIDL
diff --git a/README b/README
index 785e27855e24634bb9cf1bb58fa7063aaadb32f0..c66e2891c3a3c8d2fd0b097fa70607d9d1f4f591 100644 (file)
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-                       README for popclient 3.0
+                       README for popclient
 
 popclient is a full-featured, robust, well-documented POP2, POP3, APOP,
 and IMAP client originally developed by Carl Harris <ceharris@mal.com> and
index 74c3d993ccf8ad62fd3545b03a7905ad7f67d50a..4718d35b7e476059dfd5925a69db9b5ff894a6b4 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -78,7 +78,7 @@ struct method *proto;
        if ((mboxfd = openuserfolder(queryctl)) < 0) 
            return(PS_IOERR);
     } else if (queryctl->output == TO_SMTP) {
-       if ((mboxfd = Socket(queryctl->smtphost,SMTP_PORT)) < 0) 
+       if ((mboxfd = Socket(queryctl->smtphost, SMTP_PORT)) < 0) 
            return(PS_SOCKET);
 
        /* eat the greeting message */
@@ -97,7 +97,9 @@ struct method *proto;
     }
 
     /* open a socket to the mail server */
-    if ((socket = Socket(queryctl->servername,protocol->port)) < 0) {
+    if ((socket = Socket(queryctl->servername,
+                        queryctl->port ? queryctl->port : protocol->port))<0)
+    {
        perror("do_protocol: socket");
        ok = PS_SOCKET;
        goto closeUp;
index 1f424374ab28414e7687381bdcfae2e2c220d189..8dbaaaa4c3463dd3cbc8bb28ae61a2f1cc482d46 100644 (file)
@@ -374,7 +374,12 @@ struct hostrec *queryctl;
 
     printf("  Username = '%s'\n", queryctl->remotename);
     printf("  Password = '%s'\n", queryctl->password);
-    printf("  Protocol is %s\n", showproto(queryctl->protocol));
+    printf("  Protocol is %s", showproto(queryctl->protocol));
+    if (queryctl->port)
+       printf(" (using port %d)", queryctl->port);
+    else if (outlevel == O_VERBOSE)
+       printf(" (using default port)");
+    putchar('\n');
 
     printf("  Fetched messages will%s be kept on the server (--keep %s).\n",
           queryctl->keep ? "" : " not",
index 6a13dae5f8433d720424eab6f5666ff080465952..fa78c72682658fd0d44503a692869c923d4feb6d 100644 (file)
@@ -63,6 +63,7 @@ struct hostrec
   int fetchall;
   int flush;
   int norewrite;
+  int port;
 
   /* state used for tracking UIDL ids */
   char lastid [IDLEN];
index 76884b7b8d82262193f87ddee834eabc7a5159f7..f6dd63403966cad14e038dabe929b966e5f6a734 100644 (file)
@@ -137,9 +137,13 @@ Use POP3 with MD5 authentication.
 Use POP3 with trusted-host-based authentication (like rlogin/rsh). 
 .I popclient
 must be installed as a setuid root program to use RPOP.
-.B \--proto.
 .RE
 .TP
+.B \-P, --port
+The  option permits you to specify a TCP/IP port to connect on.
+This will seldom be necessary as all the supported protocols have
+well-established default port numbers.
+.TP
 .B \-o folder, --local folder
 Causes retrieved messages to be appended to file named by the folder 
 argument.  When neither 
@@ -205,22 +209,6 @@ that would be computed if
 .I popclient.
 were connecting to that server is displayed.
 .TP
-.PP
-.SH PROTOCOL SELECTION
-The selection of the correct Post Office Protocol (POP2 or POP3) depends upon
-the configuration of the mailserver from which you retrieve your mail.  The
-system adminstrator who installed 
-.I popclient
-on your system should have chosen an appropriate default protocol for your 
-mailserver.  If you get the message 'Connection refused' when using the 
-default protocol, try specifying
-.B \-2
-or
-.B \-3
-to select a different protocol.  If the 'Connection refused' message persists 
-regardless of the protocol selected, it is likely that your mailserver is not 
-running a POP compliant mail service.
-.PP
 .SH USER AUTHENTICATION
 User authentication in 
 .I popclient
@@ -410,6 +398,7 @@ Legal keywords are:
     noflush
     nofetchall
     norewrite
+    port
 .PP
 Legal protocol identifiers are
 
@@ -451,6 +440,7 @@ one server definition.
 .nf
   server pop.provider.net       \e
         proto pop3              \e
+        port 3111               \e
         user jsmith             \e
         pass secret1            \e
         localfolder ~/mbox
@@ -563,9 +553,10 @@ default location of file associating hosts with last message IDs seen
 (used only with newer RFC1725-compliant servers supporting the UIDL command).
 .SH BUGS
 .PP
-The --smtphost option doesn't work with POP2.  This isn't a protocol problem,
-it's because the developers couldn't find a POP2 server to test the
-necessary code reorganization with.
+When using POP2, the --smtphost option doesn't work, and mail headers
+are not rewritten to enable replies as described under --norewrite. 
+This isn't a protocol problem, it's because the developer couldn't
+find a POP2 server to test the necessary code reorganization with.
 .PP
 The --remotefolder option doesn't work with POP3.
 .PP
@@ -577,11 +568,11 @@ No RPOP support yet.
 Send comments, bug reports, gripes, and the like to Eric S. Raymond
 <esr@thyrsus.com>.
 .SH NOTE
-The -p (--password) option of previous versions has been removed -- it
+The --password option of previous versions has been removed -- it
 encouraged people to expose passwords in scripts.  Passwords
-must now be specified either manually or in your
+must now be specified either interactively or in your
 .I ~/.poprc
-file.
+file.  The short-form -p option now specifies the protocol to use.
 .SH SEE ALSO
 mail(1), binmail(1), sendmail(8), popd(8),
 RFC 937, RFC 1081, RFC 1082, RFC 1225, RFC 1460, RFC 1725.
index 3d116aa2fb2d7cd2cdd69e00b1a16f97369f974a..78693e0f5b4f74c9385874754f4a1a3e7ae61c13 100644 (file)
--- a/options.c
+++ b/options.c
 #define LA_REMOTEFILE  15
 #define        LA_LOCALFILE    16
 #define LA_MDA         17
-#define LA_SMTPHOST    18
-#define LA_LOGFILE     19
-#define LA_QUIT                20
-#define LA_NOREWRITE   21
-#define LA_YYDEBUG     22
+#define LA_PORT                18
+#define LA_SMTPHOST    19
+#define LA_LOGFILE     20
+#define LA_QUIT                21
+#define LA_NOREWRITE   22
+#define LA_YYDEBUG     23
  
 static char *shortoptions = "23PVaKkvS:scl:Fd:f:u:r:o:m:L:qN";
 static struct option longoptions[] = {
@@ -62,6 +63,7 @@ static struct option longoptions[] = {
   {"remote",    required_argument, (int *) 0, LA_REMOTEFILE },
   {"local",     required_argument, (int *) 0, LA_LOCALFILE  },
   {"mda",      required_argument, (int *) 0, LA_MDA        },
+  {"port",     required_argument, (int *) 0, LA_PORT       },
   {"smtphost", required_argument, (int *) 0, LA_SMTPHOST   },
   {"logfile",  required_argument, (int *) 0, LA_LOGFILE    },
   {"idfile",   required_argument, (int *) 0, LA_IDFILE     },
@@ -220,6 +222,10 @@ struct hostrec *queryctl;
       case LA_MDA:
         strncpy(queryctl->mda,optarg,sizeof(queryctl->mda)-1);
         break;
+      case 'P':
+      case LA_PORT:
+       queryctl->port = strtol(optarg,0,0L);
+       break;
       case 'S':
       case LA_SMTPHOST:
         if (fflag) 
diff --git a/pop2.c b/pop2.c
index 7c61162977bdb3784b3e4b26cbee86b4ded2df78..26bc1ea994df1b65fd354f4de37bd43fdac0ff76 100644 (file)
--- a/pop2.c
+++ b/pop2.c
@@ -84,17 +84,17 @@ struct hostrec *queryctl;
     fprintf(stderr,"Option --all is not supported with POP2\n");
     return(PS_SYNTAX);
   }
-#ifdef FOO
   else if (queryctl->smtphost[0]) {
     fprintf(stderr,"Option --smtphost is not supported with POP2\n");
     return(PS_SYNTAX);
   }
-#endif /* FOO */
   else
     ;
 
   /* open the socket to the POP server */
-  if ((socket = Socket(queryctl->servername,POP2_PORT)) < 0) {
+  if ((socket = Socket(queryctl->servername,
+                    queryctl->port ? queryctl->port : POP2_PORT)) < 0)
+  {
     perror("doPOP2: socket");
     return(PS_SOCKET);
   }
index b158d2ade688f46cb3bdd624d56e8baaf80b2a82..f6dbca9db881f48bbf449d995ba3b0455da242f6 100644 (file)
@@ -41,6 +41,7 @@ nokeep                { yylval.flag = FALSE; return KW_KEEP; }
 noflush                { yylval.flag = FALSE; return KW_FLUSH; }
 nofetchall     { yylval.flag = FALSE; return KW_FETCHALL; }
 norewrite      { yylval.flag = FALSE; return KW_REWRITE; }
+port           { return KW_PORT; }
 
 (auto)|(AUTO)  { yylval.proto = P_AUTO;  return PROTO_AUTO; }
 (pop2)|(POP2)  { yylval.proto = P_POP2;  return PROTO_POP2; }
index 5cd20368035e84dc4ea6c12f020bc3fc548cc117..cc040deed635c1ad46145e4ee3c06de474b6661b 100644 (file)
@@ -33,7 +33,7 @@ int yydebug;  /* in case we didn't generate with -- debug */
 %token KW_REMOTEFOLDER KW_LOCALFOLDER KW_SMTPHOST KW_MDA KW_EOL KW_DEFAULTS
 %token <proto> PROTO_AUTO PROTO_POP2 PROTO_POP3 PROTO_IMAP PROTO_APOP PROTO_RPOP
 %token <sval> PARAM_STRING
-%token <flag> KW_KEEP KW_FLUSH KW_FETCHALL KW_REWRITE
+%token <flag> KW_KEEP KW_FLUSH KW_FETCHALL KW_REWRITE KW_PORT
 %type <proto> proto;
 
 /* these are actually used by the lexer */
@@ -74,6 +74,7 @@ serv_option_clause:
        |       KW_FLUSH                        {prc_setflush($1);}
        |       KW_FETCHALL                     {prc_setfetchall($1);}
        |       KW_REWRITE                      {prc_setrewrite($1);}
+       |       KW_PORT PARAM_STRING            {prc_setport($2);}
   ;
 
 proto:         PROTO_POP2