aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/ttu/tinytacutil.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/ttu/tinytacutil.c b/src/ttu/tinytacutil.c
index e4b3ff5..efbb631 100644
--- a/src/ttu/tinytacutil.c
+++ b/src/ttu/tinytacutil.c
@@ -392,10 +392,11 @@ ttu_cli_arguments(
392 int c; 392 int c;
393 int opt_index; 393 int opt_index;
394 int opt; 394 int opt;
395 int ival;
395 int rc; 396 int rc;
396 397
397 // getopt options 398 // getopt options
398 static const char * short_opt = "+46dH:hVvqWw:y:"; 399 static const char * short_opt = "+46a:dH:hVvqWw:y:";
399 static struct option long_opt[] = 400 static struct option long_opt[] =
400 { 401 {
401 {"help", no_argument, NULL, 'h' }, 402 {"help", no_argument, NULL, 'h' },
@@ -421,17 +422,33 @@ ttu_cli_arguments(
421 break; 422 break;
422 423
423 case '4': 424 case '4':
424 opt = TTAC_YES; tinytac_set_option(cnf->tt, TTAC_OPT_IPV4, &opt); 425 ival = TTAC_YES; tinytac_set_option(cnf->tt, TTAC_OPT_IPV4, &ival);
425 opt = TTAC_NO; tinytac_set_option(cnf->tt, TTAC_OPT_IPV6, &opt); 426 ival = TTAC_NO; tinytac_set_option(cnf->tt, TTAC_OPT_IPV6, &ival);
426 break; 427 break;
427 428
428 case '6': 429 case '6':
429 opt = TTAC_YES; tinytac_set_option(cnf->tt, TTAC_OPT_IPV6, &opt); 430 ival = TTAC_YES; tinytac_set_option(cnf->tt, TTAC_OPT_IPV6, &ival);
430 opt = TTAC_NO; tinytac_set_option(cnf->tt, TTAC_OPT_IPV4, &opt); 431 ival = TTAC_NO; tinytac_set_option(cnf->tt, TTAC_OPT_IPV4, &ival);
432 break;
433
434 case 'a':
435 opt = 0;
436 if (!(strcasecmp(optarg, "ascii"))) opt = TTAC_OPT_AUTHEN_ASCII;
437 else if (!(strcasecmp(optarg, "chap"))) opt = TTAC_OPT_AUTHEN_CHAP;
438 else if (!(strcasecmp(optarg, "mschap"))) opt = TTAC_OPT_AUTHEN_MSCHAP;
439 else if (!(strcasecmp(optarg, "mschapv2"))) opt = TTAC_OPT_AUTHEN_MSCHAPV2;
440 else if (!(strcasecmp(optarg, "pap"))) opt = TTAC_OPT_AUTHEN_PAP;
441 else
442 { fprintf(stderr, "%s: unknown authentication type `%s'\n", PROGRAM_NAME, optarg);
443 fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME);
444 return(1);
445 };
446 ival = TTAC_NO; tinytac_set_option(cnf->tt, TTAC_OPT_AUTHEN_ALL, &ival);
447 ival = TTAC_YES; tinytac_set_option(cnf->tt, opt, &ival);
431 break; 448 break;
432 449
433 case 'd': 450 case 'd':
434 opt = TTAC_DEBUG_ANY; tinytac_set_option(NULL, TTAC_OPT_DEBUG_LEVEL, &opt); 451 ival = TTAC_DEBUG_ANY; tinytac_set_option(NULL, TTAC_OPT_DEBUG_LEVEL, &ival);
435 break; 452 break;
436 453
437 case 'H': 454 case 'H':
@@ -510,6 +527,7 @@ ttu_usage(
510 printf("OPTIONS:\n"); 527 printf("OPTIONS:\n");
511 printf(" -4 use IPv4\n"); 528 printf(" -4 use IPv4\n");
512 printf(" -6 use IPv6\n"); 529 printf(" -6 use IPv6\n");
530 printf(" -a type authen type: ascii, pap, chap, mschap, or mschapv2\n");
513 printf(" -d, --debug print debug messages\n"); 531 printf(" -d, --debug print debug messages\n");
514 printf(" -H host TACACS+ host\n"); 532 printf(" -H host TACACS+ host\n");
515 printf(" -h, --help print this help and exit\n"); 533 printf(" -h, --help print this help and exit\n");