[Pkg-wmaker-commits] [wmbiff] 01/32: Replaced DEBUG_x preprocessor defines with a -debug option and debug configuration keyword. Replaced most debugging messages with a DM (debug message) macro. Removed gnutls version 0.2.x support. Added troubleshooting section to man page.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:00:33 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to tag wmbiff_0_3_8
in repository wmbiff.

commit a31b909cfd3f658c08d185711c8f111499ca3548
Author: bluehal <bluehal>
Date:   Fri Mar 1 08:41:29 2002 +0000

    Replaced DEBUG_x preprocessor defines with a -debug option
    and debug configuration keyword.  Replaced most debugging
    messages with a DM (debug message) macro.  Removed gnutls
    version 0.2.x support.  Added troubleshooting section to
    man page.
---
 wmbiff/Client.h        |  30 ++++-
 wmbiff/Imap4Client.c   |  90 ++++++++-------
 wmbiff/LicqClient.c    |  33 +++---
 wmbiff/Makefile        |  20 +---
 wmbiff/Pop3Client.c    | 102 +++++++++--------
 wmbiff/maildirClient.c |  45 ++++----
 wmbiff/mboxClient.c    |  36 +++---
 wmbiff/tlsComm.c       | 291 +++++++++++++------------------------------------
 wmbiff/tlsComm.h       |   7 +-
 wmbiff/wmbiff.1        |  17 ++-
 wmbiff/wmbiff.c        | 115 ++++++++++---------
 wmbiff/wmbiffrc.5      |  19 +++-
 12 files changed, 346 insertions(+), 459 deletions(-)

diff --git a/wmbiff/Client.h b/wmbiff/Client.h
index f7d1973..55b4759 100644
--- a/wmbiff/Client.h
+++ b/wmbiff/Client.h
@@ -1,4 +1,4 @@
-/* $Id: Client.h,v 1.7 2002/02/02 18:04:18 jordi Exp $ */
+/* $Id: Client.h,v 1.8 2002/03/01 08:41:29 bluehal Exp $ */
 /* Author : Scott Holden ( scotth at thezone.net )
    Modified : Yong-iL Joh ( tolkien at mizi.com )
    Modified : Jorge Garc�a ( Jorge.Garcia at uv.es )
@@ -34,6 +34,7 @@ typedef struct _mbox_t {
 	int OldMsgs;
 	int OldUnreadMsgs;
 	int blink_stat;				/* blink digits flag-counter */
+	int debug;					/* debugging status */
 
 	union {
 		struct {
@@ -86,5 +87,32 @@ int mboxCreate(Pop3 pc, char *str);
 int maildirCreate(Pop3 pc, char *str);
 FILE *openMailbox(Pop3 pc);
 
+/* _NONE is for silent operation.  _ERROR is for things that should
+   be printed assuming that the user might possibly see them. _INFO is
+   for reasonably useless but possibly interesting messages. _ALL is
+   for everything.  Restated, _ERROR will always be printed, _INFO only
+   if debugging messages were requested. */
+#define DEBUG_NONE  0
+#define DEBUG_ERROR 1
+#define DEBUG_INFO  2
+#define DEBUG_ALL   2
+/* inspired by ksymoops-2.3.4/ksymoops.h */
+#define DM(mbox, msglevel, X...) \
+do { \
+  if (mbox == NULL || (mbox)->debug >= msglevel) { \
+     printf("wmbiff: " X); \
+(void)fflush(NULL); \
+  } \
+} while(0)
+
+extern int debug_default;
+#define DMA(msglevel, X...) \
+do { \
+  if (debug_default >= msglevel) { \
+     printf("wmbiff: " ##X); \
+(void)fflush(NULL); \
+  } \
+} while(0)
+
 #endif
 /* vim:set ts=4: */
diff --git a/wmbiff/Imap4Client.c b/wmbiff/Imap4Client.c
index 1cccf99..cb7bbc6 100644
--- a/wmbiff/Imap4Client.c
+++ b/wmbiff/Imap4Client.c
@@ -24,24 +24,14 @@
 #include <dmalloc.h>
 #endif
 
-/* emulates what 'variadic macros' are great for */
-#ifdef DEBUG_IMAP4
-#define DM printf
-#else
-#define DM nullie
-/*@unused@*/
-static void nullie( /*@unused@ */ const char *format, ...)
-{
-	return;
-}
-#endif
-
 #define	PCU	(pc->u).imap
 
 #ifdef __LCLINT__
 void asprintf( /*@out@ */ char **out, char *fmt, ...);
 #endif
 
+#define IMAP_DM(pc, lvl, args...) DM(pc, lvl, "imap4: " ##args)
+
 /* this array maps server:port pairs to file descriptors, so
    that when more than one mailbox is queried from a server,
    we only use one socket.  It's limited in size by the
@@ -107,8 +97,8 @@ static void bind_state_to_pcu(Pop3 pc,
 	for (i = 0; i < FDMAP_SIZE && fdmap[i].cs != NULL; i++);
 	if (i == FDMAP_SIZE) {
 		/* should never happen */
-		printf
-			("wmbiff: Tried to open too many IMAP connections. Sorry!\n");
+		IMAP_DM(pc, DEBUG_ERROR,
+				"Tried to open too many IMAP connections. Sorry!\n");
 		exit(EXIT_FAILURE);
 	}
 	fdmap[i].user_password_server_port = connection_id;
@@ -156,20 +146,20 @@ FILE *imap_open(Pop3 pc)
 	   structure, although it might be a blacklist entry */
 	asprintf(&connection_name, "%s:%d", PCU.serverName, PCU.serverPort);
 
+	assert(pc != NULL);
+
 	/* no cached connection */
 	sd = sock_connect((const char *) PCU.serverName, PCU.serverPort);
 	if (sd == -1) {
-		fprintf(stderr, "Couldn't connect to %s:%d: %s\n",
+		IMAP_DM(pc, DEBUG_ERROR, "Couldn't connect to %s:%d: %s\n",
 				PCU.serverName, PCU.serverPort, strerror(errno));
 		if (errno == ETIMEDOUT) {
 			/* only give up if it was a time-consuming error */
 			/* try again later if it was just a connection refused */
-			fprintf(stderr,
-					"Will not retry because this attempt to connect timed out.\n");
-			fprintf(stderr,
-					"This is done so that other mailboxes can be updated in a timely manner.\n");
-			fprintf(stderr,
-					"To try again to connect to %s:%d, restart wmbiff.\n",
+			IMAP_DM(pc, DEBUG_ERROR,
+					"Will not retry because this attempt to connect timed out.\n"
+					" This is done so that other mailboxes can be updated in a timely manner.\n"
+					" To try again to connect to %s:%d, restart wmbiff.\n",
 					PCU.serverName, PCU.serverPort);
 			bind_state_to_pcu(pc, initialize_blacklist(connection_name));
 		}
@@ -179,7 +169,7 @@ FILE *imap_open(Pop3 pc)
 	/* build the connection using STARTTLS */
 	if (PCU.dossl && (PCU.serverPort == 143)) {
 		/* setup an unencrypted binding long enough to invoke STARTTLS */
-		scs = initialize_unencrypted(sd, connection_name);
+		scs = initialize_unencrypted(sd, connection_name, pc);
 
 		/* can we? */
 		tlscomm_printf(scs, "a000 CAPABILITY\r\n");
@@ -187,19 +177,20 @@ FILE *imap_open(Pop3 pc)
 			goto communication_failure;
 
 		if (!strstr(capabilities, "STARTTLS")) {
-			printf("server doesn't support ssl imap on port 143.");
+			IMAP_DM(pc, DEBUG_ERROR,
+					"server doesn't support ssl imap on port 143.");
 			goto communication_failure;
 		}
 
 		/* we sure can! */
-		DM("Negotiating TLS within IMAP");
+		IMAP_DM(pc, DEBUG_INFO, "Negotiating TLS within IMAP");
 		tlscomm_printf(scs, "a001 STARTTLS\r\n");
 
 		if (!tlscomm_expect(scs, "a001 ", buf, BUF_SIZE))
 			goto communication_failure;
 
 		if (!strstr(buf, "a001 OK")) {
-			printf("couldn't negotiate tls. :(\n");
+			IMAP_DM(pc, DEBUG_ERROR, "couldn't negotiate tls. :(\n");
 			goto communication_failure;
 		}
 
@@ -212,13 +203,13 @@ FILE *imap_open(Pop3 pc)
 	/* either we've negotiated ssl from starttls, or
 	   we're starting an encrypted connection now */
 	if (PCU.dossl) {
-		scs = initialize_gnutls(sd, connection_name);
+		scs = initialize_gnutls(sd, connection_name, pc);
 		if (scs == NULL) {
-			fprintf(stderr, "Failed to initialize TLS\n");
+			IMAP_DM(pc, DEBUG_ERROR, "Failed to initialize TLS\n");
 			return NULL;
 		}
 	} else {
-		scs = initialize_unencrypted(sd, connection_name);
+		scs = initialize_unencrypted(sd, connection_name, pc);
 	}
 
 	/* authenticate; first find out how */
@@ -228,7 +219,7 @@ FILE *imap_open(Pop3 pc)
 	   encrypted session. */
 	tlscomm_printf(scs, "a000 CAPABILITY\r\n");
 	if (!tlscomm_expect(scs, "* CAPABILITY", capabilities, BUF_SIZE)) {
-		printf("unable to query capability string");
+		IMAP_DM(pc, DEBUG_ERROR, "unable to query capability string");
 		goto communication_failure;
 	}
 
@@ -245,8 +236,8 @@ FILE *imap_open(Pop3 pc)
 	}
 
 	/* if authentication worked, we won't get here */
-	fprintf(stderr,
-			"All Imap4 authentication methods failed for '%s@%s:%d'\n",
+	IMAP_DM(pc, DEBUG_ERROR,
+			"All authentication methods failed for '%s@%s:%d'\n",
 			PCU.userName, PCU.serverName, PCU.serverPort);
   communication_failure:
 	tlscomm_printf(scs, "a002 LOGOUT\r\n");
@@ -331,7 +322,7 @@ int imap4Create(Pop3 pc, const char *const str)
 	/* failed to match either regex */
 	if (matchedchars <= 0) {
 		pc->label[0] = '\0';
-		fprintf(stderr, "Couldn't parse line %s (%d)\n", str,
+		IMAP_DM(pc, DEBUG_ERROR, "Couldn't parse line %s (%d)\n", str,
 				matchedchars);
 		return -1;
 	}
@@ -351,12 +342,13 @@ int imap4Create(Pop3 pc, const char *const str)
 
 	grab_authList(str + regs.end[0], PCU.authList);
 
-	DM("imap4: userName= '%s'\n", PCU.userName);
-	DM("imap4: password= '%s'\n", PCU.password);
-	DM("imap4: serverName= '%s'\n", PCU.serverName);
-	DM("imap4: serverPath= '%s'\n", pc->path);
-	DM("imap4: serverPort= '%d'\n", PCU.serverPort);
-	DM("imap4: authList= '%s'\n", PCU.authList);
+	IMAP_DM(pc, DEBUG_INFO, "userName= '%s'\n", PCU.userName);
+	IMAP_DM(pc, DEBUG_INFO, "password is %d characters long\n",
+			strlen(PCU.password));
+	IMAP_DM(pc, DEBUG_INFO, "serverName= '%s'\n", PCU.serverName);
+	IMAP_DM(pc, DEBUG_INFO, "serverPath= '%s'\n", pc->path);
+	IMAP_DM(pc, DEBUG_INFO, "serverPort= '%d'\n", PCU.serverPort);
+	IMAP_DM(pc, DEBUG_INFO, "authList= '%s'\n", PCU.authList);
 
 	pc->open = imap_open;
 	pc->checkMail = imap_checkmail;
@@ -377,7 +369,8 @@ static int authenticate_plaintext(Pop3 pc,
 	 *  MUST NOT issue the LOGIN command if this capability is present.
 	 */
 	if (strstr(capabilities, "LOGINDISABLED")) {
-		printf("Plaintext auth prohibited by server: (LOGINDISABLED).\n");
+		IMAP_DM(pc, DEBUG_ERROR,
+				"Plaintext auth prohibited by server: (LOGINDISABLED).\n");
 		goto plaintext_failed;
 	}
 
@@ -385,12 +378,13 @@ static int authenticate_plaintext(Pop3 pc,
 	tlscomm_printf(scs, "a001 LOGIN %s \"%s\"\r\n", PCU.userName,
 				   PCU.password);
 	if (!tlscomm_expect(scs, "a001 ", buf, BUF_SIZE)) {
-		printf("unable to login");
+		IMAP_DM(pc, DEBUG_ERROR,
+				"Did not get a response to the LOGIN command.\n");
 		goto plaintext_failed;
 	}
 
 	if (buf[5] != 'O') {
-		printf("login failed\n");
+		IMAP_DM(pc, DEBUG_ERROR, "IMAP Login failed.\n");
 		goto plaintext_failed;
 	}
 	return (1);
@@ -418,7 +412,7 @@ static int authenticate_md5(Pop3 pc,
 		goto expect_failure;
 
 	Decode_Base64(buf + 2, buf2);
-	DM("IMAP4 CRAM-MD5 challenge: %s\n", buf2);
+	IMAP_DM(pc, DEBUG_INFO, "CRAM-MD5 challenge: %s\n", buf2);
 
 	strcpy(buf, PCU.userName);
 	strcat(buf, " ");
@@ -431,7 +425,7 @@ static int authenticate_md5(Pop3 pc,
 	gcry_md_close(gmh);
 
 	strcat(buf, buf2);
-	DM("IMAP4 CRAM-MD5 response: %s\n", buf);
+	IMAP_DM(pc, DEBUG_INFO, "CRAM-MD5 response: %s\n", buf);
 	Encode_Base64(buf, buf2);
 
 	tlscomm_printf(scs, "%s\r\n", buf2);
@@ -441,14 +435,16 @@ static int authenticate_md5(Pop3 pc,
 	if (!strncmp(buf, "a007 OK", 7))
 		return 1;				/* AUTH successful */
 
-	fprintf(stderr,
-			"IMAP4 CRAM-MD5 AUTH failed for user '%s@%s:%d'\n",
+	IMAP_DM(pc, DEBUG_ERROR,
+			"CRAM-MD5 AUTH failed for user '%s@%s:%d'\n",
 			PCU.userName, PCU.serverName, PCU.serverPort);
-	fprintf(stderr, "It said %s", buf);
+	IMAP_DM(pc, DEBUG_INFO, "It said %s", buf);
 	return 0;
 
   expect_failure:
-	fprintf(stderr, "tlscomm_expect failed during cram-md5 auth: %s", buf);
+	IMAP_DM(pc, DEBUG_ERROR,
+			"tlscomm_expect failed during cram-md5 auth: %s", buf);
+	IMAP_DM(pc, DEBUG_ERROR, "failed to authenticate using cram-md5.");
 	return 0;
 #else
 	/* not compiled with gcrypt. */
diff --git a/wmbiff/LicqClient.c b/wmbiff/LicqClient.c
index 0b176cb..6aa9c37 100644
--- a/wmbiff/LicqClient.c
+++ b/wmbiff/LicqClient.c
@@ -1,4 +1,4 @@
-/* $Id: LicqClient.c,v 1.3 2001/10/04 09:50:59 jordi Exp $ */
+/* $Id: LicqClient.c,v 1.4 2002/03/01 08:41:29 bluehal Exp $ */
 /* Author : Yong-iL Joh ( tolkien at mizi.com )
    Modified: Jorge Garc�a ( Jorge.Garcia at uv.es )
  * 
@@ -26,27 +26,23 @@ int licqCheckHistory(Pop3 pc)
 	int count_status = 0;
 	char buf[1024];
 
-#ifdef DEBUG_MAIL_COUNT
-	printf(">Mailbox: '%s'\n", pc->path);
-#endif
+	DM(pc, DEBUG_INFO, ">Mailbox: '%s'\n", pc->path);
 
 	/* licq file */
 	if (stat(pc->path, &st)) {
-		fprintf(stderr, "wmbiff: Can't stat mailbox '%s': %s\n",
-				pc->path, strerror(errno));
+		DM(pc, DEBUG_ERROR, "Can't stat mailbox '%s': %s\n",
+		   pc->path, strerror(errno));
 		return -1;				/* Error stating mailbox */
 	}
 
 	if (st.st_mtime != PCM.mtime || st.st_size != PCM.size
 		|| pc->OldMsgs < 0) {
 		/* file was changed OR initially read */
-#ifdef DEBUG_MAIL_COUNT
-		printf("  was changed,"
-			   " TIME: old %lu, new %lu"
-			   " SIZE: old %lu, new %lu\n",
-			   PCM.mtime, st.st_mtime, (unsigned long) PCM.size,
-			   st.st_size);
-#endif
+		DM(pc, DEBUG_INFO,
+		   "  was changed,"
+		   " TIME: old %lu, new %lu"
+		   " SIZE: old %lu, new %lu\n",
+		   PCM.mtime, st.st_mtime, (unsigned long) PCM.size, st.st_size);
 		ut.actime = st.st_atime;
 		ut.modtime = st.st_mtime;
 		F = pc->open(pc);
@@ -59,9 +55,8 @@ int licqCheckHistory(Pop3 pc)
 		}
 		pc->TotalMsgs = count_status * 2;
 		pc->UnreadMsgs = pc->TotalMsgs - count_status;
-#ifdef DEBUG_MAIL_COUNT
-		printf("from: %d status: %d\n", pc->TotalMsgs, pc->UnreadMsgs);
-#endif
+		DM(pc, DEBUG_INFO, "from: %d status: %d\n", pc->TotalMsgs,
+		   pc->UnreadMsgs);
 
 		fclose(F);
 
@@ -87,10 +82,8 @@ int licqCreate(Pop3 pc, char *str)
 
 	strcpy(pc->path, str + 5);	/* cut off ``licq:'' */
 
-#ifdef DEBUG_LICQ
-	printf("licq: str = '%s'\n", str);
-	printf("licq: path= '%s'\n", pc->path);
-#endif
+	DM(pc, DEBUG_INFO, "licq: str = '%s'\n", str);
+	DM(pc, DEBUG_INFO, "licq: path= '%s'\n", pc->path);
 
 	return 0;
 }
diff --git a/wmbiff/Makefile b/wmbiff/Makefile
index 8d440c3..4fa5284 100644
--- a/wmbiff/Makefile
+++ b/wmbiff/Makefile
@@ -1,13 +1,10 @@
 # Makefile for wmbiff
 #
-# $Id: Makefile,v 1.22 2002/02/03 22:43:54 jordi Exp $
+# $Id: Makefile,v 1.23 2002/03/01 08:41:29 bluehal Exp $
 
 # Disable gnutls crypto?
 #WITHOUT_CRYPTO=	1
 
-# If using v0.2.x of gnutls change the variabel below to 2
-GNUTLS_MINOR_VERSION=3
-
 # Use external GNU regexp lib?
 #EXT_GNU_REGEX_LIB=1
 
@@ -58,21 +55,12 @@ ifndef WITHOUT_CRYPTO
 EXTRAFLAGS+=	-DWITH_TLS -DWITH_GCRYPT
 LIBS+=		-lgnutls -lgcrypt
 endif
-ifeq ($(GNUTLS_MINOR_VERSION),3)
-EXTRAFLAGS+=	-DGNUTLS_VER=3 
-endif
 
 INSTALL?=	/usr/bin/install
 INSTALL_DIR?=	$(INSTALL) -d -o $(INSTALL_USER) -g $(INSTALL_GROUP) -m 755
 INSTALL_PRG?=	$(INSTALL) -p -o $(INSTALL_USER) -g $(INSTALL_GROUP) -m 755 -s
 INSTALL_FILE?=	$(INSTALL) -p -o $(INSTALL_USER) -g $(INSTALL_GROUP) -m 644
 
-
-# Misc debug stuff :
-#EXTRAFLAGS+=	-DDEBUG_POP3 -DDEBUG_IMAP4 -DDEBUG_LICQ \
-#	-DDEBUG_MBOX -DDEBUG_MAILDIR -DDEBUG -DDEBUG_MAIL_COUNT \
-#	-DDEBUG_COMM
-
 # For malloc debug :
 #CFLAGS	+= -DUSE_DMALLOC
 #LIBS	+= -ldmalloc
@@ -93,8 +81,8 @@ OBJS =	wmbiff.o socket.o \
 all: wmbiff
 
 Imap4Client.o: Imap4Client.c Client.h Makefile
-
-wmbiff.o: wmbiff-master.xpm wmbiff.c
+Pop3Client.o: Pop3Client.c Client.h Makefile
+wmbiff.o: wmbiff-master.xpm wmbiff.c Client.h
 
 .c.o:
 	$(CC) $(CFLAGS) $(EXTRAFLAGS) -c $< -o $*.o
@@ -131,7 +119,7 @@ install: wmbiff
 # everyone may be happy with this, but has been determined to be necessary for
 # consistency and legibility.
 #
-# In other words, make sure you run "make clean" or "make indent", and do not
+# In other words, make sure you run "make clean" and "make indent", and do not
 # change the options on the indent command, before you submit patches against
 # wmbiff.  This will make everyone's life easier.
 #
diff --git a/wmbiff/Pop3Client.c b/wmbiff/Pop3Client.c
index d8a79af..b606b8d 100644
--- a/wmbiff/Pop3Client.c
+++ b/wmbiff/Pop3Client.c
@@ -1,4 +1,4 @@
-/* $Id: Pop3Client.c,v 1.6 2002/02/02 18:04:19 jordi Exp $ */
+/* $Id: Pop3Client.c,v 1.7 2002/03/01 08:41:29 bluehal Exp $ */
 /* Author : Scott Holden ( scotth at thezone.net )
    Modified : Yong-iL Joh ( tolkien at mizi.com )
    Modified : Jorge Garc�a ( Jorge.Garcia at uv.es )
@@ -20,21 +20,12 @@
 
 #define	PCU	(pc->u).pop
 
-/* emulates what 'variadic macros' are great for */
-#ifdef DEBUG_POP3
-#define DM printf
-#else
-#define DM nullie
-static void nullie(const char *format, ...)
-{
-	return;
-}
-#endif
-
 static FILE *authenticate_md5(Pop3 pc, FILE * fp, char *unused);
 static FILE *authenticate_apop(Pop3 pc, FILE * fp, char *apop_str);
 static FILE *authenticate_plaintext(Pop3 pc, FILE * fp, char *unused);
 
+#define POP_DM(pc, lvl, args...) DM(pc, lvl, "pop3: " ##args)
+
 static struct authentication_method {
 	const char *name;
 	/* callback returns the filehandle if successful, 
@@ -60,15 +51,15 @@ FILE *pop3Login(Pop3 pc)
 	apop_str[0] = '\0';			/* if defined, server supports apop */
 
 	if ((fd = sock_connect(PCU.serverName, PCU.serverPort)) == -1) {
-		fprintf(stderr, "Not Connected To Server '%s:%d'\n",
-				PCU.serverName, PCU.serverPort);
+		POP_DM(pc, DEBUG_ERROR, "Not Connected To Server '%s:%d'\n",
+		   PCU.serverName, PCU.serverPort);
 		return NULL;
 	}
 
 	fp = fdopen(fd, "r+");
 	fgets(buf, BUF_SIZE, fp);
 	fflush(fp);
-	DM("%s", buf);
+	POP_DM(pc, DEBUG_INFO, "%s", buf);
 
 	/* Detect APOP, copy challenge into apop_str */
 	for (ptr1 = buf + strlen(buf), ptr2 = NULL; ptr1 > buf; --ptr1) {
@@ -93,9 +84,9 @@ FILE *pop3Login(Pop3 pc)
 	}
 
 	/* if authentication worked, we won't get here */
-	fprintf(stderr,
-			"All Pop3 authentication methods failed for '%s@%s:%d'\n",
-			PCU.userName, PCU.serverName, PCU.serverPort);
+	POP_DM(pc, DEBUG_ERROR,
+	   "All Pop3 authentication methods failed for '%s@%s:%d'\n",
+	   PCU.userName, PCU.serverName, PCU.serverPort);
 	fprintf(fp, "QUIT\r\n");
 	fclose(fp);
 	return NULL;
@@ -116,8 +107,10 @@ int pop3CheckMail(Pop3 pc)
 	fflush(f);
 	fgets(buf, 256, f);
 	if (buf[0] != '+') {
-		fprintf(stderr, "Error Receiving Stats '%s@%s:%d'\n",
-				PCU.userName, PCU.serverName, PCU.serverPort);
+		POP_DM(pc, DEBUG_ERROR,
+		   "Error Receiving Stats '%s@%s:%d'\n",
+		   PCU.userName, PCU.serverName, PCU.serverPort);
+		POP_DM(pc, DEBUG_INFO, "It said: %s\n", buf);
 		return -1;
 	} else {
 		sscanf(buf, "+OK %d", &(pc->TotalMsgs));
@@ -180,8 +173,8 @@ int pop3Create(Pop3 pc, const char *str)
 	/* failed to match either regex */
 	if (matchedchars <= 0) {
 		pc->label[0] = '\0';
-		fprintf(stderr, "Couldn't parse line %s (%d)\n", str,
-				matchedchars);
+		POP_DM(pc, DEBUG_ERROR, "Couldn't parse line %s (%d)\n", str,
+		   matchedchars);
 		return -1;
 	}
 
@@ -196,11 +189,13 @@ int pop3Create(Pop3 pc, const char *str)
 
 	grab_authList(str + regs.end[0], PCU.authList);
 
-	DM("pop3: userName= '%s'\n", PCU.userName);
-	DM("pop3: password= '%s'\n", PCU.password);
-	DM("pop3: serverName= '%s'\n", PCU.serverName);
-	DM("pop3: serverPort= '%d'\n", PCU.serverPort);
-	DM("pop3: authList= '%s'\n", PCU.authList);
+	POP_DM(pc, DEBUG_INFO, "pop3: userName= '%s'\n", PCU.userName);
+	POP_DM(pc, DEBUG_INFO, "pop3: password= is %d characters long\n",
+	   strlen(PCU.password));
+	POP_DM(pc, DEBUG_INFO, "pop3: password= '%s'\n", PCU.password);
+	POP_DM(pc, DEBUG_INFO, "pop3: serverName= '%s'\n", PCU.serverName);
+	POP_DM(pc, DEBUG_INFO, "pop3: serverPort= '%d'\n", PCU.serverPort);
+	POP_DM(pc, DEBUG_INFO, "pop3: authList= '%s'\n", PCU.authList);
 
 	pc->open = pop3Login;
 	pc->checkMail = pop3CheckMail;
@@ -224,7 +219,7 @@ static FILE *authenticate_md5(Pop3 pc, FILE * fp, char *apop_str)
 	fprintf(fp, "AUTH CRAM-MD5\r\n");
 	fflush(fp);
 	fgets(buf, BUF_SIZE, fp);
-	DM("%s", buf);
+	POP_DM(pc, DEBUG_INFO, "%s", buf);
 
 	if (buf[0] != '+' || buf[1] != ' ') {
 		/* nope, not supported. */
@@ -232,7 +227,7 @@ static FILE *authenticate_md5(Pop3 pc, FILE * fp, char *apop_str)
 	}
 
 	Decode_Base64(buf + 2, buf2);
-	DM("POP3 CRAM-MD5 challenge: %s\n", buf2);
+	POP_DM(pc, DEBUG_INFO, "CRAM-MD5 challenge: %s\n", buf2);
 
 	strcpy(buf, PCU.userName);
 	strcat(buf, " ");
@@ -249,7 +244,7 @@ static FILE *authenticate_md5(Pop3 pc, FILE * fp, char *apop_str)
 	gcry_md_close(gmh);
 
 	strcat(buf, buf2);
-	DM("POP3 CRAM-MD5 response: %s\n", buf);
+	POP_DM(pc, DEBUG_INFO, "CRAM-MD5 response: %s\n", buf);
 	Encode_Base64(buf, buf2);
 
 	fprintf(fp, "%s\r\n", buf2);
@@ -259,9 +254,9 @@ static FILE *authenticate_md5(Pop3 pc, FILE * fp, char *apop_str)
 	if (!strncmp(buf, "+OK", 3))
 		return fp;				/* AUTH successful */
 	else {
-		fprintf(stderr,
-				"POP3 CRAM-MD5 AUTH failed for user '%s@%s:%d'\n",
-				PCU.userName, PCU.serverName, PCU.serverPort);
+		POP_DM(pc, DEBUG_ERROR,
+		   "CRAM-MD5 AUTH failed for user '%s@%s:%d'\n",
+		   PCU.userName, PCU.serverName, PCU.serverPort);
 		fprintf(stderr, "It said %s", buf);
 		return NULL;
 	}
@@ -281,7 +276,7 @@ static FILE *authenticate_apop(Pop3 pc, FILE * fp, char *apop_str)
 		/* server doesn't support apop. */
 		return (NULL);
 	}
-	DM("POP3 APOP challenge: %s\n", apop_str);
+	POP_DM(pc, DEBUG_INFO, "APOP challenge: %s\n", apop_str);
 	strcat(apop_str, PCU.password);
 
 	gmh = gcry_md_open(GCRY_MD_MD5, 0);
@@ -291,7 +286,7 @@ static FILE *authenticate_apop(Pop3 pc, FILE * fp, char *apop_str)
 	Bin2Hex(md5, 16, buf);
 	gcry_md_close(gmh);
 
-	DM("POP3 APOP response: %s %s\n", PCU.userName, buf);
+	POP_DM(pc, DEBUG_INFO, "APOP response: %s %s\n", PCU.userName, buf);
 	fprintf(fp, "APOP %s %s\r\n", PCU.userName, buf);
 	fflush(fp);
 	fgets(buf, BUF_SIZE, fp);
@@ -299,9 +294,10 @@ static FILE *authenticate_apop(Pop3 pc, FILE * fp, char *apop_str)
 	if (!strncmp(buf, "+OK", 3))
 		return fp;				/* AUTH successful */
 	else {
-		fprintf(stderr, "POP3 APOP AUTH failed for user '%s@%s:%d'\n",
-				PCU.userName, PCU.serverName, PCU.serverPort);
-		fprintf(stderr, "It said %s", buf);
+		POP_DM(pc, DEBUG_ERROR,
+		   "APOP AUTH failed for user '%s@%s:%d'\n",
+		   PCU.userName, PCU.serverName, PCU.serverPort);
+		POP_DM(pc, DEBUG_INFO, "It said %s", buf);
 		return NULL;
 	}
 #else
@@ -315,22 +311,34 @@ static FILE *authenticate_plaintext(Pop3 pc, FILE * fp, char *apop_str)
 
 	fprintf(fp, "USER %s\r\n", PCU.userName);
 	fflush(fp);
-	fgets(buf, BUF_SIZE, fp);
+	if (fgets(buf, BUF_SIZE, fp) == NULL) {
+		POP_DM(pc, DEBUG_ERROR,
+		   "Error reading from server authenticating '%s@%s:%d'\n",
+		   PCU.userName, PCU.serverName, PCU.serverPort);
+		return NULL;
+	}
 	if (buf[0] != '+') {
-		fprintf(stderr, "Invalid User Name '%s@%s:%d'\n",
-				PCU.userName, PCU.serverName, PCU.serverPort);
-		DM("%s\n", buf);
+		POP_DM(pc, DEBUG_ERROR,
+		   "Failed user name when authenticating '%s@%s:%d'\n",
+		   PCU.userName, PCU.serverName, PCU.serverPort);
+		/* deb #128863 might be easier if we printed: */
+		POP_DM(pc, DEBUG_ERROR, "The server's error message was: %s\n", buf);
 		return NULL;
 	};
 
-	fflush(fp);
 	fprintf(fp, "PASS %s\r\n", PCU.password);
 	fflush(fp);
-	fgets(buf, BUF_SIZE, fp);
+	if (fgets(buf, BUF_SIZE, fp) == NULL) {
+		POP_DM(pc, DEBUG_ERROR,
+		   "Error reading from server (2) authenticating '%s@%s:%d'\n",
+		   PCU.userName, PCU.serverName, PCU.serverPort);
+		return NULL;
+	}
 	if (buf[0] != '+') {
-		fprintf(stderr, "Incorrect Password for user '%s@%s:%d'\n",
-				PCU.userName, PCU.serverName, PCU.serverPort);
-		fprintf(stderr, "It said %s", buf);
+		POP_DM(pc, DEBUG_ERROR,
+		   "Failed password when authenticating '%s@%s:%d'\n",
+		   PCU.userName, PCU.serverName, PCU.serverPort);
+		POP_DM(pc, DEBUG_ERROR, "The server's error message was: %s\n", buf);
 		return NULL;
 	};
 
diff --git a/wmbiff/maildirClient.c b/wmbiff/maildirClient.c
index b7b1a2a..50f7873 100644
--- a/wmbiff/maildirClient.c
+++ b/wmbiff/maildirClient.c
@@ -1,4 +1,4 @@
-/* $Id: maildirClient.c,v 1.3 2001/10/04 09:50:59 jordi Exp $ */
+/* $Id: maildirClient.c,v 1.4 2002/03/01 08:41:29 bluehal Exp $ */
 /* Author : Yong-iL Joh ( tolkien at mizi.com )
    Modified : Jorge Garc�a ( Jorge.Garcia at uv.es )
  * 
@@ -28,9 +28,8 @@ static int count_msgs(char *path)
 
 	D = opendir(path);
 	if (D == NULL) {
-		fprintf(stderr,
-				"wmbiff: Error opening directory '%s': %s\n", path,
-				strerror(errno));
+		DMA(DEBUG_ERROR,
+			"Error opening directory '%s': %s\n", path, strerror(errno));
 		return -1;
 	}
 
@@ -53,9 +52,7 @@ int maildirCheckHistory(Pop3 pc)
 
 	int count_new = 0, count_cur = 0;
 
-#ifdef DEBUG_MAIL_COUNT
-	printf(">Maildir: '%s'\n", pc->path);
-#endif
+	DM(pc, DEBUG_INFO, ">Maildir: '%s'\n", pc->path);
 
 	strcpy(path_new, pc->path);
 	strcat(path_new, "/new/");
@@ -64,13 +61,13 @@ int maildirCheckHistory(Pop3 pc)
 
 	/* maildir */
 	if (stat(path_new, &st_new)) {
-		fprintf(stderr, "wmbiff: Can't stat mailbox '%s': %s\n",
-				path_new, strerror(errno));
+		DM(pc, DEBUG_ERROR, "Can't stat mailbox '%s': %s\n",
+		   path_new, strerror(errno));
 		return -1;				/* Error stating mailbox */
 	}
 	if (stat(path_cur, &st_cur)) {
-		fprintf(stderr, "wmbiff: Can't stat mailbox '%s': %s\n",
-				path_cur, strerror(errno));
+		DM(pc, DEBUG_ERROR, "Can't stat mailbox '%s': %s\n",
+		   path_cur, strerror(errno));
 		return -1;				/* Error stating mailbox */
 	}
 
@@ -80,17 +77,15 @@ int maildirCheckHistory(Pop3 pc)
 		|| st_new.st_size != PCM.size_new
 		|| st_cur.st_mtime != PCM.mtime_cur
 		|| st_cur.st_size != PCM.size_cur || pc->OldMsgs < 0) {
-#ifdef DEBUG_MAIL_COUNT
-		printf("  was changed,\n"
-			   " TIME(new): old %lu, new %lu"
-			   " SIZE(new): old %lu, new %lu\n"
-			   " TIME(cur): old %lu, new %lu"
-			   " SIZE(cur): old %lu, new %lu\n",
-			   PCM.mtime_new, st_new.st_mtime,
-			   (unsigned long) PCM.size_new, st_new.st_size,
-			   PCM.mtime_cur, st_cur.st_mtime,
-			   (unsigned long) PCM.size_cur, st_cur.st_size);
-#endif
+		DM(pc, DEBUG_INFO, "  was changed,\n"
+		   " TIME(new): old %lu, new %lu"
+		   " SIZE(new): old %lu, new %lu\n"
+		   " TIME(cur): old %lu, new %lu"
+		   " SIZE(cur): old %lu, new %lu\n",
+		   PCM.mtime_new, st_new.st_mtime,
+		   (unsigned long) PCM.size_new, st_new.st_size,
+		   PCM.mtime_cur, st_cur.st_mtime,
+		   (unsigned long) PCM.size_cur, st_cur.st_size);
 
 		count_new = count_msgs(path_new);
 		count_cur = count_msgs(path_cur);
@@ -130,10 +125,8 @@ int maildirCreate(Pop3 pc, char *str)
 	pc->checkMail = maildirCheckHistory;
 	strcpy(pc->path, str + 8);	/* cut off ``maildir:'' */
 
-#ifdef DEBUG_MAILDIR
-	printf("maildir: str = '%s'\n", str);
-	printf("maildir: path= '%s'\n", pc->path);
-#endif
+	DM(pc, DEBUG_INFO, "maildir: str = '%s'\n", str);
+	DM(pc, DEBUG_INFO, "maildir: path= '%s'\n", pc->path);
 
 	return 0;
 }
diff --git a/wmbiff/mboxClient.c b/wmbiff/mboxClient.c
index 41fed5e..7dff975 100644
--- a/wmbiff/mboxClient.c
+++ b/wmbiff/mboxClient.c
@@ -1,4 +1,4 @@
-/* $Id: mboxClient.c,v 1.3 2001/10/04 09:50:59 jordi Exp $ */
+/* $Id: mboxClient.c,v 1.4 2002/03/01 08:41:29 bluehal Exp $ */
 /* Author:		Yong-iL Joh <tolkien at mizi.com>
    Modified:	Jorge Garc�a <Jorge.Garcia at uv.es>
    			 	Rob Funk <rfunk at funknet.net>
@@ -26,8 +26,8 @@ FILE *openMailbox(Pop3 pc)
 	FILE *mailbox;
 
 	if ((mailbox = fopen(pc->path, "r")) == NULL) {
-		fprintf(stderr, "wmbiff: Error opening mailbox '%s': %s\n",
-				pc->path, strerror(errno));
+		DM(pc, DEBUG_ERROR, "Error opening mailbox '%s': %s\n",
+		   pc->path, strerror(errno));
 	}
 	return (mailbox);
 }
@@ -45,9 +45,7 @@ int mboxCheckHistory(Pop3 pc)
 	int count_from = 0, count_status = 0;
 	int len_from = strlen(FROM_STR), len_status = strlen(STATUS_STR);
 
-#ifdef DEBUG_MAIL_COUNT
-	printf(">Mailbox: '%s'\n", pc->path);
-#endif
+	DM(pc, DEBUG_INFO, ">Mailbox: '%s'\n", pc->path);
 
 	/* mbox file */
 	if (stat(pc->path, &st)) {
@@ -59,13 +57,11 @@ int mboxCheckHistory(Pop3 pc)
 	if (st.st_mtime != PCM.mtime || st.st_size != PCM.size
 		|| pc->OldMsgs < 0) {
 		/* file was changed OR initially read */
-#ifdef DEBUG_MAIL_COUNT
-		printf("  was changed,"
-			   " TIME: old %lu, new %lu"
-			   " SIZE: old %lu, new %lu\n",
-			   PCM.mtime, st.st_mtime, (unsigned long) PCM.size,
-			   st.st_size);
-#endif
+		DM(pc, DEBUG_INFO,
+		   "  was changed,"
+		   " TIME: old %lu, new %lu"
+		   " SIZE: old %lu, new %lu\n",
+		   PCM.mtime, st.st_mtime, (unsigned long) PCM.size, st.st_size);
 		ut.actime = st.st_atime;
 		ut.modtime = st.st_mtime;
 		F = pc->open(pc);
@@ -91,9 +87,6 @@ int mboxCheckHistory(Pop3 pc)
 				next_from_is_start_of_header = 0;
 				if (!strncmp(buf, STATUS_STR, len_status)) {
 					if (strrchr(buf, 'R')) {
-#ifdef DEBUG_MAIL_COUNT
-						/*  printf ("Got a status: %s",buf); */
-#endif
 						if (is_header)
 							count_status++;
 					}
@@ -101,9 +94,8 @@ int mboxCheckHistory(Pop3 pc)
 			}
 		}
 
-#ifdef DEBUG_MAIL_COUNT
-		printf("from: %d status: %d\n", count_from, count_status);
-#endif
+		DM(pc, DEBUG_INFO, "from: %d status: %d\n", count_from,
+		   count_status);
 		pc->TotalMsgs = count_from;
 		pc->UnreadMsgs = count_from - count_status;
 		fclose(F);
@@ -132,10 +124,8 @@ int mboxCreate(Pop3 pc, char *str)
 	if (!strncasecmp(pc->path, "mbox:", 5))
 		strcpy(pc->path, str + 5);	/* cut off ``mbox:'' */
 
-#ifdef DEBUG_MBOX
-	printf("mbox: str = '%s'\n", str);
-	printf("mbox: path= '%s'\n", pc->path);
-#endif
+	DM(pc, DEBUG_INFO, "mbox: str = '%s'\n", str);
+	DM(pc, DEBUG_INFO, "mbox: path= '%s'\n", pc->path);
 
 	return 0;
 }
diff --git a/wmbiff/tlsComm.c b/wmbiff/tlsComm.c
index aac2b90..8152303 100644
--- a/wmbiff/tlsComm.c
+++ b/wmbiff/tlsComm.c
@@ -25,17 +25,11 @@
 
 #include "tlsComm.h"
 
-/* emulates what 'variadic macros' are great for */
-#ifdef DEBUG_COMM
-#define DM printf
-#else
-#define DM nullie
-/*@unused@*/
-static void nullie( /*@unused@ */ const char *format, ...)
-{
-	return;
-}
-#endif
+#include "Client.h"				/* debugging messages */
+
+/* WARNING: implcitly uses scs to gain access to the mailbox
+   that holds the per-mailbox debug flag. */
+#define TDM(lvl, args...) DM(scs->pc, lvl, "comm: " ##args)
 
 /* this is the per-connection state that is maintained for
    each connection; BIG variables are for ssl (null if not
@@ -52,6 +46,7 @@ struct connection_state {
 	/*@null@ */ void *xcred;
 #endif
 	char unprocessed[BUF_SIZE];
+	Pop3 pc;					/* mailbox handle for debugging messages */
 };
 
 /* gotta do our own line buffering, sigh */
@@ -61,18 +56,14 @@ void handle_gnutls_read_error(int readbytes, struct connection_state *scs);
 
 void tlscomm_close(struct connection_state *scs)
 {
-	DM("%s: closing.\n", (scs->name != NULL) ? scs->name : "null");
+	TDM(DEBUG_INFO, "%s: closing.\n",
+		(scs->name != NULL) ? scs->name : "null");
 
 	/* not ok to call this more than once */
 	if (scs->state) {
 #ifdef WITH_TLS
-#if GNUTLS_VER >= 3
 		gnutls_bye(scs->state, GNUTLS_SHUT_RDWR);
 		gnutls_x509pki_free_sc(scs->xcred);
-#else
-		gnutls_bye(scs->sd, scs->state, GNUTLS_SHUT_RDWR);
-		gnutls_free_x509_client_sc(scs->xcred);
-#endif
 		gnutls_deinit(scs->state);
 		scs->xcred = NULL;
 #endif
@@ -97,8 +88,9 @@ static int wait_for_it(int sd, int timeoutseconds)
 	FD_ZERO(&readfds);
 	FD_SET(sd, &readfds);
 	if (select(sd + 1, &readfds, NULL, NULL, &tv) == 0) {
-		DM("select timed out after %d seconds on socket: %d\n",
-		   timeoutseconds, sd);
+		DMA(DEBUG_INFO,
+			"select timed out after %d seconds on socket: %d\n",
+			timeoutseconds, sd);
 		return (0);
 	}
 	return (FD_ISSET(sd, &readfds));
@@ -146,18 +138,13 @@ int tlscomm_expect(struct connection_state *scs,
 {
 	int prefixlen = (int) strlen(prefix);
 	memset(buf, 0, buflen);
-	DM("%s: expecting: %s\n", scs->name, prefix);
+	TDM(DEBUG_INFO, "%s: expecting: %s\n", scs->name, prefix);
 	while (wait_for_it(scs->sd, 10)) {
 		int readbytes;
 #ifdef WITH_TLS
 		if (scs->state) {
 			readbytes =
-#if GNUTLS_VER >= 3
 				gnutls_read(scs->state, scs->unprocessed, BUF_SIZE);
-#else
-				gnutls_read(scs->sd, scs->state, scs->unprocessed,
-							BUF_SIZE);
-#endif
 			if (readbytes < 0) {
 				handle_gnutls_read_error(readbytes, scs);
 				return 0;
@@ -167,8 +154,8 @@ int tlscomm_expect(struct connection_state *scs,
 		{
 			readbytes = read(scs->sd, scs->unprocessed, BUF_SIZE);
 			if (readbytes < 0) {
-				fprintf(stderr, "%s: error reading: %s\n", scs->name,
-						strerror(errno));
+				TDM(DEBUG_ERROR, "%s: error reading: %s\n", scs->name,
+					strerror(errno));
 				return 0;
 			}
 		}
@@ -184,16 +171,17 @@ int tlscomm_expect(struct connection_state *scs,
 				} else {
 					readbytes -= linebytes;
 					if (strncmp(buf, prefix, prefixlen) == 0) {
-						DM("%s: got: %*s", scs->name, readbytes, buf);
+						TDM(DEBUG_INFO, "%s: got: %*s", scs->name,
+							readbytes, buf);
 						return 1;	/* got it! */
 					}
-					DM("%s: dumped(%d/%d): %.*s", scs->name,
-					   linebytes, readbytes, linebytes, buf);
+					TDM(DEBUG_INFO, "%s: dumped(%d/%d): %.*s", scs->name,
+						linebytes, readbytes, linebytes, buf);
 				}
 			}
 	}
-	fprintf(stderr, "%s: expecting: '%s', saw: %s", scs->name, prefix,
-			buf);
+	TDM(DEBUG_ERROR, "%s: expecting: '%s', saw: %s", scs->name, prefix,
+		buf);
 	return 0;					/* wait_for_it failed */
 }
 
@@ -209,7 +197,7 @@ void tlscomm_printf(struct connection_state *scs, const char *format, ...)
 	int bytes;
 
 	if (scs == NULL) {
-		fprintf(stderr, "null connection to tlscomm_printf\n");
+		DMA(DEBUG_ERROR, "null connection to tlscomm_printf\n");
 		abort();
 	}
 	va_start(args, format);
@@ -219,37 +207,31 @@ void tlscomm_printf(struct connection_state *scs, const char *format, ...)
 	if (scs->sd != -1) {
 #ifdef WITH_TLS
 		if (scs->state) {
-#if GNUTLS_VER>=3
 			int written = gnutls_write(scs->state, buf, bytes);
-#else
-			int written = gnutls_write(scs->sd, scs->state, buf, bytes);
-#endif
 			if (written < bytes) {
-				fprintf(stderr, "Error %s prevented writing: %*s\n",
-						gnutls_strerror(written), bytes, buf);
+				TDM(DEBUG_ERROR,
+					"Error %s prevented writing: %*s\n",
+					gnutls_strerror(written), bytes, buf);
 				return;
 			}
 		} else
 #endif
 			(void) write(scs->sd, buf, bytes);
 	} else {
-		fprintf(stderr,
-				"warning: tlscomm_printf called with an invalid socket descriptor\n");
+		printf
+			("warning: tlscomm_printf called with an invalid socket descriptor\n");
 		return;
 	}
-	DM("wrote %*s", bytes, buf);
+	TDM(DEBUG_INFO, "wrote %*s", bytes, buf);
 }
 
 /* most of this file only makes sense if using TLS. */
 #ifdef WITH_TLS
 
-#ifdef DEBUG_COMM
-/* taken from the GNUTLS documentation, version 0.3.0 and 0.2.10; this
-   may need to be updated from gnutls's cli.c if the gnutls interface
-   changes, but that is only necessary if you want
-   debug_comm. */
-#if GNUTLS_VER>=3
-
+/* taken from the GNUTLS documentation, version 0.3.0 and
+   0.2.10; this may need to be updated from gnutls's cli.c
+   (now common.h) if the gnutls interface changes, but that
+   is only necessary if you want debug_comm. */
 #define PRINTX(x,y) if (y[0]!=0) printf(" -   %s %s\n", x, y)
 #define PRINT_DN(X) PRINTX( "CN:", X.common_name); \
 	PRINTX( "OU:", X.organizational_unit_name); \
@@ -315,6 +297,8 @@ static int print_info(GNUTLS_STATE state)
 			printf(" - Certificate Issuer's info:\n");
 			PRINT_DN(dn);
 		}
+    default:
+      printf(" - Other.\n");
 	}
 
 	tmp = gnutls_protocol_get_name(gnutls_protocol_get_version(state));
@@ -332,101 +316,13 @@ static int print_info(GNUTLS_STATE state)
 	return 0;
 }
 
-#else
-
-#define PRINTX(x,y) if (y[0]!=0) printf(" -   %s %s\n", x, y)
-#define PRINT_DN(X) PRINTX( "CN:", X->common_name); \
-	PRINTX( "OU:", X->organizational_unit_name); \
-	PRINTX( "O:", X->organization); \
-	PRINTX( "L:", X->locality_name); \
-	PRINTX( "S:", X->state_or_province_name); \
-	PRINTX( "C:", X->country); \
-	PRINTX( "E:", X->email); \
-	PRINTX( "SAN:", gnutls_x509pki_client_get_subject_dns_name(state))
-
-
-static int print_info(GNUTLS_STATE state)
-{
-	const char *tmp;
-	CredType cred;
-	const gnutls_DN *dn;
-	CertificateStatus status;
-
-
-	tmp = gnutls_kx_get_name(gnutls_get_current_kx(state));
-	printf("- Key Exchange: %s\n", tmp);
-
-	cred = gnutls_get_auth_type(state);
-	switch (cred) {
-	case GNUTLS_ANON:
-		printf("- Anonymous DH using prime of %d bits\n",
-			   gnutls_anon_client_get_dh_bits(state));
-
-	case GNUTLS_X509PKI:
-		status = gnutls_x509pki_client_get_peer_certificate_status(state);
-		switch (status) {
-		case GNUTLS_CERT_NOT_TRUSTED:
-			printf("- Peer's X509 Certificate was NOT verified\n");
-			break;
-		case GNUTLS_CERT_EXPIRED:
-			printf
-				("- Peer's X509 Certificate was verified but is expired\n");
-			break;
-		case GNUTLS_CERT_TRUSTED:
-			printf("- Peer's X509 Certificate was verified\n");
-			break;
-		case GNUTLS_CERT_NONE:
-			printf("- Peer did not send any X509 Certificate.\n");
-			break;
-		case GNUTLS_CERT_INVALID:
-			printf("- Peer's X509 Certificate was invalid\n");
-			break;
-		}
-
-		if (status != GNUTLS_CERT_NONE && status != GNUTLS_CERT_INVALID) {
-			printf(" - Certificate info:\n");
-			printf(" - Certificate version: #%d\n",
-				   gnutls_x509pki_client_get_peer_certificate_version
-				   (state));
-
-			dn = gnutls_x509pki_client_get_peer_dn(state);
-			PRINT_DN(dn);
-
-			dn = gnutls_x509pki_client_get_issuer_dn(state);
-			printf(" - Certificate Issuer's info:\n");
-			PRINT_DN(dn);
-		}
-	default:
-	}
-
-	tmp = gnutls_version_get_name(gnutls_get_current_version(state));
-	printf("- Version: %s\n", tmp);
-
-	tmp =
-		gnutls_compression_get_name(gnutls_get_current_compression_method
-									(state));
-	printf("- Compression: %s\n", tmp);
-
-	tmp = gnutls_cipher_get_name(gnutls_get_current_cipher(state));
-	printf("- Cipher: %s\n", tmp);
-
-	tmp = gnutls_mac_get_name(gnutls_get_current_mac_algorithm(state));
-	printf("- MAC: %s\n", tmp);
-
-	return 0;
-}
-
-#endif
-
-#endif
-
-
-
-struct connection_state *initialize_gnutls(int sd, char *name)
+struct connection_state *initialize_gnutls(int sd, char *name, Pop3 pc)
 {
 	static int gnutls_initialized;
 	int zok;
-	struct connection_state *ret = malloc(sizeof(struct connection_state));
+	struct connection_state *scs = malloc(sizeof(struct connection_state));
+
+	scs->pc = pc;
 
 	assert(sd >= 0);
 
@@ -435,8 +331,7 @@ struct connection_state *initialize_gnutls(int sd, char *name)
 		gnutls_initialized = 1;
 	}
 
-	assert(gnutls_init(&ret->state, GNUTLS_CLIENT) == 0);
-#if GNUTLS_VER>=3
+	assert(gnutls_init(&scs->state, GNUTLS_CLIENT) == 0);
 	{
 		const int protocols[] = { GNUTLS_TLS1, GNUTLS_SSL3, 0 };
 		const int ciphers[] =
@@ -444,73 +339,44 @@ struct connection_state *initialize_gnutls(int sd, char *name)
 		const int compress[] = { GNUTLS_COMP_ZLIB, GNUTLS_COMP_NULL, 0 };
 		const int key_exch[] = { GNUTLS_KX_X509PKI_RSA, 0 };
 		const int mac[] = { GNUTLS_MAC_SHA, GNUTLS_MAC_MD5, 0 };
-		assert(gnutls_protocol_set_priority(ret->state, protocols) == 0);
-		assert(gnutls_cipher_set_priority(ret->state, ciphers) == 0);
-		assert(gnutls_compression_set_priority(ret->state, compress) == 0);
-		assert(gnutls_kx_set_priority(ret->state, key_exch) == 0);
-		assert(gnutls_mac_set_priority(ret->state, mac) == 0);
+		assert(gnutls_protocol_set_priority(scs->state, protocols) == 0);
+		assert(gnutls_cipher_set_priority(scs->state, ciphers) == 0);
+		assert(gnutls_compression_set_priority(scs->state, compress) == 0);
+		assert(gnutls_kx_set_priority(scs->state, key_exch) == 0);
+		assert(gnutls_mac_set_priority(scs->state, mac) == 0);
 		/* no client private key */
-		if (gnutls_x509pki_allocate_sc(&ret->xcred, 0) < 0) {
-			fprintf(stderr, "gnutls memory error\n");
+		if (gnutls_x509pki_allocate_sc(&scs->xcred, 0) < 0) {
+			DMA(DEBUG_ERROR, "gnutls memory error\n");
 			exit(1);
 		}
-		gnutls_cred_set(ret->state, GNUTLS_X509PKI, ret->xcred);
-		gnutls_transport_set_ptr(ret->state, sd);
+		gnutls_cred_set(scs->state, GNUTLS_X509PKI, scs->xcred);
+		gnutls_transport_set_ptr(scs->state, sd);
 		do {
-			zok = gnutls_handshake(ret->state);
+			zok = gnutls_handshake(scs->state);
 		} while (zok == GNUTLS_E_INTERRUPTED || zok == GNUTLS_E_AGAIN);
 	}
-#else
-	assert(gnutls_set_protocol_priority(ret->state, GNUTLS_TLS1,
-										GNUTLS_SSL3, 0) == 0);
-	assert(gnutls_set_cipher_priority(ret->state, GNUTLS_3DES_CBC,
-									  GNUTLS_ARCFOUR, 0) == 0);
-	assert(gnutls_set_compression_priority(ret->state, GNUTLS_ZLIB,
-										   GNUTLS_NULL_COMPRESSION,
-										   0) == 0);
-	assert(gnutls_set_kx_priority(ret->state, GNUTLS_KX_RSA, 0) == 0);
-	assert(gnutls_set_mac_priority(ret->state, GNUTLS_MAC_SHA,
-								   GNUTLS_MAC_MD5, 0) == 0);
-	/* no client private key */
-	if (gnutls_allocate_x509_client_sc(&ret->xcred, 0) < 0) {
-		fprintf(stderr, "gnutls memory error\n");
-		exit(1);
-	}
-	gnutls_set_cred(ret->state, GNUTLS_X509PKI, ret->xcred);
-	zok = gnutls_handshake(sd, ret->state);
-#endif
-
-	/* TODO: 
-	   zok =
-	   gnutls_set_x509_client_trust(ret->xcred, "cafile.pem",
-	   "crlfile.pem");
-	   if (zok != 0) {
-	   // printf("error setting client trust\n");
-	   }
-	 */
 
 	if (zok < 0) {
-		fprintf(stderr, "%s: Handshake failed\n", name);
-		fprintf(stderr, "%s: This may be a problem in gnutls, "
-				"which is under development\n", name);
-		fprintf(stderr,
-				"%s: Specifically, problems have been found where the extnValue \n"
-				"  buffer in _gnutls_get_ext_type() in lib/x509_extensions.c is too small in\n"
-				"  gnutls versions up to 0.2.3.  This copy of wmbiff was compiled with \n"
-				"  gnutls version %s.\n", name, LIBGNUTLS_VERSION);
+		TDM(DEBUG_ERROR, "%s: Handshake failed\n", name);
+		TDM(DEBUG_ERROR, "%s: This may be a problem in gnutls, "
+			"which is under development\n", name);
+		TDM(DEBUG_ERROR,
+			"%s: Specifically, problems have been found where the extnValue \n"
+			"  buffer in _gnutls_get_ext_type() in lib/x509_extensions.c is too small in\n"
+			"  gnutls versions up to 0.2.3.  This copy of wmbiff was compiled with \n"
+			"  gnutls version %s.\n", name, LIBGNUTLS_VERSION);
 		gnutls_perror(zok);
-		gnutls_deinit(ret->state);
-		free(ret);
+		gnutls_deinit(scs->state);
+		free(scs);
 		return (NULL);
 	} else {
-		DM("%s: Handshake was completed\n", name);
-#ifdef DEBUG_COMM
-		print_info(ret->state);
-#endif
-		ret->sd = sd;
-		ret->name = name;
+		TDM(DEBUG_INFO, "%s: Handshake was completed\n", name);
+		if (scs->pc->debug >= DEBUG_INFO)
+			print_info(scs->state);
+		scs->sd = sd;
+		scs->name = name;
 	}
-	return (ret);
+	return (scs);
 }
 
 /* moved down here, to keep from interrupting the flow with
@@ -518,23 +384,19 @@ struct connection_state *initialize_gnutls(int sd, char *name)
 void handle_gnutls_read_error(int readbytes, struct connection_state *scs)
 {
 	if (gnutls_is_fatal_error(readbytes) == 1) {
-		fprintf(stderr,
-				"%s: Received corrupted data(%d) - server has terminated the connection abnormally\n",
-				scs->name, readbytes);
+		TDM(DEBUG_ERROR,
+			"%s: Received corrupted data(%d) - server has terminated the connection abnormally\n",
+			scs->name, readbytes);
 	} else {
 		if (readbytes == GNUTLS_E_WARNING_ALERT_RECEIVED
 			|| readbytes == GNUTLS_E_FATAL_ALERT_RECEIVED)
-			fprintf(stderr, "* Received alert [%d]\n",
-#if GNUTLS_VER>=3
-					gnutls_alert_get_last(scs->state));
-#else
-					gnutls_get_last_alert(scs->state));
-#endif
+			TDM(DEBUG_ERROR, "* Received alert [%d]\n",
+				gnutls_alert_get_last(scs->state));
 		if (readbytes == GNUTLS_E_REHANDSHAKE)
-			fprintf(stderr, "* Received HelloRequest message\n");
+			TDM(DEBUG_ERROR, "* Received HelloRequest message\n");
 	}
-	fprintf(stderr, "%s: error reading: %s\n",
-			scs->name, gnutls_strerror(readbytes));
+	TDM(DEBUG_ERROR,
+		"%s: error reading: %s\n", scs->name, gnutls_strerror(readbytes));
 }
 
 #else
@@ -542,15 +404,16 @@ void handle_gnutls_read_error(int readbytes, struct connection_state *scs)
 struct connection_state *initialize_gnutls( /*@unused@ */ int sd,
 										   /*@unused@ */ char *name)
 {
-	fprintf(stderr,
-			"FATAL: tried to initialize ssl when ssl wasn't compiled in.\n");
+	DMA(DEBUG_ERROR,
+		"FATAL: tried to initialize ssl when ssl wasn't compiled in.\n");
 	exit(EXIT_FAILURE);
 }
 #endif
 
 /* either way: */
 struct connection_state *initialize_unencrypted(int sd,
-												/*@only@ */ char *name)
+												/*@only@ */ char *name,
+												Pop3 pc)
 {
 	struct connection_state *ret = malloc(sizeof(struct connection_state));
 	assert(sd >= 0);
@@ -559,6 +422,7 @@ struct connection_state *initialize_unencrypted(int sd,
 	ret->name = name;
 	ret->state = NULL;
 	ret->xcred = NULL;
+	ret->pc = pc;
 	return (ret);
 }
 
@@ -572,6 +436,7 @@ struct connection_state *initialize_blacklist( /*@only@ */ char *name)
 	ret->name = name;
 	ret->state = NULL;
 	ret->xcred = NULL;
+	ret->pc = NULL;
 	return (ret);
 }
 
diff --git a/wmbiff/tlsComm.h b/wmbiff/tlsComm.h
index b8710fc..4968e6c 100644
--- a/wmbiff/tlsComm.h
+++ b/wmbiff/tlsComm.h
@@ -8,6 +8,8 @@
    http://lclint.cs.virginia.edu/
 */
 
+/* used to drill through per-mailbox debug keys */
+#include "Client.h"
 
 /* opaque reference to the state associated with a 
    connection: may be just a file handle, or may include
@@ -17,13 +19,14 @@ struct connection_state;
 /* take a socket descriptor and negotiate a TLS connection
    over it */
 /*@only@*/
-struct connection_state *initialize_gnutls(int sd, /*@only@ */ char *name);
+struct connection_state *initialize_gnutls(int sd, /*@only@ */ char *name,
+										   Pop3 pc);
 
 /* take a socket descriptor and bundle it into a connection
    state structure for later communication */
 /*@only@*/
 struct connection_state *initialize_unencrypted(int sd,	/*@only@ */
-												char *name);
+												char *name, Pop3 pc);
 
 /* store a binding when connect() times out. these should be 
    skipped when trying to check mail so that other mailboxes
diff --git a/wmbiff/wmbiff.1 b/wmbiff/wmbiff.1
index 7d44fd6..a7fbce7 100644
--- a/wmbiff/wmbiff.1
+++ b/wmbiff/wmbiff.1
@@ -1,5 +1,5 @@
 .\" Hey, Emacs!  This is an -*- nroff -*- source file.
-.\" $Id: wmbiff.1,v 1.5 2001/10/04 09:50:59 jordi Exp $
+.\" $Id: wmbiff.1,v 1.6 2002/03/01 08:41:29 bluehal Exp $
 .\"
 .\" wmbiff.1 and wmbiffrc.5 are copyright 1999-2001 by
 .\" Jordi Mallach <jordi at debian.org>
@@ -13,7 +13,7 @@ WMBiff \- A dockable Mailbox Monitor
 
 .SH SYNOPSIS
 .B wmbiff
-[-display <display name>] [-geometry +XPOS+YPOS] [-c <filename>] [-h] [-v]
+[-display <display name>] [-geometry +XPOS+YPOS] [-c <filename>] [-h] [-v] [-debug]
 .br
 
 .SH DESCRIPTION
@@ -52,11 +52,18 @@ Initial window position.
 .TP
 .B \-c <filename>
 Use specified config file.
+.TP
+.B \-debug 
+Print verbose log of progress.
 
 .SH BUGS
-Please send any bug reports or suggestions to the WMBiff Development
-Mailing List <wmbiff-devel at lists.sourceforge.net>.
-.br
+Send bug reports or suggestions to the WMBiff Development
+Mailing List <wmbiff-devel at lists.sourceforge.net>.   Consider
+attaching a transcript of your session, generated using:
+.RS
+wmbiff -debug | tee wmbiff-log
+.RE
+Be sure to remove any instances of your password.
 
 .SH FILES
 .TP
diff --git a/wmbiff/wmbiff.c b/wmbiff/wmbiff.c
index 6de6a46..c85ccdf 100644
--- a/wmbiff/wmbiff.c
+++ b/wmbiff/wmbiff.c
@@ -1,4 +1,4 @@
-/* $Id: wmbiff.c,v 1.11 2001/11/16 00:37:46 bluehal Exp $ */
+/* $Id: wmbiff.c,v 1.12 2002/03/01 08:41:29 bluehal Exp $ */
 
 #define	USE_POLL
 
@@ -60,6 +60,7 @@ void ClearDigits(int i);
 void XSleep(int millisec);
 void sigchld_handler(int sig);
 
+int debug_default = DEBUG_ERROR;
 
 void init_biff(char *uconfig_file)
 {
@@ -74,6 +75,7 @@ void init_biff(char *uconfig_file)
 		mbox[i].action[0] = 0;
 		mbox[i].fetchcmd[0] = 0;
 		mbox[i].loopinterval = 0;
+		mbox[i].debug = debug_default;
 	}
 
 	/* Some defaults, if config file is unavailable */
@@ -86,42 +88,38 @@ void init_biff(char *uconfig_file)
 	}
 #ifdef WITH_GCRYPT
 	/* gcrypt is a little strange, in that it doesn't 
-	 * seem to initialize it's memory pool by itself. 
+	 * seem to initialize its memory pool by itself. 
 	 * I believe we *expect* "Warning: using insecure memory!"
 	 */
 	if ((i = gcry_control(GCRYCTL_INIT_SECMEM, 16384, 0)) != 0) {
-		fprintf(stderr,
-				"Error: gcry_control() to initialize secure memory returned non-zero: %d\n",
-				i);
-		fprintf(stderr, "Message: %s\n", gcry_strerror(gcry_errno()));
-		fprintf(stderr, "libgcrypt version: %s\n",
-				gcry_check_version(NULL));
-		fprintf(stderr,
-				"attempting to recover: will fail later if using CRAM-MD5 or APOP authentication. \n");
+		DMA(DEBUG_ERROR,
+			"Error: gcry_control() to initialize secure memory returned non-zero: %d\n"
+			" Message: %s\n"
+			" libgcrypt version: %s\n"
+			" recovering: will fail later if using CRAM-MD5 or APOP authentication.\n",
+			i, gcry_strerror(gcry_errno()), gcry_check_version(NULL));
 	};
 #endif
 
 	/* Read config file */
 	if (uconfig_file[0] != 0) {
 		/* user-specified config file */
-		fprintf(stderr, "Using user-specified config file '%s'.\n",
-				uconfig_file);
+		DMA(DEBUG_INFO, "Using user-specified config file '%s'.\n",
+			uconfig_file);
 		strcpy(config_file, uconfig_file);
 	} else
 		sprintf(config_file, "%s/.wmbiffrc", getenv("HOME"));
 
-#ifdef DEBUG
-	printf("config_file = %s.\n", config_file);
-#endif
+	DMA(DEBUG_INFO, "config_file = %s.\n", config_file);
 
 	if (!Read_Config_File(config_file, &loopinterval)) {
 		if (m == NULL) {
-			fprintf(stderr, "Cannot open '%s' nor use the "
-					"MAIL environment var.\n", uconfig_file);
+			DMA(DEBUG_ERROR, "Cannot open '%s' nor use the "
+				"MAIL environment var.\n", uconfig_file);
 			exit(1);
 		}
 		/* we are using MAIL environment var. type mbox */
-		fprintf(stderr, "Using MAIL environment var '%s'.\n", m);
+		DMA(DEBUG_INFO, "Using MAIL environment var '%s'.\n", m);
 		mboxCreate((&mbox[0]), mbox[0].path);
 	}
 
@@ -187,12 +185,11 @@ void do_biff(int argc, char **argv)
 		if (mbox[i].label[0] != 0) {
 			mbox[i].prevtime = mbox[i].prevfetch_time = curtime;
 			BlitString(mbox[i].label, 5, (11 * i) + 5, 0);
+			DM(&mbox[i], DEBUG_INFO,
+			   "working on [%d].label=>%s< [%d].path=>%s<\n", i,
+			   mbox[i].label, i, mbox[i].path);
 			displayMsgCounters(i, count_mail(i), &Sleep_Interval,
 							   &Blink_Mode);
-#ifdef DEBUG
-			printf("[%d].label=>%s<\n[%d].path=>%s<\n\n", i,
-				   mbox[i].label, i, mbox[i].path);
-#endif
 		}
 	}
 
@@ -207,16 +204,16 @@ void do_biff(int argc, char **argv)
 				curtime = time(0);
 				if (curtime >= mbox[i].prevtime + mbox[i].loopinterval) {
 					NeedRedraw = 1;
+					DM(&mbox[i], DEBUG_INFO,
+					   "working on [%d].label=>%s< [%d].path=>%s<\n", i,
+					   mbox[i].label, i, mbox[i].path);
+					DM(&mbox[i], DEBUG_INFO,
+					   "curtime=%d, prevtime=%d, interval=%d\n",
+					   (int) curtime, (int) mbox[i].prevtime,
+					   mbox[i].loopinterval);
 					mbox[i].prevtime = curtime;
 					displayMsgCounters(i, count_mail(i), &Sleep_Interval,
 									   &Blink_Mode);
-#ifdef DEBUG
-					printf("[%d].label=>%s<\n[%d].path=>%s<\n\n",
-						   i, mbox[i].label, i, mbox[i].path);
-					printf("curtime=%d, prevtime=%d, interval=%d\n",
-						   (int) curtime,
-						   (int) mbox[i].prevtime, mbox[i].loopinterval);
-#endif
 				}
 			}
 			if (mbox[i].blink_stat > 0) {
@@ -226,9 +223,6 @@ void do_biff(int argc, char **argv)
 				}
 				displayMsgCounters(i, 1, &Sleep_Interval, &Blink_Mode);
 				NeedRedraw = 1;
-#ifdef DEBUG
-				/*printf("i= %d, Sleep_Interval= %d\n", i, Sleep_Interval); */
-#endif
 			}
 			if (Blink_Mode == 0) {
 				mbox[i].blink_stat = 0;
@@ -476,9 +470,7 @@ int ReadLine(FILE * fp, char *setting, char *value, int *index)
 	} else
 		*index = -1;
 
-#ifdef DEBUG
-	printf("@%s.%d=%s@\n", setting, *index, value);
-#endif
+	DMA(DEBUG_INFO, "@%s.%d=%s@\n", setting, *index, value);
 	return 1;
 }
 
@@ -506,8 +498,8 @@ int Read_Config_File(char *filename, int *loopinterval)
 
 	if (!(fp = fopen(filename, "r"))) {
 		perror("Read_Config_File");
-		fprintf(stderr, "Unable to open %s, no settings read.\n",
-				filename);
+		DMA(DEBUG_ERROR, "Unable to open %s, no settings read.\n",
+			filename);
 		return 0;
 	}
 	while (!feof(fp)) {
@@ -531,6 +523,15 @@ int Read_Config_File(char *filename, int *loopinterval)
 			strcpy(mbox[index].fetchcmd, value);
 		} else if (!strcmp(setting, "fetchinterval.")) {
 			mbox[index].fetchinterval = atoi(value);
+		} else if (!strcmp(setting, "debug.")) {
+			int debug_value = debug_default;
+			if (strcasecmp(value, "all") == 0) {
+				debug_value = DEBUG_ALL;
+			}
+			/* could disable debugging, but I want the command
+			   line argument to provide all information
+			   possible. */
+			mbox[index].debug = debug_value;
 		}
 	}
 	for (index = 0; index < 5; index++)
@@ -605,20 +606,22 @@ void parse_cmd(int argc, char **argv, char *config_file)
 		if (*arg == '-') {
 			switch (arg[1]) {
 			case 'd':
-				if (strcmp(arg + 1, "display")) {
+				if (strcmp(arg + 1, "debug") == 0) {
+					debug_default = DEBUG_ALL;
+				} else if (strcmp(arg + 1, "display")) {
 					usage();
-					exit(1);
+					exit(EXIT_FAILURE);
 				}
 				break;
 			case 'g':
 				if (strcmp(arg + 1, "geometry")) {
 					usage();
-					exit(1);
+					exit(EXIT_FAILURE);
 				}
 				break;
 			case 'v':
 				printversion();
-				exit(0);
+				exit(EXIT_SUCCESS);
 				break;
 			case 'c':
 				if (argc > (i + 1)) {
@@ -628,7 +631,7 @@ void parse_cmd(int argc, char **argv, char *config_file)
 				break;
 			default:
 				usage();
-				exit(0);
+				exit(EXIT_SUCCESS);
 				break;
 			}
 		}
@@ -638,26 +641,22 @@ void parse_cmd(int argc, char **argv, char *config_file)
 
 void usage(void)
 {
-	fprintf(stderr,
-			"\nwmBiff v" WMBIFF_VERSION
-			" - incoming mail checker\n"
-			"Gennady Belyakov <gb at ccat.elect.ru> and others (see the README file)\n"
-			"\n");
-	fprintf(stderr, "usage:\n");
-	fprintf(stderr, "    -display <display name>\n");
-	fprintf(stderr,
-			"    -geometry +XPOS+YPOS      initial window position\n");
-	fprintf(stderr,
-			"    -c <filename>             use specified config file\n");
-	fprintf(stderr, "    -h                        this help screen\n");
-	fprintf(stderr,
-			"    -v                        print the version number\n");
-	fprintf(stderr, "\n");
+	printf("\nwmBiff v" WMBIFF_VERSION
+		   " - incoming mail checker\n"
+		   "Gennady Belyakov <gb at ccat.elect.ru> and others (see the README file)\n"
+		   "\n"
+		   "usage:\n"
+		   "    -display <display name>\n"
+		   "    -geometry +XPOS+YPOS      initial window position\n"
+		   "    -c <filename>             use specified config file\n"
+		   "    -h                        this help screen\n"
+		   "    -v                        print the version number\n"
+		   "\n");
 }
 
 void printversion(void)
 {
-	fprintf(stderr, "wmbiff v%s\n", WMBIFF_VERSION);
+	printf("wmbiff v%s\n", WMBIFF_VERSION);
 }
 
 /* vim:set ts=4: */
diff --git a/wmbiff/wmbiffrc.5 b/wmbiff/wmbiffrc.5
index 318122d..b46927c 100644
--- a/wmbiff/wmbiffrc.5
+++ b/wmbiff/wmbiffrc.5
@@ -1,5 +1,5 @@
 .\" Hey, Emacs!  This is an -*- nroff -*- source file.
-.\" $Id: wmbiffrc.5,v 1.8 2002/01/27 12:46:38 jordi Exp $
+.\" $Id: wmbiffrc.5,v 1.9 2002/03/01 08:41:29 bluehal Exp $
 .\"
 .\" wmbiff.1 and wmbiffrc.5 are copyright 1999-2002 by 
 .\" Jordi Mallach <jordi at debian.org>
@@ -126,6 +126,12 @@ in seconds.
 \fBfetchcmd.n\fP
 Command to be executed to fetch mail. If not specified, fetching through
 wmbiff is disabled completely.
+.TP
+\fBdebug.n\fP 
+Show debugging messages from this mailbox.  Currently
+supported values are "all" and "none".  The \-debug option
+to wmbiff overrides this setting.  Since IMAP uses a single
+connection per server, per-mailbox debugging may not
 
 .SH AUTHENTICATION
 
@@ -144,6 +150,17 @@ methods.  Leaving authentication methods unspecified should
 be reasonably safe.  The order of entries in the [auth] list
 is not currently considered.
 
+.SH TROUBLESHOOTING
+
+For problems authenticating to servers, try specifying the
+authentication method explicitly as described above:
+sometimes a failed attempt to authenticate can cause later
+failures.  Some servers claim to support cram-md5 but fail:
+telling wmbiff not totry can help.
+
+For other problems, run wmbiff with the -debug option.  See
+wmbiff(1) for details.
+
 .SH FILES
 .TP
 .I ~/.wmbiffrc

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git



More information about the Pkg-wmaker-commits mailing list