diff options
-rw-r--r-- | authz/listfile.c | 6 | ||||
-rw-r--r-- | authz/pamacct.c | 6 | ||||
-rw-r--r-- | authz/simple.c | 14 |
3 files changed, 25 insertions, 1 deletions
diff --git a/authz/listfile.c b/authz/listfile.c index 24feac3..da3a0e6 100644 --- a/authz/listfile.c +++ b/authz/listfile.c @@ -73,7 +73,8 @@ qauthz_list_file_load(QAuthZListFile *fauthz, Error **errp) pdict = qobject_to(QDict, obj); if (!pdict) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "obj", "dict"); + error_setg(errp, "File '%s' must contain a JSON object", + fauthz->filename); goto cleanup; } @@ -128,6 +129,9 @@ qauthz_list_file_complete(UserCreatable *uc, Error **errp) } fauthz->list = qauthz_list_file_load(fauthz, errp); + if (!fauthz->list) { + return; + } if (!fauthz->refresh) { return; diff --git a/authz/pamacct.c b/authz/pamacct.c index e67195f..c862d9f 100644 --- a/authz/pamacct.c +++ b/authz/pamacct.c @@ -84,6 +84,12 @@ qauthz_pam_prop_get_service(Object *obj, static void qauthz_pam_complete(UserCreatable *uc, Error **errp) { + QAuthZPAM *pauthz = QAUTHZ_PAM(uc); + + if (!pauthz->service) { + error_setg(errp, "The 'service' property must be set"); + return; + } } 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", |