fr_assert(coa_tree);
if (!fr_rb_insert(coa_tree, parent)) {
ERROR("Failed inserting packet from %s into CoA tree", request->name);
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
return 0;
fr_assert(request->reply == NULL);
#ifdef STATIC_ANALYZER
- if (!secret) fr_exit_now(1);
+ if (!secret) fr_exit_now(EXIT_FAILURE);
#endif
fr_assert(request->packet->id < 0);
* Cleanly close the BIO, so that we exercise the shutdown path.
*/
fr_assert(bio == client_bio);
- TALLOC_FREE(client_bio);
+ TALLOC_FREE(bio);
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
* Cleanly close the BIO, so that we exercise the shutdown path.
*/
fr_assert(client == client_bio);
- TALLOC_FREE(client_bio);
+ TALLOC_FREE(client);
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
static void client_read(fr_event_list_t *el, int fd, UNUSED int flags, void *uctx)
rcode = fr_bio_packet_read(client, (void **) &request, &reply, client, &reply_pairs);
if (rcode < 0) {
ERROR("Failed reading packet - %s", fr_bio_strerror(rcode));
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
/*
* The retry bio takes care of suppressing duplicate replies.
*/
if (paused) {
- if (fr_event_filter_update(el, fd, FR_EVENT_FILTER_IO, resume_write) < 0) fr_assert(0);
+ if (fr_event_filter_update(el, fd, FR_EVENT_FILTER_IO, resume_write) < 0) {
+ fr_perror("radclient");
+ fr_exit_now(EXIT_FAILURE);
+ }
paused = false;
}
*/
if (!request) {
pause:
- if (fr_event_filter_update(el, fd, FR_EVENT_FILTER_IO, pause_write) < 0) fr_assert(0);
+ if (fr_event_filter_update(el, fd, FR_EVENT_FILTER_IO, pause_write) < 0) {
+ fr_perror("radclient");
+ fr_exit_now(EXIT_FAILURE);
+ }
return;
}
goto pause;
}
- if (send_one_packet(client, request) < 0) fr_assert(0);
+ if (send_one_packet(client, request) < 0) {
+ fr_perror("radclient");
+ fr_exit_now(EXIT_FAILURE);
+ }
request->resend++;
current = request;
if (fr_event_fd_insert(autofree, NULL, info->retry_info->el, info->fd_info->socket.fd,
client_read, client_write, client_error, client) < 0) {
fr_perror("radclient");
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
}
if (fr_inet_pton_port(&fd_config.src_ipaddr, &fd_config.src_port,
optarg, -1, AF_UNSPEC, true, false) < 0) {
fr_perror("Failed parsing source address");
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
break;
}
fp = fopen(optarg, "r");
if (!fp) {
ERROR("Error opening %s: %s", optarg, fr_syserror(errno));
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
if (fgets(filesecret, sizeof(filesecret), fp) == NULL) {
ERROR("Error reading %s: %s", optarg, fr_syserror(errno));
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
fclose(fp);
if (strlen(filesecret) < 2) {
ERROR("Secret in %s is too short", optarg);
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
secret = talloc_strdup(autofree, filesecret);
client_config.verify.secret = (uint8_t *) secret;
if (strcmp(argv[1], "-") != 0) {
if (fr_inet_pton_port(&fd_config.dst_ipaddr, &fd_config.dst_port, argv[1], -1, fd_config.dst_ipaddr.af, true, true) < 0) {
fr_perror("radclient");
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
/*
attr_coa_filter = fr_dict_attr_by_name(NULL, fr_dict_root(dict_radius), attr_coa_filter_name);
if (!attr_coa_filter) {
ERROR("Unknown or invalid CoA filter attribute %s", optarg);
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
/*
files = talloc_zero(talloc_autofree_context(), rc_file_pair_t);
files->packets = "-";
- if (radclient_init(files, files) < 0) fr_exit_now(1);
+ if (radclient_init(files, files) < 0) fr_exit_now(EXIT_FAILURE);
}
if ((forced_id >= 0) && (fr_dlist_num_elements(&filenames) > 1)) {
fr_dlist_foreach(&filenames, rc_file_pair_t, files) {
if (radclient_init(files, files)) {
ERROR("Failed parsing input files");
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
}
*/
if (!fr_dlist_num_elements(&rc_request_list)) {
ERROR("Nothing to send");
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
/***********************************************************************
NULL);
if (!client_config.retry_cfg.el) {
ERROR("Failed opening event list: %s", fr_strerror());
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
/*
client_bio = fr_radius_client_bio_alloc(autofree, &client_config, &fd_config);
if (!client_bio) {
ERROR("Failed opening socket: %s", fr_strerror());
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
client_info = fr_radius_client_bio_info(client_bio);
if (forced_id >= 0) {
if (fr_radius_client_bio_force_id(client_bio, packet_code, forced_id) < 0) {
fr_perror("radclient");
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
}
*/
fr_dlist_foreach(&rc_request_list, rc_request_t, this) {
if (radclient_sane(this) < 0) {
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
}
if (fr_event_fd_insert(autofree, NULL, client_config.retry_cfg.el, client_info->fd_info->socket.fd, NULL,
fr_radius_client_bio_connect, client_error, client_bio) < 0) {
fr_perror("radclient");
- fr_exit_now(1);
+ fr_exit_now(EXIT_FAILURE);
}
/***********************************************************************