aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2005-09-21 10:52:51 +0000
committerMatthias Andree <matthias.andree@gmx.de>2005-09-21 10:52:51 +0000
commitcc0f8a09d93ed7093792a23218177c141b34f0c2 (patch)
tree34ae54133584cb0d5b558bc4a5c0858ebe21209d
parent330d0365531e63bd8fb86c3df7e96f6667748242 (diff)
downloadfetchmail-cc0f8a09d93ed7093792a23218177c141b34f0c2.tar.gz
fetchmail-cc0f8a09d93ed7093792a23218177c141b34f0c2.tar.bz2
fetchmail-cc0f8a09d93ed7093792a23218177c141b34f0c2.zip
Add full support for --service option.
svn path=/trunk/; revision=4307
-rw-r--r--NEWS1
-rw-r--r--fetchmail-FAQ.html5
-rw-r--r--fetchmail.man17
-rw-r--r--options.c8
-rw-r--r--rcfile_y.y6
5 files changed, 24 insertions, 13 deletions
diff --git a/NEWS b/NEWS
index cd76a51a..4e4a1a6c 100644
--- a/NEWS
+++ b/NEWS
@@ -202,6 +202,7 @@ fetchmail 6.3.0 (not yet released officially):
* Expunge between IMAP folders when polling multiple folders.
Sunil Shetye. (MA)
* Fix IMAP expunged message counting. Sunil Shetye. (MA)
+* Add full support for --service option. Matthias Andree
# INTERNAL CHANGES
* Switched to automake. Matthias Andree.
diff --git a/fetchmail-FAQ.html b/fetchmail-FAQ.html
index 7c96a450..691d1bdc 100644
--- a/fetchmail-FAQ.html
+++ b/fetchmail-FAQ.html
@@ -2518,9 +2518,8 @@ declaration <tt>auth password</tt> in your .fetchmailrc.</p>
literal, for instance, 192.168.0.1</li>
<li>Make sure your <code>/etc/services</code> file (or other
services database) contains the necessary service entries. If you
- cannot fix the services database, use the --port option and give the
- numeric port address. Common port addresses
- are:<table>
+ cannot fix the services database, use the --service option and give the
+ numeric port address. Common port addresses are:<table>
<tr><th>service</th><th>port</th></tr>
<tr><td>IMAP</td><td>143</td></tr>
<tr><td>IMAP+SSL</td><td>993</td></tr>
diff --git a/fetchmail.man b/fetchmail.man
index 19dd9e4c..dbf2f5cd 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -270,15 +270,18 @@ depending on upstream server capabilities. Note also that this option
may be removed and forced enabled in a future fetchmail version.
.TP
+.B \-\-service <servicename>
+(Keyword: service)
+The service option permits you to specify a service name to connect to.
+You can specify a decimal port number here, if your services database
+lacks the required service-port assignments. See the FAQ item R12 for
+details. This replaces the older \-\-port option.
+.TP
.B \-P <portnumber> | \-\-port <portnumber>
(Keyword: port)
-The port option permits you to specify a TCP/IP port to connect on.
-This option will seldom be necessary as all the supported protocols have
-well-established default port numbers. On some older machines, however,
-the protocol <\-\-> port mappings are missing from the services database
-(often /etc/services), and this port can make fetchmail work for you
-even if you don't have system administrator privileges. See the FAQ item
-R12 for details.
+Obsolete version of \-\-service that does not take service names.
+.B Note:
+this option may be removed from a future version.
.TP
.B \-\-principal <principal>
(Keyword: principal)
diff --git a/options.c b/options.c
index c55276e5..0243774f 100644
--- a/options.c
+++ b/options.c
@@ -87,10 +87,9 @@
#define LA_FETCHSIZELIMIT 61
#define LA_FASTUIDL 62
-
/* don't use 63-122: they could clash with short options */
-
#define LA_LIMITFLUSH 128
+#define LA_SERVICE 129
/* options still left: CDgGhHjJoORwWxXYz */
static const char *shortoptions =
@@ -120,6 +119,7 @@ static const struct option longoptions[] = {
{"proto", required_argument, (int *) 0, LA_PROTOCOL },
{"uidl", no_argument, (int *) 0, LA_UIDL },
{"port", required_argument, (int *) 0, LA_PORT },
+ {"service", required_argument, (int *) 0, LA_SERVICE },
{"auth", required_argument, (int *) 0, LA_AUTH},
{"timeout", required_argument, (int *) 0, LA_TIMEOUT },
{"envelope", required_argument, (int *) 0, LA_ENVELOPE },
@@ -387,6 +387,7 @@ struct query *ctl; /* option record to be initialized */
break;
case 'P':
case LA_PORT:
+ case LA_SERVICE:
ctl->server.service = optarg;
break;
case LA_AUTH:
@@ -680,7 +681,8 @@ struct query *ctl; /* option record to be initialized */
P(GT_(" -p, --protocol specify retrieval protocol (see man page)\n"));
P(GT_(" -U, --uidl force the use of UIDLs (pop3 only)\n"));
- P(GT_(" -P, --port TCP/IP service port to connect to\n"));
+ P(GT_(" -P, --port TCP port to connect to (obsolete, use --service)\n"));
+ P(GT_(" --service TCP service to connect to (can be numeric TCP port)\n"));
P(GT_(" --auth authentication type (password/kerberos/ssh/otp)\n"));
P(GT_(" -t, --timeout server nonresponse timeout\n"));
P(GT_(" -E, --envelope envelope address header\n"));
diff --git a/rcfile_y.y b/rcfile_y.y
index daff1a34..0aa9265e 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -173,6 +173,12 @@ serv_option : AKA alias_list
| SERVICE STRING {
current.server.service = $2;
}
+ | SERVICE NUMBER {
+ int port = $2;
+ char buf[10];
+ snprintf(buf, sizeof buf, "%d", port);
+ current.server.service = xstrdup(buf);
+ }
| PORT NUMBER {
int port = $2;
char buf[10];