* [PATCH userspace] run_init: fix build when crypt() is not in unistd.h
@ 2019-05-13 11:58 Ondrej Mosnacek
2019-05-24 16:47 ` Stephen Smalley
0 siblings, 1 reply; 2+ messages in thread
From: Ondrej Mosnacek @ 2019-05-13 11:58 UTC (permalink / raw)
To: selinux
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH userspace] run_init: fix build when crypt() is not in unistd.h
2019-05-13 11:58 [PATCH userspace] run_init: fix build when crypt() is not in unistd.h Ondrej Mosnacek
@ 2019-05-24 16:47 ` Stephen Smalley
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Smalley @ 2019-05-24 16:47 UTC (permalink / raw)
To: Ondrej Mosnacek, selinux
On 5/13/19 7:58 AM, Ondrej Mosnacek wrote:
> 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
Thanks, applied. We generally don't see this because pam-devel is
installed and thus USE_PAM gets enabled instead.
>
> 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 *);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-24 16:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-13 11:58 [PATCH userspace] run_init: fix build when crypt() is not in unistd.h Ondrej Mosnacek
2019-05-24 16:47 ` Stephen Smalley
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).