]> git.ozlabs.org Git - petitboot/blobdiff - ui/ncurses/nc-config.c
ui/ncurses: in lockdown ensure system reboot in ncurses menu exit
[petitboot] / ui / ncurses / nc-config.c
index 337d8a4fdc11eed258645fca77252dcab7d6ccdf..51861763b9201298877e1b1313afa5659c923e45 100644 (file)
@@ -203,7 +203,7 @@ static int screen_process_form(struct config_screen *screen)
        const struct system_info *sysinfo = screen->cui->sysinfo;
        enum net_conf_type net_conf_type;
        struct interface_config *iface;
-       bool allow_write, autoboot;
+       bool allow_write;
        char *str, *end;
        struct config *config;
        int i, n_boot_opts, rc;
@@ -218,8 +218,8 @@ static int screen_process_form(struct config_screen *screen)
        n_boot_opts = widget_subset_get_order(config, &order,
                                              screen->widgets.boot_order_f);
 
-       autoboot = widget_select_get_value(screen->widgets.autoboot_f);
-       config->autoboot_enabled = autoboot && n_boot_opts;
+       config->autoboot_enabled = widget_select_get_value(
+                                               screen->widgets.autoboot_f);
 
        config->n_autoboot_opts = n_boot_opts;
        config->autoboot_opts = talloc_array(config, struct autoboot_option,
@@ -946,7 +946,7 @@ static void config_screen_setup_widgets(struct config_screen *screen,
                label = talloc_asprintf(screen,
                                _("%s IPMI boot option: %s"),
                                config->ipmi_bootdev_persistent ?
-                               "Persistent" : "Temporary",
+                               _("Persistent") : _("Temporary"),
                                ipmi_bootdev_display_name(config->ipmi_bootdev));
                screen->widgets.ipmi_type_l = widget_new_label(set, 0, 0,
                                                        label);
@@ -1029,8 +1029,8 @@ static void config_screen_setup_widgets(struct config_screen *screen,
 
        widget_textbox_set_fixed_size(screen->widgets.ip_addr_f);
        widget_textbox_set_fixed_size(screen->widgets.ip_mask_f);
-       widget_textbox_set_validator_ipv4(screen->widgets.ip_addr_f);
-       widget_textbox_set_validator_integer(screen->widgets.ip_mask_f, 1, 31);
+       widget_textbox_set_validator_ip(screen->widgets.ip_addr_f);
+       widget_textbox_set_validator_integer(screen->widgets.ip_mask_f, 1, 127);
 
        screen->widgets.gateway_l = widget_new_label(set, 0, 0, _("Gateway:"));
        screen->widgets.gateway_f = widget_new_textbox(set, 0, 0, 16, gw);
@@ -1038,10 +1038,11 @@ static void config_screen_setup_widgets(struct config_screen *screen,
                widget_new_label(set, 0, 0, _("(eg. 192.168.0.1)"));
 
        widget_textbox_set_fixed_size(screen->widgets.gateway_f);
-       widget_textbox_set_validator_ipv4(screen->widgets.gateway_f);
+       widget_textbox_set_validator_ip(screen->widgets.gateway_f);
 
        screen->widgets.url_l = widget_new_label(set, 0, 0, _("URL:"));
        screen->widgets.url_f = widget_new_textbox(set, 0, 0, 32, url);
+       widget_textbox_set_validator_url(screen->widgets.url_f);
        screen->widgets.url_help_l =
                widget_new_label(set, 0, 0, _("(eg. tftp://)"));
 
@@ -1058,7 +1059,7 @@ static void config_screen_setup_widgets(struct config_screen *screen,
        screen->widgets.dns_help_l =
                widget_new_label(set, 0, 0, _("(eg. 192.168.0.2)"));
 
-       widget_textbox_set_validator_ipv4_multi(screen->widgets.dns_f);
+       widget_textbox_set_validator_ip_multi(screen->widgets.dns_f);
 
        screen->widgets.dns_dhcp_help_l = widget_new_label(set, 0, 0,
                        _("(if not provided by DHCP server)"));