chiark / gitweb /
[PATCH] udev_selinux changes
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Sat, 17 Apr 2004 06:58:27 +0000 (23:58 -0700)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:35:15 +0000 (21:35 -0700)
Here is the fix for extras/seliux/*
 o install the binary in /sbin/
 o add symlink to /etc/dev.d/ with suffix .dev
 o removed the undefined udev_log variable
 o fixed compiler warnings

extras/dbus/Makefile
extras/selinux/Makefile
extras/selinux/udev_selinux.c

index 04f17605e890b07033988fd895ce435367fb99e3..0cfc650c4b222d79adab8a715e375968cf944275 100644 (file)
@@ -53,16 +53,16 @@ spotless: clean
 
 install-dbus-policy:
        $(INSTALL) -d $(DESTDIR)$(dbusdir)
-       $(INSTALL_DATA) etc/dbus-1/system.d/udev_sysbus_policy.conf $(DESTDIR)$(dbusdir)
-       $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(usrsbindir)/$(PROG)
-       - ln -s -f $(DESTDIR)$(usrsbindir)/$(PROG) $(DESTDIR)$(devddir)/$(PROG).dev
 
 uninstall-dbus-policy:
        - rm $(DESTDIR)$(dbusdir)/udev_sysbus_policy.conf
-       - rm $(DESTDIR)$(devddir)/$(PROG).dev
-       - rm $(DESTDIR)$(usrsbindir)/$(PROG)
 
 install: install-dbus-policy all
+       $(INSTALL_DATA) etc/dbus-1/system.d/udev_sysbus_policy.conf $(DESTDIR)$(dbusdir)
+       $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(usrsbindir)/$(PROG)
+       - ln -s -f $(DESTDIR)$(usrsbindir)/$(PROG) $(DESTDIR)$(devddir)/$(PROG).dev
 
 uninstall: uninstall-dbus-policy
+       - rm $(DESTDIR)$(devddir)/$(PROG).dev
+       - rm $(DESTDIR)$(usrsbindir)/$(PROG)
 
index 813756700ba0f265ae19126212192d3ee301edc8..35d2e9e6da3d8a5588c3a505eaa3d2f6e5959b6b 100644 (file)
@@ -26,7 +26,9 @@ exec_prefix = ${prefix}
 etcdir =       ${prefix}/etc
 sbindir =      ${exec_prefix}/sbin
 usrbindir =    ${exec_prefix}/usr/bin
+usrsbindir =   ${exec_prefix}/usr/sbin
 mandir =       ${prefix}/usr/share/man
+devddir =      ${etcdir}/dev.d/default
 hotplugdir =   ${etcdir}/hotplug.d/default
 configdir =    ${etcdir}/udev/
 initdir =      ${etcdir}/init.d/
@@ -52,8 +54,11 @@ clean:
 
 spotless: clean
 
-
 install: all
+       $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG)
+       - ln -s -f $(DESTDIR)$(sbindir)/$(PROG) $(DESTDIR)$(devddir)/$(PROG).dev
 
-uninstall: 
+uninstall:
+       - rm $(DESTDIR)$(devddir)/$(PROG).dev
+       - rm $(DESTDIR)$(sbindir)/$(PROG)
 
index df23d9e6a70dc612f2cd489fd36e1ceee752b0ee..8b1c2c7da8bd57bd11b16ed59f21fd3ec3484134 100644 (file)
@@ -1,10 +1,27 @@
+/*
+ * udev_selinux.c
+ *
+ * Copyright (C) 2004 Daniel J Walsh <dwalsh@redhat.com>
+ *
+ *     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 the
+ *     Free Software Foundation version 2 of the License.
+ * 
+ *     This program is distributed in the hope that it will be useful, but
+ *     WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *     General Public License for more details.
+ * 
+ *     You should have received a copy of the GNU General Public License along
+ *     with this program; if not, write to the Free Software Foundation, Inc.,
+ *     675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
 #include <errno.h>
-#include <ctype.h>
 #include <selinux/selinux.h>
 
 #include "../../udev_lib.h"
@@ -16,16 +33,13 @@ void log_message(int level, const char *format, ...)
 {
        va_list args;
 
-       if (!udev_log)
-               return;
-
        va_start(args, format);
        vsyslog(level, format, args);
        va_end(args);
 }
 #endif
 
-void selinux_add_node(char *filename)
+static void selinux_add_node(char *filename)
 {
        int retval;
 
@@ -35,7 +49,7 @@ void selinux_add_node(char *filename)
                if (retval < 0) {
                        dbg("matchpathcon(%s) failed\n", filename);
                } else {
-                       retval=setfilecon(filename,scontext);
+                       retval = setfilecon(filename,scontext);
                        if (retval < 0)
                                dbg("setfiles %s failed with error '%s'",
                                    filename, strerror(errno));
@@ -47,7 +61,6 @@ void selinux_add_node(char *filename)
 int main(int argc, char *argv[], char *envp[])
 {
        char *action;
-       char *devpath;
        char *devname;
        int retval = 0;