[4839] in Athena Bugs

home help back first fref pref prev next nref lref last post

Re: nfsc

daemon@ATHENA.MIT.EDU (John F Carr)
Sun Apr 29 18:08:20 1990

Date: Sun, 29 Apr 90 18:07:58 -0400 (EDT)
From: John F Carr <jfc@ATHENA.MIT.EDU>
To: marc@MIT.EDU
Cc: bugs@ATHENA.MIT.EDU
In-Reply-To: <9004272025.AA04170@W20-575-96.MIT.EDU>
New, improved patches for nfsc are included in this message.  This
version requires a leading '#' for userids (since there are users with
user names consisting entirely of digits).  It also includes the program
name in the warnings it prints, and prints a warning if the userid is
too large.

*** /source/bsd-4.3/common/usr.etc/nfsc/nfsc.c	Fri Apr 13 16:17:52 1990
--- nfsc.c	Sun Apr 29 18:00:44 1990
***************
*** 143,153 ****
  	case 3:
  	    break;
  	case 4:
! 	    user = getpwnam(argv[3]);
! 	    if (!user) {
! 		status = EUNKNOWNUSER;
  		goto usage;
- 	    }
  	    cuid = (rpc_gid_t)(user->pw_uid);
  	    gid = (rpc_gid_t)(user->pw_gid);
  	    break;
--- 143,150 ----
  	case 3:
  	    break;
  	case 4:
! 	    if (status = parse_user(2, argv + 2, &user))
  		goto usage;
  	    cuid = (rpc_gid_t)(user->pw_uid);
  	    gid = (rpc_gid_t)(user->pw_gid);
  	    break;
***************
*** 178,184 ****
  	credp->aup_gid = gid;
  
  	if (uid && credp->aup_uid != uid)
! 		printf("Warning: NFS bug will prevent use of this mapping\n");
  	if (nfsmapctl (NFSMC_SET, (char *) &sin, sizeof (sin),
  		           uid, credp) < 0) {
  		if (errno == ESRCH) errno = ENOMATCH;
--- 175,181 ----
  	credp->aup_gid = gid;
  
  	if (uid && credp->aup_uid != uid)
! 		printf("nfsc: warning: NFS bug may prevent use of this mapping\n");
  	if (nfsmapctl (NFSMC_SET, (char *) &sin, sizeof (sin),
  		           uid, credp) < 0) {
  		if (errno == ESRCH) errno = ENOMATCH;
***************
*** 185,191 ****
  		perror("nfsmapctl");
  	} else {
  		/* should add something to tables.. */
! 		printf("add: ");
  		print_cred(&sin.sin_addr, uid, credp, 0);
  	}
  	return;
--- 182,188 ----
  		perror("nfsmapctl");
  	} else {
  		/* should add something to tables.. */
! 		printf("nfsc: add: ");
  		print_cred(&sin.sin_addr, uid, credp, 0);
  	}
  	return;
***************
*** 194,200 ****
  #ifdef notyet
  	printf("Usage: set host [uid] user|uid { [+-]groups ... }\n");
  #else
! 	printf("Usage: set host [user|uid] user\n");
  #endif
  }
  
--- 191,197 ----
  #ifdef notyet
  	printf("Usage: set host [uid] user|uid { [+-]groups ... }\n");
  #else
! 	printf("Usage: set host [user|#uid] user\n");
  #endif
  }
  
***************
*** 394,411 ****
  
  	if (argc < 2) return ENOTENOUGHARGS;
  
! 	if (*uname == '#') uname++;
! 
! 	if (!isdigit(*uname)) {
  		*userp = getpwnam(uname);
  		if (!*userp)
  			return EUNKNOWNUSER;
  	} else {
! 		*userp = getpwuid(atoi(uname));
  		if (!*userp) {
- 			com_err("Warning", EUNKNOWNUSER, uname);
  			*userp = &st_pw;
  			(*userp)->pw_uid = atoi(uname);
  			sprintf(buf, "#%d", (*userp)->pw_uid);
  			(*userp)->pw_name = buf;
  		}
--- 391,410 ----
  
  	if (argc < 2) return ENOTENOUGHARGS;
  
! 	if (*uname != '#') {
  		*userp = getpwnam(uname);
  		if (!*userp)
  			return EUNKNOWNUSER;
  	} else {
! 		*userp = getpwuid(atoi(++uname));
  		if (!*userp) {
  			*userp = &st_pw;
  			(*userp)->pw_uid = atoi(uname);
+ 			com_err("nfsc", EUNKNOWNUSER, "(userid %d)",
+ 				(*userp)->pw_uid);
+ 			if((*userp)->pw_uid > (unsigned)(rpc_uid_t)-1)
+ 			  com_err("nfsc", EIDTOOBIG, "(userid %d)",
+ 				  (*userp)->pw_uid);
  			sprintf(buf, "#%d", (*userp)->pw_uid);
  			(*userp)->pw_name = buf;
  		}
*** /source/bsd-4.3/common/usr.etc/nfsc/Makefile	Fri Feb  9 15:42:35 1990
--- Makefile	Sun Apr 29 17:55:56 1990
***************
*** 44,50 ****
  	ls ${LIBS} ${SRCS} | \
  	sed 's/\([^ ]*\)/load("\1");/g' >saber_load.c
  
! nfsc_err.c nfsc_err.h:
  	rm -f nfsc_err.[ch]
  	compile_et nfsc_err.et
  
--- 44,50 ----
  	ls ${LIBS} ${SRCS} | \
  	sed 's/\([^ ]*\)/load("\1");/g' >saber_load.c
  
! nfsc_err.c nfsc_err.h: nfsc_err.et
  	rm -f nfsc_err.[ch]
  	compile_et nfsc_err.et
  
*** /source/bsd-4.3/common/usr.etc/nfsc/nfsc_err.et	Sun Aug  9 12:49:10 1987
--- nfsc_err.et	Sun Apr 29 17:54:51 1990
***************
*** 5,8 ****
--- 5,9 ----
  ec	ETOOMANYGRPS, "Too many groups in groups file"
  ec	ENOMATCH, "No match"
  ec	ENOTDIGIT, "Argument is not numeric"
+ ec	EIDTOOBIG, "User or group ID too large"
  end
    --John Carr (jfc@athena.mit.edu)

home help back first fref pref prev next nref lref last post