bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: breaks if no matchpathcon_init_prefix in selinux.h


From: Jim Meyering
Subject: Re: breaks if no matchpathcon_init_prefix in selinux.h
Date: Mon, 02 Jun 2008 21:39:30 +0200

"Ilya N. Golubev" <address@hidden> wrote:
> Version: 6.12.
>
> If system `selinux/selinux.h' is compilable, coreutils always uses it
> (does not build `selinux/selinux.h' in `lib'), and `src/install.c'
> assumes that it always provides (correct) declaration of
> `matchpathcon_init_prefix'.  If system header does not declare it at
> all, build of `ginstall' fails with
>
> undefined reference to `matchpathcon_init_prefix'

Thank you for the fine bug report.
That reminds me that I forgot to provide a stubbed-out
definition of matchpathcon_init_prefix in the replacement
selinux.h file.

Would you please confirm that the following
patch also solves your link failure?
(it should be sufficient to add these three lines to install.c)

    #if ! HAVE_MATCHPATHCON_INIT_PREFIX
    # define matchpathcon_init_prefix(a, p) /* empty */
    #endif


>From 0647f3eb5aeaa783ce21ddee268367d2ba7248df Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 2 Jun 2008 21:17:57 +0200
Subject: [PATCH] accommodate older SELinux which lacks matchpathcon_init_prefix

* m4/jm-macros.m4: Check for matchpathcon_init_prefix.
* src/install.c [!HAVE_MATCHPATHCON_INIT_PREFIX]
(matchpathcon_init_prefix): Define away.
* gl/lib/se-selinux.in.h (matchpathcon_init_prefix): Define.
Reported by Ilya N. Golubev in
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13686>.
---
 THANKS                 |    1 +
 gl/lib/se-selinux.in.h |    7 +++++--
 m4/jm-macros.m4        |    5 ++++-
 src/install.c          |    4 ++++
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/THANKS b/THANKS
index df84761..feaf463 100644
--- a/THANKS
+++ b/THANKS
@@ -220,6 +220,7 @@ Ian Jackson                         address@hidden
 Ian Lance Taylor                    address@hidden
 Ian Turner                          address@hidden
 Iida Yosiaki                        address@hidden
+Ilya N. Golubev                     address@hidden
 Ingo Saitz                          address@hidden
 Ivo Timmermans                      address@hidden
 James                               address@hidden
diff --git a/gl/lib/se-selinux.in.h b/gl/lib/se-selinux.in.h
index 7be1e70..ac421c3 100644
--- a/gl/lib/se-selinux.in.h
+++ b/gl/lib/se-selinux.in.h
@@ -17,7 +17,8 @@ typedef unsigned short security_class_t;
 # define security_context_t char*
 # define is_selinux_enabled() 0

-static inline int getcon (security_context_t *con) { errno = ENOTSUP; return 
-1; }
+static inline int getcon (security_context_t *con)
+  { errno = ENOTSUP; return -1; }
 static inline void freecon (security_context_t con) {}


@@ -28,7 +29,9 @@ static inline int setfscreatecon (security_context_t con)
 static inline int matchpathcon (char const *s, mode_t m,
                                security_context_t *con)
   { errno = ENOTSUP; return -1; }
-
+static inline int matchpathcon_init_prefix (const char *path,
+                                           const char *prefix)
+  { errno = ENOTSUP; return -1; }
 static inline int getfilecon (char const *s, security_context_t *con)
   { errno = ENOTSUP; return -1; }
 static inline int lgetfilecon (char const *s, security_context_t *con)
diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4
index 5a92d4a..cf1f2f0 100644
--- a/m4/jm-macros.m4
+++ b/m4/jm-macros.m4
@@ -2,7 +2,7 @@

 dnl Misc type-related macros for coreutils.

-# Copyright (C) 1998, 2000-2007 Free Software Foundation, Inc.
+# Copyright (C) 1998, 2000-2008 Free Software Foundation, Inc.

 # 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
@@ -46,6 +46,9 @@ AC_DEFUN([coreutils_MACROS],
   # used by shred
   AC_CHECK_FUNCS_ONCE(directio)

+  # Used by install.c.
+  AC_CHECK_FUNCS_ONCE([matchpathcon_init_prefix])
+
   AC_CHECK_FUNCS_ONCE( \
     endgrent \
     endpwent \
diff --git a/src/install.c b/src/install.c
index 1d902d6..decdd7d 100644
--- a/src/install.c
+++ b/src/install.c
@@ -66,6 +66,10 @@ static bool use_default_selinux_context = true;
 # define lchown(name, uid, gid) chown (name, uid, gid)
 #endif

+#if ! HAVE_MATCHPATHCON_INIT_PREFIX
+# define matchpathcon_init_prefix(a, p) /* empty */
+#endif
+
 /* Initial number of entries in each hash table entry's table of inodes.  */
 #define INITIAL_HASH_MODULE 100

--
1.5.6.rc0.54.gf71a2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]