From patchwork Fri Mar 20 20:43:17 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 132111 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 157F64C900C3 for ; Fri, 20 Mar 2026 20:46:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 157F64C900C3 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HD8CK5HE X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 6EE724C31843 for ; Fri, 20 Mar 2026 20:43:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6EE724C31843 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6EE724C31843 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774039403; cv=none; b=gViyB6NXG0/ZXh0ZCZZUJP+zS0fHgNjaI/G/zRKv6fGVYPkLcfGu9fHxB6/UgsMYGRg1mMc3R7pkVyEGjjemN2gq4HJTN5JtyvOOSKEy5eOX0nksrjwyuv4+eBiPV4VPJdvmMBrtIbi53RCZzy6l4gasjq7PQaIFwNQT7bLsODI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774039403; c=relaxed/simple; bh=wca09xcUQ55HGDhaM36WCYTIqCWM9wJmMd4HLkfR4P4=; h=DKIM-Signature:From:To:Subject:Message-ID:Date:MIME-Version; b=SBtQapYy+88z5LAQaLpsDtLKknybeHFzZHH9Yx3nr4U7o8d3Z5dL1aaI9yidcV5mLMcmTs6+jKKkUq8kzNQO3aQSulBIjAf5oNmsWT95YVzWf3R8TkqaqTC7orzOvTUyHJD/rNf34UnVFe+8JXd0axPJBFTek0jtpGUIryKuWnc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6EE724C31843 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774039403; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ktSoUe5Mv5wbOd0Tr1e1Aw87PdVzGfxM2KnTsFoKJvA=; b=HD8CK5HELNKdyG+BAyO9TNCUSr5L+ZgC5XXGxWqC6Q//qiPmklT0y/DHRGcCBad+bEUHDl FhU5Yr8b5g2kruZyTpvH5DFAvUc85BOTn7UZxEt9crPN57VTLeGn1akINqg9qFfvgYH5xr JHanpCTviQ+xEz3LnIm0YbDGj87HXIY= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-287-7zVFspqJNBuQE5CqB85ycw-1; Fri, 20 Mar 2026 16:43:21 -0400 X-MC-Unique: 7zVFspqJNBuQE5CqB85ycw-1 X-Mimecast-MFC-AGG-ID: 7zVFspqJNBuQE5CqB85ycw_1774039400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A300B180047F for ; Fri, 20 Mar 2026 20:43:20 +0000 (UTC) Received: from fweimer-oldenburg.csb.redhat.com (unknown [10.45.224.63]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id ED91D1953944 for ; Fri, 20 Mar 2026 20:43:19 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH v2 22/23] nscd: Remove most of the rebuilds of existing libc functions In-Reply-To: Message-ID: References: X-From-Line: a43dcac8810f29ab99ee968ffcd0bbfa86cf0fff Mon Sep 17 00:00:00 2001 Date: Fri, 20 Mar 2026 21:43:17 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: mEBScQb7vPXVbyAGjIwL4lkHkpwLmCA90s6LQ3Jpwec_1774039400 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_NONE, TXREP, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org With __nscd_disable_database, the databases are already disabled. Keep the struct hostent functions because the *2_r and *3_r variants are not exported from libc. Reviewed-by: Carlos O'Donell --- nscd/Makefile | 6 ------ nscd/getgrgid_r.c | 34 ---------------------------------- nscd/getgrnam_r.c | 33 --------------------------------- nscd/getpwnam_r.c | 30 ------------------------------ nscd/getpwuid_r.c | 30 ------------------------------ nscd/getsrvbynm_r.c | 29 ----------------------------- nscd/getsrvbypt_r.c | 29 ----------------------------- nscd/grpcache.c | 4 ++-- nscd/pwdcache.c | 4 ++-- nscd/servicescache.c | 4 ++-- 10 files changed, 6 insertions(+), 197 deletions(-) delete mode 100644 nscd/getgrgid_r.c delete mode 100644 nscd/getgrnam_r.c delete mode 100644 nscd/getpwnam_r.c delete mode 100644 nscd/getpwuid_r.c delete mode 100644 nscd/getsrvbynm_r.c delete mode 100644 nscd/getsrvbypt_r.c diff --git a/nscd/Makefile b/nscd/Makefile index 2578b00e27..58a2d01e00 100644 --- a/nscd/Makefile +++ b/nscd/Makefile @@ -46,14 +46,8 @@ nscd-modules := \ cachedumper \ connections \ dbg_log \ - getgrgid_r \ - getgrnam_r \ gethstbyad_r \ gethstbynm3_r \ - getpwnam_r \ - getpwuid_r \ - getsrvbynm_r \ - getsrvbypt_r \ grpcache \ hstcache \ initgrcache \ diff --git a/nscd/getgrgid_r.c b/nscd/getgrgid_r.c deleted file mode 100644 index 3fa0717d88..0000000000 --- a/nscd/getgrgid_r.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1996-2026 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ - -#include - -#include - -#define LOOKUP_TYPE struct group -#define FUNCTION_NAME getgrgid -#define DATABASE_NAME group -#define ADD_PARAMS gid_t gid -#define ADD_VARIABLES gid -#define BUFLEN NSS_BUFLEN_GROUP - -#define DEEPCOPY_FN __copy_grp -#define MERGE_FN __merge_grp - -/* We are nscd, so we don't want to be talking to ourselves. */ -#undef USE_NSCD - -#include diff --git a/nscd/getgrnam_r.c b/nscd/getgrnam_r.c deleted file mode 100644 index 7be4374408..0000000000 --- a/nscd/getgrnam_r.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 1996-2026 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ - -#include - -#include - -#define LOOKUP_TYPE struct group -#define FUNCTION_NAME getgrnam -#define DATABASE_NAME group -#define ADD_PARAMS const char *name -#define ADD_VARIABLES name - -#define DEEPCOPY_FN __copy_grp -#define MERGE_FN __merge_grp - -/* We are nscd, so we don't want to be talking to ourselves. */ -#undef USE_NSCD - -#include diff --git a/nscd/getpwnam_r.c b/nscd/getpwnam_r.c deleted file mode 100644 index e63b7fb0c1..0000000000 --- a/nscd/getpwnam_r.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 1996-2026 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ - -#include - - -#define LOOKUP_TYPE struct passwd -#define FUNCTION_NAME getpwnam -#define DATABASE_NAME passwd -#define ADD_PARAMS const char *name -#define ADD_VARIABLES name -#define BUFLEN NSS_BUFLEN_PASSWD - -/* We are nscd, so we don't want to be talking to ourselves. */ -#undef USE_NSCD - -#include diff --git a/nscd/getpwuid_r.c b/nscd/getpwuid_r.c deleted file mode 100644 index 3ea5f806f8..0000000000 --- a/nscd/getpwuid_r.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 1996-2026 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ - -#include - - -#define LOOKUP_TYPE struct passwd -#define FUNCTION_NAME getpwuid -#define DATABASE_NAME passwd -#define ADD_PARAMS uid_t uid -#define ADD_VARIABLES uid -#define BUFLEN NSS_BUFLEN_PASSWD - -/* We are nscd, so we don't want to be talking to ourselves. */ -#undef USE_NSCD - -#include diff --git a/nscd/getsrvbynm_r.c b/nscd/getsrvbynm_r.c deleted file mode 100644 index 4ac934815c..0000000000 --- a/nscd/getsrvbynm_r.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 1996-2026 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ - -#include - - -#define LOOKUP_TYPE struct servent -#define FUNCTION_NAME getservbyname -#define DATABASE_NAME services -#define ADD_PARAMS const char *name, const char *proto -#define ADD_VARIABLES name, proto - -/* We are nscd, so we don't want to be talking to ourselves. */ -#undef USE_NSCD - -#include "../nss/getXXbyYY_r.c" diff --git a/nscd/getsrvbypt_r.c b/nscd/getsrvbypt_r.c deleted file mode 100644 index 9ca0fec407..0000000000 --- a/nscd/getsrvbypt_r.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 1996-2026 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . */ - -#include - - -#define LOOKUP_TYPE struct servent -#define FUNCTION_NAME getservbyport -#define DATABASE_NAME services -#define ADD_PARAMS int port, const char *proto -#define ADD_VARIABLES port, proto - -/* We are nscd, so we don't want to be talking to ourselves. */ -#undef USE_NSCD - -#include "../nss/getXXbyYY_r.c" diff --git a/nscd/grpcache.c b/nscd/grpcache.c index a05f6fb6e6..1e060724f6 100644 --- a/nscd/grpcache.c +++ b/nscd/grpcache.c @@ -401,9 +401,9 @@ lookup (int type, union keytype key, struct group *resultbufp, char *buffer, size_t buflen, struct group **grp) { if (type == GETGRBYNAME) - return __getgrnam_r (key.v, resultbufp, buffer, buflen, grp); + return getgrnam_r (key.v, resultbufp, buffer, buflen, grp); else - return __getgrgid_r (key.g, resultbufp, buffer, buflen, grp); + return getgrgid_r (key.g, resultbufp, buffer, buflen, grp); } diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c index 715775be2f..66f9ff09a2 100644 --- a/nscd/pwdcache.c +++ b/nscd/pwdcache.c @@ -379,9 +379,9 @@ lookup (int type, union keytype key, struct passwd *resultbufp, char *buffer, size_t buflen, struct passwd **pwd) { if (type == GETPWBYNAME) - return __getpwnam_r (key.v, resultbufp, buffer, buflen, pwd); + return getpwnam_r (key.v, resultbufp, buffer, buflen, pwd); else - return __getpwuid_r (key.u, resultbufp, buffer, buflen, pwd); + return getpwuid_r (key.u, resultbufp, buffer, buflen, pwd); } diff --git a/nscd/servicescache.c b/nscd/servicescache.c index aa8a80d483..46cf1a9e3b 100644 --- a/nscd/servicescache.c +++ b/nscd/servicescache.c @@ -329,10 +329,10 @@ lookup (int type, char *key, struct servent *resultbufp, char *buffer, } if (type == GETSERVBYNAME) - return __getservbyname_r (key, proto, resultbufp, buffer, buflen, serv); + return getservbyname_r (key, proto, resultbufp, buffer, buflen, serv); assert (type == GETSERVBYPORT); - return __getservbyport_r (atol (key), proto, resultbufp, buffer, buflen, + return getservbyport_r (atol (key), proto, resultbufp, buffer, buflen, serv); }