Your message dated Tue, 08 Apr 2008 09:17:30 +0000
with message-id <[EMAIL PROTECTED]>
and subject line Bug#474102: fixed in vim 1:7.1.291-1
has caused the Debian Bug report #474102,
regarding vim: SE Linux support for VIM
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [EMAIL PROTECTED]
immediately.)


-- 
474102: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=474102
Debian Bug Tracking System
Contact [EMAIL PROTECTED] with problems
--- Begin Message ---
Package: vim
Version: 1:7.1.285-1
Severity: normal
Tags: selinux patch

Hi,
could be the SE Linux support included in a next VIM release please? The
problem with the current VIM is, that it does not save security context.
When SE Linux policy defines different security context (file context by
path pattern) than security context obtained by transition rules, than
editor without SE Linux support brings the latter context. This could be
very annoying to check SE Linux context after every editing and run
restorecon after.

The presented problem:

    sid:/etc# dpkg -l 'vim*'|grep '^ii'
    ii  vim                               1:7.1.285-1                 Vi 
IMproved - enhanced vi editor
    ii  vim-common                        1:7.1.285-1                 Vi 
IMproved - Common files
    ii  vim-runtime                       1:7.1.285-1                 Vi 
IMproved - Runtime files
    sid:/etc# restorecon syslog.conf
    sid:/etc# ls -laZ syslog.conf 
    -rw-r--r-- 1 root root system_u:object_r:syslog_conf_t:s0 1614 Apr  3 12:23 
syslog.conf
    sid:/etc# vim -c write -c quit syslog.conf
    sid:/etc# ls -laZ syslog.conf 
    -rw-r--r-- 1 root root staff_u:object_r:etc_t:s0 1614 Apr  3 12:53 
syslog.conf

# /etc/syslog.conf context was changed to staff_u:object_r:etc_t:s0
# this is the problem

    sid:/etc# dpkg -l 'vim*'|grep '^ii'
    ii  vim                               1:7.1.285-2~icz+2           Vi 
IMproved - enhanced vi editor
    ii  vim-common                        1:7.1.285-2~icz+2           Vi 
IMproved - Common files
    ii  vim-runtime                       1:7.1.285-2~icz+2           Vi 
IMproved - Runtime files
    sid:/etc# restorecon syslog.conf
    sid:/etc# vim -c write -c quit syslog.conf
    sid:/etc# ls -laZ syslog.conf 
    -rw-r--r-- 1 root root system_u:object_r:syslog_conf_t:s0 1614 Apr  3 12:56 
syslog.conf

# The patched version is OK :)

The Fedora already has VIM patched for some time, so I prepared the
change for the VIM package based on the Fedora source RPM.

Could you be so kind to include the attached change in some form?

Best Regards
-- 
Zito

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.18-6-xen-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=cs_CZ.ISO-8859-2 (charmap=ISO-8859-2)
Shell: /bin/sh linked to /bin/bash

Versions of packages vim depends on:
ii  libacl1                2.2.45-1          Access control list shared library
ii  libc6                  2.7-10            GNU C Library: Shared libraries
ii  libgpmg1               1.20.3~pre3-3     General Purpose Mouse - shared lib
ii  libncurses5            5.6+20080308-1    Shared libraries for terminal hand
ii  libselinux1            2.0.59-1          SELinux shared libraries
ii  vim-common             1:7.1.285-1       Vi IMproved - Common files
ii  vim-runtime            1:7.1.285-1       Vi IMproved - Runtime files

vim recommends no packages.

-- no debconf information
>From 999894c95638478dd1646a78b3e58f241852e11a Mon Sep 17 00:00:00 2001
From: Vaclav Ovsik <[EMAIL PROTECTED]>
Date: Wed, 2 Apr 2008 09:43:47 +0200
Subject: [PATCH] Added patch to support SE Linux.

---
 debian/changelog |   12 +++++++++---
 debian/control   |    2 +-
 debian/rules     |   15 +++++++++++++--
 src/config.h.in  |    1 +
 src/configure.in |   15 +++++++++++++++
 src/fileio.c     |   13 +++++++++++++
 src/memfile.c    |    5 +++++
 src/os_unix.c    |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 110 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 42a5ce4..ffd5046 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,14 @@
-vim (1:7.1.285-2) UNRELEASED; urgency=low
+vim (1:7.1.285-2~icz+2) unstable; urgency=low
 
-  * NOT RELEASED YET
+  * Added patch to support SE Linux.
+    - The original patch vim-selinux.patch and vim-selinux2.patch are
+      taken from the Fedora source package vim-7.1.211-1.fc8.src.rpm.
+  * debian/control:
+    - Build-Depend on libselinux1-dev, autoconf
+  * debian/rules:
+    - Rule & dependecy added for rebuilding src/auto/configure & cleanup
 
- -- James Vega <[EMAIL PROTECTED]>  Sun, 30 Mar 2008 17:41:57 -0400
+ -- Vaclav Ovsik <[EMAIL PROTECTED]>  Thu, 03 Apr 2008 10:57:29 +0200
 
 vim (1:7.1.285-1) unstable; urgency=low
 
diff --git a/debian/control b/debian/control
index 0b6393a..a04fcf9 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Build-Depends: debhelper, bzip2, libperl-dev, tcl-dev, 
libacl1-dev,
  libgpmg1-dev [!hurd-i386] | not+linux-gnu, python-dev, libxpm-dev,
  libncurses5-dev, ruby, ruby1.8-dev, libgtk2.0-dev, lynx,
  libgnomeui-dev, lesstif2-dev, make (>= 3.80+3.81.b4), docbook-xml,
- docbook-utils
+ docbook-utils, libselinux1-dev, autoconf
 Vcs-Git: git://git.debian.org/git/pkg-vim/vim.git
 Vcs-Browser: http://git.debian.org/?p=pkg-vim/vim.git
 Homepage: http://www.vim.org/
diff --git a/debian/rules b/debian/rules
index c3c76db..d49c51f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -160,7 +160,11 @@ get-orig-source:
 clean: $(foreach v,$(VARIANTS),clean-$(v))
        dh_testdir
        dh_testroot
-       rm -f extract-stamp* build-stamp* install-stamp* configure-stamp*
+       if test -f src/auto/configure.dist; then \
+           mv src/auto/configure.dist src/auto/configure; \
+           make distclean; \
+       fi
+       rm -f extract-stamp* build-stamp* install-stamp* autoconf-stamp 
configure-stamp*
        rm -f debian/helpztags.1
        rm -rf debian/policy/vim-policy.html
        rm -f debian/policy/vim-policy.txt
@@ -194,7 +198,14 @@ build-stamp: $(foreach v,$(VARIANTS),build-stamp-$(v))
        $(MAKE) -C debian/policy/ text html
        touch $@
 
-configure-stamp-%:
+autoconf-stamp:
+       if ! test -f src/auto/configure.dist; then \
+           cp -a src/auto/configure src/auto/configure.dist; \
+       fi
+       $(MAKE) -C src autoconf
+       touch $@
+
+configure-stamp-%: autoconf-stamp
        dh_testdir
        @echo "*** DEBIAN *** CONFIGURING VARIANT $*"
        if test -f src/auto/config.cache; then make distclean; fi
diff --git a/src/config.h.in b/src/config.h.in
index 3d9e162..cb1feaf 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -155,6 +155,7 @@
 #undef HAVE_READLINK
 #undef HAVE_RENAME
 #undef HAVE_SELECT
+#undef HAVE_SELINUX
 #undef HAVE_SETENV
 #undef HAVE_SETPGID
 #undef HAVE_SETSID
diff --git a/src/configure.in b/src/configure.in
index 898e79c..87d0ae4 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -300,6 +300,21 @@ esac
 fi
 
 
+dnl vim: set sw=2 tw=78 fo+=l:
+dnl Link with -lselinux for SELinux stuff; if not found
+AC_MSG_CHECKING(--disable-selinux argument)
+AC_ARG_ENABLE(selinux,
+       [  --disable-selinux      Don't check for SELinux support.],
+       , [enable_selinux="yes"])
+if test "$enable_selinux" = "yes"; then
+   AC_MSG_RESULT(no)
+   AC_CHECK_LIB(selinux, is_selinux_enabled,
+     [LIBS="$LIBS -lselinux"
+      AC_DEFINE(HAVE_SELINUX)])
+else
+   AC_MSG_RESULT(yes)
+fi
+
 dnl Check user requested features.
 
 AC_MSG_CHECKING(--with-features argument)
diff --git a/src/fileio.c b/src/fileio.c
index bcabbff..58dd47a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1,3 +1,4 @@
+
 /* vi:set ts=8 sts=4 sw=4:
  *
  * VIM - Vi IMproved   by Bram Moolenaar
@@ -3651,6 +3652,9 @@ buf_write(buf, fname, sfname, start, end, eap, append, 
forceit,
                                                )
                            mch_setperm(backup,
                                          (perm & 0707) | ((perm & 07) << 3));
+#ifdef HAVE_SELINUX
+                       mch_copy_sec(fname, backup);
+#endif
 #endif
 
                        /*
@@ -3687,6 +3691,9 @@ buf_write(buf, fname, sfname, start, end, eap, append, 
forceit,
 #ifdef HAVE_ACL
                        mch_set_acl(backup, acl);
 #endif
+#ifdef HAVE_SELINUX
+                       mch_copy_sec(fname, backup);
+#endif
                        break;
                    }
                }
@@ -4309,6 +4316,12 @@ restore_backup:
     }
 #endif
 
+#ifdef HAVE_SELINUX
+    /* Probably need to set the security context */
+    if (!backup_copy)
+       mch_copy_sec(backup, wfname);
+#endif
+
 #ifdef UNIX
     /* When creating a new file, set its owner/group to that of the original
      * file.  Get the new device and inode number. */
diff --git a/src/memfile.c b/src/memfile.c
index d0dd8de..e405656 100644
--- a/src/memfile.c
+++ b/src/memfile.c
@@ -1346,5 +1346,10 @@ mf_do_open(mfp, fname, flags)
        mfp->mf_ffname = NULL;
     }
     else
+    {
+#ifdef HAVE_SELINUX
+        mch_copy_sec(fname, mfp->mf_fname);
+#endif
        mch_hide(mfp->mf_fname);    /* try setting the 'hidden' flag */
+    }
 }
diff --git a/src/os_unix.c b/src/os_unix.c
index 1b0ec70..00107eb 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -45,6 +45,10 @@
 # include <X11/SM/SMlib.h>
 #endif
 
+#ifdef HAVE_SELINUX
+#include <selinux/selinux.h>
+static int selinux_enabled=-1;
+#endif
 /*
  * Use this prototype for select, some include files have a wrong prototype
  */
@@ -2557,6 +2561,55 @@ typedef struct vim_acl_solaris_T {
 } vim_acl_solaris_T;
 # endif
 
+mch_copy_sec(from_file, to_file)
+     char_u    *from_file;
+     char_u    *to_file;
+{
+  if (from_file == NULL)
+    return;
+  
+#ifdef HAVE_SELINUX
+  if (selinux_enabled == -1)
+    selinux_enabled = is_selinux_enabled ();
+
+  if (selinux_enabled>0)
+    {
+      security_context_t from_context=NULL;
+      security_context_t to_context=NULL;
+      if (getfilecon (from_file, &from_context) < 0)
+       {
+         /* If the filesystem doesn't support extended attributes,
+            the original had no special security context and the
+            target cannot have one either.  */
+         if (errno == EOPNOTSUPP)
+           return ;
+         
+         MSG_PUTS(_("\nCould not get security context for "));
+         msg_outtrans(from_file);
+         msg_putchar('\n');
+         return ;
+       }
+      if (getfilecon (to_file, &to_context) < 0)
+       {
+         MSG_PUTS(_("\nCould not get security context for "));
+         msg_outtrans(to_file);
+         msg_putchar('\n');
+         freecon (from_context);
+         return ;
+       }
+      if (strcmp(from_context,to_context) != 0 ) {
+       if (setfilecon (to_file, from_context) < 0)
+         {
+           MSG_PUTS(_("\nCould not set security context for "));
+           msg_outtrans(to_file);
+           msg_putchar('\n');
+         }
+      }
+      freecon (to_context);
+      freecon (from_context);
+    }
+#endif /* HAVE_SELINUX */
+}
 /*
  * Return a pointer to the ACL of file "fname" in allocated memory.
  * Return NULL if the ACL is not available for whatever reason.
-- 
1.5.4.4


--- End Message ---
--- Begin Message ---
Source: vim
Source-Version: 1:7.1.291-1

We believe that the bug you reported is fixed in the latest version of
vim, which is due to be installed in the Debian FTP archive:

vim-common_7.1.291-1_i386.deb
  to pool/main/v/vim/vim-common_7.1.291-1_i386.deb
vim-dbg_7.1.291-1_i386.deb
  to pool/main/v/vim/vim-dbg_7.1.291-1_i386.deb
vim-doc_7.1.291-1_all.deb
  to pool/main/v/vim/vim-doc_7.1.291-1_all.deb
vim-full_7.1.291-1_all.deb
  to pool/main/v/vim/vim-full_7.1.291-1_all.deb
vim-gnome_7.1.291-1_i386.deb
  to pool/main/v/vim/vim-gnome_7.1.291-1_i386.deb
vim-gtk_7.1.291-1_i386.deb
  to pool/main/v/vim/vim-gtk_7.1.291-1_i386.deb
vim-gui-common_7.1.291-1_all.deb
  to pool/main/v/vim/vim-gui-common_7.1.291-1_all.deb
vim-lesstif_7.1.291-1_i386.deb
  to pool/main/v/vim/vim-lesstif_7.1.291-1_i386.deb
vim-nox_7.1.291-1_i386.deb
  to pool/main/v/vim/vim-nox_7.1.291-1_i386.deb
vim-perl_7.1.291-1_all.deb
  to pool/main/v/vim/vim-perl_7.1.291-1_all.deb
vim-python_7.1.291-1_all.deb
  to pool/main/v/vim/vim-python_7.1.291-1_all.deb
vim-ruby_7.1.291-1_all.deb
  to pool/main/v/vim/vim-ruby_7.1.291-1_all.deb
vim-runtime_7.1.291-1_all.deb
  to pool/main/v/vim/vim-runtime_7.1.291-1_all.deb
vim-tcl_7.1.291-1_all.deb
  to pool/main/v/vim/vim-tcl_7.1.291-1_all.deb
vim-tiny_7.1.291-1_i386.deb
  to pool/main/v/vim/vim-tiny_7.1.291-1_i386.deb
vim_7.1.291-1.diff.gz
  to pool/main/v/vim/vim_7.1.291-1.diff.gz
vim_7.1.291-1.dsc
  to pool/main/v/vim/vim_7.1.291-1.dsc
vim_7.1.291-1_i386.deb
  to pool/main/v/vim/vim_7.1.291-1_i386.deb
vim_7.1.291.orig.tar.gz
  to pool/main/v/vim/vim_7.1.291.orig.tar.gz



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [EMAIL PROTECTED],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
James Vega <[EMAIL PROTECTED]> (supplier of updated vim package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [EMAIL PROTECTED])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Tue, 08 Apr 2008 02:24:11 -0400
Source: vim
Binary: vim-common vim-gui-common vim-runtime vim-doc vim-tiny vim vim-dbg 
vim-perl vim-python vim-ruby vim-tcl vim-gtk vim-nox vim-lesstif vim-gnome 
vim-full
Architecture: source all i386
Version: 1:7.1.291-1
Distribution: unstable
Urgency: low
Maintainer: [EMAIL PROTECTED]
Changed-By: James Vega <[EMAIL PROTECTED]>
Description: 
 vim        - Vi IMproved - enhanced vi editor
 vim-common - Vi IMproved - Common files
 vim-dbg    - Vi IMproved - enhanced vi editor (debugging symbols)
 vim-doc    - Vi IMproved - HTML documentation
 vim-full   - Vi IMproved - enhanced vi editor (transitional package)
 vim-gnome  - Vi IMproved - enhanced vi editor - with GNOME2 GUI
 vim-gtk    - Vi IMproved - enhanced vi editor - with GTK2 GUI
 vim-gui-common - Vi IMproved - Common GUI files
 vim-lesstif - Vi IMproved - enhanced vi editor - with LessTif GUI
 vim-nox    - Vi IMproved - enhanced vi editor
 vim-perl   - Vi IMproved - enhanced vi editor (transitional package)
 vim-python - Vi IMproved - enhanced vi editor (transitional package)
 vim-ruby   - Vi IMproved - enhanced vi editor (transitional package)
 vim-runtime - Vi IMproved - Runtime files
 vim-tcl    - Vi IMproved - enhanced vi editor (transitional package)
 vim-tiny   - Vi IMproved - enhanced vi editor - compact version
Closes: 473660 474102
Changes: 
 vim (1:7.1.291-1) unstable; urgency=low
 .
   * Lintian cleanups
     - Change doc-base section to Editors.
     - Remove Encoding key from desktop entry.
   * New upstream patches (286 - 291), see README.gz for details.
   * Add SELinux support  (Closes: #474102)
     - Vim patch taken from Fedora's Vim packaging
     - Thanks to Vaclav Ovsik for the patch to the Debian packaging.
   * Fix indentation of Perl files when folding is enabled.  Thanks to Gregory
     Hainaut for the patch.  (Closes: #473660)
   * debian/control:
     - Add libselinux1-dev and autoconf Build-Depends.
   * debian/rules:
     - Rule & dependency added for rebuilding src/auto/configure.
     - Add update-orig target to prep a new upstream+patches orig.tar.gz for
       release.
Files: 
 ef5dd78dbd77add86e30652069b71274 1283 editors optional vim_7.1.291-1.dsc
 883fd265934d050d9f21d135a351f1c7 10271930 editors optional 
vim_7.1.291.orig.tar.gz
 1909f06e570fe86e1092a4ff1ca0dcff 337639 editors optional vim_7.1.291-1.diff.gz
 9fbb92607ca96f584b377da47459349e 173336 editors optional 
vim-gui-common_7.1.291-1_all.deb
 dee3e8f2136d2ffa9462025539546529 5543138 editors optional 
vim-runtime_7.1.291-1_all.deb
 581f6667a7e43665c54da2d062331611 2140686 doc optional vim-doc_7.1.291-1_all.deb
 eb270a8f1627141f159ad2963266b0cf 72666 editors extra vim-perl_7.1.291-1_all.deb
 9b308590eada9a18f2d13e98e057b041 72672 editors extra 
vim-python_7.1.291-1_all.deb
 e44896aae36e75705bc8f685c1bc6a29 72672 editors extra vim-ruby_7.1.291-1_all.deb
 ada2f585ef3942ce63d6196d20ff9dd6 72662 editors extra vim-tcl_7.1.291-1_all.deb
 4b3a8a661445b204a47ba09ede49fc8f 72690 editors extra vim-full_7.1.291-1_all.deb
 128879b5a1b21e96c4a339f7050db491 319834 editors important 
vim-tiny_7.1.291-1_i386.deb
 36baf5c8949ff9fe60232d913094bc69 963974 editors extra 
vim-gtk_7.1.291-1_i386.deb
 6ea7a422a20fbbabf409161bd7e3bb23 966068 editors extra 
vim-gnome_7.1.291-1_i386.deb
 758e8d3b025a0b003837b40b6df79bd2 957204 editors extra 
vim-lesstif_7.1.291-1_i386.deb
 ead47511161b5b3e244abd86b3f4332c 836326 editors extra 
vim-nox_7.1.291-1_i386.deb
 3d456650dfd27cca4dad6ae87728020d 227210 editors important 
vim-common_7.1.291-1_i386.deb
 27474c13006712d3c1ad9d676a43b2d5 746794 editors optional vim_7.1.291-1_i386.deb
 e758ed663e182c2e0ac6dd0fbbf168b2 8109688 editors extra 
vim-dbg_7.1.291-1_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iEYEARECAAYFAkf7L6EACgkQDb3UpmEybUDW/wCcCpRxd4GC8Yd97pRlQ1R+zn1k
8foAn3/DyipJWdeZ5YepkO1iztECrxZi
=bsI6
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to