From: Ondrej Mosnacek <omosnace@redhat.com>
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 [thread overview]
Message-ID: <20190513115826.22475-1-omosnace@redhat.com> (raw)
According to [1], crypt() support in POSIX is optional, so include
also <crypt.h> 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 <omosnace@redhat.com>
---
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 <shadow.h> /* for shadow passwd functions */
#include <string.h> /* 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 <crypt.h>
+#endif
+
#define PASSWORD_PROMPT _("Password:") /* prompt for getpass() */
int authenticate_via_shadow_passwd(const struct passwd *);
--
2.20.1
next reply other threads:[~2019-05-13 11:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-13 11:58 Ondrej Mosnacek [this message]
2019-05-24 16:47 ` [PATCH userspace] run_init: fix build when crypt() is not in unistd.h Stephen Smalley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190513115826.22475-1-omosnace@redhat.com \
--to=omosnace@redhat.com \
--cc=selinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).