nss-mymachines.c revision e70df46b9721a3d025e7a0b4ffb5893cbde5e55d
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering This file is part of systemd.
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering Copyright 2014 Lennart Poettering
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering systemd is free software; you can redistribute it and/or modify it
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering under the terms of the GNU Lesser General Public License as published by
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering the Free Software Foundation; either version 2.1 of the License, or
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering (at your option) any later version.
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering systemd is distributed in the hope that it will be useful, but
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering Lesser General Public License for more details.
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering You should have received a copy of the GNU Lesser General Public License
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poetteringstatic int count_addresses(sd_bus_message *m, int af, unsigned *ret) {
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering unsigned c = 0;
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering while ((r = sd_bus_message_enter_container(m, 'r', "yay")) > 0) {
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poettering r = sd_bus_message_read(m, "i", &family);
d0767ffd08bbb5c069e266710eb0462315e47e6dLennart Poetteringenum nss_status _nss_mymachines_gethostbyname4_r(
char *r_name;
int n_ifindices, r;
goto fail;
r = -ENOTTY;
goto fail;
if (n_ifindices < 0) {
r = n_ifindices;
goto fail;
goto fail;
"/org/freedesktop/machine1",
NULL,
&reply,
goto fail;
goto fail;
goto fail;
return NSS_STATUS_NOTFOUND;
return NSS_STATUS_TRYAGAIN;
int family;
goto fail;
goto fail;
goto fail;
r = -EAFNOSUPPORT;
goto fail;
r = -EINVAL;
goto fail;
r_tuple->next = i == c-1 ? NULL : (struct gaih_addrtuple*) ((char*) r_tuple + ALIGN(sizeof(struct gaih_addrtuple)));
assert(i == c);
goto fail;
if (*pat)
if (ttlp)
*ttlp = 0;
*errnop = 0;
h_errno = 0;
return NSS_STATUS_SUCCESS;
fail:
*errnop = -r;
return NSS_STATUS_UNAVAIL;
const char *name,
int af,
char **canonp) {
r = -EAFNOSUPPORT;
goto fail;
goto fail;
r = -ENOTTY;
goto fail;
goto fail;
"/org/freedesktop/machine1",
NULL,
&reply,
goto fail;
goto fail;
goto fail;
return NSS_STATUS_NOTFOUND;
return NSS_STATUS_TRYAGAIN;
idx += sizeof(char*);
int family;
goto fail;
goto fail;
goto fail;
r = -EINVAL;
goto fail;
assert(i == c);
goto fail;
if (ttlp)
*ttlp = 0;
if (canonp)
*errnop = 0;
h_errno = 0;
return NSS_STATUS_SUCCESS;
fail:
*errnop = -r;
return NSS_STATUS_UNAVAIL;