]> Pileus Git - ~andy/fetchmail/commitdiff
Introduced bool.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 11 Jun 1997 14:46:37 +0000 (14:46 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 11 Jun 1997 14:46:37 +0000 (14:46 -0000)
svn path=/trunk/; revision=1084

driver.c
fetchmail.c
fetchmail.h
options.c
rcfile_y.y

index f1e69dab5266b28ab352c76f56e2dd89ca1d8266..79f0bd2bd00d3441dec692f2947ffbafd2d347a6 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -63,7 +63,7 @@ extern char *strstr();        /* needed on sysV68 R3V7.1. */
 
 int fetchlimit;                /* how often to tear down the server connection */
 int batchcount;                /* count of messages sent in current batch */
-int peek_capable;      /* can we peek for better error recovery? */
+bool peek_capable;     /* can we peek for better error recovery? */
 
 static const struct method *protocol;
 static jmp_buf restart;
@@ -445,9 +445,9 @@ char *realname;             /* real name of host */
     int n, linelen, oldlen, ch, remaining;
     char               *cp;
     struct idlist      *idp, *xmit_names;
-    int                        good_addresses, bad_addresses, has_nuls;
+    bool                       good_addresses, bad_addresses, has_nuls;
 #ifdef HAVE_RES_SEARCH
-    int                        no_local_matches = FALSE;
+    bool               no_local_matches = FALSE;
 #endif /* HAVE_RES_SEARCH */
     int                        olderrs;
 
@@ -1028,8 +1028,8 @@ static int readbody(sock, ctl, forward, len, delimited)
 struct query *ctl;     /* query control record */
 int sock;              /* to which the server is connected */
 int len;               /* length of message */
-int forward;           /* TRUE to forward */
-int delimited;         /* does the protocol use a message delimiter? */
+bool forward;          /* TRUE to forward */
+bool delimited;                /* does the protocol use a message delimiter? */
 {
     int        linelen;
     char buf[MSGBUFSIZE+1], *cp;
@@ -1167,7 +1167,7 @@ const struct method *proto;       /* protocol method table */
     void (*sigsave)();
 
 #ifndef KERBEROS_V4
-    if (ctl->server.authenticate == A_KERBEROS_V4)
+    if (ctl->server.preauthenticate == A_KERBEROS_V4)
     {
        error(0, -1, "Kerberos V4 support not linked.");
        return(PS_ERROR);
@@ -1246,7 +1246,7 @@ const struct method *proto;       /* protocol method table */
        }
 
 #ifdef KERBEROS_V4
-       if (ctl->server.authenticate == A_KERBEROS_V4)
+       if (ctl->server.preauthenticate == A_KERBEROS_V4)
        {
            ok = kerberos_auth(sock, ctl->server.canonical_name);
            if (ok != 0)
@@ -1420,7 +1420,7 @@ const struct method *proto;       /* protocol method table */
            }
            else if (count > 0)
            {    
-               int     force_retrieval;
+               bool    force_retrieval;
 
                /*
                 * What forces this code is that in POP3 and IMAP2BIS you can't
@@ -1449,11 +1449,11 @@ const struct method *proto;     /* protocol method table */
                /* read, forward, and delete messages */
                for (num = 1; num <= count; num++)
                {
-                   int toolarge = msgsizes && (msgsizes[num-1] > ctl->limit);
-                   int fetch_it = ctl->fetchall ||
+                   bool toolarge = msgsizes && (msgsizes[num-1] > ctl->limit);
+                   bool fetch_it = ctl->fetchall ||
                        (!toolarge && (force_retrieval || !(protocol->is_old && (protocol->is_old)(sock,ctl,num))));
-                   int suppress_delete = FALSE;
-                   int suppress_forward = FALSE;
+                   bool suppress_delete = FALSE;
+                   bool suppress_forward = FALSE;
 
                    /* we may want to reject this message if it's old */
                    if (!fetch_it)
@@ -1475,7 +1475,8 @@ const struct method *proto;       /* protocol method table */
 
                        if (outlevel > O_SILENT)
                        {
-                           int havesizes, mlen;
+                           bool havesizes;
+                           int mlen;
 
                            error_build("reading message %d", num);
 
index cc303530ab95329daa0b99b09664986dcdc55d7f..222b2e84f0be095b1f67946e996e6a73854f8d95 100644 (file)
@@ -57,18 +57,18 @@ int yydebug;                /* enable parse debugging */
 
 /* daemon mode control */
 int poll_interval;     /* poll interval in seconds */
-int nodetach;          /* if TRUE, don't detach daemon process */
+bool nodetach;         /* if TRUE, don't detach daemon process */
 char *logfile;         /* log file for daemon mode */
-int use_syslog;                /* if --syslog was set */
-int quitmode;          /* if --quit was set */
-int check_only;                /* if --probe was set */
+bool use_syslog;       /* if --syslog was set */
+bool quitmode;         /* if --quit was set */
+bool check_only;       /* if --probe was set */
 char *cmd_logfile;     /* if --logfile was set */
 int cmd_daemon;        /* if --daemon was set */
 
 /* miscellaneous global controls */
 char *rcfile;          /* path name of rc file */
 char *idfile;          /* UID list file */
-int versioninfo;       /* emit only version info */
+bool versioninfo;      /* emit only version info */
 char *user;            /* the name of the invoking user */
 char *fetchmailhost;   /* the name of the host running fetchmail */
 char *program_name;    /* the name to prefix error messages with */
@@ -305,7 +305,7 @@ int main (int argc, char **argv)
     for (ctl = querylist; ctl; ctl = ctl->next)
        if (ctl->active && !(implicitmode && ctl->server.skip)&&!ctl->password)
        {
-           if (ctl->server.authenticate == A_KERBEROS_V4 || ctl->server.protocol == P_IMAP_K4)
+           if (ctl->server.preauthenticate == A_KERBEROS_V4 || ctl->server.protocol == P_IMAP_K4)
                /* Server won't care what the password is, but there
                   must be some non-null string here.  */
                ctl->password = ctl->remotename;
@@ -405,7 +405,7 @@ int main (int argc, char **argv)
                 * as a probe to make sure our nameserver is still up.
                 * The multidrop case (especially) needs it.
                 */
-               if (ctl->server.authenticate==A_KERBEROS_V4 || MULTIDROP(ctl))
+               if (ctl->server.preauthenticate==A_KERBEROS_V4 || MULTIDROP(ctl))
                {
                    struct hostent      *namerec;
 
@@ -859,7 +859,7 @@ void dump_params (struct query *ctl)
            printf("  Password = '%s'.\n", visbuf(ctl->password));
     if (ctl->server.protocol == P_POP3 
                && ctl->server.port == KPOP_PORT
-               && ctl->server.authenticate == A_KERBEROS_V4)
+               && ctl->server.preauthenticate == A_KERBEROS_V4)
        printf("  Protocol is KPOP");
     else
        printf("  Protocol is %s", showproto(ctl->server.protocol));
@@ -871,7 +871,7 @@ void dump_params (struct query *ctl)
        printf(" (forcing UIDL use)");
     putchar('.');
     putchar('\n');
-    if (ctl->server.authenticate == A_KERBEROS_V4)
+    if (ctl->server.preauthenticate == A_KERBEROS_V4)
            printf("  Kerberos V4 preauthentication enabled.\n");
     printf("  Server nonresponse timeout is %d seconds", ctl->server.timeout);
     if (ctl->server.timeout ==  CLIENT_TIMEOUT)
index 689a584340d997bc1e2be211abc5247ae42f9086..010ccd9c36a4d346f9edaff417c68a9a9fb28b3d 100644 (file)
@@ -14,7 +14,7 @@
 
 #define                KPOP_PORT       1109
 
-/* authentication types */
+/* preauthentication types */
 #define                A_PASSWORD      0       /* password or inline authentication */
 #define                A_KERBEROS_V4   1       /* preauthenticate w/ Kerberos V4 */
 
@@ -64,21 +64,22 @@ struct idlist
     struct idlist *next;
 };
 
+typedef        int     bool;
 
 struct hostdata                /* shared among all user connections to given server */
 {
     /* rc file data */
     struct idlist *names;              /* server name first, then akas */
     struct idlist *localdomains;       /* list of pass-through domains */
-    int protocol;
-    int port;
-    int interval;
-    int authenticate;
-    int timeout;
-    char *envelope;
-    int skip;
-    int dns;
-    int uidl;
+    int protocol;                      /* protocol type */
+    int port;                          /* TCP/IP service port number */
+    int interval;                      /* # cycles to skip between polls */
+    int preauthenticate;               /* preauthentication mode to try */
+    int timeout;                       /* inactivity timout in seconds */
+    char *envelope;                    /* envelope address list header */
+    bool skip;                         /* skip this server? */
+    bool dns;                          /* do DNS lookup on multidrop? */
+    bool uidl;                         /* use RFC1725 UIDLs? */
 
 #ifdef linux
     char *interface;
@@ -113,21 +114,21 @@ struct query
     char *preconnect;
 
     /* per-user control flags */
-    int keep;
-    int fetchall;
-    int flush;
-    int rewrite;
-    int stripcr;
-    int forcecr;
-    int limit;
-    int fetchlimit;
-    int batchlimit;
+    bool keep;
+    bool fetchall;
+    bool flush;
+    bool rewrite;
+    bool stripcr;
+    bool forcecr;
+    bool limit;
+    bool fetchlimit;
+    bool batchlimit;
 
     /* unseen, previous state of mailbox (initially from .fetchids) */
     struct idlist *oldsaved, *newsaved;
 
     /* internal use */
-    int active;
+    bool active;
     int errcount;              /* count transient errors in last pass */
     struct query *next;                /* next query control block in chain */
     int smtp_socket;           /* socket descriptor for SMTP connection */
@@ -142,8 +143,8 @@ struct method
 {
     char *name;                        /* protocol name */
     int        port;                   /* service port */
-    int tagged;                        /* if true, generate & expect command tags */
-    int delimited;             /* if true, accept "." message delimiter */
+    bool tagged;               /* if true, generate & expect command tags */
+    bool delimited;            /* if true, accept "." message delimiter */
     int (*parse_response)();   /* response_parsing function */
     int (*getauth)();          /* authorization fetcher */
     int (*getrange)();         /* get message range to fetch */
@@ -168,23 +169,23 @@ extern int yydebug;               /* enable parse debugging */
 
 /* daemon mode control */
 extern int poll_interval;      /* poll interval in seconds */
-extern int nodetach;           /* if TRUE, don't detach daemon process */
+extern bool nodetach;          /* if TRUE, don't detach daemon process */
 extern char *logfile;          /* log file for daemon mode */
-extern int use_syslog;         /* if --syslog was set */
-extern int quitmode;           /* if --quit was set */
-extern int check_only;         /* if --check was set */
+extern bool use_syslog;                /* if --syslog was set */
+extern bool quitmode;          /* if --quit was set */
+extern bool check_only;                /* if --check was set */
 extern char *cmd_logfile;      /* if --logfile was set */
 extern int cmd_daemon;         /* if --daemon was set */
 
 /* these get computed */
 extern int batchcount;         /* count of messages sent in current batch */
-extern int peek_capable;       /* can we read msgs without setting seen? */
+extern bool peek_capable;      /* can we read msgs without setting seen? */
 
 /* miscellaneous global controls */
 extern char *rcfile;           /* path name of rc file */
 extern char *idfile;           /* path name of UID file */
 extern int linelimit;          /* limit # lines retrieved per site */
-extern int versioninfo;                /* emit only version info */
+extern bool versioninfo;       /* emit only version info */
 extern char *user;             /* name of invoking user */
 extern char *fetchmailhost;    /* the name of the host running fetchmail */
 
index 4dea3dc8140cb6dfeb4189c4546b6b06c1ca46a9..0241ca57a15985f6055703c6943863fa4ca27c7b 100644 (file)
--- a/options.c
+++ b/options.c
@@ -186,7 +186,7 @@ struct query *ctl;  /* option record to be initialized */
            {
                ctl->server.protocol = P_POP3;
                ctl->server.port = KPOP_PORT;
-               ctl->server.authenticate =  A_KERBEROS_V4;
+               ctl->server.preauthenticate =  A_KERBEROS_V4;
            }
            else if (strcasecmp(optarg,"imap") == 0)
                ctl->server.protocol = P_IMAP;
@@ -212,13 +212,13 @@ struct query *ctl;        /* option record to be initialized */
        case 'A':
        case LA_AUTHENTICATE:
            if (strcmp(optarg, "password") == 0)
-               ctl->server.authenticate = A_PASSWORD;
+               ctl->server.preauthenticate = A_PASSWORD;
            else if (strcmp(optarg, "kerberos") == 0)
-               ctl->server.authenticate = A_KERBEROS_V4;
+               ctl->server.preauthenticate = A_KERBEROS_V4;
            else if (strcmp(optarg, "kerberos_v4") == 0)
-               ctl->server.authenticate = A_KERBEROS_V4;
+               ctl->server.preauthenticate = A_KERBEROS_V4;
            else {
-               fprintf(stderr,"Invalid authentication `%s' specified.\n", optarg);
+               fprintf(stderr,"Invalid preauthentication `%s' specified.\n", optarg);
                errflag++;
            }
            break;
index 94f0cc8f3783774f45b8b774ee692aadf87ad99a..6fa773053c212842d86bc80b13a6dc64ddda3a97 100644 (file)
@@ -120,15 +120,15 @@ serv_option       : AKA alias_list
                | PROTOCOL PROTO        {current.server.protocol = $2;}
                | PROTOCOL KPOP         {
                                            current.server.protocol = P_POP3;
-                                           current.server.authenticate = A_KERBEROS_V4;
+                                           current.server.preauthenticate = A_KERBEROS_V4;
                                            current.server.port = KPOP_PORT;
                                        }
                | UIDL                  {current.server.uidl = FLAG_TRUE;}
                | NO UIDL               {current.server.uidl  = FLAG_FALSE;}
                | PORT NUMBER           {current.server.port = $2;}
                | INTERVAL NUMBER               {current.server.interval = $2;}
-               | AUTHENTICATE PASSWORD {current.server.authenticate = A_PASSWORD;}
-               | AUTHENTICATE KERBEROS4        {current.server.authenticate = A_KERBEROS_V4;}
+               | AUTHENTICATE PASSWORD {current.server.preauthenticate = A_PASSWORD;}
+               | AUTHENTICATE KERBEROS4        {current.server.preauthenticate = A_KERBEROS_V4;}
                | TIMEOUT NUMBER        {current.server.timeout = $2;}
                | ENVELOPE STRING       {current.server.envelope = xstrdup($2);}
                | INTERFACE STRING      {
@@ -384,7 +384,7 @@ static void record_current(void)
     FLAG_FORCE(server.protocol);
     FLAG_FORCE(server.port);
     FLAG_FORCE(server.interval);
-    FLAG_FORCE(server.authenticate);
+    FLAG_FORCE(server.preauthenticate);
     FLAG_FORCE(server.timeout);
     FLAG_FORCE(server.envelope);
     FLAG_FORCE(server.skip);
@@ -432,7 +432,7 @@ void optmerge(struct query *h2, struct query *h1)
     FLAG_MERGE(server.protocol);
     FLAG_MERGE(server.port);
     FLAG_MERGE(server.interval);
-    FLAG_MERGE(server.authenticate);
+    FLAG_MERGE(server.preauthenticate);
     FLAG_MERGE(server.timeout);
     FLAG_MERGE(server.envelope);
     FLAG_MERGE(server.skip);