[comp.sources.d] NN 6.3 -- Official patch #6

storm@texas.dk (Kim F. Storm) (09/11/89)

This is patch #6 for nn release 6.3.

Well, patch #5 did not keep the title as the last official patch
to nn 6.3 for long.

This patch is needed with the Cnews patches from 22-Aug-89, because
Cnews will now update the min field in a different way than Bnews:

	When the group is empty, the min field will be one greater
	than the last article field.

Thanks to Wayne Davidson for the necessary fix (he also provided the
necessary patches to Cnews which are included in the 22-Aug-89 patches).

Cnews also has a different date format than Bnews which may lead to
improperly sorted menus.  Thanks to P{r Emanuelsson for recognizing
this.  However, time zones are still not recognized in dates, so the
ordering may still be slightly wrong.

This patch also fixes a few other problems in nnadmin.

A few patches needed for 286 support are also included.  These have
previously been circulated on the net as unofficial patches (from 
Wietse Z. Venema).

And finally: The missing check for the buffer overrun in pack_date.c
is fixed.  Thank you to all those who went through the efforts to
track this nasty problem down.


++Kim Storm

*** /usr/storm/nn6.3.5/patchlevel.h	Tue Aug 22 13:19:44 1989
--- patchlevel.h	Fri Aug 25 13:15:33 1989
***************
*** 13,19 ****
   *	1989-06-30:  Patch 3: several files
   *	1989-07-10:  Patch 4: several files
   *	1989-08-22:  Patch 5: db.c
   */
  
! #define PATCHLEVEL 5
  
--- 13,20 ----
   *	1989-06-30:  Patch 3: several files
   *	1989-07-10:  Patch 4: several files
   *	1989-08-22:  Patch 5: db.c
+  *	1989-08-25:  Patch 6: admin.c pack_date.c pack_name.c ...
   */
  
! #define PATCHLEVEL 6
  

*** /usr/storm/nn6.3.4/admin.c	Mon Jul 10 13:36:01 1989
--- admin.c	Fri Aug 25 11:22:39 1989
***************
*** 95,101 ****
      
      for (;;) {
  	switch(get_cmd(
! "\nU)pdate W)akeup M)aster G)roups L)og S)tat C)onf E)xpire I)nit V)alidate Q)uit",
  "ADMIN")) {
  	    
  	 case 'M':
--- 95,101 ----
      
      for (;;) {
  	switch(get_cmd(
! "\nC)onf E)xpire G)roups I)nit L)og M)aster Q)uit S)tat U)pdate V)alidate W)akeup",
  "ADMIN")) {
  	    
  	 case 'M':
***************
*** 190,196 ****
  
      for (;;) {
  	switch (c = get_cmd(
! "\nG)roup A)ll E)mpty N)on-empty F)iles O)ptions S)tat T)race K)ill",
  "MASTER")) {
  
  	 case 'G':
--- 190,196 ----
  
      for (;;) {
  	switch (c = get_cmd(
! "\nA)ll E)mpty F)iles G)roup K)ill N)on-empty O)ptions S)tat T)race",
  "MASTER")) {
  
  	 case 'G':
***************
*** 222,231 ****
  
  	 case 'O':
  	    c = get_cmd("r)epeat_delay  e)xpire_level", "OPTION");
! 	    if (c != 'r' && c != 'e') break;
  	    value = get_entry("Option value", 1L, 10000L);
  	    if (value < 0) break;
! 	    send_master(c, value, 0L);
  	    break;
  	    
  	 case 'S':
--- 222,231 ----
  
  	 case 'O':
  	    c = get_cmd("r)epeat_delay  e)xpire_level", "OPTION");
! 	    if (c != 'R' && c != 'E') break;
  	    value = get_entry("Option value", 1L, 10000L);
  	    if (value < 0) break;
! 	    send_master(tolower(c), value, 0L);
  	    break;
  	    
  	 case 'S':
***************
*** 260,266 ****
   loop:
  
      c = get_cmd(
! "\nE)rrors R)eports C)ollect e(X)pire A)dmin G)roup (1-9)tail (*)all (@)clean",
  "LOG");
      
      if (c < SP || c == 'Q') return;
--- 260,266 ----
   loop:
  
      c = get_cmd(
! "\n(1-9)tail A)dmin C)ollect E)rrors G)roup R)eports e(X)pire (*)all (@)clean",
  "LOG");
      
      if (c < SP || c == 'Q') return;
***************
*** 341,347 ****
   
      for (;;) {
  	switch (get_cmd(
! "\nD)ata H)eader F)iles S)et_flag C)lear_flag E)xpire R)ecollect G)roup",
  "GROUP")) {
  	 case 'D':
  	    dump_group(gh, 0);
--- 341,347 ----
   
      for (;;) {
  	switch (get_cmd(
! "\nC)lear_flag D)ata E)xpire F)iles G)roup H)eader S)et_flag R)ecollect",
  "GROUP")) {
  	 case 'D':
  	    dump_group(gh, 0);
***************
*** 930,936 ****
  	    continue;
  	}
  	
! 	if (gh->first_article > gh->last_l_article ||
  	    gh->last_l_article  > gh->last_article || 
  	    gh->first_l_article > gh->first_article) {
  
--- 930,936 ----
  	    continue;
  	}
  	
! 	if (gh->first_article > (gh->last_l_article + 1) ||
  	    gh->last_l_article  > gh->last_article || 
  	    gh->first_l_article > gh->first_article) {
  

*** /usr/storm/nn6.3.0/pack_date.c	Thu Jun  1 11:11:00 1989
--- pack_date.c	Mon Jul 17 21:10:04 1989
***************
*** 10,16 ****
   *	The result is NOT a time_t value, i.e. ctime() will
   *	not produce the original Date string.
   *
!  *	The date must have format:  [D]D Mmm YY hh:mm:ss GMT
   */
  
  pack_date(destp, date)
--- 10,16 ----
   *	The result is NOT a time_t value, i.e. ctime() will
   *	not produce the original Date string.
   *
!  *	The date must have format:  [...,] [D]D Mmm YY hh:mm:ss GMT
   */
  
  pack_date(destp, date)
***************
*** 17,42 ****
  time_stamp *destp;
  char *date;
  {
!     time_stamp res;
      register int min, hour, day, mon, year;
! 
      *destp = 0;
      if (date == NULL) return;
      
      if ((day = next_int(&date)) == 0) return;
      
!     switch (*date) {
       case 'J':
! 	if (date[1] == 'a') { mon = 0; break; }
! 	if (date[2] == 'n') { mon = 5; break; }
  	mon = 6; break;
       case 'F':
  	mon = 1; break;
       case 'M':
! 	if (date[2] == 'r') { mon = 2; break; }
  	mon = 4; break;
       case 'A':
! 	if (date[1] == 'p') { mon = 3; break; }
  	mon = 7; break;
       case 'S':
  	mon = 8; break;
--- 17,44 ----
  time_stamp *destp;
  char *date;
  {
!     register time_stamp res;
      register int min, hour, day, mon, year;
!     
      *destp = 0;
      if (date == NULL) return;
      
      if ((day = next_int(&date)) == 0) return;
+ 
+     while (*date && isspace(*date)) date++;
      
!     switch (*date++) {
       case 'J':
! 	if (*date++ == 'a') { mon = 0; break; }
! 	if (*date++ == 'n') { mon = 5; break; }
  	mon = 6; break;
       case 'F':
  	mon = 1; break;
       case 'M':
! 	if (*++date == 'r') { mon = 2; break; }
  	mon = 4; break;
       case 'A':
! 	if (*date++ == 'p') { mon = 3; break; }
  	mon = 7; break;
       case 'S':
  	mon = 8; break;
***************
*** 50,57 ****
  	return;
      }
      
-     date += 4;
-     
      year = next_int(&date);
      hour = next_int(&date);
      min = next_int(&date);
--- 52,57 ----
***************
*** 72,84 ****
  {
      register char *str = *dp;
      register i;
      
      i = 0;
      while (*str && isdigit(*str))
  	i = (i * 10) + *str++ - '0';
  	
-     while (*str && (isspace(*str) || *str == ':')) str++;
- 
      *dp = str;
      return i;
  }
--- 72,84 ----
  {
      register char *str = *dp;
      register i;
+ 
+     while (*str && !isdigit(*str)) str++;
      
      i = 0;
      while (*str && isdigit(*str))
  	i = (i * 10) + *str++ - '0';
  	
      *dp = str;
      return i;
  }
*** /usr/storm/nn6.3.0/pack_name.c	Thu Jun  1 11:11:00 1989
--- pack_name.c	Mon Sep 11 12:37:16 1989
***************
*** 183,188 ****
--- 183,189 ----
  	return 0;
  
      p = source, q = namebuf, n = 0;
+     maxq = namebuf + sizeof namebuf - 1;
      
  new_partition:
      for (i = SEP_MAXIMUM; --i >= 0; separator[i] = NULL);
***************
*** 211,216 ****
--- 212,218 ----
  	    continue;
  	}
  	if (n > 1) continue;
+ 	if (q >= maxq) break;
  	*q++ = c;
  	if (IS_SEPARATOR(c)) {
  	    switch (sep = (Class[c] & 0xff)) {
*** ./sequence.c-	Tue Jul 11 21:38:23 1989
--- ./sequence.c	Tue Jul 11 22:13:10 1989
***************
*** 363,369 ****
  
  static faked_entry(name, flag)
  char *name;
! int flag;
  {
      group_header *gh;
      
--- 363,369 ----
  
  static faked_entry(name, flag)
  char *name;
! int32 flag;
  {
      group_header *gh;
      
*** ./rc.c-	Tue Jul 11 21:38:16 1989
--- ./rc.c	Tue Jul 11 22:13:09 1989
***************
*** 443,449 ****
  	gh->group_flag &= ~G_UNREAD_COUNT;
      }    
  	
!     return was_unread;
  }
  
  
--- 443,449 ----
  	gh->group_flag &= ~G_UNREAD_COUNT;
      }    
  	
!     return (was_unread != 0);
  }
  
  
*** ./articles.c-	Tue Jul 11 21:36:58 1989
--- ./articles.c	Tue Jul 11 22:36:27 1989
***************
*** 225,231 ****
  	    max_articles += NEXT_ART_ARRAY_SIZE;
  	}
  	art_array = (article_header **)
! 	    calloc(max_articles, sizeof(article_header **));
  	mem_check((char *)art_array, (int)max_articles, "article headers");
  	while (--n >= 0) art_array[n] = *--articles;
  	articles = art_array + mem_offset;
--- 225,231 ----
  	    max_articles += NEXT_ART_ARRAY_SIZE;
  	}
  	art_array = (article_header **)
! 	    calloc((unsigned)max_articles, sizeof(article_header **));
  	mem_check((char *)art_array, (int)max_articles, "article headers");
  	while (--n >= 0) art_array[n] = *--articles;
  	articles = art_array + mem_offset;


-- 
Kim F. Storm        storm@texas.dk        Tel +45 429 174 00
Texas Instruments, Marielundvej 46E, DK-2730 Herlev, Denmark
	  No news is good news, but nn is better!