summaryrefslogtreecommitdiff
path: root/src/nss-mymachines/nss-mymachines.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-08-18 22:52:13 -0400
committerGitHub <noreply@github.com>2016-08-18 22:52:13 -0400
commit57e3375f83c09c21e1d68151425493112ae7ff66 (patch)
treeeb4466e1ca55cc31e4aa6dfd238d3dab866df677 /src/nss-mymachines/nss-mymachines.c
parent2ae0858e6c12018def32921e5d732395c74c4379 (diff)
parent6e32c03ed87e5dfd3857013e909e48b5e61564c1 (diff)
Merge pull request #3865 from poettering/remove-ipc
add RemoveIPC= service file setting
Diffstat (limited to 'src/nss-mymachines/nss-mymachines.c')
-rw-r--r--src/nss-mymachines/nss-mymachines.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/nss-mymachines/nss-mymachines.c b/src/nss-mymachines/nss-mymachines.c
index 8d57b26cbc..895f61c462 100644
--- a/src/nss-mymachines/nss-mymachines.c
+++ b/src/nss-mymachines/nss-mymachines.c
@@ -25,6 +25,7 @@
#include "alloc-util.h"
#include "bus-common-errors.h"
+#include "env-util.h"
#include "hostname-util.h"
#include "in-addr-util.h"
#include "macro.h"
@@ -434,6 +435,12 @@ enum nss_status _nss_mymachines_getpwnam_r(
if (!machine_name_is_valid(machine))
goto not_found;
+ if (getenv_bool("SYSTEMD_NSS_BYPASS_BUS") > 0)
+ /* Make sure we can't deadlock if we are invoked by dbus-daemon. This way, it won't be able to resolve
+ * these UIDs, but that should be unproblematic as containers should never be able to connect to a bus
+ * running on the host. */
+ goto not_found;
+
r = sd_bus_open_system(&bus);
if (r < 0)
goto fail;
@@ -514,6 +521,9 @@ enum nss_status _nss_mymachines_getpwuid_r(
if (uid < HOST_UID_LIMIT)
goto not_found;
+ if (getenv_bool("SYSTEMD_NSS_BYPASS_BUS") > 0)
+ goto not_found;
+
r = sd_bus_open_system(&bus);
if (r < 0)
goto fail;
@@ -605,6 +615,9 @@ enum nss_status _nss_mymachines_getgrnam_r(
if (!machine_name_is_valid(machine))
goto not_found;
+ if (getenv_bool("SYSTEMD_NSS_BYPASS_BUS") > 0)
+ goto not_found;
+
r = sd_bus_open_system(&bus);
if (r < 0)
goto fail;
@@ -682,6 +695,9 @@ enum nss_status _nss_mymachines_getgrgid_r(
if (gid < HOST_GID_LIMIT)
goto not_found;
+ if (getenv_bool("SYSTEMD_NSS_BYPASS_BUS") > 0)
+ goto not_found;
+
r = sd_bus_open_system(&bus);
if (r < 0)
goto fail;