From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> The there various methods named "virXXXXSecurityContext", which are specific to SELinux. Rename them all to "virXXXXSELinuxContext". They will still raise errors at runtime if SELinux is not compiled in Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> --- src/libvirt_private.syms | 4 ++-- src/rpc/virnetserverclient.c | 10 +++++----- src/rpc/virnetserverclient.h | 4 ++-- src/rpc/virnetsocket.c | 8 ++++---- src/rpc/virnetsocket.h | 4 ++-- src/util/viridentity.c | 2 +- src/util/viridentity.h | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a7e1eeb..4335152 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -862,7 +862,7 @@ virNetServerClientGetFD; virNetServerClientGetIdentity; virNetServerClientGetPrivateData; virNetServerClientGetReadonly; -virNetServerClientGetSecurityContext; +virNetServerClientGetSELinuxContext; virNetServerClientGetUNIXIdentity; virNetServerClientImmediateClose; virNetServerClientInit; @@ -933,7 +933,7 @@ virNetSocketClose; virNetSocketDupFD; virNetSocketGetFD; virNetSocketGetPort; -virNetSocketGetSecurityContext; +virNetSocketGetSELinuxContext; virNetSocketGetUNIXIdentity; virNetSocketHasCachedData; virNetSocketHasPassFD; diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c index 58fb0b4..50015f7 100644 --- a/src/rpc/virnetserverclient.c +++ b/src/rpc/virnetserverclient.c @@ -699,7 +699,7 @@ virNetServerClientCreateIdentity(virNetServerClientPtr client) #endif if (client->sock && - virNetSocketGetSecurityContext(client->sock, &seccontext) < 0) + virNetSocketGetSELinuxContext(client->sock, &seccontext) < 0) goto cleanup; if (!(ret = virIdentityNew())) @@ -734,7 +734,7 @@ virNetServerClientCreateIdentity(virNetServerClientPtr client) goto error; if (seccontext && virIdentitySetAttr(ret, - VIR_IDENTITY_ATTR_SECURITY_CONTEXT, + VIR_IDENTITY_ATTR_SELINUX_CONTEXT, seccontext) < 0) goto error; @@ -769,14 +769,14 @@ virIdentityPtr virNetServerClientGetIdentity(virNetServerClientPtr client) } -int virNetServerClientGetSecurityContext(virNetServerClientPtr client, - char **context) +int virNetServerClientGetSELinuxContext(virNetServerClientPtr client, + char **context) { int ret = 0; *context = NULL; virObjectLock(client); if (client->sock) - ret = virNetSocketGetSecurityContext(client->sock, context); + ret = virNetSocketGetSELinuxContext(client->sock, context); virObjectUnlock(client); return ret; } diff --git a/src/rpc/virnetserverclient.h b/src/rpc/virnetserverclient.h index b3b8df0..8536994 100644 --- a/src/rpc/virnetserverclient.h +++ b/src/rpc/virnetserverclient.h @@ -101,8 +101,8 @@ bool virNetServerClientIsLocal(virNetServerClientPtr client); int virNetServerClientGetUNIXIdentity(virNetServerClientPtr client, uid_t *uid, gid_t *gid, pid_t *pid); -int virNetServerClientGetSecurityContext(virNetServerClientPtr client, - char **context); +int virNetServerClientGetSELinuxContext(virNetServerClientPtr client, + char **context); virIdentityPtr virNetServerClientGetIdentity(virNetServerClientPtr client); diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index c4fd9ee..5a831dd 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -1161,8 +1161,8 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock ATTRIBUTE_UNUSED, #endif #ifdef WITH_SELINUX -int virNetSocketGetSecurityContext(virNetSocketPtr sock, - char **context) +int virNetSocketGetSELinuxContext(virNetSocketPtr sock, + char **context) { security_context_t seccon = NULL; int ret = -1; @@ -1192,8 +1192,8 @@ cleanup: return ret; } #else -int virNetSocketGetSecurityContext(virNetSocketPtr sock ATTRIBUTE_UNUSED, - char **context) +int virNetSocketGetSELinuxContext(virNetSocketPtr sock ATTRIBUTE_UNUSED, + char **context) { *context = NULL; return 0; diff --git a/src/rpc/virnetsocket.h b/src/rpc/virnetsocket.h index 7392c72..7bced14 100644 --- a/src/rpc/virnetsocket.h +++ b/src/rpc/virnetsocket.h @@ -114,8 +114,8 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock, uid_t *uid, gid_t *gid, pid_t *pid); -int virNetSocketGetSecurityContext(virNetSocketPtr sock, - char **context); +int virNetSocketGetSELinuxContext(virNetSocketPtr sock, + char **context); int virNetSocketSetBlocking(virNetSocketPtr sock, bool blocking); diff --git a/src/util/viridentity.c b/src/util/viridentity.c index c9efd3f..840485a 100644 --- a/src/util/viridentity.c +++ b/src/util/viridentity.c @@ -173,7 +173,7 @@ virIdentityPtr virIdentityGetSystem(void) goto error; if (seccontext && virIdentitySetAttr(ret, - VIR_IDENTITY_ATTR_SECURITY_CONTEXT, + VIR_IDENTITY_ATTR_SELINUX_CONTEXT, seccontext) < 0) goto error; diff --git a/src/util/viridentity.h b/src/util/viridentity.h index 39ab20e..d7293be 100644 --- a/src/util/viridentity.h +++ b/src/util/viridentity.h @@ -33,7 +33,7 @@ typedef enum { VIR_IDENTITY_ATTR_UNIX_PROCESS_ID, VIR_IDENTITY_ATTR_SASL_USER_NAME, VIR_IDENTITY_ATTR_X509_DISTINGUISHED_NAME, - VIR_IDENTITY_ATTR_SECURITY_CONTEXT, + VIR_IDENTITY_ATTR_SELINUX_CONTEXT, VIR_IDENTITY_ATTR_LAST, } virIdentityAttrType; -- 1.8.1.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list