diff -ur slrn-0.9.7.2.orig/src/nntplib.c slrn-0.9.7.2/src/nntplib.c
--- slrn-0.9.7.2.orig/src/nntplib.c	Mon Aug 20 18:02:26 2001
+++ slrn-0.9.7.2/src/nntplib.c	Thu Aug 30 14:07:11 2001
@@ -462,7 +462,7 @@
 
    s->init_state = 1;
    s->number_bytes_received = 0;
-   NNTP_Try_Authentication = 1;
+   NNTP_Try_Authentication = 2;
    
    /* Read logon message. */
    switch (nntp_get_server_response (s))
@@ -829,20 +829,36 @@
 	break;
      }
 
+   if (NNTP_Try_Authentication == 2)
+     NNTP_Try_Authentication = 1;
    return s->code;
 }
 
 int nntp_refresh_groups (NNTP_Type *s, Slrn_Group_Range_Type *gr, int n)
 {
-   int reconnect, i, max_tries = 3;
+   int reconnect, i, prev = 0, max_tries = 3;
    
    start_over:
+   
+   /* If we might still need authentication, use nntp_select_group first. */
+   if ((NNTP_Try_Authentication == 2) && n)
+     {
+	int status;
+	NNTP_Try_Authentication = 1;
+	
+	status = nntp_select_group (s, gr->name, &(gr->min), &(gr->max));
+	if (status == -1) return -1;
+	else if (status == ERR_NOGROUP)
+	  gr->min = -1;
+	n--; gr++;
+     }
+   
    max_tries--;
    reconnect = s->flags & NNTP_RECONNECT_OK;
    s->flags &= ~NNTP_RECONNECT_OK;
    /* disallow reconnect for the moment as we batch commands */
    
-   i = 0;
+   i = prev;
    while (i < n)
      {
 	if (-1 == nntp_start_server_vcmd (s, "GROUP %s", gr[i].name))
@@ -854,10 +870,11 @@
 	  }
 	i++;
      }
-   i = 0;
+   i = prev;
    while (i < n)
      {
 	int estim;
+	prev = i;
 	switch (nntp_get_server_response (s))
 	  {
 	   case -1:
@@ -866,11 +883,30 @@
 	       return -1;
 	     goto start_over;
 	     
+	   case ERR_NOAUTH:
+	     s->flags |= reconnect;
+	     while (++i < n)
+	       nntp_get_server_response (s);
+	     if (NNTP_Try_Authentication)
+	       {
+		  NNTP_Try_Authentication = 0;
+		  if (-1 == nntp_authorization (s))
+		    return -1;
+		  max_tries++;
+		  goto start_over;
+	       }
+	     else
+	       return -1;
+	     
 	   case OK_GROUP:
 	     if (3 != sscanf (s->rspbuf + 4, "%d %d %d", &estim,
 			      &(gr[i].min), &(gr[i].max)))
-	       return -1;
-	     
+	       {
+		  s->flags |= reconnect;
+		  while (++i < n)
+		    nntp_get_server_response (s);
+		  return -1;
+	       }
 	     slrn_strncpy (s->group_name, gr[i].name, NNTP_MAX_GROUP_NAME_LEN);
 	     break;
 	     
