From patchwork Mon May 13 11:58:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Mosnacek X-Patchwork-Id: 10940767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 15AD8912 for ; Mon, 13 May 2019 11:58:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07A0E26E7B for ; Mon, 13 May 2019 11:58:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFC1F27861; Mon, 13 May 2019 11:58:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 800A42785D for ; Mon, 13 May 2019 11:58:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728943AbfEML6c (ORCPT ); Mon, 13 May 2019 07:58:32 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:56231 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728841AbfEML6b (ORCPT ); Mon, 13 May 2019 07:58:31 -0400 Received: by mail-wm1-f67.google.com with SMTP id x64so2338162wmb.5 for ; Mon, 13 May 2019 04:58:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=HQG2aHVzKDOu5bdBsMSwfv1Gpjo++7Q5Sx0rwS4cqF8=; b=biB3nZzEq8rT+VM0gFGk7BvfqpvdG/ARTe2wHMgqfA+61K/3kvujOpRBK9NRzeDYzx rQX5EVcGLx/IDNfd0Hiep7qmSRr4dGMrAW/zXoymVuxTJLq9elbnSuhfXIOzAsYJT+PN vjp5JzzrNbF27/0tuk9m/rcqAYGrtEfKBix9Txz2ZWEi9jMM+Lh/mo9c59MOKsUSpG2G MRS+lkC6gZ8iSZ9PPQbJMNAOudMRsw9uHHEfx0vn9PFRQJPzIsH1A5WZnCQrYfdJVIz2 5dXrRmYRx0cX1y/F+njJxg2m1fHpLVwfzfnnvH2otfhrJyyeIcfA7UDO074M7vPw1lv1 jV1Q== X-Gm-Message-State: APjAAAVUP+UsG50R+/8AZLRQRssBYdnau0pFuOW6hYzULWL9GzRWKMcg br7cYIdxeKEIbIGtC5EeXma88/SD1So= X-Google-Smtp-Source: APXvYqx6dAf7dLyYOdL9IR3mRb8SJCf0XdTo13nJQvRj46YHkuY8dyZfdV7XB3d3EnNCzMkQ941sig== X-Received: by 2002:a1c:c016:: with SMTP id q22mr9911081wmf.6.1557748709801; Mon, 13 May 2019 04:58:29 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id q7sm13942379wmc.11.2019.05.13.04.58.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 May 2019 04:58:28 -0700 (PDT) From: Ondrej Mosnacek To: selinux@vger.kernel.org Subject: [PATCH userspace] run_init: fix build when crypt() is not in unistd.h Date: Mon, 13 May 2019 13:58:26 +0200 Message-Id: <20190513115826.22475-1-omosnace@redhat.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: selinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP According to [1], crypt() support in POSIX is optional, so include also when _XOPEN_CRYPT is not defined or is defined to -1. Without this I can't build run_init from source out-of-the-box on Fedora 29. [1] http://man7.org/linux/man-pages/man3/crypt.3.html#NOTES Signed-off-by: Ondrej Mosnacek --- policycoreutils/run_init/run_init.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/policycoreutils/run_init/run_init.c b/policycoreutils/run_init/run_init.c index 4bc32b1c..a007ce49 100644 --- a/policycoreutils/run_init/run_init.c +++ b/policycoreutils/run_init/run_init.c @@ -159,6 +159,14 @@ int authenticate_via_pam(const struct passwd *p_passwd_line) #include /* for shadow passwd functions */ #include /* for strlen(), memset() */ +/* + * crypt() may not be defined in unistd.h; see: + * http://man7.org/linux/man-pages/man3/crypt.3.html#NOTES + */ +#if !defined(_XOPEN_CRYPT) || _XOPEN_CRYPT == -1 +#include +#endif + #define PASSWORD_PROMPT _("Password:") /* prompt for getpass() */ int authenticate_via_shadow_passwd(const struct passwd *);