5 bug fixes for the nu (new user) program

Glenn Skinner glenn at nsc.UUCP
Tue Dec 4 04:27:56 AEST 1984


How embarrassing!  After posting some bug fixes to nu, I found a bug in one
of my fixes.  The bug occurs in the fix to the password locking problem.  My
fix as posted works except in the case when nu is invoked with no arguments.
In this case, it tries to unlock the password file even thoug it hasn't been
locked yet (harmless, but annoying).

A fix for the fix follows.  Apply it _after_ applying the original fix.

		-- Glenn Skinner
		National Semiconductor, Microcomputer Systems Division
		(408) 733-2600 x 335

----------------------------------------------------------------

------- nu.c -------
*** /tmp/d07963	Mon Dec  3 10:04:53 1984
--- nu.c	Mon Dec  3 09:51:20 1984
***************
*** 1386,1392
      struct passwd  *pwd;
  
      if (argc == 1)
! 	goto uusage;
      incritsect = FALSE;
      signal (SIGINT, Catch);		/* catch ^C's */
      gethostname (This_host, 100);

--- 1386,1392 -----
      struct passwd  *pwd;
  
      if (argc == 1)
! 	goto usage;
      incritsect = FALSE;
      signal (SIGINT, Catch);		/* catch ^C's */
      gethostname (This_host, 100);
***************
*** 1442,1448
      }
      unlink (StrV ("Linkfile"));
      exit (OK);
uusage: 
      fprintf (stderr,
  	    "usage:	nu -a			add new accounts\n");
      fprintf (stderr, "	nu -k user1 user2 ...	kill old accounts\n");

--- 1442,1450 -----
      }
      unlink (StrV ("Linkfile"));
      exit (OK);
uusage:
+     unlink (StrV ("Linkfile"));
+ usage:
      fprintf (stderr,
  	    "usage:	nu -a			add new accounts\n");
      fprintf (stderr, "	nu -k user1 user2 ...	kill old accounts\n");
***************
*** 1447,1452
  	    "usage:	nu -a			add new accounts\n");
      fprintf (stderr, "	nu -k user1 user2 ...	kill old accounts\n");
      fprintf (stderr, "	nu -m			modify existing accounts\n");
-     unlink (StrV ("Linkfile"));
      exit (ERROR);
  }

--- 1449,1453 -----
  	    "usage:	nu -a			add new accounts\n");
      fprintf (stderr, "	nu -k user1 user2 ...	kill old accounts\n");
      fprintf (stderr, "	nu -m			modify existing accounts\n");
      exit (ERROR);
  }



More information about the Comp.sources.bugs mailing list