mock/src mock-helper.c,1.6,1.7

Jeremy Katz (katzj) fedora-extras-commits at redhat.com
Thu Jul 14 18:00:28 UTC 2005


Author: katzj

Update of /cvs/fedora/mock/src
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv13029/src

Modified Files:
	mock-helper.c 
Log Message:
add mock-yum wrapper to remove the selinux LD_PRELOAD.  also, only set
the LD_PRELOAD for use with running yum



Index: mock-helper.c
===================================================================
RCS file: /cvs/fedora/mock/src/mock-helper.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- mock-helper.c	23 Jun 2005 20:00:45 -0000	1.6
+++ mock-helper.c	14 Jul 2005 18:00:26 -0000	1.7
@@ -133,7 +133,7 @@
 
 /* argv[0] should by convention be the binary name to be executed */
 void
-do_command (const char *filename, char *const argv[])
+do_command (const char *filename, char *const argv[], int use_selinux_preload)
 {
   /* do not trust user environment;
    * copy over allowed env vars, after setting PATH and HOME ourselves
@@ -163,7 +163,7 @@
 
 #ifdef USE_SELINUX
   /* add LD_PRELOAD for our selinux lib if selinux is in use is set */
-  if (is_selinux_enabled() > 0)
+  if ((is_selinux_enabled() > 0) && (use_selinux_preload == 1))
   {
     ld_preload = strdup("LD_PRELOAD=libselinux-mock.so");
     printf("adding ld_preload of %s\n", ld_preload);
@@ -198,7 +198,7 @@
   /* do we allow this dir ? */
   check_dir_allowed (rootsdir, argv[2]);
  
-  do_command ("/usr/sbin/chroot", &(argv[1]));
+  do_command ("/usr/sbin/chroot", &(argv[1]), 0);
 }
 
 /*
@@ -235,7 +235,7 @@
     error ("unallowed mount type");
 
   /* all checks passed, execute */
-  do_command ("/bin/mount", &(argv[1]));
+  do_command ("/bin/mount", &(argv[1]), 0);
 }
 
 /* clean out a chroot dir */
@@ -254,7 +254,7 @@
   check_dir_allowed (rootsdir, argv[3]);
 
   /* all checks passed, execute */
-  do_command ("/bin/rm", &(argv[1]));
+  do_command ("/bin/rm", &(argv[1]), 0);
 }
 
 /* perform rpm commands on root */
@@ -273,7 +273,7 @@
   check_dir_allowed (rootsdir, argv[3]);
 
   /* all checks passed, execute */
-  do_command ("/bin/rpm", &(argv[1]));
+  do_command ("/bin/rpm", &(argv[1]), 0);
 }
 
 
@@ -292,7 +292,7 @@
   check_dir_allowed (rootsdir, argv[3]);
 
   /* all checks passed, execute */
-  do_command ("/usr/bin/yum", &(argv[1]));
+  do_command ("/usr/libexec/mock-yum", &(argv[1]), 1);
 }
 
 
@@ -308,7 +308,7 @@
   check_dir_allowed (rootsdir, argv[2]);
 
   /* all checks passed, execute */
-  do_command ("/bin/umount", &(argv[1]));
+  do_command ("/bin/umount", &(argv[1]), 1);
 }
 
 /* make /dev/ device nodes */
@@ -338,7 +338,7 @@
 
   /* removed specific checks so we can make more than just /dev/null */
   /* all checks passed, execute */
-  do_command ("/bin/mknod", &(argv[1]));
+  do_command ("/bin/mknod", &(argv[1]), 0);
 }
 
 int




More information about the scm-commits mailing list