chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sd-bus: add API to check if a client has privileges
[elogind.git]
/
src
/
nss-mymachines
/
nss-mymachines.c
diff --git
a/src/nss-mymachines/nss-mymachines.c
b/src/nss-mymachines/nss-mymachines.c
index 985ebb7134b4fa43d32b2b6ed3ebe78869846e27..abeb8253c3c2fa4781e8e8ac1f6901160f27f17b 100644
(file)
--- a/
src/nss-mymachines/nss-mymachines.c
+++ b/
src/nss-mymachines/nss-mymachines.c
@@
-39,7
+39,7
@@
static int count_addresses(sd_bus_message *m, int af, unsigned *ret) {
assert(m);
assert(ret);
assert(m);
assert(ret);
- while ((r = sd_bus_message_enter_container(m, 'r', "
y
ay")) > 0) {
+ while ((r = sd_bus_message_enter_container(m, 'r', "
i
ay")) > 0) {
int family;
r = sd_bus_message_read(m, "i", &family);
int family;
r = sd_bus_message_read(m, "i", &family);
@@
-79,7
+79,7
@@
enum nss_status _nss_mymachines_gethostbyname4_r(
struct gaih_addrtuple *r_tuple, *r_tuple_first = NULL;
_cleanup_bus_message_unref_ sd_bus_message* reply = NULL;
struct gaih_addrtuple *r_tuple, *r_tuple_first = NULL;
_cleanup_bus_message_unref_ sd_bus_message* reply = NULL;
- _cleanup_bus_unref_ sd_bus *bus = NULL;
+ _cleanup_bus_
close_
unref_ sd_bus *bus = NULL;
_cleanup_free_ int *ifindices = NULL;
_cleanup_free_ char *class = NULL;
size_t l, ms, idx;
_cleanup_free_ int *ifindices = NULL;
_cleanup_free_ char *class = NULL;
size_t l, ms, idx;
@@
-205,6
+205,11
@@
enum nss_status _nss_mymachines_gethostbyname4_r(
if (ttlp)
*ttlp = 0;
if (ttlp)
*ttlp = 0;
+ /* Explicitly reset all error variables */
+ *errnop = 0;
+ *h_errnop = NETDB_SUCCESS;
+ h_errno = 0;
+
return NSS_STATUS_SUCCESS;
fail:
return NSS_STATUS_SUCCESS;
fail:
@@
-223,7
+228,7
@@
enum nss_status _nss_mymachines_gethostbyname3_r(
char **canonp) {
_cleanup_bus_message_unref_ sd_bus_message* reply = NULL;
char **canonp) {
_cleanup_bus_message_unref_ sd_bus_message* reply = NULL;
- _cleanup_bus_unref_ sd_bus *bus = NULL;
+ _cleanup_bus_
close_
unref_ sd_bus *bus = NULL;
_cleanup_free_ char *class = NULL;
unsigned c = 0, i = 0;
char *r_name, *r_aliases, *r_addr, *r_addr_list;
_cleanup_free_ char *class = NULL;
unsigned c = 0, i = 0;
char *r_name, *r_aliases, *r_addr, *r_addr_list;
@@
-365,6
+370,11
@@
enum nss_status _nss_mymachines_gethostbyname3_r(
if (canonp)
*canonp = r_name;
if (canonp)
*canonp = r_name;
+ /* Explicitly reset all error variables */
+ *errnop = 0;
+ *h_errnop = NETDB_SUCCESS;
+ h_errno = 0;
+
return NSS_STATUS_SUCCESS;
fail:
return NSS_STATUS_SUCCESS;
fail: