1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-24 06:04:47 +00:00

Inside libc, getpwent.c does not use dbopen() and instead uses unexported

db functions.  The copy of the code outside libc, must use dbopen().
-DFORCE_DBOPEN was used with #ifdef, but now that the file is an edited copy
that is no longer neccessary.
This commit is contained in:
deraadt
2026-03-09 12:56:12 +00:00
parent 87c4221f9b
commit c1317b35bd
4 changed files with 11 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: getpwent.c,v 1.69 2026/03/09 12:22:44 deraadt Exp $ */
/* $OpenBSD: getpwent.c,v 1.70 2026/03/09 12:56:12 deraadt Exp $ */
/*
* Copyright (c) 2008 Theo de Raadt
* Copyright (c) 1988, 1993
@@ -960,20 +960,11 @@ __initdb(int shadow)
__ypmode = YPMODE_NONE;
__getpwent_has_yppw = -1;
#endif
if (shadow) {
#ifdef FORCE_DBOPEN
_pw_db = dbopen(_PATH_SMP_DB, O_RDONLY, 0, DB_HASH, NULL);
#else
if (shadow)
_pw_db = __hash_open(_PATH_SMP_DB, -1, O_RDONLY, 0, NULL, 0);
#endif
}
if (!_pw_db) {
#ifdef FORCE_DBOPEN
_pw_db = dbopen(_PATH_MP_DB, O_RDONLY, 0, DB_HASH, NULL);
#else
_pw_db = __hash_open(_PATH_MP_DB, -1, O_RDONLY, 0, NULL, 0);
#endif
}
if (!_pw_db)
_pw_db = __hash_open(_PATH_MP_DB, -1, O_RDONLY, 0, NULL, 0);
if (_pw_db) {
errno = saved_errno;
return (1);

View File

@@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.17 2026/03/07 18:20:25 deraadt Exp $
# $OpenBSD: Makefile,v 1.18 2026/03/09 12:56:12 deraadt Exp $
.include <bsd.own.mk>
@@ -7,7 +7,6 @@ SRCS= chpass.c edit.c field.c table.c util.c getpwent.c
BINOWN= root
BINMODE=4555
LINKS= ${BINDIR}/chpass ${BINDIR}/chfn ${BINDIR}/chpass ${BINDIR}/chsh
CFLAGS+=-DFORCE_DBOPEN
DPADD+= ${LIBUTIL}
LDADD+= -lutil

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: getpwent.c,v 1.2 2026/03/07 18:15:49 deraadt Exp $ */
/* $OpenBSD: getpwent.c,v 1.3 2026/03/09 12:56:12 deraadt Exp $ */
/*
* Copyright (c) 2008 Theo de Raadt
* Copyright (c) 1988, 1993
@@ -370,20 +370,10 @@ __initdb(int shadow)
static int warned;
int saved_errno = errno;
if (shadow) {
#ifdef FORCE_DBOPEN
if (shadow)
_pw_db = dbopen(_PATH_SMP_DB, O_RDONLY, 0, DB_HASH, NULL);
#else
_pw_db = __hash_open(_PATH_SMP_DB, O_RDONLY, 0, NULL, 0);
#endif
}
if (!_pw_db) {
#ifdef FORCE_DBOPEN
if (!_pw_db)
_pw_db = dbopen(_PATH_MP_DB, O_RDONLY, 0, DB_HASH, NULL);
#else
_pw_db = __hash_open(_PATH_MP_DB, O_RDONLY, 0, NULL, 0);
#endif
}
if (_pw_db) {
errno = saved_errno;

View File

@@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.43 2026/03/07 18:20:26 deraadt Exp $
# $OpenBSD: Makefile,v 1.44 2026/03/09 12:56:12 deraadt Exp $
.include <bsd.own.mk>
@@ -8,7 +8,7 @@ SRCS= local_passwd.c passwd.c getpwent.c \
.PATH: ${.CURDIR}/../chpass
DPADD+= ${LIBRPCSVC} ${LIBUTIL}
LDADD+= -lrpcsvc -lutil
CFLAGS+= -I${.CURDIR} -DFORCE_DBOPEN
CFLAGS+= -I${.CURDIR}
BINMODE=4555
BINOWN=root