Change the identity class attribute names with a "UNIX" tag to have a
more generic "OS" tag, since when we expose this in the public API we
want it to be more flexible for the future.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/access/viraccessdriverpolkit.c | 12 ++---
src/admin/admin_server.c | 10 ++--
src/libvirt_private.syms | 24 ++++-----
src/rpc/virnetserverclient.c | 12 ++---
src/util/viridentity.c | 84 +++++++++++++++---------------
src/util/viridentity.h | 60 ++++++++++-----------
tests/viridentitytest.c | 18 +++----
tests/virnetserverclienttest.c | 8 +--
8 files changed, 114 insertions(+), 114 deletions(-)
diff --git a/src/access/viraccessdriverpolkit.c b/src/access/viraccessdriverpolkit.c
index b1473cd0a4..b98122d4a3 100644
--- a/src/access/viraccessdriverpolkit.c
+++ b/src/access/viraccessdriverpolkit.c
@@ -88,19 +88,19 @@ virAccessDriverPolkitGetCaller(const char *actionid,
return -1;
}
- if (virIdentityGetUNIXProcessID(identity, pid) < 0) {
+ if (virIdentityGetOSProcessID(identity, pid) < 0) {
virAccessError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("No UNIX process ID available"));
+ _("No OS process ID available"));
goto cleanup;
}
- if (virIdentityGetUNIXProcessTime(identity, startTime) < 0) {
+ if (virIdentityGetOSProcessTime(identity, startTime) < 0) {
virAccessError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("No UNIX process start time available"));
+ _("No OS process start time available"));
goto cleanup;
}
- if (virIdentityGetUNIXUserID(identity, uid) < 0) {
+ if (virIdentityGetOSUserID(identity, uid) < 0) {
virAccessError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("No UNIX caller UID available"));
+ _("No OS caller UID available"));
goto cleanup;
}
diff --git a/src/admin/admin_server.c b/src/admin/admin_server.c
index f2a38f6dfa..b92eb2fdc6 100644
--- a/src/admin/admin_server.c
+++ b/src/admin/admin_server.c
@@ -257,29 +257,29 @@ adminClientGetInfo(virNetServerClientPtr client,
pid_t pid;
uid_t uid;
gid_t gid;
- if (virIdentityGetUNIXUserID(identity, &uid) < 0 ||
+ if (virIdentityGetOSUserID(identity, &uid) < 0 ||
virTypedParamsAddInt(&tmpparams, nparams, &maxparams,
VIR_CLIENT_INFO_UNIX_USER_ID, uid) < 0)
goto cleanup;
- if (virIdentityGetUNIXUserName(identity, &attr) < 0 ||
+ if (virIdentityGetOSUserName(identity, &attr) < 0 ||
virTypedParamsAddString(&tmpparams, nparams, &maxparams,
VIR_CLIENT_INFO_UNIX_USER_NAME,
attr) < 0)
goto cleanup;
- if (virIdentityGetUNIXGroupID(identity, &gid) < 0 ||
+ if (virIdentityGetOSGroupID(identity, &gid) < 0 ||
virTypedParamsAddInt(&tmpparams, nparams, &maxparams,
VIR_CLIENT_INFO_UNIX_GROUP_ID, gid) < 0)
goto cleanup;
- if (virIdentityGetUNIXGroupName(identity, &attr) < 0 ||
+ if (virIdentityGetOSGroupName(identity, &attr) < 0 ||
virTypedParamsAddString(&tmpparams, nparams, &maxparams,
VIR_CLIENT_INFO_UNIX_GROUP_NAME,
attr) < 0)
goto cleanup;
- if (virIdentityGetUNIXProcessID(identity, &pid) < 0 ||
+ if (virIdentityGetOSProcessID(identity, &pid) < 0 ||
virTypedParamsAddInt(&tmpparams, nparams, &maxparams,
VIR_CLIENT_INFO_UNIX_PROCESS_ID, pid) < 0)
goto cleanup;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c323f679b3..ac357583e4 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2138,28 +2138,28 @@ virHostMemSetParameters;
# util/viridentity.h
virIdentityGetAttr;
virIdentityGetCurrent;
+virIdentityGetOSGroupID;
+virIdentityGetOSGroupName;
+virIdentityGetOSProcessID;
+virIdentityGetOSProcessTime;
+virIdentityGetOSUserID;
+virIdentityGetOSUserName;
virIdentityGetSASLUserName;
virIdentityGetSELinuxContext;
virIdentityGetSystem;
-virIdentityGetUNIXGroupID;
-virIdentityGetUNIXGroupName;
-virIdentityGetUNIXProcessID;
-virIdentityGetUNIXProcessTime;
-virIdentityGetUNIXUserID;
-virIdentityGetUNIXUserName;
virIdentityGetX509DName;
virIdentityIsEqual;
virIdentityNew;
virIdentitySetAttr;
virIdentitySetCurrent;
+virIdentitySetOSGroupID;
+virIdentitySetOSGroupName;
+virIdentitySetOSProcessID;
+virIdentitySetOSProcessTime;
+virIdentitySetOSUserID;
+virIdentitySetOSUserName;
virIdentitySetSASLUserName;
virIdentitySetSELinuxContext;
-virIdentitySetUNIXGroupID;
-virIdentitySetUNIXGroupName;
-virIdentitySetUNIXProcessID;
-virIdentitySetUNIXProcessTime;
-virIdentitySetUNIXUserID;
-virIdentitySetUNIXUserName;
virIdentitySetX509DName;
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 410de253d2..1f020a5a04 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -779,21 +779,21 @@ virNetServerClientCreateIdentity(virNetServerClientPtr client)
if (!(username = virGetUserName(uid)))
goto error;
- if (virIdentitySetUNIXUserName(ret, username) < 0)
+ if (virIdentitySetOSUserName(ret, username) < 0)
goto error;
- if (virIdentitySetUNIXUserID(ret, uid) < 0)
+ if (virIdentitySetOSUserID(ret, uid) < 0)
goto error;
if (!(groupname = virGetGroupName(gid)))
goto error;
- if (virIdentitySetUNIXGroupName(ret, groupname) < 0)
+ if (virIdentitySetOSGroupName(ret, groupname) < 0)
goto error;
- if (virIdentitySetUNIXGroupID(ret, gid) < 0)
+ if (virIdentitySetOSGroupID(ret, gid) < 0)
goto error;
- if (virIdentitySetUNIXProcessID(ret, pid) < 0)
+ if (virIdentitySetOSProcessID(ret, pid) < 0)
goto error;
- if (virIdentitySetUNIXProcessTime(ret, timestamp) < 0)
+ if (virIdentitySetOSProcessTime(ret, timestamp) < 0)
goto error;
}
diff --git a/src/util/viridentity.c b/src/util/viridentity.c
index 4ceff3cb74..2c6c0ee91f 100644
--- a/src/util/viridentity.c
+++ b/src/util/viridentity.c
@@ -144,27 +144,27 @@ virIdentityPtr virIdentityGetSystem(void)
if (!(ret = virIdentityNew()))
goto error;
- if (virIdentitySetUNIXProcessID(ret, getpid()) < 0)
+ if (virIdentitySetOSProcessID(ret, getpid()) < 0)
goto error;
if (virProcessGetStartTime(getpid(), &startTime) < 0)
goto error;
if (startTime != 0 &&
- virIdentitySetUNIXProcessTime(ret, startTime) < 0)
+ virIdentitySetOSProcessTime(ret, startTime) < 0)
goto error;
if (!(username = virGetUserName(geteuid())))
return ret;
- if (virIdentitySetUNIXUserName(ret, username) < 0)
+ if (virIdentitySetOSUserName(ret, username) < 0)
goto error;
- if (virIdentitySetUNIXUserID(ret, getuid()) < 0)
+ if (virIdentitySetOSUserID(ret, getuid()) < 0)
goto error;
if (!(groupname = virGetGroupName(getegid())))
return ret;
- if (virIdentitySetUNIXGroupName(ret, groupname) < 0)
+ if (virIdentitySetOSGroupName(ret, groupname) < 0)
goto error;
- if (virIdentitySetUNIXGroupID(ret, getgid()) < 0)
+ if (virIdentitySetOSGroupID(ret, getgid()) < 0)
goto error;
#if WITH_SELINUX
@@ -310,24 +310,24 @@ bool virIdentityIsEqual(virIdentityPtr identA,
}
-int virIdentityGetUNIXUserName(virIdentityPtr ident,
- const char **username)
+int virIdentityGetOSUserName(virIdentityPtr ident,
+ const char **username)
{
return virIdentityGetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_USER_NAME,
+ VIR_IDENTITY_ATTR_OS_USER_NAME,
username);
}
-int virIdentityGetUNIXUserID(virIdentityPtr ident,
- uid_t *uid)
+int virIdentityGetOSUserID(virIdentityPtr ident,
+ uid_t *uid)
{
int val;
const char *userid;
*uid = -1;
if (virIdentityGetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_USER_ID,
+ VIR_IDENTITY_ATTR_OS_USER_ID,
&userid) < 0)
return -1;
@@ -342,24 +342,24 @@ int virIdentityGetUNIXUserID(virIdentityPtr ident,
return 0;
}
-int virIdentityGetUNIXGroupName(virIdentityPtr ident,
- const char **groupname)
+int virIdentityGetOSGroupName(virIdentityPtr ident,
+ const char **groupname)
{
return virIdentityGetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_GROUP_NAME,
+ VIR_IDENTITY_ATTR_OS_GROUP_NAME,
groupname);
}
-int virIdentityGetUNIXGroupID(virIdentityPtr ident,
- gid_t *gid)
+int virIdentityGetOSGroupID(virIdentityPtr ident,
+ gid_t *gid)
{
int val;
const char *groupid;
*gid = -1;
if (virIdentityGetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_GROUP_ID,
+ VIR_IDENTITY_ATTR_OS_GROUP_ID,
&groupid) < 0)
return -1;
@@ -375,15 +375,15 @@ int virIdentityGetUNIXGroupID(virIdentityPtr ident,
}
-int virIdentityGetUNIXProcessID(virIdentityPtr ident,
- pid_t *pid)
+int virIdentityGetOSProcessID(virIdentityPtr ident,
+ pid_t *pid)
{
unsigned long long val;
const char *processid;
*pid = 0;
if (virIdentityGetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_PROCESS_ID,
+ VIR_IDENTITY_ATTR_OS_PROCESS_ID,
&processid) < 0)
return -1;
@@ -399,12 +399,12 @@ int virIdentityGetUNIXProcessID(virIdentityPtr ident,
}
-int virIdentityGetUNIXProcessTime(virIdentityPtr ident,
- unsigned long long *timestamp)
+int virIdentityGetOSProcessTime(virIdentityPtr ident,
+ unsigned long long *timestamp)
{
const char *processtime;
if (virIdentityGetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_PROCESS_TIME,
+ VIR_IDENTITY_ATTR_OS_PROCESS_TIME,
&processtime) < 0)
return -1;
@@ -445,17 +445,17 @@ int virIdentityGetSELinuxContext(virIdentityPtr ident,
}
-int virIdentitySetUNIXUserName(virIdentityPtr ident,
- const char *username)
+int virIdentitySetOSUserName(virIdentityPtr ident,
+ const char *username)
{
return virIdentitySetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_USER_NAME,
+ VIR_IDENTITY_ATTR_OS_USER_NAME,
username);
}
-int virIdentitySetUNIXUserID(virIdentityPtr ident,
- uid_t uid)
+int virIdentitySetOSUserID(virIdentityPtr ident,
+ uid_t uid)
{
VIR_AUTOFREE(char *) val = NULL;
@@ -463,22 +463,22 @@ int virIdentitySetUNIXUserID(virIdentityPtr ident,
return -1;
return virIdentitySetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_USER_ID,
+ VIR_IDENTITY_ATTR_OS_USER_ID,
val);
}
-int virIdentitySetUNIXGroupName(virIdentityPtr ident,
- const char *groupname)
+int virIdentitySetOSGroupName(virIdentityPtr ident,
+ const char *groupname)
{
return virIdentitySetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_GROUP_NAME,
+ VIR_IDENTITY_ATTR_OS_GROUP_NAME,
groupname);
}
-int virIdentitySetUNIXGroupID(virIdentityPtr ident,
- gid_t gid)
+int virIdentitySetOSGroupID(virIdentityPtr ident,
+ gid_t gid)
{
VIR_AUTOFREE(char *) val = NULL;
@@ -486,13 +486,13 @@ int virIdentitySetUNIXGroupID(virIdentityPtr ident,
return -1;
return virIdentitySetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_GROUP_ID,
+ VIR_IDENTITY_ATTR_OS_GROUP_ID,
val);
}
-int virIdentitySetUNIXProcessID(virIdentityPtr ident,
- pid_t pid)
+int virIdentitySetOSProcessID(virIdentityPtr ident,
+ pid_t pid)
{
VIR_AUTOFREE(char *) val = NULL;
@@ -500,13 +500,13 @@ int virIdentitySetUNIXProcessID(virIdentityPtr ident,
return -1;
return virIdentitySetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_PROCESS_ID,
+ VIR_IDENTITY_ATTR_OS_PROCESS_ID,
val);
}
-int virIdentitySetUNIXProcessTime(virIdentityPtr ident,
- unsigned long long timestamp)
+int virIdentitySetOSProcessTime(virIdentityPtr ident,
+ unsigned long long timestamp)
{
VIR_AUTOFREE(char *) val = NULL;
@@ -514,7 +514,7 @@ int virIdentitySetUNIXProcessTime(virIdentityPtr ident,
return -1;
return virIdentitySetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_PROCESS_TIME,
+ VIR_IDENTITY_ATTR_OS_PROCESS_TIME,
val);
}
diff --git a/src/util/viridentity.h b/src/util/viridentity.h
index 0fde3207ca..4b87506373 100644
--- a/src/util/viridentity.h
+++ b/src/util/viridentity.h
@@ -27,12 +27,12 @@ typedef struct _virIdentity virIdentity;
typedef virIdentity *virIdentityPtr;
typedef enum {
- VIR_IDENTITY_ATTR_UNIX_USER_NAME,
- VIR_IDENTITY_ATTR_UNIX_USER_ID,
- VIR_IDENTITY_ATTR_UNIX_GROUP_NAME,
- VIR_IDENTITY_ATTR_UNIX_GROUP_ID,
- VIR_IDENTITY_ATTR_UNIX_PROCESS_ID,
- VIR_IDENTITY_ATTR_UNIX_PROCESS_TIME,
+ VIR_IDENTITY_ATTR_OS_USER_NAME,
+ VIR_IDENTITY_ATTR_OS_USER_ID,
+ VIR_IDENTITY_ATTR_OS_GROUP_NAME,
+ VIR_IDENTITY_ATTR_OS_GROUP_ID,
+ VIR_IDENTITY_ATTR_OS_PROCESS_ID,
+ VIR_IDENTITY_ATTR_OS_PROCESS_TIME,
VIR_IDENTITY_ATTR_SASL_USER_NAME,
VIR_IDENTITY_ATTR_X509_DISTINGUISHED_NAME,
VIR_IDENTITY_ATTR_SELINUX_CONTEXT,
@@ -64,18 +64,18 @@ bool virIdentityIsEqual(virIdentityPtr identA,
ATTRIBUTE_NONNULL(1)
ATTRIBUTE_NONNULL(2);
-int virIdentityGetUNIXUserName(virIdentityPtr ident,
- const char **username);
-int virIdentityGetUNIXUserID(virIdentityPtr ident,
- uid_t *uid);
-int virIdentityGetUNIXGroupName(virIdentityPtr ident,
- const char **groupname);
-int virIdentityGetUNIXGroupID(virIdentityPtr ident,
- gid_t *gid);
-int virIdentityGetUNIXProcessID(virIdentityPtr ident,
- pid_t *pid);
-int virIdentityGetUNIXProcessTime(virIdentityPtr ident,
- unsigned long long *timestamp);
+int virIdentityGetOSUserName(virIdentityPtr ident,
+ const char **username);
+int virIdentityGetOSUserID(virIdentityPtr ident,
+ uid_t *uid);
+int virIdentityGetOSGroupName(virIdentityPtr ident,
+ const char **groupname);
+int virIdentityGetOSGroupID(virIdentityPtr ident,
+ gid_t *gid);
+int virIdentityGetOSProcessID(virIdentityPtr ident,
+ pid_t *pid);
+int virIdentityGetOSProcessTime(virIdentityPtr ident,
+ unsigned long long *timestamp);
int virIdentityGetSASLUserName(virIdentityPtr ident,
const char **username);
int virIdentityGetX509DName(virIdentityPtr ident,
@@ -84,18 +84,18 @@ int virIdentityGetSELinuxContext(virIdentityPtr ident,
const char **context);
-int virIdentitySetUNIXUserName(virIdentityPtr ident,
- const char *username);
-int virIdentitySetUNIXUserID(virIdentityPtr ident,
- uid_t uid);
-int virIdentitySetUNIXGroupName(virIdentityPtr ident,
- const char *groupname);
-int virIdentitySetUNIXGroupID(virIdentityPtr ident,
- gid_t gid);
-int virIdentitySetUNIXProcessID(virIdentityPtr ident,
- pid_t pid);
-int virIdentitySetUNIXProcessTime(virIdentityPtr ident,
- unsigned long long timestamp);
+int virIdentitySetOSUserName(virIdentityPtr ident,
+ const char *username);
+int virIdentitySetOSUserID(virIdentityPtr ident,
+ uid_t uid);
+int virIdentitySetOSGroupName(virIdentityPtr ident,
+ const char *groupname);
+int virIdentitySetOSGroupID(virIdentityPtr ident,
+ gid_t gid);
+int virIdentitySetOSProcessID(virIdentityPtr ident,
+ pid_t pid);
+int virIdentitySetOSProcessTime(virIdentityPtr ident,
+ unsigned long long timestamp);
int virIdentitySetSASLUserName(virIdentityPtr ident,
const char *username);
int virIdentitySetX509DName(virIdentityPtr ident,
diff --git a/tests/viridentitytest.c b/tests/viridentitytest.c
index b60d944d8e..64b511c272 100644
--- a/tests/viridentitytest.c
+++ b/tests/viridentitytest.c
@@ -46,12 +46,12 @@ static int testIdentityAttrs(const void *data ATTRIBUTE_UNUSED)
goto cleanup;
if (virIdentitySetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_USER_NAME,
+ VIR_IDENTITY_ATTR_OS_USER_NAME,
"fred") < 0)
goto cleanup;
if (virIdentityGetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_USER_NAME,
+ VIR_IDENTITY_ATTR_OS_USER_NAME,
&val) < 0)
goto cleanup;
@@ -61,7 +61,7 @@ static int testIdentityAttrs(const void *data ATTRIBUTE_UNUSED)
}
if (virIdentityGetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_GROUP_NAME,
+ VIR_IDENTITY_ATTR_OS_GROUP_NAME,
&val) < 0)
goto cleanup;
@@ -71,14 +71,14 @@ static int testIdentityAttrs(const void *data ATTRIBUTE_UNUSED)
}
if (virIdentitySetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_USER_NAME,
+ VIR_IDENTITY_ATTR_OS_USER_NAME,
"joe") != -1) {
VIR_DEBUG("Unexpectedly overwrote attribute");
goto cleanup;
}
if (virIdentityGetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_USER_NAME,
+ VIR_IDENTITY_ATTR_OS_USER_NAME,
&val) < 0)
goto cleanup;
@@ -111,7 +111,7 @@ static int testIdentityEqual(const void *data ATTRIBUTE_UNUSED)
}
if (virIdentitySetAttr(identa,
- VIR_IDENTITY_ATTR_UNIX_USER_NAME,
+ VIR_IDENTITY_ATTR_OS_USER_NAME,
"fred") < 0)
goto cleanup;
@@ -121,7 +121,7 @@ static int testIdentityEqual(const void *data ATTRIBUTE_UNUSED)
}
if (virIdentitySetAttr(identb,
- VIR_IDENTITY_ATTR_UNIX_USER_NAME,
+ VIR_IDENTITY_ATTR_OS_USER_NAME,
"fred") < 0)
goto cleanup;
@@ -131,11 +131,11 @@ static int testIdentityEqual(const void *data ATTRIBUTE_UNUSED)
}
if (virIdentitySetAttr(identa,
- VIR_IDENTITY_ATTR_UNIX_GROUP_NAME,
+ VIR_IDENTITY_ATTR_OS_GROUP_NAME,
"flintstone") < 0)
goto cleanup;
if (virIdentitySetAttr(identb,
- VIR_IDENTITY_ATTR_UNIX_GROUP_NAME,
+ VIR_IDENTITY_ATTR_OS_GROUP_NAME,
"flintstone") < 0)
goto cleanup;
diff --git a/tests/virnetserverclienttest.c b/tests/virnetserverclienttest.c
index cb5071b2d9..280bd24227 100644
--- a/tests/virnetserverclienttest.c
+++ b/tests/virnetserverclienttest.c
@@ -86,7 +86,7 @@ static int testIdentity(const void *opaque ATTRIBUTE_UNUSED)
}
if (virIdentityGetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_USER_NAME,
+ VIR_IDENTITY_ATTR_OS_USER_NAME,
&gotUsername) < 0) {
fprintf(stderr, "Missing username in identity\n");
goto cleanup;
@@ -98,7 +98,7 @@ static int testIdentity(const void *opaque ATTRIBUTE_UNUSED)
}
if (virIdentityGetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_USER_ID,
+ VIR_IDENTITY_ATTR_OS_USER_ID,
&gotUserID) < 0) {
fprintf(stderr, "Missing user ID in identity\n");
goto cleanup;
@@ -110,7 +110,7 @@ static int testIdentity(const void *opaque ATTRIBUTE_UNUSED)
}
if (virIdentityGetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_GROUP_NAME,
+ VIR_IDENTITY_ATTR_OS_GROUP_NAME,
&gotGroupname) < 0) {
fprintf(stderr, "Missing groupname in identity\n");
goto cleanup;
@@ -122,7 +122,7 @@ static int testIdentity(const void *opaque ATTRIBUTE_UNUSED)
}
if (virIdentityGetAttr(ident,
- VIR_IDENTITY_ATTR_UNIX_GROUP_ID,
+ VIR_IDENTITY_ATTR_OS_GROUP_ID,
&gotGroupID) < 0) {
fprintf(stderr, "Missing group ID in identity\n");
goto cleanup;
--
2.21.0