From 25844176b66a992b42041fd07bf14096f3d2ad02 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 17 Oct 1998 15:10:42 +0000 Subject: Introduced O_DEBUG. svn path=/trunk/; revision=2102 --- NEWS | 3 +++ checkalias.c | 6 +++--- driver.c | 36 ++++++++++++++++++------------------ fetchmail-FAQ.html | 11 ++++++----- fetchmail.c | 50 +++++++++++++++++++++++++------------------------- fetchmail.h | 3 ++- fetchmail.man | 2 ++ imap.c | 36 ++++++++++++++++++------------------ options.c | 5 ++++- rpa.c | 38 +++++++++++++++++++------------------- sink.c | 2 +- smtp.c | 20 ++++++++++---------- 12 files changed, 111 insertions(+), 101 deletions(-) diff --git a/NEWS b/NEWS index 595d8f9d..05fa1d86 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ Release Notes: +fetchmail-4.6.3 (): +* Introduced `debug' verbosity, invocable by -v -v. + fetchmail-4.6.2 (Fri Oct 16 12:49:30 EDT 1998): * Time out server open requests like we do reads. This protects against buggy TCP/IP configurations that hang forever on a bad open. diff --git a/checkalias.c b/checkalias.c index a111a39f..5d515cfc 100644 --- a/checkalias.c +++ b/checkalias.c @@ -140,15 +140,15 @@ int is_host_alias(const char *name, struct query *ctl) goto match; else if (((he_st = gethostbyname(ctl->server.truename)) != (struct hostent *)NULL) && ctl->server.checkalias) { - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "Checking if %s is really the same node as %s",ctl->server.truename,name); if (is_ip_alias(ctl->server.truename,name) == TRUE) { - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "Yes, their IP addresses match"); goto match; } - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "No, their IP addresses don't match"); } else diff --git a/driver.c b/driver.c index 52882b2d..4cb24bc9 100644 --- a/driver.c +++ b/driver.c @@ -137,7 +137,7 @@ struct idlist **xmit_names; /* list of recipient names parsed out */ if (lname != (char *)NULL) { - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "mapped %s to local %s", name, lname); save_str(xmit_names, lname, XMIT_ACCEPT); accept_count++; @@ -192,7 +192,7 @@ struct idlist **xmit_names; /* list of recipient names parsed out */ (rhs[-1] == '.' || rhs[-1] == '@') && strcasecmp(rhs, idp->id) == 0) { - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "passed through %s matching %s", cp, idp->id); save_str(xmit_names, cp, XMIT_ACCEPT); @@ -238,7 +238,7 @@ static char *parse_received(struct query *ctl, char *bufp) char *ok = (char *)NULL; static char rbuf[HOSTLEN + USERNAMELEN + 4]; - if (outlevel >= O_VERBOSE) + if (outlevel >= O_DEBUG) error(0, 0, "analyzing Received line:\n%s", bufp); /* * Try to extract the real envelope addressee. We look here @@ -267,13 +267,13 @@ static char *parse_received(struct query *ctl, char *bufp) */ if (is_host_alias(rbuf, ctl)) { - if (outlevel >= O_VERBOSE) + if (outlevel >= O_DEBUG) error(0, 0, "line accepted, %s is an alias of the mailserver", rbuf); } else { - if (outlevel >= O_VERBOSE) + if (outlevel >= O_DEBUG) error(0, 0, "line rejected, %s is not an alias of the mailserver", rbuf); @@ -323,7 +323,7 @@ static char *parse_received(struct query *ctl, char *bufp) } else { - if (outlevel == O_VERBOSE) { + if (outlevel >= O_VERBOSE) { char *lf = rbuf + strlen(rbuf)-1; *lf = '\0'; if (outlevel >= O_VERBOSE) @@ -808,7 +808,7 @@ int num; /* index of message */ { no_local_matches = TRUE; save_str(&xmit_names, run.postmaster, XMIT_ACCEPT); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "no local matches, forwarding to %s", run.postmaster); @@ -823,7 +823,7 @@ int num; /* index of message */ */ if (ctl->errcount > olderrs) /* there were DNS errors above */ { - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0,0, "forwarding and deletion suppressed due to DNS errors"); free(headers); free_str_list(&xmit_names); @@ -936,7 +936,7 @@ int num; /* index of message */ free_str_list(&xmit_names); return(PS_IOERR); } - else if (!run.use_syslog && outlevel == O_VERBOSE) + else if (!run.use_syslog && outlevel >= O_VERBOSE) fputs("#", stderr); /* write error notifications */ @@ -1090,7 +1090,7 @@ flag forward; /* TRUE to forward */ release_sink(ctl); return(PS_IOERR); } - else if (outlevel == O_VERBOSE) + else if (outlevel >= O_VERBOSE) fputc('*', stderr); } } @@ -1438,7 +1438,7 @@ const struct method *proto; /* protocol method table */ #ifndef EHOSTUNREACH #define EHOSTUNREACH (-1) #endif - if (outlevel == O_VERBOSE || errno != EHOSTUNREACH) + if (outlevel >= O_VERBOSE || errno != EHOSTUNREACH) { error_build("fetchmail: %s connection to %s failed: ", protocol->name, ctl->server.pollname); @@ -1594,7 +1594,7 @@ const struct method *proto; /* protocol method table */ else { /* these are pointless in normal daemon mode */ - if (pass == 1 && (run.poll_interval == 0 || outlevel == O_VERBOSE)) + if (pass == 1 && (run.poll_interval == 0 || outlevel >= O_VERBOSE)) error(0, 0, "No mail for %s", buf); } @@ -1754,7 +1754,7 @@ const struct method *proto; /* protocol method table */ if (len > 0) error_build(" (%d %soctets)", len, wholesize ? "" : "header "); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error_complete(0, 0, ""); else error_build(" "); @@ -1787,7 +1787,7 @@ const struct method *proto; /* protocol method table */ */ if (protocol->fetch_body && !suppress_readbody) { - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) fputc('\n', stderr); if ((ok = (protocol->trail)(sock, ctl, num))) @@ -1828,7 +1828,7 @@ const struct method *proto; /* protocol method table */ /* tell server we got it OK and resynchronize */ if (protocol->trail) { - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) fputc('\n', stderr); ok = (protocol->trail)(sock, ctl, num); @@ -2050,7 +2050,7 @@ va_dcl strcat(buf, "\r\n"); SockWrite(sock, buf, strlen(buf)); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) { char *cp; @@ -2092,7 +2092,7 @@ int size; /* length of buffer */ buf[strlen(buf)-1] = '\0'; if (buf[strlen(buf)-1] == '\r') buf[strlen(buf)-1] = '\0'; - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "%s< %s", protocol->name, buf); phase = oldphase; return(PS_SUCCESS); @@ -2137,7 +2137,7 @@ va_dcl strcat(buf, "\r\n"); SockWrite(sock, buf, strlen(buf)); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) { char *cp; diff --git a/fetchmail-FAQ.html b/fetchmail-FAQ.html index 3d5bb89e..e0c4a691 100644 --- a/fetchmail-FAQ.html +++ b/fetchmail-FAQ.html @@ -10,7 +10,7 @@
Back to Fetchmail Home Page To Site Map -$Date: 1998/10/16 14:00:02 $ +$Date: 1998/10/17 15:10:42 $

Frequently Asked Questions About Fetchmail

@@ -207,10 +207,11 @@ lots of ways for other programs in the mail chain to screw up that look like fetchmail's fault, but you may be able to fix these by tweaking your configuration.

-A transcript of the failed session with -v on is almost always useful. +A transcript of the failed session with -v -v (yes, that's +two -v options, enabling debug mode) will almost always be useful. It is very important that the transcript include your POP/IMAP server's -greeting line, so I can identify it in case of server problems. Doing -this will not reveal your passwords, which are specially masked +greeting line, so I can identify it in case of server problems. This +transcript will not reveal your passwords, which are specially masked out precisely so the transcript can be passed around.

If the bug involves a core dump or hang, a gdb stack trace is good to have. @@ -2181,7 +2182,7 @@ Re-ordering messages is a user-agent function, anyway.

Back to Fetchmail Home Page To Site Map -$Date: 1998/10/16 14:00:02 $ +$Date: 1998/10/17 15:10:42 $

Eric S. Raymond <esr@snark.thyrsus.com>
diff --git a/fetchmail.c b/fetchmail.c index 6a53499b..e56ee867 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -130,7 +130,7 @@ static void unlockit(void) /* Various EMX-specific definitions */ int itimerflag; void itimerthread(void* dummy) { - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) fprintf(stderr, "fetchmail: thread sleeping for %d sec.\n", poll_interval); while(1) { _sleep2(poll_interval*1000); @@ -228,7 +228,7 @@ int main (int argc, char **argv) printf("\n"); else printf(" and %s\n", rcfile); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) printf("Lockfile at %s\n", tmpbuf); if (querylist == NULL) @@ -495,7 +495,7 @@ int main (int argc, char **argv) { if (ctl->server.poll_count++ % ctl->server.interval) { - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) fprintf(stderr, "fetchmail: interval not reached, not querying %s\n", ctl->server.pollname); @@ -520,16 +520,16 @@ int main (int argc, char **argv) /* Save UID list to prevent re-fetch in case fetchmail recover from crash */ - if (!check_only && outlevel == O_VERBOSE) + if (!check_only) { write_saved_lists(querylist, run.idfile); - if (outlevel == O_VERBOSE) + if (outlevel >= O_DEBUG) error(0, 0, "saved UID List"); } #endif /* POP3_ENABLE */ } else if (!check_only && - ((querystatus!=PS_NOMAIL) || (outlevel==O_VERBOSE))) + ((querystatus!=PS_NOMAIL) || (outlevel==O_DEBUG))) error(0, 0, "Query status=%d", querystatus); #if defined(linux) && !INET6 @@ -572,7 +572,7 @@ int main (int argc, char **argv) */ if (run.poll_interval) { - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) { time_t now; @@ -684,7 +684,7 @@ int main (int argc, char **argv) if (!getuid()) signal(SIGHUP, SIG_IGN); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) { time_t now; @@ -695,7 +695,7 @@ int main (int argc, char **argv) } while (run.poll_interval); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) fprintf(stderr,"fetchmail: normal termination, status %d\n", successes ? PS_SUCCESS : querystatus); @@ -1111,7 +1111,7 @@ static int query_host(struct query *ctl) { int i, st; - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) { time_t now; @@ -1216,7 +1216,7 @@ void dump_params (struct runctl *runp, struct query *querylist, flag implicit) ctl->server.interval); if (ctl->server.truename) printf(" True name of server is %s.\n", ctl->server.truename); - if (ctl->server.skip || outlevel == O_VERBOSE) + if (ctl->server.skip || outlevel >= O_VERBOSE) printf(" This host will%s be queried when no host is specified.\n", ctl->server.skip ? " not" : ""); /* @@ -1229,7 +1229,7 @@ void dump_params (struct runctl *runp, struct query *querylist, flag implicit) #endif /* GSSAPI */ ) printf(" Password will be prompted for.\n"); - else if (outlevel == O_VERBOSE) + else if (outlevel >= O_VERBOSE) if (ctl->server.protocol == P_APOP) printf(" APOP secret = \"%s\".\n", visbuf(ctl->password)); else if (ctl->server.protocol == P_RPOP) @@ -1256,7 +1256,7 @@ void dump_params (struct runctl *runp, struct query *querylist, flag implicit) if (ctl->server.port) printf(" (using port %d)", ctl->server.port); #endif /* INET6 */ - else if (outlevel == O_VERBOSE) + else if (outlevel >= O_VERBOSE) printf(" (using default port)"); if (ctl->server.uidl && (ctl->server.protocol != P_ETRN)) printf(" (forcing UIDL use)"); @@ -1317,27 +1317,27 @@ void dump_params (struct runctl *runp, struct query *querylist, flag implicit) if (NUM_NONZERO(ctl->limit)) printf(" Message size limit is %d bytes (--limit %d).\n", ctl->limit, ctl->limit); - else if (outlevel == O_VERBOSE) + else if (outlevel >= O_VERBOSE) printf(" No message size limit (--limit 0).\n"); if (run.poll_interval > 0) printf(" Message size warning interval is %d seconds (--warnings %d).\n", ctl->warnings, ctl->warnings); - else if (outlevel == O_VERBOSE) + else if (outlevel >= O_VERBOSE) printf(" Size warnings on every poll (--warnings 0).\n"); } if (NUM_NONZERO(ctl->fetchlimit)) printf(" Received-message limit is %d (--fetchlimit %d).\n", ctl->fetchlimit, ctl->fetchlimit); - else if (outlevel == O_VERBOSE) + else if (outlevel >= O_VERBOSE) printf(" No received-message limit (--fetchlimit 0).\n"); if (NUM_NONZERO(ctl->batchlimit)) printf(" SMTP message batch limit is %d.\n", ctl->batchlimit); - else if (outlevel == O_VERBOSE) + else if (outlevel >= O_VERBOSE) printf(" No SMTP message batch limit (--batchlimit 0).\n"); if (ctl->server.protocol == P_IMAP) if (NUM_NONZERO(ctl->expunge)) printf(" Deletion interval between expunges is %d (--expunge %d).\n", ctl->expunge, ctl->expunge); - else if (outlevel == O_VERBOSE) + else if (outlevel >= O_VERBOSE) printf(" No expunges (--expunge 0).\n"); } if (ctl->mda && (ctl->server.protocol != P_ETRN)) @@ -1370,18 +1370,18 @@ void dump_params (struct runctl *runp, struct query *querylist, flag implicit) printf(" %d", idp->val.status.num); printf("\n"); } - else if (outlevel == O_VERBOSE) + else if (outlevel >= O_VERBOSE) printf(" Spam-blocking disabled\n"); } if (ctl->preconnect) printf(" Server connection will be brought up with \"%s\".\n", visbuf(ctl->preconnect)); - else if (outlevel == O_VERBOSE) + else if (outlevel >= O_VERBOSE) printf(" No pre-connection command.\n"); if (ctl->postconnect) printf(" Server connection will be taken down with \"%s\".\n", visbuf(ctl->postconnect)); - else if (outlevel == O_VERBOSE) + else if (outlevel >= O_VERBOSE) printf(" No post-connection command.\n"); if (ctl->server.protocol != P_ETRN) { if (!ctl->localnames) @@ -1400,7 +1400,7 @@ void dump_params (struct runctl *runp, struct query *querylist, flag implicit) printf(" Single-drop mode: "); printf("%d local name(s) recognized.\n", count); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) { for (idp = ctl->localnames; idp; idp = idp->next) if (idp->val.id2) @@ -1463,11 +1463,11 @@ void dump_params (struct runctl *runp, struct query *querylist, flag implicit) #ifdef linux if (ctl->server.interface) printf(" Connection must be through interface %s.\n", ctl->server.interface); - else if (outlevel == O_VERBOSE) + else if (outlevel >= O_VERBOSE) printf(" No interface requirement specified.\n"); if (ctl->server.monitor) printf(" Polling loop will monitor %s.\n", ctl->server.monitor); - else if (outlevel == O_VERBOSE) + else if (outlevel >= O_VERBOSE) printf(" No monitor interface specified.\n"); #endif @@ -1483,7 +1483,7 @@ void dump_params (struct runctl *runp, struct query *querylist, flag implicit) ++count; printf(" %d UIDs saved.\n", count); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) for (idp = ctl->oldsaved; idp; idp = idp->next) fprintf(stderr, "\t%s\n", idp->id); } diff --git a/fetchmail.h b/fetchmail.h index 7ee599dd..2143a89a 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -71,7 +71,8 @@ /* output noise level */ #define O_SILENT 0 /* mute, max squelch, etc. */ #define O_NORMAL 1 /* user-friendly */ -#define O_VERBOSE 2 /* excessive */ +#define O_VERBOSE 2 /* chatty */ +#define O_DEBUG 3 /* prolix */ #define SIZETICKER 1024 /* print 1 dot per this many bytes */ diff --git a/fetchmail.man b/fetchmail.man index e486905a..f025e954 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -121,6 +121,8 @@ suppress actual error messages). The --verbose option overrides this. Verbose mode. All control messages passed between .I fetchmail and the mailserver are echoed to stderr. Overrides --silent. +Doubling this option (-v -v) causes extra diagnostic information +to be printed. .SS Disposal Options .TP .B \-a, --all diff --git a/imap.c b/imap.c index c1187cf6..29747e01 100644 --- a/imap.c +++ b/imap.c @@ -141,7 +141,7 @@ static int do_otp(int sock, struct query *ctl) to64frombits(buffer, ctl->remotename, strlen(ctl->remotename)); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "IMAP> %s", buffer); SockWrite(sock, buffer, strlen(buffer)); SockWrite(sock, "\r\n", 2); @@ -168,7 +168,7 @@ static int do_otp(int sock, struct query *ctl) to64frombits(buffer, response, strlen(response)); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "IMAP> %s", buffer); SockWrite(sock, buffer, strlen(buffer)); SockWrite(sock, "\r\n", 2); @@ -308,7 +308,7 @@ static int do_rfc1731(int sock, char *truename) } to64frombits(buf1, authenticator.dat, authenticator.length); - if (outlevel == O_VERBOSE) { + if (outlevel >= O_VERBOSE) { error(0, 0, "IMAP> %s", buf1); } SockWrite(sock, buf1, strlen(buf1)); @@ -391,7 +391,7 @@ static int do_rfc1731(int sock, char *truename) &session, 1); to64frombits(buf1, authenticator.dat, authenticator.length); - if (outlevel == O_VERBOSE) { + if (outlevel >= O_VERBOSE) { error(0, 0, "IMAP> %s", buf1); } SockWrite(sock, buf1, strlen(buf1)); @@ -438,7 +438,7 @@ static int do_gssauth(int sock, char *hostname, char *username) error(0, -1, "Couldn't get service name for [%s]", buf1); return PS_AUTHFAIL; } - else if (outlevel == O_VERBOSE) { + else if (outlevel >= O_VERBOSE) { maj_stat = gss_display_name(&min_stat, target_name, &request_buf, &mech_name); error(0, 0, "Using service name [%s]",request_buf.value); @@ -456,7 +456,7 @@ static int do_gssauth(int sock, char *hostname, char *username) /* now start the security context initialisation loop... */ sec_token = GSS_C_NO_BUFFER; context = GSS_C_NO_CONTEXT; - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0,0,"Sending credentials"); do { maj_stat = gss_init_sec_context(&min_stat, GSS_C_NO_CREDENTIAL, @@ -475,7 +475,7 @@ static int do_gssauth(int sock, char *hostname, char *username) gss_release_buffer(&min_stat, &send_token); SockWrite(sock, buf1, strlen(buf1)); SockWrite(sock, "\r\n", 2); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0,0,"IMAP> %s", buf1); if (maj_stat == GSS_S_CONTINUE_NEEDED) { if (result = gen_recv(sock, buf1, sizeof buf1)) { @@ -503,7 +503,7 @@ static int do_gssauth(int sock, char *hostname, char *username) gss_release_buffer(&min_stat, &send_token); return PS_AUTHFAIL; } - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0,0,"Credential exchange complete"); /* first octet is security levels supported. We want none, for now */ server_conf_flags = ((char *)send_token.value)[0]; @@ -516,7 +516,7 @@ static int do_gssauth(int sock, char *hostname, char *username) buf_size = ntohl(*((long *)send_token.value)); /* we don't care about buffer size if we don't wrap data */ gss_release_buffer(&min_stat, &send_token); - if (outlevel == O_VERBOSE) { + if (outlevel >= O_VERBOSE) { error(0,0,"Unwrapped security level flags: %s%s%s", server_conf_flags & GSSAUTH_P_NONE ? "N" : "-", server_conf_flags & GSSAUTH_P_INTEGRITY ? "I" : "-", @@ -538,7 +538,7 @@ static int do_gssauth(int sock, char *hostname, char *username) return PS_AUTHFAIL; } to64frombits(buf1, send_token.value, send_token.length); - if (outlevel == O_VERBOSE) { + if (outlevel >= O_VERBOSE) { error(0,0,"Requesting authorisation as %s", username); error(0,0,"IMAP> %s",buf1); } @@ -550,7 +550,7 @@ static int do_gssauth(int sock, char *hostname, char *username) return result; if (strstr(buf1, "OK")) { /* flush security context */ - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "Releasing GSS credentials"); maj_stat = gss_delete_sec_context(&min_stat, &context, &send_token); if (maj_stat != GSS_S_COMPLETE) { @@ -600,20 +600,20 @@ int imap_getauth(int sock, struct query *ctl, char *greeting) if (strstr(capabilities, "IMAP4REV1")) { imap_version = IMAP4rev1; - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "Protocol identified as IMAP4 rev 1"); } else { imap_version = IMAP4; - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "Protocol identified as IMAP4 rev 0"); } } else if (ok == PS_ERROR) { imap_version = IMAP2; - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "Protocol identified as IMAP2 or IMAP2BIS"); } else @@ -624,7 +624,7 @@ int imap_getauth(int sock, struct query *ctl, char *greeting) #if OPIE if ((ctl->server.protocol == P_IMAP) && strstr(capabilities, "AUTH=X-OTP")) { - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "OTP authentication is supported"); if (do_otp(sock, ctl) == PS_SUCCESS) return(PS_SUCCESS); @@ -636,7 +636,7 @@ int imap_getauth(int sock, struct query *ctl, char *greeting) { if (ctl->server.protocol == P_IMAP_GSS) { - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "GSS authentication is supported"); return do_gssauth(sock, ctl->server.truename, ctl->remotename); } @@ -651,14 +651,14 @@ int imap_getauth(int sock, struct query *ctl, char *greeting) #ifdef KERBEROS_V4 if (strstr(capabilities, "AUTH=KERBEROS_V4")) { - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "KERBEROS_V4 authentication is supported"); if (ctl->server.protocol == P_IMAP_K4) { if ((ok = do_rfc1731(sock, ctl->server.truename))) { - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "IMAP> *"); SockWrite(sock, "*\r\n", 3); } diff --git a/options.c b/options.c index 7883eed1..7aa58d21 100644 --- a/options.c +++ b/options.c @@ -256,7 +256,10 @@ struct query *ctl; /* option record to be initialized */ break; case 'v': case LA_VERBOSE: - outlevel = O_VERBOSE; + if (outlevel == O_VERBOSE) + outlevel = O_DEBUG; + else + outlevel = O_VERBOSE; break; case 'd': case LA_DAEMON: diff --git a/rpa.c b/rpa.c index 1a02efff..694a0123 100644 --- a/rpa.c +++ b/rpa.c @@ -119,7 +119,7 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) SockPrintf(socket,"AUTH RPA\r\n"); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "> AUTH RPA\n"); /* Create unicode user name in Nu. */ @@ -155,7 +155,7 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) #ifndef TESTMODE SockPrintf(socket,"%s\r\n",buf); #endif - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "> %s\n",buf); if ((ok = POP3_rpa_resp(buf,socket)) != 0) { @@ -176,12 +176,12 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) /* Interpret Token 2 */ verh = *(bufp++); verl = *(bufp++); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "Service chose RPA version %d.%d\n",verh,verl); Csl = *(bufp++); memcpy(Cs, bufp, Csl); bufp += Csl; - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) { error(0, 0, "Service challenge (l=%d):",Csl); for (i=0; i= O_VERBOSE) error(0, 0, "Service timestamp %s\n",Ts); rll = *(bufp++) << 8; rll = rll | *(bufp++); if ((bufp-buf+rll) != rxlen) @@ -200,7 +200,7 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) error(0, 0, "RPA token 2 length error\n"); return(PS_RPA); } - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "Realm list: %s\n",bufp); if (SetRealmService(bufp) != 0) { @@ -231,7 +231,7 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) #ifndef TESTMODE SockPrintf(socket,"%s\r\n",buf); #endif - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "> %s\n",buf); if ((ok = POP3_rpa_resp(buf,socket)) != 0) { @@ -251,7 +251,7 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) /* Interpret Token 4 */ aulin = *(bufp++); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) { error(0, 0, "User authentication (l=%d):",aulin); for (i=0; i= O_VERBOSE) error(0, 0, "RPA status: %02X\n",status); } else status = 0; @@ -301,7 +301,7 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) error(0, 0, "RPA _service_ auth fail. Spoof server?\n"); return(PS_AUTHFAIL); } - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) { error(0, 0, "Session key established:"); for (i=0; i= O_VERBOSE) error(0, 0, "> %s\n",buf); if ((ok = POP3_rpa_resp(buf,socket)) != 0) { @@ -362,7 +362,7 @@ int socket; char *bufp; int sockrc; - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "Get response\n"); #ifndef TESTMODE sockrc = gen_recv(socket, buf, sizeof(buf)); @@ -392,7 +392,7 @@ int socket; } else ok = PS_SOCKET; - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "Get response return %d [%s]\n", ok, buf); buf[sockrc] = 0; return(ok); @@ -537,7 +537,7 @@ unsigned char *bufp; } } } - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) { error(0, 0, "Inbound binary data:\n"); for (i=0; i= O_VERBOSE) { error(0, 0, "Outbound data:\n"); for (i=0; i= O_VERBOSE) { error(0, 0, "Unicode:"); for (i=0; i<(*plen); i++) @@ -723,7 +723,7 @@ int len; if (devrandom) fclose(devrandom); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) { error(0, 0, "User challenge:"); for (i=0; i= O_VERBOSE) { error(0, 0, "MD5 being applied to data block:\n"); for (i=0; i= O_VERBOSE) { error(0, 0, "MD5 result is: "); for (i=0; i<16; i++) diff --git a/sink.c b/sink.c index 5f2aefac..0f2afc87 100644 --- a/sink.c +++ b/sink.c @@ -374,7 +374,7 @@ int open_sink(struct query *ctl, } - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "about to deliver with: %s", before); #ifdef HAVE_SETEUID diff --git a/smtp.c b/smtp.c index bb97827d..0328f86c 100644 --- a/smtp.c +++ b/smtp.c @@ -38,7 +38,7 @@ int SMTP_helo(int sock,char *host) int ok; SockPrintf(sock,"HELO %s\r\n", host); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "SMTP> HELO %s", host); ok = SMTP_ok(sock); return ok; @@ -50,7 +50,7 @@ int SMTP_ehlo(int sock, char *host, int *opt) struct opt *hp; SockPrintf(sock,"EHLO %s\r\n", host); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "SMTP> EHLO %s", host); *opt = 0; @@ -65,7 +65,7 @@ int SMTP_ehlo(int sock, char *host, int *opt) if (n < 4) return SM_ERROR; smtp_response[n] = '\0'; - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "SMTP< %s", smtp_response); for (hp = extensions; hp->name; hp++) if (!strncasecmp(hp->name, smtp_response+4, strlen(hp->name))) @@ -91,7 +91,7 @@ int SMTP_from(int sock, char *from, char *opts) if (opts) strcat(buf, opts); SockPrintf(sock,"%s\r\n", buf); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "SMTP> %s", buf); ok = SMTP_ok(sock); return ok; @@ -103,7 +103,7 @@ int SMTP_rcpt(int sock, char *to) int ok; SockPrintf(sock,"RCPT TO:<%s>\r\n", to); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "SMTP> RCPT TO:<%s>", to); ok = SMTP_ok(sock); return ok; @@ -115,7 +115,7 @@ int SMTP_data(int sock) int ok; SockPrintf(sock,"DATA\r\n"); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "SMTP> DATA"); ok = SMTP_ok(sock); return ok; @@ -127,7 +127,7 @@ int SMTP_rset(int sock) int ok; SockPrintf(sock,"RSET\r\n"); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "SMTP> RSET"); ok = SMTP_ok(sock); return ok; @@ -139,7 +139,7 @@ int SMTP_quit(int sock) int ok; SockPrintf(sock,"QUIT\r\n"); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "SMTP> QUIT"); ok = SMTP_ok(sock); return ok; @@ -151,7 +151,7 @@ int SMTP_eom(int sock) int ok; SockPrintf(sock,".\r\n"); - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "SMTP>. (EOM)"); ok = SMTP_ok(sock); return ok; @@ -171,7 +171,7 @@ int SMTP_ok(int sock) if (n < 4) return SM_ERROR; smtp_response[n] = '\0'; - if (outlevel == O_VERBOSE) + if (outlevel >= O_VERBOSE) error(0, 0, "SMTP< %s", smtp_response); if ((smtp_response[0] == '1' || smtp_response[0] == '2' || smtp_response[0] == '3') && smtp_response[3] == ' ') return SM_OK; -- cgit v1.2.3