Skip to content

Commit c2aa8a3

Browse files
kevmwberrange
authored andcommitted
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 <[email protected]> Signed-off-by: Daniel P. Berrangé <[email protected]>
1 parent 3428455 commit c2aa8a3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

authz/simple.c

+14
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,25 @@ qauthz_simple_finalize(Object *obj)
6565
}
6666

6767

68+
static void
69+
qauthz_simple_complete(UserCreatable *uc, Error **errp)
70+
{
71+
QAuthZSimple *sauthz = QAUTHZ_SIMPLE(uc);
72+
73+
if (!sauthz->identity) {
74+
error_setg(errp, "The 'identity' property must be set");
75+
return;
76+
}
77+
}
78+
79+
6880
static void
6981
qauthz_simple_class_init(ObjectClass *oc, void *data)
7082
{
7183
QAuthZClass *authz = QAUTHZ_CLASS(oc);
84+
UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
7285

86+
ucc->complete = qauthz_simple_complete;
7387
authz->is_allowed = qauthz_simple_is_allowed;
7488

7589
object_class_property_add_str(oc, "identity",

0 commit comments

Comments
 (0)