diff options
| author | Bill Paul <wpaul@FreeBSD.org> | 1995-04-14 14:56:28 +0000 | 
|---|---|---|
| committer | Bill Paul <wpaul@FreeBSD.org> | 1995-04-14 14:56:28 +0000 | 
| commit | c98fda6ec826c5d62abbeb03efb382e5c700ab51 (patch) | |
| tree | 9b493b33bde5b4a444daac86b00436dee818d5b6 /lib | |
| parent | 09a901eb605300b89bcf4fdeac655a5320aec356 (diff) | |
Notes
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libc/gen/getpwent.c | 10 | 
1 files changed, 8 insertions, 2 deletions
| diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index 7c693e38c56f..b8f1b19b0b61 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -604,7 +604,7 @@ _getyppass(struct passwd *pw, const char *name, const char *map)  	if(resultlen >= sizeof resultbuf) return 0;  	strcpy(resultbuf, result);  	sprintf (user, "%.*s", (strchr(result, ':') - result), result); -	_pw_passwd.pw_fields = 0; +	_pw_passwd.pw_fields = -1; /* Impossible value */  	if (_minuscnt && _minushead) {  		m = _minushead;  		while (m) { @@ -633,6 +633,9 @@ _getyppass(struct passwd *pw, const char *name, const char *map)  		}  	}  	free(result); +	/* No hits in the plus or minus lists: Bzzt! reject. */ +	if (_pw_passwd.pw_fields == -1) +		return(0);  	result = resultbuf;  	_pw_breakout_yp(pw, resultbuf, gotmaster); @@ -694,7 +697,7 @@ unpack:  		strcpy(resultbuf, result);  		sprintf(user, "%.*s", (strchr(result, ':') - result), result); -		_pw_passwd.pw_fields = 0; +		_pw_passwd.pw_fields = -1; /* Impossible value */  		if (_minuscnt && _minushead) {  			m = _minushead;  			while (m) { @@ -723,6 +726,9 @@ unpack:  			}  		}  		free(result); +		/* No plus or minus hits: Bzzzt! reject. */ +		if (_pw_passwd.pw_fields == -1) +			goto tryagain;  		if(result = strchr(resultbuf, '\n')) *result = '\0';  		_pw_breakout_yp(pw, resultbuf, gotmaster);  	} | 
