]> Pileus Git - ~andy/fetchmail/blobdiff - options.c
Merge Sunil Shetye's --limitflush patch.
[~andy/fetchmail] / options.c
index 000270ee0f0a3447e45788e552be8faeddd8b42d..0323e71ac0398a5465f7b280515e7dacf841bb7a 100644 (file)
--- a/options.c
+++ b/options.c
@@ -66,7 +66,6 @@
 #define LA_LMTP                42
 #define LA_PLUGIN      43
 #define LA_PLUGOUT     44
-#define LA_NETSEC      45
 #define LA_INTERFACE    46
 #define LA_MONITOR      47
 #define LA_CONFIGDUMP  48
 #define LA_SSLFINGERPRINT      60
 #endif
 
+#define LA_FETCHSIZELIMIT      61
+#define LA_FASTUIDL    62
+
+/* don't use 63-122: they could clash with short options */
+
+#define LA_LIMITFLUSH  128
 
 /* options still left: CDgGhHjJoORwWxXYz */
 static const char *shortoptions = 
@@ -127,6 +132,7 @@ static const struct option longoptions[] = {
   {"nokeep",   no_argument,       (int *) 0, LA_NOKEEP      },
   {"keep",     no_argument,       (int *) 0, LA_KEEP        },
   {"flush",    no_argument,       (int *) 0, LA_FLUSH       },
+  {"limitflush",       no_argument, (int *) 0, LA_LIMITFLUSH       },
   {"norewrite",        no_argument,       (int *) 0, LA_NOREWRITE   },
   {"limit",    required_argument, (int *) 0, LA_LIMIT       },
   {"warnings", required_argument, (int *) 0, LA_WARNINGS    },
@@ -140,15 +146,13 @@ static const struct option longoptions[] = {
   
   {"batchlimit",required_argument, (int *) 0, LA_BATCHLIMIT  },
   {"fetchlimit",required_argument, (int *) 0, LA_FETCHLIMIT  },
+  {"fetchsizelimit",required_argument, (int *) 0, LA_FETCHSIZELIMIT  },
+  {"fastuidl", required_argument, (int *) 0, LA_FASTUIDL    },
   {"expunge",  required_argument, (int *) 0, LA_EXPUNGE     },
   {"mda",      required_argument, (int *) 0, LA_MDA         },
   {"bsmtp",    required_argument, (int *) 0, LA_BSMTP       },
   {"lmtp",     no_argument,       (int *) 0, LA_LMTP        },
 
-#ifdef INET6_ENABLE
-  {"netsec",   required_argument, (int *) 0, LA_NETSEC      },
-#endif /* INET6_ENABLE */
-
 #ifdef SSL_ENABLE
   {"ssl",       no_argument,       (int *) 0, LA_SSL        },
   {"sslkey",    required_argument, (int *) 0, LA_SSLKEY     },
@@ -161,10 +165,10 @@ static const struct option longoptions[] = {
 
   {"principal", required_argument, (int *) 0, LA_PRINCIPAL },
 
-#if (defined(linux) && !INET6_ENABLE) || defined(__FreeBSD__)
+#ifdef CAN_MONITOR
   {"interface",        required_argument, (int *) 0, LA_INTERFACE   },
   {"monitor",  required_argument, (int *) 0, LA_MONITOR     },
-#endif /* (defined(linux) && !INET6_ENABLE) || defined(__FreeBSD__) */
+#endif /* CAN_MONITOR */
   {"plugin",   required_argument, (int *) 0, LA_PLUGIN      },
   {"plugout",  required_argument, (int *) 0, LA_PLUGOUT     },
 
@@ -319,10 +323,11 @@ struct query *ctl;        /* option record to be initialized */
            rctl->invisible = TRUE;
            break;
        case LA_SHOWDOTS:
-           rctl->showdots = TRUE;
+           rctl->showdots = FLAG_TRUE;
            break;
        case 'f':
        case LA_RCFILE:
+           xfree(rcfile);
            rcfile = prependdir (optarg, currentwd);
            break;
        case 'i':
@@ -358,11 +363,7 @@ struct query *ctl; /* option record to be initialized */
            else if (strcasecmp(optarg,"kpop") == 0)
            {
                ctl->server.protocol = P_POP3;
-#if INET6_ENABLE
                ctl->server.service = KPOP_PORT;
-#else /* INET6_ENABLE */
-               ctl->server.port = KPOP_PORT;
-#endif /* INET6_ENABLE */
 #ifdef KERBEROS_V5
                ctl->server.authenticate =  A_KERBEROS_V5;
 #else
@@ -386,11 +387,7 @@ struct query *ctl; /* option record to be initialized */
            break;
        case 'P':
        case LA_PORT:
-#if INET6_ENABLE
            ctl->server.service = optarg;
-#else /* INET6_ENABLE */
-           ctl->server.port = xatoi(optarg, &errflag);
-#endif /* INET6_ENABLE */
            break;
        case LA_AUTH:
            if (strcmp(optarg, "password") == 0)
@@ -409,6 +406,8 @@ struct query *ctl;  /* option record to be initialized */
                ctl->server.authenticate = A_SSH;
            else if (strcmp(optarg, "otp") == 0)
                ctl->server.authenticate = A_OTP;
+           else if (strcmp(optarg, "opie") == 0)
+               ctl->server.authenticate = A_OTP;
            else if (strcmp(optarg, "ntlm") == 0)
                ctl->server.authenticate = A_NTLM;
            else if (strcmp(optarg, "cram") == 0)
@@ -459,6 +458,9 @@ struct query *ctl;  /* option record to be initialized */
        case LA_FLUSH:
            ctl->flush = FLAG_TRUE;
            break;
+       case LA_LIMITFLUSH:
+           ctl->limitflush = FLAG_TRUE;
+           break;
        case 'n':
        case LA_NOREWRITE:
            ctl->rewrite = FLAG_FALSE;
@@ -470,33 +472,33 @@ struct query *ctl;        /* option record to be initialized */
            break;
        case 'r':
        case LA_FOLDER:
-           xalloca(buf, char *, strlen(optarg) + 1);
-           strcpy(buf, optarg);
+           buf = xstrdup(optarg);
            cp = strtok(buf, ",");
            do {
                save_str(&ctl->mailboxes, cp, 0);
            } while
                ((cp = strtok((char *)NULL, ",")));
+           free(buf);
            break;
        case 'S':
        case LA_SMTPHOST:
-           xalloca(buf, char *, strlen(optarg) + 1);
-           strcpy(buf, optarg);
+           buf = xstrdup(optarg);
            cp = strtok(buf, ",");
            do {
                save_str(&ctl->smtphunt, cp, TRUE);
            } while
                ((cp = strtok((char *)NULL, ",")));
+           free(buf);
            ocount++;
            break;
        case LA_FETCHDOMAINS:
-           xalloca(buf, char *, strlen(optarg) + 1);
-           strcpy(buf, optarg);
+           buf = xstrdup(optarg);
            cp = strtok(buf, ",");
            do {
                save_str(&ctl->domainlist, cp, TRUE);
            } while
                ((cp = strtok((char *)NULL, ",")));
+           free(buf);
            break;
        case 'D':
        case LA_SMTPADDR:
@@ -507,8 +509,7 @@ struct query *ctl;  /* option record to be initialized */
          break;
        case 'Z':
        case LA_ANTISPAM:
-           xalloca(buf, char *, strlen(optarg) + 1);
-           strcpy(buf, optarg);
+           buf = xstrdup(optarg);
            cp = strtok(buf, ",");
            do {
                struct idlist   *idp = save_str(&ctl->antispam, NULL, 0);;
@@ -516,6 +517,7 @@ struct query *ctl;  /* option record to be initialized */
                idp->val.status.num = xatoi(cp, &errflag);
            } while
                ((cp = strtok((char *)NULL, ",")));
+           free(buf);
            break;
        case 'b':
        case LA_BATCHLIMIT:
@@ -527,6 +529,14 @@ struct query *ctl; /* option record to be initialized */
            c = xatoi(optarg, &errflag);
            ctl->fetchlimit = NUM_VALUE_IN(c);
            break;
+       case LA_FETCHSIZELIMIT:
+           c = xatoi(optarg, &errflag);
+           ctl->fetchsizelimit = NUM_VALUE_IN(c);
+           break;
+       case LA_FASTUIDL:
+           c = xatoi(optarg, &errflag);
+           ctl->fastuidl = NUM_VALUE_IN(c);
+           break;
        case 'e':
        case LA_EXPUNGE:
            c = xatoi(optarg, &errflag);
@@ -545,17 +555,7 @@ struct query *ctl; /* option record to be initialized */
            ctl->listener = LMTP_MODE;
            break;
 
-       case 'T':
-       case LA_NETSEC:
-#if NET_SECURITY
-           ctl->server.netsec = (void *)optarg;
-#else
-           fprintf(stderr, GT_("fetchmail: network security support is disabled\n"));
-           errflag++;
-#endif /* NET_SECURITY */
-           break;
-
-#if (defined(linux) && !INET6_ENABLE) || defined(__FreeBSD__)
+#ifdef CAN_MONITOR
        case 'I':
        case LA_INTERFACE:
            interface_parse(optarg, &ctl->server);
@@ -564,7 +564,7 @@ struct query *ctl;  /* option record to be initialized */
        case LA_MONITOR:
            ctl->server.monitor = xstrdup(optarg);
            break;
-#endif /* (defined(linux) && !INET6_ENABLE) || defined(__FreeBSD__) */
+#endif /* CAN_MONITOR */
        case LA_PLUGIN:
            ctl->server.plugin = xstrdup(optarg);
            break;
@@ -594,7 +594,7 @@ struct query *ctl;  /* option record to be initialized */
            break;
 
        case LA_SSLCERTPATH:
-           ctl->sslcertpath = xstrdup(optarg);
+           ctl->sslcertpath = prependdir(optarg, currentwd);
            break;
 
        case LA_SSLFINGERPRINT:
@@ -629,9 +629,9 @@ struct query *ctl;  /* option record to be initialized */
            rctl->use_syslog = FLAG_FALSE;
            break;
 
-        case LA_TRACEPOLLS:
-            ctl->tracepolls = FLAG_TRUE;
-            break;
+       case LA_TRACEPOLLS:
+           ctl->server.tracepolls = FLAG_TRUE;
+           break;
 
        case '?':
        case LA_HELP:
@@ -661,7 +661,7 @@ struct query *ctl;  /* option record to be initialized */
        P(GT_("  -i, --idfile      specify alternate UIDs file\n"));
        P(GT_("      --postmaster  specify recipient of last resort\n"));
        P(GT_("      --nobounce    redirect bounces from user to postmaster.\n"));
-#if (defined(linux) && !INET6_ENABLE) || defined(__FreeBSD__)
+#ifdef CAN_MONITOR
        P(GT_("  -I, --interface   interface required specification\n"));
        P(GT_("  -M, --monitor     monitor interface for activity\n"));
 #endif
@@ -669,6 +669,8 @@ struct query *ctl;  /* option record to be initialized */
        P(GT_("      --ssl         enable ssl encrypted session\n"));
        P(GT_("      --sslkey      ssl private key file\n"));
        P(GT_("      --sslcert     ssl client certificate\n"));
+       P(GT_("      --sslcertpath path to ssl certificates\n"));
+       P(GT_("      --sslfingerprint fingerprint that must match that of the server's cert.\n"));
        P(GT_("      --sslproto    force ssl protocol (ssl2/ssl3/tls1)\n"));
 #endif
        P(GT_("      --plugin      specify external command to open connection\n"));
@@ -677,7 +679,7 @@ 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_("      --auth        authentication type (password/kerberos/ssh)\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"));
        P(GT_("  -Q, --qvirtual    prefix to remove from local user id\n"));
@@ -689,13 +691,11 @@ struct query *ctl;        /* option record to be initialized */
        P(GT_("  -K, --nokeep      delete new messages after retrieval\n"));
        P(GT_("  -k, --keep        save new messages after retrieval\n"));
        P(GT_("  -F, --flush       delete old messages from server\n"));
+       P(GT_("      --limitflush  delete oversized messages\n"));
        P(GT_("  -n, --norewrite   don't rewrite header addresses\n"));
        P(GT_("  -l, --limit       don't fetch messages over given size\n"));
        P(GT_("  -w, --warnings    interval between warning mail notification\n"));
 
-#if NET_SECURITY
-       P(GT_("  -T, --netsec      set IP security request\n"));
-#endif /* NET_SECURITY */
        P(GT_("  -S, --smtphost    set SMTP forwarding host\n"));
        P(GT_("      --fetchdomains fetch mail for specified domains\n"));
        P(GT_("  -D, --smtpaddress set SMTP delivery domain to use\n"));
@@ -703,6 +703,8 @@ struct query *ctl;  /* option record to be initialized */
        P(GT_("  -Z, --antispam,   set antispam response values\n"));
        P(GT_("  -b, --batchlimit  set batch limit for SMTP connections\n"));
        P(GT_("  -B, --fetchlimit  set fetch limit for server connections\n"));
+       P(GT_("      --fetchsizelimit set fetch message size limit\n"));
+       P(GT_("      --fastuidl    do a binary search for UIDLs\n"));
        P(GT_("  -e, --expunge     set max deletions between expunges\n"));
         P(GT_("  -m, --mda         set MDA to use for forwarding\n"));
         P(GT_("      --bsmtp       set output BSMTP file\n"));