From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 770593857C70 for ; Wed, 17 Feb 2021 21:15:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 770593857C70 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-394-5VfllY_qNoquEXbMEfrmVQ-1; Wed, 17 Feb 2021 16:15:49 -0500 X-MC-Unique: 5VfllY_qNoquEXbMEfrmVQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5D1BD801965; Wed, 17 Feb 2021 21:15:48 +0000 (UTC) Received: from greed.delorie.com (ovpn-116-4.rdu2.redhat.com [10.10.116.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 324A618B5E; Wed, 17 Feb 2021 21:15:48 +0000 (UTC) Received: from greed.delorie.com.redhat.com (localhost [127.0.0.1]) by greed.delorie.com (8.14.7/8.14.7) with ESMTP id 11HLFlnY010735; Wed, 17 Feb 2021 16:15:47 -0500 From: DJ Delorie To: Andreas Schwab Cc: libc-alpha@sourceware.org Subject: Re: v5 [PATCH 6/6] nsswitch: use new internal API (callers) In-Reply-To: <87k0r6jt9w.fsf@igel.home> (message from Andreas Schwab on Wed, 17 Feb 2021 22:09:31 +0100) Date: Wed, 17 Feb 2021 16:15:47 -0500 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 21:15:52 -0000 Andreas Schwab writes: > On Feb 17 2021, DJ Delorie wrote: > >> Andreas Schwab writes: >> >>> On Feb 17 2021, DJ Delorie wrote: >>> >>>> + /* Neither found, use default config. */ >>>> + *ni = __nss_action_parse (defconfig); >>>> + if (*ni != NULL) >>>> + return 0; >>>> + >>>> + /* Failure. */ >>>> + return -1; >>> >>> How can that ever be reached? >> >> Passing a syntactically incorrect string as defconfig, or memory >> allocation failure. > > defconfig isn't used before that point. *ni = __nss_action_parse (defconfig); If defconfig is syntactically invalid, __nss_action_parse can't parse it, and returns NULL. If parsing defconfig requires allocating memory, and the allocation fails, __nss_action_parse returns NULL. If either of these cases happens, we report failure by returning -1. Either that or I'm totally misunderstanding what you're asking. Which "that" are you asking how it can be reached? If you're refering to the "Neither found" comment, it reaches that if nsswitch.conf mentions neither the primary nor alternate service name.