From c64bc78c091837def7820299eb99ed51a21570d8 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 12 Sep 1996 11:59:39 +0000 Subject: Added port-specification option. svn path=/trunk/; revision=87 --- Makefile.in | 4 ++-- NEWS | 13 +++++++++---- README | 2 +- driver.c | 6 ++++-- fetchmail.c | 7 ++++++- fetchmail.h | 1 + fetchmail.man | 37 ++++++++++++++----------------------- options.c | 16 +++++++++++----- pop2.c | 6 +++--- rcfile_l.l | 1 + rcfile_y.y | 3 ++- 11 files changed, 54 insertions(+), 42 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4b40f40f..1b21e6fc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 c8fe25a2..411c7251 100644 --- 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 - 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 785e2785..c66e2891 100644 --- 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 and diff --git a/driver.c b/driver.c index 74c3d993..4718d35b 100644 --- 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; diff --git a/fetchmail.c b/fetchmail.c index 1f424374..8dbaaaa4 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -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", diff --git a/fetchmail.h b/fetchmail.h index 6a13dae5..fa78c726 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -63,6 +63,7 @@ struct hostrec int fetchall; int flush; int norewrite; + int port; /* state used for tracking UIDL ids */ char lastid [IDLEN]; diff --git a/fetchmail.man b/fetchmail.man index 76884b7b..f6dd6340 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -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 . .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. diff --git a/options.c b/options.c index 3d116aa2..78693e0f 100644 --- a/options.c +++ b/options.c @@ -36,11 +36,12 @@ #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 7c611629..26bc1ea9 100644 --- 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); } diff --git a/rcfile_l.l b/rcfile_l.l index b158d2ad..f6dbca9d 100644 --- a/rcfile_l.l +++ b/rcfile_l.l @@ -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; } diff --git a/rcfile_y.y b/rcfile_y.y index 5cd20368..cc040dee 100644 --- a/rcfile_y.y +++ b/rcfile_y.y @@ -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_AUTO PROTO_POP2 PROTO_POP3 PROTO_IMAP PROTO_APOP PROTO_RPOP %token PARAM_STRING -%token KW_KEEP KW_FLUSH KW_FETCHALL KW_REWRITE +%token KW_KEEP KW_FLUSH KW_FETCHALL KW_REWRITE KW_PORT %type 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 -- cgit v1.2.3