mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/berrange-gitlab/tags/misc-fixes-pull-request' into staging
Misc error reporting and checking fixes to authorization objects # gpg: Signature made Wed 18 Nov 2020 12:48:53 GMT # gpg: using RSA key DAF3A6FDB26B62912D0E8E3FBE86EBB415104FDF # gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [full] # gpg: aka "Daniel P. Berrange <berrange@redhat.com>" [full] # Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E 8E3F BE86 EBB4 1510 4FDF * remotes/berrange-gitlab/tags/misc-fixes-pull-request: authz-simple: Check that 'identity' property is set authz-pam: Check that 'service' property is set authz-list-file: Improve an error message authz-list-file: Fix file read error handling Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
+5
-1
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -65,11 +65,25 @@ 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",
|
||||
|
||||
Reference in New Issue
Block a user