peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0009-build-rename-CONFIG_LIBCAP-to-CONFIG_LIBCAP_NG.patch

1d442b
From: Paolo Bonzini <pbonzini@redhat.com>
1d442b
Date: Mon, 27 Jan 2020 19:00:38 +0000
1d442b
Subject: [PATCH] build: rename CONFIG_LIBCAP to CONFIG_LIBCAP_NG
1d442b
1d442b
Since we are actually testing for the newer capng library, rename the
1d442b
symbol to match.
1d442b
1d442b
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442b
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1d442b
(cherry picked from commit a358bca24026a377e0804e137a4499e4e041918d)
1d442b
---
1d442b
 configure             |  2 +-
1d442b
 qemu-bridge-helper.c  |  6 +++---
1d442b
 scsi/qemu-pr-helper.c | 12 ++++++------
1d442b
 3 files changed, 10 insertions(+), 10 deletions(-)
1d442b
1d442b
diff --git a/configure b/configure
1d442b
index 6099be1d84..afe9393f04 100755
1d442b
--- a/configure
1d442b
+++ b/configure
1d442b
@@ -6759,7 +6759,7 @@ if test "$l2tpv3" = "yes" ; then
1d442b
   echo "CONFIG_L2TPV3=y" >> $config_host_mak
1d442b
 fi
1d442b
 if test "$cap_ng" = "yes" ; then
1d442b
-  echo "CONFIG_LIBCAP=y" >> $config_host_mak
1d442b
+  echo "CONFIG_LIBCAP_NG=y" >> $config_host_mak
1d442b
 fi
1d442b
 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
1d442b
 for drv in $audio_drv_list; do
1d442b
diff --git a/qemu-bridge-helper.c b/qemu-bridge-helper.c
1d442b
index 3d50ec094c..88b26747fc 100644
1d442b
--- a/qemu-bridge-helper.c
1d442b
+++ b/qemu-bridge-helper.c
1d442b
@@ -43,7 +43,7 @@
1d442b
 
1d442b
 #include "net/tap-linux.h"
1d442b
 
1d442b
-#ifdef CONFIG_LIBCAP
1d442b
+#ifdef CONFIG_LIBCAP_NG
1d442b
 #include <cap-ng.h>
1d442b
 #endif
1d442b
 
1d442b
@@ -207,7 +207,7 @@ static int send_fd(int c, int fd)
1d442b
     return sendmsg(c, &msg, 0);
1d442b
 }
1d442b
 
1d442b
-#ifdef CONFIG_LIBCAP
1d442b
+#ifdef CONFIG_LIBCAP_NG
1d442b
 static int drop_privileges(void)
1d442b
 {
1d442b
     /* clear all capabilities */
1d442b
@@ -246,7 +246,7 @@ int main(int argc, char **argv)
1d442b
     int access_allowed, access_denied;
1d442b
     int ret = EXIT_SUCCESS;
1d442b
 
1d442b
-#ifdef CONFIG_LIBCAP
1d442b
+#ifdef CONFIG_LIBCAP_NG
1d442b
     /* if we're run from an suid binary, immediately drop privileges preserving
1d442b
      * cap_net_admin */
1d442b
     if (geteuid() == 0 && getuid() != geteuid()) {
1d442b
diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c
1d442b
index debb18f4aa..0659ceef09 100644
1d442b
--- a/scsi/qemu-pr-helper.c
1d442b
+++ b/scsi/qemu-pr-helper.c
1d442b
@@ -24,7 +24,7 @@
1d442b
 #include <linux/dm-ioctl.h>
1d442b
 #include <scsi/sg.h>
1d442b
 
1d442b
-#ifdef CONFIG_LIBCAP
1d442b
+#ifdef CONFIG_LIBCAP_NG
1d442b
 #include <cap-ng.h>
1d442b
 #endif
1d442b
 #include <pwd.h>
1d442b
@@ -70,7 +70,7 @@ static int num_active_sockets = 1;
1d442b
 static int noisy;
1d442b
 static int verbose;
1d442b
 
1d442b
-#ifdef CONFIG_LIBCAP
1d442b
+#ifdef CONFIG_LIBCAP_NG
1d442b
 static int uid = -1;
1d442b
 static int gid = -1;
1d442b
 #endif
1d442b
@@ -97,7 +97,7 @@ static void usage(const char *name)
1d442b
 "                            (default '%s')\n"
1d442b
 "  -T, --trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n"
1d442b
 "                            specify tracing options\n"
1d442b
-#ifdef CONFIG_LIBCAP
1d442b
+#ifdef CONFIG_LIBCAP_NG
1d442b
 "  -u, --user=USER           user to drop privileges to\n"
1d442b
 "  -g, --group=GROUP         group to drop privileges to\n"
1d442b
 #endif
1d442b
@@ -827,7 +827,7 @@ static void close_server_socket(void)
1d442b
     num_active_sockets--;
1d442b
 }
1d442b
 
1d442b
-#ifdef CONFIG_LIBCAP
1d442b
+#ifdef CONFIG_LIBCAP_NG
1d442b
 static int drop_privileges(void)
1d442b
 {
1d442b
     /* clear all capabilities */
1d442b
@@ -920,7 +920,7 @@ int main(int argc, char **argv)
1d442b
             pidfile = g_strdup(optarg);
1d442b
             pidfile_specified = true;
1d442b
             break;
1d442b
-#ifdef CONFIG_LIBCAP
1d442b
+#ifdef CONFIG_LIBCAP_NG
1d442b
         case 'u': {
1d442b
             unsigned long res;
1d442b
             struct passwd *userinfo = getpwnam(optarg);
1d442b
@@ -1056,7 +1056,7 @@ int main(int argc, char **argv)
1d442b
         exit(EXIT_FAILURE);
1d442b
     }
1d442b
 
1d442b
-#ifdef CONFIG_LIBCAP
1d442b
+#ifdef CONFIG_LIBCAP_NG
1d442b
     if (drop_privileges() < 0) {
1d442b
         error_report("Failed to drop privileges: %s", strerror(errno));
1d442b
         exit(EXIT_FAILURE);