2.3: "paused" nntp channels FIXED!

Heath Kehoe heath.kehoe at intermec.com
Thu Apr 13 09:21:12 UTC 2000


This patch fixes these problems with RCreadfile():

 * max-connections and hold-time were not getting set to their default values.
   If you did not set them anywhere in incoming.conf, they'd wind up with
   uninitialized values.

 * If you put a hostname: and a hold-time: in the same block, it would bomb
   with 'duplicate key'.  This is because the *_CONFIG macros were wrong.
   Same would happen with streaming: and noresendid:

-heath


*** rc.c.dist	Thu Apr 13 03:40:40 2000
--- rc.c	Thu Apr 13 04:10:24 2000
***************
*** 24,41 ****
  
  #define TEST_CONFIG(a, b) \
      { \
! 	int byte, offset; \
! 	offset = a % 8; \
! 	byte = (a - offset) / 8; \
! 	b = ((peer_params.Keysetbit & (1 << offset)) != 0) ? TRUE : FALSE; \
      }
  
  #define SET_CONFIG(a) \
      { \
! 	int byte, offset; \
! 	offset = a % 8; \
! 	byte = (a - offset) / 8; \
! 	peer_params.Keysetbit |= (1 << offset); \
      }
  
  /*
--- 24,35 ----
  
  #define TEST_CONFIG(a, b) \
      { \
! 	b = ((peer_params.Keysetbit & (1 << a)) != 0) ? TRUE : FALSE; \
      }
  
  #define SET_CONFIG(a) \
      { \
! 	peer_params.Keysetbit |= (1 << a); \
      }
  
  /*
***************
*** 792,797 ****
--- 786,796 ----
  	  groups[groupcount - 2].Pattern : default_params.Pattern;
  	group_params->Password = groupcount > 1 ?
  	  groups[groupcount - 2].Password : default_params.Password;
+ 	group_params->MaxCnx = groupcount > 1 ?
+ 	  groups[groupcount - 2].MaxCnx : default_params.MaxCnx;
+ 	group_params->HoldTime = groupcount > 1 ?
+ 	  groups[groupcount - 2].HoldTime : default_params.HoldTime;
+ 
  	if ((word = RCreaddata (&linecount, F, &toolong)) == NULL) {
  	  syslog(L_ERROR, LEFT_BRACE, LogName, filename, linecount);
  	  break;
***************
*** 840,845 ****
--- 839,849 ----
  	  group_params->Pattern : default_params.Pattern;
  	peer_params.Password = groupcount > 0 ?
  	  group_params->Password : default_params.Password;
+ 	peer_params.MaxCnx = groupcount > 0 ?
+ 	  group_params->MaxCnx : default_params.MaxCnx;
+ 	peer_params.HoldTime = groupcount > 0 ?
+ 	  group_params->HoldTime : default_params.HoldTime;
+ 
  	peer_params.Keysetbit = 0;
  
  	if ((word = RCreaddata (&linecount, F, &toolong)) == NULL)
***************
*** 1117,1122 ****
--- 1121,1127 ----
  
        /* max-connections */
        if (!strncmp (word, MAX_CONN, sizeof MAX_CONN)) {
+ 	int max;
  	DISPOSE(word);
  	TEST_CONFIG(K_MAX_CONN, bit);
          if (bit) {
***************
*** 1129,1142 ****
  	RCadddata(data, &infocount, K_MAX_CONN, T_STRING, word);
  	for (p = word; isdigit(*p) && *p != '\0'; p++);
  	if (!strcmp (word, "none") || !strcmp (word, "unlimited")) {
! 	  peer_params.MaxCnx = 0;
! 	  continue;
  	}
! 	if (*p != '\0') {
! 	  syslog(L_ERROR, MUST_BE_INT, LogName, filename, linecount);
! 	  break;
! 	}
! 	peer_params.MaxCnx = atoi(word);
  	SET_CONFIG(K_MAX_CONN);
  	continue;
        }
--- 1134,1154 ----
  	RCadddata(data, &infocount, K_MAX_CONN, T_STRING, word);
  	for (p = word; isdigit(*p) && *p != '\0'; p++);
  	if (!strcmp (word, "none") || !strcmp (word, "unlimited")) {
! 	  max = 0;
! 	} else {
! 	  if (*p != '\0') {
! 	    syslog(L_ERROR, MUST_BE_INT, LogName, filename, linecount);
! 	    break;
! 	  }
! 	  max = atoi(word);
  	}
! 	if (peer_params.Label != NULL)
! 	  peer_params.MaxCnx = max;
! 	else
! 	  if (groupcount > 0 && group_params->Label != NULL)
! 	    group_params->MaxCnx = max;
! 	  else
! 	    default_params.MaxCnx = max;
  	SET_CONFIG(K_MAX_CONN);
  	continue;
        }
***************
*** 1158,1164 ****
  	  syslog(L_ERROR, MUST_BE_INT, LogName, filename, linecount);
  	  break;
  	}
! 	peer_params.HoldTime = atoi(word);
  	SET_CONFIG(K_HOLD_TIME);
  	continue;
        }
--- 1170,1182 ----
  	  syslog(L_ERROR, MUST_BE_INT, LogName, filename, linecount);
  	  break;
  	}
! 	if (peer_params.Label != NULL)
! 	  peer_params.HoldTime = atoi(word);
! 	else
! 	  if (groupcount > 0 && group_params->Label != NULL)
! 	    group_params->HoldTime = atoi(word);
! 	  else
! 	    default_params.HoldTime = atoi(word);
  	SET_CONFIG(K_HOLD_TIME);
  	continue;
        }
***************
*** 1412,1417 ****
--- 1430,1441 ----
  	  case K_MAX_CONN:
  	    RCwritelistindent (F, inc);
  	    fprintf(F, "%s\t", MAX_CONN);
+ 	    RCwritelistvalue (F, RCpeerlistfile[i].value);
+ 	    fputc ('\n', F);
+ 	    break;
+ 	  case K_HOLD_TIME:
+ 	    RCwritelistindent (F, inc);
+ 	    fprintf(F, "%s\t", HOLD_TIME);
  	    RCwritelistvalue (F, RCpeerlistfile[i].value);
  	    fputc ('\n', F);
  	    break;




More information about the inn-workers mailing list