_cleanup_(json_variant_unrefp) JsonVariant *last = NULL;
r = userdb_all(userdb_flags, &iterator);
+ if (IN_SET(r, -ESRCH, -ENOLINK))
+ /* We turn off Varlink lookups in various cases (e.g. in case we only enable DropIn
+ * backend) — this might make userdb_all return ENOLINK (which indicates that varlink
+ * was off and no other suitable source or entries were found). Let's hide this
+ * implementation detail and always return NoRecordFound in this case, since from a
+ * client's perspective it's irrelevant if there was no entry at all or just not on
+ * the service that the query was limited to. */
+ return varlink_error(link, "io.systemd.UserDatabase.NoRecordFound", NULL);
if (r < 0)
return r;
_cleanup_(json_variant_unrefp) JsonVariant *last = NULL;
r = groupdb_all(userdb_flags, &iterator);
+ if (IN_SET(r, -ESRCH, -ENOLINK))
+ return varlink_error(link, "io.systemd.UserDatabase.NoRecordFound", NULL);
if (r < 0)
return r;
r = membershipdb_by_user(p.user_name, userdb_flags, &iterator);
else
r = membershipdb_all(userdb_flags, &iterator);
+ if (IN_SET(r, -ESRCH, -ENOLINK))
+ return varlink_error(link, "io.systemd.UserDatabase.NoRecordFound", NULL);
if (r < 0)
return r;