]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
authz-pam: Check that 'service' property is set
authorKevin Wolf <kwolf@redhat.com>
Tue, 17 Nov 2020 16:30:44 +0000 (17:30 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 18 Nov 2020 10:51:35 +0000 (10:51 +0000)
If the 'service' property is not set, we'll call pam_start() with a NULL
pointer for the service name. This fails and leaves a message like this
in the syslog:

qemu-storage-daemon[294015]: PAM pam_start: invalid argument: service == NULL

Make specifying the property mandatory and catch the error already
during the creation of the object.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
authz/pamacct.c

index e67195f7be0f0333208b668c314db7db1a6c7963..c862d9ff39b2d7f3dd747835b26a61fe9abe3472 100644 (file)
@@ -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;
+    }
 }