-/* $OpenBSD: getgrent.c,v 1.49 2022/07/17 03:10:47 deraadt Exp $ */
+/* $OpenBSD: getgrent.c,v 1.50 2022/08/02 17:00:15 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
}
#ifdef YP
if (line[0] == '+' || line[0] == '-') {
- if (__ypdomain == NULL &&
- yp_get_default_domain(&__ypdomain))
- goto parse;
- switch (yp_bind(__ypdomain)) {
- case 0:
- break;
- case YPERR_BADARGS:
- case YPERR_YPBIND:
- goto parse;
- default:
- return 0;
- }
+ if (!__ypdomain)
+ yp_get_default_domain(&__ypdomain);
}
if (line[0] == '+') {
switch (line[1]) {
-/* $OpenBSD: getgrouplist.c,v 1.29 2022/07/17 03:10:47 deraadt Exp $ */
+/* $OpenBSD: getgrouplist.c,v 1.30 2022/08/02 17:00:15 deraadt Exp $ */
/*
* Copyright (c) 2008 Ingo Schwarze <schwarze@usta.de>
* Copyright (c) 1991, 1993
}
/* Only access YP when there is no static entry. */
- if (!yp_bind(__ypdomain) &&
- !yp_match(__ypdomain, "netid.byname", key,
- (int)strlen(key), &ypdata, &ypdatalen))
+ if (!yp_match(__ypdomain, "netid.byname", key,
+ (int)strlen(key), &ypdata, &ypdatalen))
if (_parse_netid(ypdata, pwstore.pw_uid,
groups, &ngroups, maxgroups) == -1)
ret = -1;
-/* $OpenBSD: getnetgrent.c,v 1.28 2016/09/24 12:43:37 millert Exp $ */
+/* $OpenBSD: getnetgrent.c,v 1.29 2022/08/02 17:00:15 deraadt Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
{
struct stringlist *sl;
#ifdef YP
- char *line;
+ static char *__ypdomain;
+ char *line = NULL;
#endif
char *ng_copy, *ypdom = NULL;
* We use yp if there is a "+" in the netgroup file, or if there is
* no netgroup file at all
*/
- if (_ng_db == NULL || lookup(NULL, "+", &line, _NG_KEYBYNAME) == 0)
- yp_get_default_domain(&ypdom);
- else
- free(line);
+ if (_ng_db == NULL || lookup(NULL, "+", &line, _NG_KEYBYNAME) == 0) {
+ if (!__ypdomain)
+ yp_get_default_domain(&__ypdomain);
+ ypdom = __ypdomain;
+ }
+ free(line);
#endif
ng_copy = strdup(ng);
if (ng_copy != NULL)
int
innetgr(const char *grp, const char *host, const char *user, const char *domain)
{
- char *ypdom = NULL, *grpdup;
+ char *ypdom = NULL, *grpdup;
#ifdef YP
- char *line = NULL;
+ static char *__ypdomain;
+ char *line = NULL;
#endif
int found;
struct stringlist *sl;
* We use yp if there is a "+" in the netgroup file, or if there is
* no netgroup file at all
*/
- if (_ng_db == NULL)
- yp_get_default_domain(&ypdom);
- else if (lookup(NULL, "+", &line, _NG_KEYBYNAME) == 0)
- yp_get_default_domain(&ypdom);
+ if (_ng_db == NULL || lookup(NULL, "+", &line, _NG_KEYBYNAME) == 0) {
+ if (!__ypdomain)
+ yp_get_default_domain(&__ypdomain);
+ ypdom = __ypdomain;
+ }
free(line);
#endif
-/* $OpenBSD: getpwent.c,v 1.65 2022/07/17 03:10:47 deraadt Exp $ */
+/* $OpenBSD: getpwent.c,v 1.66 2022/08/02 17:00:15 deraadt Exp $ */
/*
* Copyright (c) 2008 Theo de Raadt
* Copyright (c) 1988, 1993
int keylen, datalen, r, s;
char *key, *data = NULL;
- if (!__ypdomain) {
- if (_yp_check(&__ypdomain) == 0) {
- __ypmode = YPMODE_NONE;
- goto again;
- }
- }
+ if (!__ypdomain)
+ yp_get_default_domain(&__ypdomain);
switch (__ypmode) {
case YPMODE_FULL:
if (__ypcurrent) {
return (checked);
}
- if (!__ypdomain) {
- if (_yp_check(&__ypdomain) == 0) {
- saved_uid = uid;
- saved_euid = euid;
- checked = 0;
- return (checked); /* No domain. */
- }
- }
+ if (!__ypdomain)
+ yp_get_default_domain(&__ypdomain);
if (yp_first(__ypdomain, "master.passwd.byname",
&key, &keylen, &result, &resultlen)) {
break;
switch (pw->pw_name[0]) {
case '+':
- if (!__ypdomain) {
- if (_yp_check(&__ypdomain) == 0)
- continue;
- }
+ if (!__ypdomain)
+ yp_get_default_domain(&__ypdomain);
__ypproto_set(pw, &__yppbuf, *flagsp, &yp_pw_flags);
if (!map) {
if (lookup == LOOKUP_BYNAME) {