char *buffer, size_t buflen,
int *errnop) {
+ _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;
uint32_t translated;
size_t l;
int bypass, r;
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) {
+ if (r < 0)
bypass = 1;
- goto direct_lookup;
- }
+ }
+ if (bypass > 0) {
+ r = direct_lookup_name(name, (uid_t*) &translated);
+ if (r == -ENOENT)
+ goto not_found;
+ if (r < 0)
+ goto fail;
+ } else {
r = sd_bus_call_method(bus,
"org.freedesktop.systemd1",
"/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;
bypass = getenv_bool_secure("SYSTEMD_NSS_BYPASS_BUS");
if (bypass <= 0) {
r = sd_bus_open_system(&bus);
- if (r < 0) {
+ if (r < 0)
bypass = 1;
- goto direct_lookup;
- }
+ }
+
+ if (bypass > 0) {
+ r = direct_lookup_uid(uid, &direct);
+ if (r == -ENOENT)
+ goto not_found;
+ if (r < 0)
+ goto fail;
+
+ translated = direct;
+ } else {
r = sd_bus_call_method(bus,
"org.freedesktop.systemd1",
"/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;
char *buffer, size_t buflen,
int *errnop) {
+ _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;
uint32_t translated;
size_t l;
int bypass, r;
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) {
+ if (r < 0)
bypass = 1;
- goto direct_lookup;
- }
+ }
+ if (bypass > 0) {
+ r = direct_lookup_name(name, (uid_t*) &translated);
+ if (r == -ENOENT)
+ goto not_found;
+ if (r < 0)
+ goto fail;
+ } else {
r = sd_bus_call_method(bus,
"org.freedesktop.systemd1",
"/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;
bypass = getenv_bool_secure("SYSTEMD_NSS_BYPASS_BUS");
if (bypass <= 0) {
r = sd_bus_open_system(&bus);
- if (r < 0) {
+ if (r < 0)
bypass = 1;
- goto direct_lookup;
- }
+ }
+
+ if (bypass > 0) {
+ r = direct_lookup_uid(gid, &direct);
+ if (r == -ENOENT)
+ goto not_found;
+ if (r < 0)
+ goto fail;
+
+ translated = direct;
+ } else {
r = sd_bus_call_method(bus,
"org.freedesktop.systemd1",
"/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;