diff options
| -rw-r--r-- | Makefile.am | 11 | ||||
| -rw-r--r-- | acinclude.m4 | 33 | ||||
| -rw-r--r-- | configure.ac | 2 | ||||
| -rw-r--r-- | src/tinyrad-url.c | 316 |
4 files changed, 0 insertions, 362 deletions
diff --git a/Makefile.am b/Makefile.am index 7c645c5..a70073d 100644 --- a/Makefile.am +++ b/Makefile.am | |||
| @@ -106,7 +106,6 @@ EXTRA_PROGRAMS = examples/seed-by-clock \ | |||
| 106 | EXTRA = lib/libtinyrad.a \ | 106 | EXTRA = lib/libtinyrad.a \ |
| 107 | lib/libtinyrad.la \ | 107 | lib/libtinyrad.la \ |
| 108 | src/tinyrad \ | 108 | src/tinyrad \ |
| 109 | src/tinyrad-url \ | ||
| 110 | src/tinyradproxy \ | 109 | src/tinyradproxy \ |
| 111 | include/tinyrad.h | 110 | include/tinyrad.h |
| 112 | 111 | ||
| @@ -210,9 +209,6 @@ if ENABLE_TINYRAD | |||
| 210 | bin_PROGRAMS += src/tinyrad | 209 | bin_PROGRAMS += src/tinyrad |
| 211 | TESTS += tests/test-dict-defaults.sh | 210 | TESTS += tests/test-dict-defaults.sh |
| 212 | endif | 211 | endif |
| 213 | if ENABLE_TINYRAD_URL | ||
| 214 | bin_PROGRAMS += src/tinyrad-url | ||
| 215 | endif | ||
| 216 | if ENABLE_TINYRADPROXY | 212 | if ENABLE_TINYRADPROXY |
| 217 | sbin_PROGRAMS += src/tinyradproxy | 213 | sbin_PROGRAMS += src/tinyradproxy |
| 218 | endif | 214 | endif |
| @@ -312,13 +308,6 @@ src_tinyrad_SOURCES = $(noinst_HEADERS) $(include_HEADERS) \ | |||
| 312 | src/tru/widget-url.c | 308 | src/tru/widget-url.c |
| 313 | 309 | ||
| 314 | 310 | ||
| 315 | # macros for src/tinyrad-url | ||
| 316 | src_tinyrad_url_DEPENDENCIES = $(lib_LTLIBRARIES) $(noinst_LIBRARIES) | ||
| 317 | src_tinyrad_url_LDADD = $(lib_LTLIBRARIES) $(noinst_LIBRARIES) | ||
| 318 | src_tinyrad_url_SOURCES = $(noinst_HEADERS) $(include_HEADERS) \ | ||
| 319 | src/tinyrad-url.c | ||
| 320 | |||
| 321 | |||
| 322 | # macros for src/tinyradproxy | 311 | # macros for src/tinyradproxy |
| 323 | src_tinyradproxy_DEPENDENCIES = $(lib_LTLIBRARIES) $(noinst_LIBRARIES) | 312 | src_tinyradproxy_DEPENDENCIES = $(lib_LTLIBRARIES) $(noinst_LIBRARIES) |
| 324 | src_tinyradproxy_LDADD = $(lib_LTLIBRARIES) $(noinst_LIBRARIES) | 313 | src_tinyradproxy_LDADD = $(lib_LTLIBRARIES) $(noinst_LIBRARIES) |
diff --git a/acinclude.m4 b/acinclude.m4 index cc01489..87343ad 100644 --- a/acinclude.m4 +++ b/acinclude.m4 | |||
| @@ -39,14 +39,12 @@ AC_DEFUN([AC_TINYRAD_COMMON],[dnl | |||
| 39 | AC_REQUIRE([AC_TINYRAD_DOCUMENTATION]) | 39 | AC_REQUIRE([AC_TINYRAD_DOCUMENTATION]) |
| 40 | AC_REQUIRE([AC_TINYRAD_LIBTINYRAD]) | 40 | AC_REQUIRE([AC_TINYRAD_LIBTINYRAD]) |
| 41 | AC_REQUIRE([AC_TINYRAD_TINYRAD]) | 41 | AC_REQUIRE([AC_TINYRAD_TINYRAD]) |
| 42 | AC_REQUIRE([AC_TINYRAD_TINYRAD_URL]) | ||
| 43 | AC_REQUIRE([AC_TINYRAD_TINYRADPROXY]) | 42 | AC_REQUIRE([AC_TINYRAD_TINYRADPROXY]) |
| 44 | 43 | ||
| 45 | ENABLE_TINYRAD_COMMON="no" | 44 | ENABLE_TINYRAD_COMMON="no" |
| 46 | if test "x${ENABLE_DOCUMENATION}" = "xyes";then ENABLE_TINYRAD_COMMON="yes" | 45 | if test "x${ENABLE_DOCUMENATION}" = "xyes";then ENABLE_TINYRAD_COMMON="yes" |
| 47 | elif test "x${ENABLE_LIBTINYRAD}" = "xyes";then ENABLE_TINYRAD_COMMON="yes" | 46 | elif test "x${ENABLE_LIBTINYRAD}" = "xyes";then ENABLE_TINYRAD_COMMON="yes" |
| 48 | elif test "x${ENABLE_TINYRAD}" = "xyes";then ENABLE_TINYRAD_COMMON="yes" | 47 | elif test "x${ENABLE_TINYRAD}" = "xyes";then ENABLE_TINYRAD_COMMON="yes" |
| 49 | elif test "x${ENABLE_TINYRAD_URL}" = "xyes";then ENABLE_TINYRAD_COMMON="yes" | ||
| 50 | elif test "x${ENABLE_TINYRADPROXY}" = "xyes";then ENABLE_TINYRAD_COMMON="yes" | 48 | elif test "x${ENABLE_TINYRADPROXY}" = "xyes";then ENABLE_TINYRAD_COMMON="yes" |
| 51 | fi; | 49 | fi; |
| 52 | 50 | ||
| @@ -216,37 +214,6 @@ AC_DEFUN([AC_TINYRAD_TINYRAD],[dnl | |||
| 216 | ])dnl | 214 | ])dnl |
| 217 | 215 | ||
| 218 | 216 | ||
| 219 | # AC_TINYRAD_TINYRAD_URL() | ||
| 220 | # ______________________________________________________________________________ | ||
| 221 | AC_DEFUN([AC_TINYRAD_TINYRAD_URL],[dnl | ||
| 222 | |||
| 223 | AC_REQUIRE([AC_TINYRAD_UTILITIES]) | ||
| 224 | |||
| 225 | enableval="" | ||
| 226 | AC_ARG_ENABLE( | ||
| 227 | tinyrad-url, | ||
| 228 | [AS_HELP_STRING([--enable-tinyrad-url], [enable tinyrad-url utility])], | ||
| 229 | [ ETINYRADURL=$enableval ], | ||
| 230 | [ ETINYRADURL=$enableval ] | ||
| 231 | ) | ||
| 232 | |||
| 233 | if test "x${ETINYRADURL}" == "xyes";then | ||
| 234 | ENABLE_TINYRAD_URL="yes" | ||
| 235 | elif test "x${ETINYRADURL}" == "xno";then | ||
| 236 | ENABLE_TINYRAD_URL="no" | ||
| 237 | elif test "x${ENABLE_UTILITIES}" == "xyes";then | ||
| 238 | ENABLE_TINYRAD_URL="yes" | ||
| 239 | elif test "x${ENABLE_UTILITIES}" == "xno";then | ||
| 240 | ENABLE_TINYRAD_URL="no" | ||
| 241 | else | ||
| 242 | ENABLE_TINYRAD_URL="no" | ||
| 243 | fi | ||
| 244 | |||
| 245 | AM_CONDITIONAL([ENABLE_TINYRAD_URL], [test "$ENABLE_TINYRAD_URL" = "yes"]) | ||
| 246 | AM_CONDITIONAL([DISABLE_TINYRAD_URL], [test "$ENABLE_TINYRAD_URL" = "no"]) | ||
| 247 | ])dnl | ||
| 248 | |||
| 249 | |||
| 250 | # AC_TINYRAD_TINYRADPROXY() | 217 | # AC_TINYRAD_TINYRADPROXY() |
| 251 | # ______________________________________________________________________________ | 218 | # ______________________________________________________________________________ |
| 252 | AC_DEFUN([AC_TINYRAD_TINYRADPROXY],[dnl | 219 | AC_DEFUN([AC_TINYRAD_TINYRADPROXY],[dnl |
diff --git a/configure.ac b/configure.ac index 1bb778d..ef2eac8 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -196,7 +196,6 @@ AC_TINYRAD_LIBTINYRAD | |||
| 196 | AC_TINYRAD_UTILITIES | 196 | AC_TINYRAD_UTILITIES |
| 197 | AC_TINYRAD_TINYRAD | 197 | AC_TINYRAD_TINYRAD |
| 198 | AC_TINYRAD_TINYRADPROXY | 198 | AC_TINYRAD_TINYRADPROXY |
| 199 | AC_TINYRAD_TINYRAD_URL | ||
| 200 | AC_TINYRAD_EXAMPLES | 199 | AC_TINYRAD_EXAMPLES |
| 201 | AC_TINYRAD_DOCUMENTATION | 200 | AC_TINYRAD_DOCUMENTATION |
| 202 | AC_TINYRAD_COMMON | 201 | AC_TINYRAD_COMMON |
| @@ -224,7 +223,6 @@ AC_MSG_NOTICE([ Build examples ${ENABLE_EXAMPLES}]) | |||
| 224 | AC_MSG_NOTICE([ Install extra docs ${ENABLE_DOCUMENATION}]) | 223 | AC_MSG_NOTICE([ Install extra docs ${ENABLE_DOCUMENATION}]) |
| 225 | AC_MSG_NOTICE([ Install libtinyrad.la ${ENABLE_LIBTINYRAD}]) | 224 | AC_MSG_NOTICE([ Install libtinyrad.la ${ENABLE_LIBTINYRAD}]) |
| 226 | AC_MSG_NOTICE([ Install tinyrad ${ENABLE_TINYRAD}]) | 225 | AC_MSG_NOTICE([ Install tinyrad ${ENABLE_TINYRAD}]) |
| 227 | AC_MSG_NOTICE([ Install tinyrad-url ${ENABLE_TINYRAD_URL}]) | ||
| 228 | AC_MSG_NOTICE([ Install tinyradproxy ${ENABLE_TINYRADPROXY}]) | 226 | AC_MSG_NOTICE([ Install tinyradproxy ${ENABLE_TINYRADPROXY}]) |
| 229 | AC_MSG_NOTICE([ Install common files ${ENABLE_TINYRAD_COMMON}]) | 227 | AC_MSG_NOTICE([ Install common files ${ENABLE_TINYRAD_COMMON}]) |
| 230 | AC_MSG_NOTICE([ ]) | 228 | AC_MSG_NOTICE([ ]) |
diff --git a/src/tinyrad-url.c b/src/tinyrad-url.c deleted file mode 100644 index 00d432a..0000000 --- a/src/tinyrad-url.c +++ /dev/null | |||
| @@ -1,316 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Tiny RADIUS Client Library | ||
| 3 | * Copyright (C) 2021 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * All rights reserved. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions are | ||
| 8 | * met: | ||
| 9 | * | ||
| 10 | * * Redistributions of source code must retain the above copyright | ||
| 11 | * notice, this list of conditions and the following disclaimer. | ||
| 12 | * * Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in the | ||
| 14 | * documentation and/or other materials provided with the distribution. | ||
| 15 | * * Neither the name of David M. Syzdek nor the | ||
| 16 | * names of its contributors may be used to endorse or promote products | ||
| 17 | * derived from this software without specific prior written permission. | ||
| 18 | * | ||
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 20 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 21 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M. SYZDEK BE LIABLE FOR | ||
| 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 29 | * SUCH DAMAGE. | ||
| 30 | */ | ||
| 31 | #define _SRC_UTILITIES_TINYRAD_URL_C 1 | ||
| 32 | |||
| 33 | |||
| 34 | /////////////// | ||
| 35 | // // | ||
| 36 | // Headers // | ||
| 37 | // // | ||
| 38 | /////////////// | ||
| 39 | #pragma mark - Headers | ||
| 40 | |||
| 41 | #include <tinyrad_utils.h> | ||
| 42 | |||
| 43 | #include <stdio.h> | ||
| 44 | #include <stdarg.h> | ||
| 45 | #include <stdlib.h> | ||
| 46 | #include <string.h> | ||
| 47 | #include <strings.h> | ||
| 48 | #include <unistd.h> | ||
| 49 | #include <getopt.h> | ||
| 50 | #include <arpa/inet.h> | ||
| 51 | |||
| 52 | |||
| 53 | /////////////////// | ||
| 54 | // // | ||
| 55 | // Definitions // | ||
| 56 | // // | ||
| 57 | /////////////////// | ||
| 58 | #pragma mark - Definitions | ||
| 59 | |||
| 60 | #undef PROGRAM_NAME | ||
| 61 | #define PROGRAM_NAME "tinyrad-url" | ||
| 62 | |||
| 63 | |||
| 64 | ////////////////// | ||
| 65 | // // | ||
| 66 | // Prototypes // | ||
| 67 | // // | ||
| 68 | ////////////////// | ||
| 69 | #pragma mark - Prototypes | ||
| 70 | |||
| 71 | int main( int argc, char * argv[] ); | ||
| 72 | |||
| 73 | int my_print_urldesc( TinyRadURLDesc * trudp); | ||
| 74 | void my_usage( void ); | ||
| 75 | |||
| 76 | |||
| 77 | ///////////////// | ||
| 78 | // // | ||
| 79 | // Functions // | ||
| 80 | // // | ||
| 81 | ///////////////// | ||
| 82 | #pragma mark - Functions | ||
| 83 | |||
| 84 | int main(int argc, char * argv[]) | ||
| 85 | { | ||
| 86 | int opt; | ||
| 87 | int c; | ||
| 88 | int rc; | ||
| 89 | int pos; | ||
| 90 | int opt_index; | ||
| 91 | int resolve; | ||
| 92 | unsigned opts; | ||
| 93 | uint32_t tr_opts; | ||
| 94 | TinyRadURLDesc * trudp; | ||
| 95 | TinyRadURLDesc ** trudpp; | ||
| 96 | TinyRadURLDesc * trudp_next; | ||
| 97 | |||
| 98 | // getopt options | ||
| 99 | static char short_opt[] = "d:46hqrVv"; | ||
| 100 | static struct option long_opt[] = | ||
| 101 | { | ||
| 102 | {"debug", optional_argument, NULL, 'd' }, | ||
| 103 | {"help", no_argument, NULL, 'h' }, | ||
| 104 | {"quiet", no_argument, NULL, 'q' }, | ||
| 105 | {"silent", no_argument, NULL, 'q' }, | ||
| 106 | {"version", no_argument, NULL, 'V' }, | ||
| 107 | {"verbose", no_argument, NULL, 'v' }, | ||
| 108 | {"resolve", no_argument, NULL, 'r' }, | ||
| 109 | { NULL, 0, NULL, 0 } | ||
| 110 | }; | ||
| 111 | |||
| 112 | trutils_initialize(PROGRAM_NAME); | ||
| 113 | |||
| 114 | opts = 0; | ||
| 115 | tr_opts = 0; | ||
| 116 | resolve = 0; | ||
| 117 | trudp = NULL; | ||
| 118 | trudp_next = NULL; | ||
| 119 | |||
| 120 | while((c = getopt_long(argc, argv, short_opt, long_opt, &opt_index)) != -1) | ||
| 121 | { | ||
| 122 | switch(c) | ||
| 123 | { | ||
| 124 | case -1: /* no more arguments */ | ||
| 125 | case 0: /* long options toggles */ | ||
| 126 | break; | ||
| 127 | |||
| 128 | case '4': | ||
| 129 | tr_opts |= TRAD_IPV4; | ||
| 130 | break; | ||
| 131 | |||
| 132 | case '6': | ||
| 133 | tr_opts |= TRAD_IPV6; | ||
| 134 | break; | ||
| 135 | |||
| 136 | case 'd': | ||
| 137 | opt = ((optarg)) ? (int)strtol(optarg, NULL, 0) : TRAD_DEBUG_ANY; | ||
| 138 | tinyrad_set_option(NULL, TRAD_OPT_DEBUG_LEVEL, &opt); | ||
| 139 | break; | ||
| 140 | |||
| 141 | case 'h': | ||
| 142 | my_usage(); | ||
| 143 | return(0); | ||
| 144 | |||
| 145 | case 'q': | ||
| 146 | opts |= TRUTILS_OPT_QUIET; | ||
| 147 | opts &= ~TRUTILS_OPT_VERBOSE; | ||
| 148 | break; | ||
| 149 | |||
| 150 | case 'r': | ||
| 151 | resolve = 1; | ||
| 152 | break; | ||
| 153 | |||
| 154 | case 'V': | ||
| 155 | trutils_version(); | ||
| 156 | return(0); | ||
| 157 | |||
| 158 | case 'v': | ||
| 159 | opts |= TRUTILS_OPT_VERBOSE; | ||
| 160 | opts &= ~TRUTILS_OPT_QUIET; | ||
| 161 | break; | ||
| 162 | |||
| 163 | case '?': | ||
| 164 | fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME); | ||
| 165 | return(1); | ||
| 166 | |||
| 167 | default: | ||
| 168 | fprintf(stderr, "%s: unrecognized option `--%c'\n", PROGRAM_NAME, c); | ||
| 169 | fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME); | ||
| 170 | return(1); | ||
| 171 | }; | ||
| 172 | }; | ||
| 173 | |||
| 174 | // argument checks | ||
| 175 | if (optind >= argc) | ||
| 176 | { | ||
| 177 | fprintf(stderr, "%s: missing required argument\n", PROGRAM_NAME); | ||
| 178 | fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME); | ||
| 179 | return(1); | ||
| 180 | }; | ||
| 181 | |||
| 182 | // parse and resolve URLs | ||
| 183 | trudpp = &trudp; | ||
| 184 | for(pos = optind; (pos < argc); pos++) | ||
| 185 | { | ||
| 186 | if ((rc = tinyrad_urldesc_parse(argv[pos], trudpp)) != TRAD_SUCCESS) | ||
| 187 | { | ||
| 188 | if (!(opts & TRUTILS_OPT_QUIET)) | ||
| 189 | { | ||
| 190 | fprintf(stderr, "%s: %s: %s\n", PROGRAM_NAME, argv[pos], tinyrad_strerror(rc)); | ||
| 191 | fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME); | ||
| 192 | }; | ||
| 193 | return(1); | ||
| 194 | }; | ||
| 195 | if ((resolve)) | ||
| 196 | { | ||
| 197 | if ((rc = tinyrad_urldesc_resolve(*trudpp, tr_opts)) != TRAD_SUCCESS) | ||
| 198 | { | ||
| 199 | if (!(opts & TRUTILS_OPT_QUIET)) | ||
| 200 | { | ||
| 201 | fprintf(stderr, "%s: %s: %s\n", PROGRAM_NAME, argv[pos], tinyrad_strerror(rc)); | ||
| 202 | fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME); | ||
| 203 | }; | ||
| 204 | return(1); | ||
| 205 | }; | ||
| 206 | }; | ||
| 207 | trudpp = &(*trudpp)->trud_next; | ||
| 208 | }; | ||
| 209 | |||
| 210 | // exit if not displaying output | ||
| 211 | if (!(opts & TRUTILS_OPT_VERBOSE)) | ||
| 212 | { | ||
| 213 | tinyrad_urldesc_free(trudp); | ||
| 214 | return(0); | ||
| 215 | }; | ||
| 216 | |||
| 217 | // display URLs | ||
| 218 | trudp_next = trudp; | ||
| 219 | while ((trudp_next)) | ||
| 220 | { | ||
| 221 | if ((my_print_urldesc(trudp_next))) | ||
| 222 | { | ||
| 223 | tinyrad_urldesc_free(trudp); | ||
| 224 | return(1); | ||
| 225 | }; | ||
| 226 | trudp_next = trudp_next->trud_next; | ||
| 227 | }; | ||
| 228 | |||
| 229 | tinyrad_urldesc_free(trudp); | ||
| 230 | |||
| 231 | return(0); | ||
| 232 | } | ||
| 233 | |||
| 234 | |||
| 235 | int my_print_urldesc( TinyRadURLDesc * trudp) | ||
| 236 | { | ||
| 237 | int pos; | ||
| 238 | char * str; | ||
| 239 | const char * scheme; | ||
| 240 | struct sockaddr_storage * sas; | ||
| 241 | char addr[INET6_ADDRSTRLEN]; | ||
| 242 | |||
| 243 | if ((str = tinyrad_urldesc2str(trudp)) == NULL) | ||
| 244 | { | ||
| 245 | fprintf(stderr, "%s: out of virtual memory\n", PROGRAM_NAME); | ||
| 246 | tinyrad_urldesc_free(trudp); | ||
| 247 | return(1); | ||
| 248 | }; | ||
| 249 | switch(trudp->trud_opts & TRAD_SCHEME) | ||
| 250 | { | ||
| 251 | case TRAD_RADIUS: scheme = "radius (RFC2865 RADIUS)"; break;; | ||
| 252 | case TRAD_RADIUS_ACCT: scheme = "radius-acct (RFC2866 RADIUS Accounting)"; break;; | ||
| 253 | case TRAD_RADIUS_DYNAUTH: scheme = "radius-dynauth (RFC2866 RADIUS Dynamic Authorization)"; break;; | ||
| 254 | case TRAD_RADSEC: scheme = "radsec (RFC6614/RFC7360 RADIUS TLS/DTLS)"; break;; | ||
| 255 | default: scheme = "Unknown or unsupported URL scheme"; break; | ||
| 256 | }; | ||
| 257 | |||
| 258 | printf("%s\n", str); | ||
| 259 | printf(" scheme: %s\n", scheme); | ||
| 260 | printf(" host: %s\n", trudp->trud_host); | ||
| 261 | printf(" port: %i\n", trudp->trud_port); | ||
| 262 | printf(" secret: %s\n", (((trudp->trud_secret)) ? trudp->trud_secret : "n/a")); | ||
| 263 | printf(" protocol: %s\n", ((trudp->trud_opts & TRAD_TCP)) ? "tcp" : "udp"); | ||
| 264 | if ( ((trudp->trud_sockaddrs)) && ((trudp->trud_sockaddrs[0])) ) | ||
| 265 | { | ||
| 266 | for(pos = 0; ((trudp->trud_sockaddrs[pos])); pos++) | ||
| 267 | { | ||
| 268 | sas = trudp->trud_sockaddrs[pos]; | ||
| 269 | switch(sas->ss_family) | ||
| 270 | { | ||
| 271 | case AF_INET: inet_ntop(sas->ss_family, &((struct sockaddr_in *)sas)->sin_addr, addr, sizeof(addr)); break; | ||
| 272 | case AF_INET6: inet_ntop(sas->ss_family, &((struct sockaddr_in6 *)sas)->sin6_addr, addr, sizeof(addr)); break; | ||
| 273 | default: | ||
| 274 | addr[0] = '\0'; | ||
| 275 | break; | ||
| 276 | }; | ||
| 277 | printf(" %s%s\n", ((!(pos)) ? "addresses: " : " "), addr); | ||
| 278 | }; | ||
| 279 | }; | ||
| 280 | printf("\n"); | ||
| 281 | |||
| 282 | tinyrad_free(str); | ||
| 283 | |||
| 284 | return(0); | ||
| 285 | } | ||
| 286 | |||
| 287 | |||
| 288 | void my_usage(void) | ||
| 289 | { | ||
| 290 | printf("Usage: %s [OPTIONS] url url ... url\n", PROGRAM_NAME); | ||
| 291 | printf("Options:\n"); | ||
| 292 | printf(" -4 use IPv4 addresses\n"); | ||
| 293 | printf(" -6 use IPv6 addresses\n"); | ||
| 294 | printf(" -d level, --debug=level print debug messages\n"); | ||
| 295 | printf(" -h, --help print this help and exit\n"); | ||
| 296 | printf(" -q, --quiet, --silent do not print messages\n"); | ||
| 297 | printf(" -V, --version print version number and exit\n"); | ||
| 298 | printf(" -v, --verbose print verbose messages\n"); | ||
| 299 | printf(" -r, --resolve resolve URLs\n"); | ||
| 300 | printf("\n"); | ||
| 301 | printf("URL Syntax:\n"); | ||
| 302 | printf(" radius://hostport/[secret][?proto] use RFC2865 (udp/port 1812)\n"); | ||
| 303 | printf(" radius-acct://hostport/[secret][?proto] use RFC2866 (udp/port 1813)\n"); | ||
| 304 | printf(" radsec://hostport/[?proto] use RFC6614/RFC7360 (tcp/port 2083)\n"); | ||
| 305 | printf(" radius-dynauth://hostport/[secret][?proto] use RFC5176 (udp/port 3799)\n"); | ||
| 306 | printf("\n"); | ||
| 307 | printf(" where:\n"); | ||
| 308 | printf(" 'hostport' is a host name with an optional ':portnumber'\n"); | ||
| 309 | printf(" 'secret' is the RADIUS secret encoded using character encoding in RFC3986\n"); | ||
| 310 | printf(" 'proto' is communication protocol used by the connection (UDP or TCP)\n"); | ||
| 311 | printf("\n"); | ||
| 312 | return; | ||
| 313 | } | ||
| 314 | |||
| 315 | |||
| 316 | /* end of source */ | ||
