Package: setools
Version: 3.3.8-3
Tags: patch
Followup-For: Bug #750331

Hello!

I was able to reproduce this on amd64.

Attached you can find a patch that fixes the problem:
The cause for this was, that at one point the prototype
for 'lsetfilecon_raw' was wrong.

Header: int lsetfilecon_raw(const char *, const char *)
  defined as 'extern "C"'

replcon.cc: int lsetfilecon_raw(const char *, security_context_t)

Therefore the later one was treated as a C++ symbol - which
cannot be compared to NULL.  I tested this with a minimalistic
prototype implementation: the correct function is picked up.

The patch is against the current HEAD of the master from
git://anonscm.debian.org/selinux/setools.git
commit a3ab84b35efd9c42641d53ec2236ad01f7411df7

Kind regards

Andre

-- System Information:
Debian Release: jessie/sid
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.14-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages setools depends on:
ii  libbz2-1.0    1.0.6-7
ii  libc6         2.19-7
ii  libgcc1       1:4.9.1-4
ii  libqpol1      3.3.8-3
ii  libselinux1   2.3-1
ii  libsqlite3-0  3.8.5-2
ii  libstdc++6    4.9.1-4
ii  libxml2       2.9.1+dfsg1-4

setools recommends no packages.

Versions of packages setools suggests:
pn  setools-gui  <none>

-- no debconf information
diff --git a/debian/changelog b/debian/changelog
index a9ab1c7..8a98632 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+setools (3.3.8-4) unstable; urgency=medium
+
+  [ Andreas Florath ]
+  * secmds/replcon.cc: Fixed prototype of lsetfilecon_raw.
+    (Closes: #750331)
+
+ -- To Be Filled In <t...@example.com>  Sun, 10 Aug 2014 22:54:16 +0200
+
 setools (3.3.8-3) unstable; urgency=medium
 
   * Team upload.
diff --git a/debian/patches/fix-lsetfilecon_raw-prototype.patch b/debian/patches/fix-lsetfilecon_raw-prototype.patch
new file mode 100644
index 0000000..feeaf04
--- /dev/null
+++ b/debian/patches/fix-lsetfilecon_raw-prototype.patch
@@ -0,0 +1,13 @@
+Index: setools-git/secmds/replcon.cc
+===================================================================
+--- setools-git.orig/secmds/replcon.cc
++++ setools-git/secmds/replcon.cc
+@@ -60,7 +60,7 @@ static struct option const longopts[] =
+ 	{NULL, 0, NULL, 0}
+ };
+ 
+-extern int lsetfilecon_raw(const char *, security_context_t) __attribute__ ((weak));
++extern int lsetfilecon_raw(const char *, const char *) __attribute__ ((weak));
+ 
+ /**
+  * As that setools must work with older libselinux versions that may
diff --git a/debian/patches/series b/debian/patches/series
index 83a22dd..668a9ea 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -13,3 +13,4 @@ setools-swig-2.0.7.patch
 python_setools_path.patch
 fix-javacflags.patch
 fix-sediffx-crash.patch
+fix-lsetfilecon_raw-prototype.patch

Reply via email to