188
188
TEMP_FAILURE_RETRY(fprintf(stream, "Mandos plugin %s: ",
189
189
program_invocation_short_name));
190
return TEMP_FAILURE_RETRY(vfprintf(stream, format, ap));
190
return (int)TEMP_FAILURE_RETRY(vfprintf(stream, format, ap));
662
/* If the interface is specified and we have a list of interfaces */
663
if(if_index != AVAHI_IF_UNSPEC and mc->interfaces != NULL){
664
/* Check if the interface is one of the interfaces we are using */
667
char *interface = NULL;
668
while((interface=argz_next(mc->interfaces, mc->interfaces_size,
670
if(if_nametoindex(interface) == (unsigned int)if_index){
677
/* This interface does not match any in the list, so we don't
678
connect to the server */
680
char interface[IF_NAMESIZE];
681
if(if_indextoname((unsigned int)if_index, interface) == NULL){
682
perror_plus("if_indextoname");
684
fprintf_plus(stderr, "Skipping server on non-used interface"
686
if_indextoname((unsigned int)if_index,
662
694
ret = init_gnutls_session(&session, mc);
2006
2038
/* Lower privileges */
2010
perror_plus("seteuid");
2015
/* Remove empty interface names */
2043
/* Remove invalid interface names (except "none") */
2017
2045
char *interface = NULL;
2018
2046
while((interface = argz_next(mc.interfaces, mc.interfaces_size,
2020
if(if_nametoindex(interface) == 0){
2021
if(interface[0] != '\0' and strcmp(interface, "none") != 0){
2048
if(strcmp(interface, "none") != 0
2049
and if_nametoindex(interface) == 0){
2050
if(interface[0] != '\0'){
2022
2051
fprintf_plus(stderr, "Not using nonexisting interface"
2023
2052
" \"%s\"\n", interface);
2159
/* If we only got one interface, explicitly use only that one */
2160
if(argz_count(mc.interfaces, mc.interfaces_size) == 1){
2162
fprintf_plus(stderr, "Using only interface \"%s\"\n",
2165
if_index = (AvahiIfIndex)if_nametoindex(mc.interfaces);
2168
/* Bring up interfaces which are down */
2169
if(not (argz_count(mc.interfaces, mc.interfaces_size) == 1
2170
and strcmp(mc.interfaces, "none") == 0)){
2187
/* Bring up interfaces which are down, and remove any "none"s */
2171
2189
char *interface = NULL;
2172
2190
while((interface = argz_next(mc.interfaces, mc.interfaces_size,
2192
/* If interface name is "none", stop bringing up interfaces.
2193
Also remove all instances of "none" from the list */
2194
if(strcmp(interface, "none") == 0){
2195
argz_delete(&mc.interfaces, &mc.interfaces_size,
2198
while((interface = argz_next(mc.interfaces,
2199
mc.interfaces_size, interface))){
2200
if(strcmp(interface, "none") == 0){
2201
argz_delete(&mc.interfaces, &mc.interfaces_size,
2174
2208
bool interface_was_up = interface_is_up(interface);
2175
2209
ret = bring_up_interface(interface, delay);
2176
2210
if(not interface_was_up){
2187
free(mc.interfaces);
2188
mc.interfaces = NULL;
2189
mc.interfaces_size = 0;
2190
2221
if(debug and (interfaces_to_take_down == NULL)){
2191
2222
fprintf_plus(stderr, "No interfaces were brought up\n");
2226
/* If we only got one interface, explicitly use only that one */
2227
if(argz_count(mc.interfaces, mc.interfaces_size) == 1){
2229
fprintf_plus(stderr, "Using only interface \"%s\"\n",
2232
if_index = (AvahiIfIndex)if_nametoindex(mc.interfaces);