diff options
author | Kevin Wolf <kwolf@redhat.com> | 2020-11-17 17:30:45 +0100 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2020-11-18 10:51:35 +0000 |
commit | c2aa8a3d7e5ce57fa3df310c9b7ca48fcbf9d4ad (patch) | |
tree | 6f7e285c4d3140958971600005fa94fdffba5304 /authz/simple.c | |
parent | 3428455df9302b2b924e380cb90a77ca1ce5001e (diff) | |
download | qemu-c2aa8a3d7e5ce57fa3df310c9b7ca48fcbf9d4ad.zip qemu-c2aa8a3d7e5ce57fa3df310c9b7ca48fcbf9d4ad.tar.gz qemu-c2aa8a3d7e5ce57fa3df310c9b7ca48fcbf9d4ad.tar.bz2 |
authz-simple: Check that 'identity' property is set
If the 'identify' property is not set, we'll pass a NULL pointer to
g_str_equal() and crash. Catch the error condition during the creation
of the object.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'authz/simple.c')
-rw-r--r-- | authz/simple.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/authz/simple.c b/authz/simple.c index 18db035..0597dcd 100644 --- a/authz/simple.c +++ b/authz/simple.c @@ -66,10 +66,24 @@ qauthz_simple_finalize(Object *obj) static void +qauthz_simple_complete(UserCreatable *uc, Error **errp) +{ + QAuthZSimple *sauthz = QAUTHZ_SIMPLE(uc); + + if (!sauthz->identity) { + error_setg(errp, "The 'identity' property must be set"); + return; + } +} + + +static void qauthz_simple_class_init(ObjectClass *oc, void *data) { QAuthZClass *authz = QAUTHZ_CLASS(oc); + UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc); + ucc->complete = qauthz_simple_complete; authz->is_allowed = qauthz_simple_is_allowed; object_class_property_add_str(oc, "identity", |