/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to plugins.d/mandos-client.c

working new feature: network-hooks - Enables user-scripts to take up
                     interfaces during bootup

Show diffs side-by-side

added added

removed removed

Lines of Context:
202
202
}
203
203
 
204
204
/* Add server to set of servers to retry periodically */
205
 
bool add_server(const char *ip, uint16_t port, AvahiIfIndex if_index,
206
 
                int af){
 
205
int add_server(const char *ip, uint16_t port, AvahiIfIndex if_index,
 
206
               int af){
207
207
  int ret;
208
208
  server *new_server = malloc(sizeof(server));
209
209
  if(new_server == NULL){
210
210
    perror_plus("malloc");
211
 
    return false;
 
211
    return -1;
212
212
  }
213
213
  *new_server = (server){ .ip = strdup(ip),
214
214
                          .port = port,
216
216
                          .af = af };
217
217
  if(new_server->ip == NULL){
218
218
    perror_plus("strdup");
219
 
    return false;
 
219
    return -1;
220
220
  }
221
221
  /* Special case of first server */
222
222
  if (mc.current_server == NULL){
233
233
  ret = clock_gettime(CLOCK_MONOTONIC, &mc.current_server->last_seen);
234
234
  if(ret == -1){
235
235
    perror_plus("clock_gettime");
236
 
    return false;
 
236
    return -1;
237
237
  }
238
 
  return true;
 
238
  return 0;
239
239
}
240
240
 
241
241
/* 
1030
1030
      if(ret == 0){
1031
1031
        avahi_simple_poll_quit(mc.simple_poll);
1032
1032
      } else {
1033
 
        if(not add_server(ip, port, interface,
1034
 
                          avahi_proto_to_af(proto))){
1035
 
          fprintf_plus(stderr, "Failed to add server \"%s\" to server"
1036
 
                       " list\n", name);
1037
 
        }
 
1033
        ret = add_server(ip, port, interface,
 
1034
                         avahi_proto_to_af(proto));
1038
1035
      }
1039
1036
    }
1040
1037
  }
1674
1671
        argp_state_help(state, state->out_stream,
1675
1672
                        ARGP_HELP_USAGE | ARGP_HELP_EXIT_ERR);
1676
1673
      case 'V':                 /* --version */
 
1674
        fprintf_plus(state->out_stream,
 
1675
                     "Mandos plugin mandos-client: ");
1677
1676
        fprintf_plus(state->out_stream, "%s\n", argp_program_version);
1678
1677
        exit(argp_err_exit_status);
1679
1678
        break;