/* Handle command line options:
* -U,--user
* -A,--authentication-file
- * -k,--use-kerberos
+ * -k,--kerberos[=yes|no]
* -N,--no-pass
* -S,--signing
* -P --machine-pass
const struct poptOption *opt,
const char *arg, const void *data)
{
+ bool use_kerberos = false;
+
if (reason == POPT_CALLBACK_REASON_PRE) {
struct user_auth_info *auth_info =
user_auth_info_init(NULL);
break;
case 'k':
+ /* Force us to only use kerberos */
+ if (arg) {
+ if (!set_boolean(arg, &use_kerberos)) {
+ fprintf(stderr, "Error parsing -k %s. Should be "
+ "-k [yes|no]\n", arg);
+ exit(1);
+ break;
+ }
+ }
+
+ if (use_kerberos) {
#ifndef HAVE_KRB5
- d_printf("No kerberos support compiled in\n");
- exit(1);
-#else
- set_cmdline_auth_info_use_krb5_ticket(cmdline_auth_info);
+ d_printf("No kerberos support compiled in\n");
+ exit(1);
#endif
+ set_cmdline_auth_info_use_krb5_ticket(cmdline_auth_info);
+ } else {
+ set_cmdline_auth_info_use_kerberos(cmdline_auth_info, false);
+ }
break;
case 'S':
.shortName = 'k',
.argInfo = POPT_ARG_NONE,
.val = 'k',
- .descrip = "Use kerberos (active directory) authentication",
+ .descrip = "Use kerberos (active directory) authentication, -k [yes|no]",
},
{
.longName = "authentication-file",