Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix non-interactive mode
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jun 11, 2012
1 parent ba4fd25 commit cd0472b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion main.c
Expand Up @@ -1007,6 +1007,11 @@ static int process_auth_form(void *_vpninfo,
select_opt = NULL;
continue;
}
if (non_inter) {
vpn_progress(vpninfo, PRG_ERR,
_("User input required in non-interactive mode\n"));
return -EINVAL;
}
printf("%s [", opt->label);
for (i = 0; i < select_opt->nr_choices; i++) {
choice = &select_opt->choices[i];
Expand Down Expand Up @@ -1049,6 +1054,10 @@ static int process_auth_form(void *_vpninfo,
opt->value = strdup(vpninfo->username);
if (!opt->value)
return -ENOMEM;
} else if (non_inter) {
vpn_progress(vpninfo, PRG_ERR,
_("User input required in non-interactive mode\n"));
return -EINVAL;
} else {
opt->value=malloc(80);
if (!opt->value)
Expand All @@ -1067,10 +1076,14 @@ static int process_auth_form(void *_vpninfo,
} else if (opt->type == OC_FORM_OPT_PASSWORD) {
if (vpninfo->password &&
!strcmp(opt->name, "password")) {
opt->value = strdup(vpninfo->password);
opt->value = vpninfo->password;
vpninfo->password = NULL;
if (!opt->value)
return -ENOMEM;
} else if (non_inter) {
vpn_progress(vpninfo, PRG_ERR,
_("User input required in non-interactive mode\n"));
return -EINVAL;
} else {
struct termios t;
opt->value=malloc(80);
Expand Down

0 comments on commit cd0472b

Please sign in to comment.