[comp.bugs.4bsd] Reno passwd

jonathan@beta.isor.vuw.ac.nz (Jonathan Stone) (06/14/91)

Subject: Reno passwd(1) broken on non-Kerberised systems
Index: /usr/src/usr.bin/passwd.c

Description:
	On a Kerberos-less system, the distributed passwd() will not
	allow a user to change their own password.  Furthermore,
	it will not let the superuser change their or anyone else's
	password.

Repeat-By:
	Issue the passwd command from the shell, as in the examples below:

	    Script started on Fri Jun 14 13:55:37 1991
	    nikau> # try and change my own password
	    #: Command not found.
	    nikau> passwd
	    passwd: unknown user passwd.
	    nikau> passwd jonathan
	    usage: passwd user
	    nikau> su
	    Password:
	    nikau# passwd jonathan
	    usage: passwd user
	    nikau# passwd
	    passwd: unknown user passwd.
	    nikau# exit
	    nikau> exit
	    Script done on Fri Jun 14 13:57:35 1991

Fix:
	At least for systems not running Kerberos, apply
	the following patch, and rebuild install /usr/bin/passwd.
	An error message for the "-l" switch coul be added
	according to taste.

*** /usr/src/usr.bin/passwd/passwd.c	Wed Jun 20 12:05:46 1990
--- /usr/vuw/passwd.c	Sat Jun  8 03:10:41 1991
***************
*** 73,84 ****
  	uid = getuid();
  	uname = getlogin();
  
- #ifdef	KERBEROS
  	while ((ch = getopt(argc, argv, ARGSTR)) != EOF)
  		switch (ch) {
  		/* change local password file */
  		case 'l':
  			use_kerberos = 0;
  			break;
  		default:
  		case '?':
--- 73,85 ----
  	uid = getuid();
  	uname = getlogin();
  
  	while ((ch = getopt(argc, argv, ARGSTR)) != EOF)
  		switch (ch) {
  		/* change local password file */
  		case 'l':
+ #ifdef	KERBEROS
  			use_kerberos = 0;
+ #endif
  			break;
  		default:
  		case '?':
***************
*** 88,94 ****
  
  	argc -= optind;
  	argv += optind;
- #endif
  
  	switch(argc) {
  	case 0:
--- 89,94 ----