uint32_t translated;
size_t l;
- int r;
+ int bypass, r;
BLOCK_SIGNALS(NSS_SIGNALS_BLOCK);
if (getenv_bool_secure("SYSTEMD_NSS_DYNAMIC_BYPASS") > 0)
goto not_found;
- if (getenv_bool_secure("SYSTEMD_NSS_BYPASS_BUS") > 0) {
-
- /* Access the dynamic UID allocation directly if we are called from dbus-daemon, see above. */
- r = direct_lookup_name(name, (uid_t*) &translated);
- if (r == -ENOENT)
- goto not_found;
- if (r < 0)
- goto fail;
-
- } else {
+ bypass = getenv_bool_secure("SYSTEMD_NSS_BYPASS_BUS");
+ if (bypass <= 0) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message* reply = NULL;
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
r = sd_bus_open_system(&bus);
- if (r < 0)
- goto fail;
+ if (r < 0) {
+ bypass = 1;
+ goto direct_lookup;
+ }
r = sd_bus_call_method(bus,
"org.freedesktop.systemd1",
goto fail;
}
+direct_lookup:
+ if (bypass > 0) {
+ /* Access the dynamic UID allocation directly if we are called from dbus-daemon, see above. */
+ r = direct_lookup_name(name, (uid_t*) &translated);
+ if (r == -ENOENT)
+ goto not_found;
+ if (r < 0)
+ goto fail;
+ }
+
l = strlen(name);
if (buflen < l+1) {
*errnop = ERANGE;
_cleanup_free_ char *direct = NULL;
const char *translated;
size_t l;
- int r;
+ int bypass, r;
BLOCK_SIGNALS(NSS_SIGNALS_BLOCK);
if (getenv_bool_secure("SYSTEMD_NSS_DYNAMIC_BYPASS") > 0)
goto not_found;
- if (getenv_bool_secure("SYSTEMD_NSS_BYPASS_BUS") > 0) {
-
- r = direct_lookup_uid(uid, &direct);
- if (r == -ENOENT)
- goto not_found;
- if (r < 0)
- goto fail;
-
- translated = direct;
-
- } else {
+ bypass = getenv_bool_secure("SYSTEMD_NSS_BYPASS_BUS");
+ if (bypass <= 0) {
r = sd_bus_open_system(&bus);
- if (r < 0)
- goto fail;
+ if (r < 0) {
+ bypass = 1;
+ goto direct_lookup;
+ }
r = sd_bus_call_method(bus,
"org.freedesktop.systemd1",
goto fail;
}
+direct_lookup:
+ if (bypass > 0) {
+ r = direct_lookup_uid(uid, &direct);
+ if (r == -ENOENT)
+ goto not_found;
+ if (r < 0)
+ goto fail;
+
+ translated = direct;
+
+ }
+
l = strlen(translated) + 1;
if (buflen < l) {
*errnop = ERANGE;
uint32_t translated;
size_t l;
- int r;
+ int bypass, r;
BLOCK_SIGNALS(NSS_SIGNALS_BLOCK);
if (getenv_bool_secure("SYSTEMD_NSS_DYNAMIC_BYPASS") > 0)
goto not_found;
- if (getenv_bool_secure("SYSTEMD_NSS_BYPASS_BUS") > 0) {
-
- /* Access the dynamic GID allocation directly if we are called from dbus-daemon, see above. */
- r = direct_lookup_name(name, (uid_t*) &translated);
- if (r == -ENOENT)
- goto not_found;
- if (r < 0)
- goto fail;
- } else {
-
+ bypass = getenv_bool_secure("SYSTEMD_NSS_BYPASS_BUS");
+ if (bypass <= 0) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message* reply = NULL;
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
r = sd_bus_open_system(&bus);
- if (r < 0)
- goto fail;
+ if (r < 0) {
+ bypass = 1;
+ goto direct_lookup;
+ }
r = sd_bus_call_method(bus,
"org.freedesktop.systemd1",
goto fail;
}
+direct_lookup:
+ if (bypass > 0) {
+ /* Access the dynamic GID allocation directly if we are called from dbus-daemon, see above. */
+ r = direct_lookup_name(name, (uid_t*) &translated);
+ if (r == -ENOENT)
+ goto not_found;
+ if (r < 0)
+ goto fail;
+ }
+
l = sizeof(char*) + strlen(name) + 1;
if (buflen < l) {
*errnop = ERANGE;
_cleanup_free_ char *direct = NULL;
const char *translated;
size_t l;
- int r;
+ int bypass, r;
BLOCK_SIGNALS(NSS_SIGNALS_BLOCK);
if (getenv_bool_secure("SYSTEMD_NSS_DYNAMIC_BYPASS") > 0)
goto not_found;
- if (getenv_bool_secure("SYSTEMD_NSS_BYPASS_BUS") > 0) {
-
- r = direct_lookup_uid(gid, &direct);
- if (r == -ENOENT)
- goto not_found;
- if (r < 0)
- goto fail;
-
- translated = direct;
- } else {
+ bypass = getenv_bool_secure("SYSTEMD_NSS_BYPASS_BUS");
+ if (bypass <= 0) {
r = sd_bus_open_system(&bus);
- if (r < 0)
- goto fail;
+ if (r < 0) {
+ bypass = 1;
+ goto direct_lookup;
+ }
r = sd_bus_call_method(bus,
"org.freedesktop.systemd1",
goto fail;
}
+direct_lookup:
+ if (bypass > 0) {
+
+ r = direct_lookup_uid(gid, &direct);
+ if (r == -ENOENT)
+ goto not_found;
+ if (r < 0)
+ goto fail;
+
+ translated = direct;
+ }
+
l = sizeof(char*) + strlen(translated) + 1;
if (buflen < l) {
*errnop = ERANGE;