pam_systemd_home: make sure we handle RefUnit() returning HomeBusy properly
authorLennart Poettering <lennart@poettering.net>
Tue, 28 Nov 2023 14:42:13 +0000 (15:42 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 14 Feb 2024 14:08:55 +0000 (15:08 +0100)
RefUnit() only succeeds it a home dir is fully up. We already dealt with
it not being up at all, but let's also cover the case where it is
currently busy with changing state, and in that case fall back to
RefUnrestricted(), with the usual implications.

This has the effect that two subsequent ssh logins one-after-the-other
will work correctly.

src/home/pam_systemd_home.c

index 2f628e37094500f5e5aded9f640113ec9cdf667b..21caa5a0589372e488d3debe1f143511f6813284 100644 (file)
@@ -621,7 +621,7 @@ static int acquire_home(
 
                 r = sd_bus_call(bus, m, HOME_SLOW_BUS_CALL_TIMEOUT_USEC, &error, &reply);
                 if (r < 0) {
-                        if (sd_bus_error_has_name(&error, BUS_ERROR_HOME_NOT_ACTIVE)) {
+                        if (sd_bus_error_has_names(&error, BUS_ERROR_HOME_NOT_ACTIVE, BUS_ERROR_HOME_BUSY)) {
                                 /* Only on RefHome(): We can't access the home directory currently, unless
                                  * it's unlocked with a password. Hence, let's try this again, this time with
                                  * authentication. */