#ifdef HAVE_LIBREADLINE
+# include <stdio.h>
#if defined(HAVE_READLINE_READLINE_H)
# include <readline/readline.h>
# define USE_READLINE (1)
/*
* For configuration file stuff.
*/
-char const *progname = "radmin";
+static char const *progname = "radmin";
static char const *radmin_version = "radmin version " RADIUSD_VERSION_STRING
#ifdef RADIUSD_VERSION_COMMIT
" (git #" STRINGIFY(RADIUSD_VERSION_COMMIT) ")"
* they're running inside of the server. And we don't (yet)
* have a "libfreeradius-server", or "libfreeradius-util".
*/
-log_lvl_t debug_flag = 0;
-struct main_config_t main_config;
-
-bool check_config = false;
+main_config_t main_config;
static bool echo = false;
static char const *secret = "testing123";
memcpy(&status, buffer, sizeof(status));
status = ntohl(status);
- // set the status from the data
- return 1 + status;
+ return status;
default:
fprintf(stderr, "Unexpected response\n");
if (cf_file_read(cs, buffer) < 0) {
fprintf(stderr, "%s: Errors reading or parsing %s\n", progname, buffer);
+ talloc_free(cs);
usage(1);
}
len = run_command(sockfd, commands[i], buffer, sizeof(buffer));
if (len < 0) exit(1);
- if (len == 1) exit_status = EXIT_FAILURE;
+ if (len == FR_CHANNEL_FAIL) exit_status = EXIT_FAILURE;
}
exit(exit_status);
}
if (!quiet) {
printf("%s - FreeRADIUS Server administration tool.\n", radmin_version);
- printf("Copyright (C) 2008-2015 The FreeRADIUS server project and contributors.\n");
+ printf("Copyright (C) 2008-2017 The FreeRADIUS server project and contributors.\n");
printf("There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n");
printf("PARTICULAR PURPOSE.\n");
printf("You may redistribute copies of FreeRADIUS under the terms of the\n");
retry:
len = run_command(sockfd, line, buffer, sizeof(buffer));
if (len < 0) {
- if (!quiet) fprintf(stderr, "Reconnecting...");
+ if (!quiet) fprintf(stderr, "... reconnecting ...\n");
if (do_connect(&sockfd, file, server) < 0) {
exit(1);
fprintf(stderr, "Failed to connect to server\n");
exit(1);
- } else if (len == 0) {
+ } else if (len == FR_CHANNEL_SUCCESS) {
break;
- } else if (len == 1) {
+ } else if (len == FR_CHANNEL_FAIL) {
exit_status = EXIT_FAILURE;
}
}