Index: h/mts.h
===================================================================
RCS file: /cvs/nmh/h/mts.h,v
retrieving revision 1.1
diff -u -r1.1 mts.h
--- h/mts.h	2000/12/14 01:30:44	1.1
+++ h/mts.h	2002/05/09 23:12:59
@@ -61,6 +61,7 @@
 extern char *clientname;
 extern char *servers;
 extern char *pophost;
+extern char *usesasl;
 
 /*
  * BBoards-specific variables
Index: sbr/mts.c
===================================================================
RCS file: /cvs/nmh/sbr/mts.c,v
retrieving revision 1.1
diff -u -r1.1 mts.c
--- sbr/mts.c	2000/12/14 01:30:45	1.1
+++ sbr/mts.c	2002/05/09 23:12:59
@@ -82,6 +82,7 @@
 char *clientname = NULL;
 char *servers    = "localhost \01localnet";
 char *pophost    = "";
+char *usesasl    = NULL;
 
 /*
  * BBoards-specific variables
@@ -143,6 +144,7 @@
     { "servers", &servers },
     { "pophost", &pophost },
     { "bbdomain", &bb_domain },
+    { "sasl", &usesasl },
 
 #ifdef BPOP
     { "popbbhost", &popbbhost },
Index: uip/inc.c
===================================================================
RCS file: /cvs/nmh/uip/inc.c,v
retrieving revision 1.12
diff -u -r1.12 inc.c
--- uip/inc.c	2000/12/14 01:30:46	1.12
+++ uip/inc.c	2002/05/09 23:12:59
@@ -125,7 +125,9 @@
     { "kpop", KPOPminc (-4) },
 #define SASLSW                    24
     { "sasl", SASLminc(-4) },
-#define SASLMECHSW                25
+#define NOSASLSW                  25
+    { "nosasl", SASLminc(-6) },
+#define SASLMECHSW                26
     { "saslmech", SASLminc(-8) },
     { NULL, 0 }
 };
@@ -300,6 +302,9 @@
 	snoop++;
 #endif /* POP */
 
+    if (usesasl)
+	sasl = 1;
+
     rpop = 0;
 
     while ((cp = *argp++)) {
@@ -434,6 +439,10 @@
 	
 	    case SASLSW:
 		sasl++;
+		continue;
+	
+	    case NOSASLSW:
+		sasl--;
 		continue;
 	
 	    case SASLMECHSW:
Index: uip/msgchk.c
===================================================================
RCS file: /cvs/nmh/uip/msgchk.c,v
retrieving revision 1.9
diff -u -r1.9 msgchk.c
--- uip/msgchk.c	2000/12/14 01:30:48	1.9
+++ uip/msgchk.c	2002/05/09 23:12:59
@@ -79,7 +79,9 @@
     { "kpop", KPOPminc (-4) },
 #define SASLSW                  14
     { "sasl", SASLminc(-4) },
-#define SASLMECHSW		15
+#define NOSASLSW                15
+    { "nosasl", SASLminc(-6) },
+#define SASLMECHSW		16
     { "saslmech", SASLminc(-5) },
     { NULL, 0 }
 };
@@ -152,6 +154,9 @@
 	snoop++;
 #endif
 
+    if (usesasl)
+	sasl = 1;
+
     rpop = 0;
 
     while ((cp = *argp++)) {
@@ -227,6 +232,10 @@
 
 		case SASLSW:
 		    sasl++;
+		    continue;
+		
+		case NOSASLSW:
+		    sasl--;
 		    continue;
 		
 		case SASLMECHSW:
Index: uip/popsbr.c
===================================================================
RCS file: /cvs/nmh/uip/popsbr.c,v
retrieving revision 1.7
diff -u -r1.7 popsbr.c
--- uip/popsbr.c	2000/07/07 03:48:05	1.7
+++ uip/popsbr.c	2002/05/09 23:12:59
@@ -276,8 +276,13 @@
      * and get out a possible initial challenge
      */
 
-    result = sasl_client_start(conn, mech ? mech : server_mechs,
-			       NULL, NULL, &buf, &buflen, &chosen_mech);
+    if (mech)
+	strcpy(server_mechs, mech);
+    result = NOTOK;
+    for (mech = strtok(server_mechs, " "); result!=SASL_OK && result!=SASL_CONTINUE && mech; mech = strtok(NULL, " ")) {
+	result = sasl_client_start(conn, mech,
+				   NULL, NULL, &buf, &buflen, &chosen_mech);
+    }
 
     if (result != SASL_OK && result != SASL_CONTINUE) {
 	snprintf(response, sizeof(response), "SASL client start failed: %s",
@@ -538,7 +543,9 @@
 		if (sasl) {
 		    if (pop_auth_sasl(user, host, mech) != NOTOK)
 			return OK;
-		} else
+		    pass = NULL;
+		    ruserpass (host, &user, &pass);
+		}
 #  endif /* CYRUS_SASL */
 		if (command ("USER %s", user) != NOTOK
 		    && command ("%s %s", rpop ? "RPOP" : (pophack++, "PASS"),
Index: uip/post.c
===================================================================
RCS file: /cvs/nmh/uip/post.c,v
retrieving revision 1.12
diff -u -r1.12 post.c
--- uip/post.c	2000/12/14 01:30:48	1.12
+++ uip/post.c	2002/05/09 23:12:59
@@ -136,9 +136,11 @@
     { "queued", -6 },
 #define SASLSW                   37
     { "sasl", SASLminc(-4) },
-#define SASLMECHSW               38
+#define NOSASLSW                 38
+    { "nosasl", SASLminc(-6) },
+#define SASLMECHSW               39
     { "saslmech", SASLminc(-5) },
-#define USERSW                   39
+#define USERSW                   40
     { "user", SASLminc(-4) },
     { NULL, 0 }
 };
@@ -346,6 +348,9 @@
     mmdf_init (invo_name);
 #endif /* MMDFMTS and MMDFII */
 
+    if (usesasl)
+	sasl = 1;
+
     while ((cp = *argp++)) {
 	if (*cp == '-') {
 	    switch (smatch (++cp, switches)) {
@@ -535,6 +540,10 @@
 		
 		case SASLSW:
 		    sasl++;
+		    continue;
+		
+		case NOSASLSW:
+		    sasl--;
 		    continue;
 		
 		case SASLMECHSW:
Index: uip/send.c
===================================================================
RCS file: /cvs/nmh/uip/send.c,v
retrieving revision 1.4
diff -u -r1.4 send.c
--- uip/send.c	2000/07/07 03:48:05	1.4
+++ uip/send.c	2002/05/09 23:13:00
@@ -94,9 +94,11 @@
     { "snoop", -5 },
 #define SASLSW                37
     { "sasl", SASLminc(-4) },
-#define SASLMECHSW            38
+#define NOSASLSW              38
+    { "nosasl", SASLminc(-6) },
+#define SASLMECHSW            39
     { "saslmech", SASLminc(-5) },
-#define USERSW                39
+#define USERSW                40
     { "user", SASLminc(-4) },
     { NULL, 0 }
 };
@@ -254,6 +256,7 @@
 		case SOMLSW: 
 		case SNOOPSW: 
 		case SASLSW:
+		case NOSASLSW:
 		    vec[vecp++] = --cp;
 		    continue;
 
Index: uip/whatnowsbr.c
===================================================================
RCS file: /cvs/nmh/uip/whatnowsbr.c,v
retrieving revision 1.4
diff -u -r1.4 whatnowsbr.c
--- uip/whatnowsbr.c	2000/07/07 03:48:05	1.4
+++ uip/whatnowsbr.c	2002/05/09 23:13:00
@@ -688,9 +688,11 @@
     { "nodraftfolder", -3 },
 #define SASLSW           36
     { "sasl", SASLminc(-4) },
-#define SASLMECHSW       37
+#define NOSASLSW         37
+    { "nosasl", SASLminc(-6) },
+#define SASLMECHSW       38
     { "saslmech", SASLminc(-5) },
-#define USERSW           38
+#define USERSW           39
     { "user", SASLminc(-4) },
     { NULL, 0 }
 };
@@ -843,6 +845,7 @@
 		case SOMLSW: 
 		case SNOOPSW: 
 		case SASLSW:
+		case NOSASLSW:
 		    vec[vecp++] = --cp;
 		    continue;
 
