[ostree] main: Only verify SUPERUSER flag if using default sysroot



commit 2a30af72db2f2f535a2dff9b13b039bfc6e75465
Author: Colin Walters <walters verbum org>
Date:   Wed Apr 1 06:21:34 2015 -0400

    main: Only verify SUPERUSER flag if using default sysroot
    
    The use case for non-default sysroots that I know of are:
     1) The current test suite
     2) Installers (Anaconda)
     3) Inspecting VM disks
    
    For 2) and 3), it'll quickly be obvious if they're not running as
    root, and these are more obscure cases.  We want to allow 1), and this
    is a simple way to do it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747164

 src/ostree/ot-main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/ostree/ot-main.c b/src/ostree/ot-main.c
index 10ff748..1cff1f4 100644
--- a/src/ostree/ot-main.c
+++ b/src/ostree/ot-main.c
@@ -327,7 +327,8 @@ ostree_admin_option_context_parse (GOptionContext *context,
 
   if (flags & OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER)
     {
-      if (getuid () != 0)
+      if ((opt_sysroot == NULL || strcmp (opt_sysroot, "/") == 0)
+          && getuid () != 0)
         {
           g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
                        "You must be root to perform this command");


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