diff --git a/WebminCore.pm b/WebminCore.pm index 9c7a622b8..8e843df00 100644 --- a/WebminCore.pm +++ b/WebminCore.pm @@ -20,7 +20,7 @@ require Exporter; # Add functions in web-lib-funcs.pl # Generated with : # grep -h "^sub " web-lib-funcs.pl ui-lib.pl | sed -e 's/sub /\&/' | xargs echo -@EXPORT = qw(&read_file &read_file_cached &read_file_cached_with_stat &write_file &html_escape "e_escape "e_javascript &tempname &tempname_dir &transname &trunc &indexof &indexoflc &sysprint &check_ipaddress &check_ip6address &generate_icon &urlize &un_urlize &include ©data &ReadParseMime &ReadParse &read_fully &read_parse_mime_callback &read_parse_mime_javascript &PrintHeader &header &get_html_title &get_html_framed_title &get_html_status_line &popup_header &footer &popup_footer &load_theme_library &redirect &kill_byname &kill_byname_logged &find_byname &error &popup_error &error_setup &wait_for &fast_wait_for &has_command &make_date &file_chooser_button &popup_window_button &popup_window_link &read_acl &acl_filename &acl_check &get_miniserv_config &put_miniserv_config &restart_miniserv &reload_miniserv &check_os_support &http_download &complete_http_download &http_post &ftp_download &ftp_upload &no_proxy &open_socket &download_timeout &ftp_command &to_ipaddress &to_ip6address &to_hostname &icons_table &replace_file_line &read_file_lines &flush_file_lines &unflush_file_lines &unix_user_input &unix_group_input &hlink &user_chooser_button &group_chooser_button &foreign_check &foreign_exists &foreign_available &foreign_require &foreign_call &foreign_config &foreign_installed &foreign_defined &get_system_hostname &get_webmin_version &get_module_acl &get_group_module_acl &save_module_acl &save_group_module_acl &init_config &load_language &text_subs &text &encode_base64 &decode_base64 &encode_base32 &decode_base32 &get_module_info &get_all_module_infos &list_themes &get_theme_info &list_languages &read_env_file &write_env_file &lock_file &unlock_file &test_lock &unlock_all_files &can_lock_file &webmin_log &additional_log &webmin_debug_log &system_logged &backquote_logged &backquote_with_timeout &backquote_command &kill_logged &rename_logged &rename_file &symlink_logged &symlink_file &link_file &make_dir &set_ownership_permissions &unlink_logged &unlink_file ©_source_dest &remote_session_name &remote_foreign_require &remote_foreign_call &remote_foreign_check &remote_foreign_config &remote_eval &remote_write &remote_read &remote_finished &remote_error_setup &remote_rpc_call &remote_multi_callback &remote_multi_callback_error &serialise_variable &unserialise_variable &other_groups &date_chooser_button &help_file &seed_random &disk_usage_kb &recursive_disk_usage &help_search_link &make_http_connection &read_http_connection &write_http_connection &close_http_connection &clean_environment &reset_environment &clean_language &progress_callback &switch_to_remote_user &switch_to_unix_user &create_user_config_dirs &create_missing_homedir &filter_javascript &resolve_links &simplify_path &same_file &flush_webmin_caches &list_usermods &available_usermods &get_available_module_infos &get_visible_module_infos &get_visible_modules_categories &is_under_directory &parse_http_url &check_clicks_function &load_entities_map &entities_to_ascii &get_product_name &get_charset &get_display_hostname &save_module_config &save_user_module_config &nice_size &get_perl_path &get_goto_module &select_all_link &select_invert_link &select_rows_link &check_pid_file &get_mod_lib &module_root_directory &list_mime_types &guess_mime_type &open_tempfile &close_tempfile &print_tempfile &is_selinux_enabled &get_clear_file_attributes &reset_file_attributes &cleanup_tempnames &open_lock_tempfile &END &month_to_number &number_to_month &get_rbac_module_acl &supports_rbac &supports_ipv6 &use_rbac_module_acl &execute_command &open_readfile &open_execute_command &translate_filename &translate_command ®ister_filename_callback ®ister_command_callback &capture_function_output &capture_function_output_tempfile &modules_chooser_button &substitute_template &running_in_zone &running_in_vserver &running_in_xen &running_in_openvz &list_categories &is_readonly_mode &command_as_user &list_osdn_mirrors &convert_osdn_url &get_current_dir &supports_users &supports_symlinks "e_path &get_windows_root &read_file_contents &write_file_contents &unix_crypt &split_quoted_string &write_to_http_cache &check_in_http_cache &supports_javascript &ui_link &ui_link_button &ui_img &ui_table_start &ui_table_end &ui_table_row &ui_table_hr &ui_table_span &ui_columns_start &ui_columns_row &ui_columns_header &ui_checked_columns_row &ui_radio_columns_row &ui_columns_end &ui_columns_table &ui_form_columns_table &ui_form_start &ui_form_end &ui_textbox &ui_filebox &ui_bytesbox &ui_upload &ui_password &ui_hidden &ui_select &ui_multi_select &ui_multi_select_javascript &ui_radio &ui_yesno_radio &ui_checkbox &ui_oneradio &ui_textarea &ui_user_textbox &ui_group_textbox &ui_users_textbox &ui_groups_textbox &ui_opt_textbox &ui_submit &ui_reset &ui_button &ui_date_input &ui_buttons_start &ui_buttons_end &ui_buttons_row &ui_buttons_hr &ui_post_header &ui_pre_footer &ui_print_header &ui_print_unbuffered_header &ui_print_footer &ui_config_link &ui_print_endpage &ui_subheading &ui_links_row &ui_hidden_javascript &ui_hidden_start &ui_hidden_end &ui_hidden_table_row_start &ui_hidden_table_row_end &ui_hidden_table_start &ui_hidden_table_end &ui_tabs_start &ui_tabs_end &ui_tabs_start_tab &ui_tabs_start_tabletab &ui_tabs_end_tab &ui_tabs_end_tabletab &ui_max_text_width &ui_radio_selector &ui_radio_selector_javascript &ui_grid_table &ui_radio_table &ui_up_down_arrows &ui_hr &ui_nav_link &ui_confirmation_form &js_disable_inputs &ui_page_flipper &ui_text_type &ui_alert_box &js_checkbox_disable &js_redirect &get_module_name clear_time_locale reset_time_locale eval_as_unix_user get_userdb_string connect_userdb disconnect_userdb split_userdb_string uniquelc &list_combined_webmin_menu &list_modules_webmin_menu &list_combined_system_info &validate_ssl_connection shell_is_bash compare_version_numbers convert_to_json convert_from_json print_json ®ister_error_handler &call_error_handlers); +@EXPORT = qw(&read_file &read_file_cached &read_file_cached_with_stat &write_file &html_escape "e_escape "e_javascript &tempname &tempname_dir &transname &trunc &indexof &indexoflc &sysprint &check_ipaddress &check_ip6address &generate_icon &urlize &un_urlize &include ©data &ReadParseMime &ReadParse &read_fully &read_parse_mime_callback &read_parse_mime_javascript &PrintHeader &header &get_html_title &get_html_framed_title &get_html_status_line &popup_header &footer &popup_footer &load_theme_library &redirect &kill_byname &kill_byname_logged &find_byname &error &popup_error &error_setup &wait_for &fast_wait_for &has_command &make_date &file_chooser_button &popup_window_button &popup_window_link &read_acl &acl_filename &acl_check &get_miniserv_config &put_miniserv_config &restart_miniserv &reload_miniserv &check_os_support &http_download &complete_http_download &http_post &ftp_download &ftp_upload &no_proxy &open_socket &download_timeout &ftp_command &to_ipaddress &to_ip6address &to_hostname &icons_table &replace_file_line &read_file_lines &flush_file_lines &unflush_file_lines &unix_user_input &unix_group_input &hlink &user_chooser_button &group_chooser_button &foreign_check &foreign_exists &foreign_available &foreign_require &foreign_call &foreign_config &foreign_installed &foreign_defined &get_system_hostname &get_webmin_version &get_module_acl &get_group_module_acl &save_module_acl &save_group_module_acl &init_config &load_language &text_subs &text &encode_base64 &decode_base64 &encode_base32 &decode_base32 &get_module_info &get_all_module_infos &list_themes &get_theme_info &list_languages &read_env_file &write_env_file &lock_file &unlock_file &test_lock &unlock_all_files &can_lock_file &webmin_log &additional_log &webmin_debug_log &system_logged &backquote_logged &backquote_with_timeout &backquote_command &kill_logged &rename_logged &rename_file &symlink_logged &symlink_file &link_file &make_dir &set_ownership_permissions &unlink_logged &unlink_file ©_source_dest &remote_session_name &remote_foreign_require &remote_foreign_call &remote_foreign_check &remote_foreign_config &remote_eval &remote_write &remote_read &remote_finished &remote_error_setup &remote_rpc_call &remote_multi_callback &remote_multi_callback_error &serialise_variable &unserialise_variable &other_groups &date_chooser_button &help_file &seed_random &disk_usage_kb &recursive_disk_usage &help_search_link &make_http_connection &read_http_connection &write_http_connection &close_http_connection &clean_environment &reset_environment &clean_language &progress_callback &switch_to_remote_user &switch_to_unix_user &create_user_config_dirs &create_missing_homedir &filter_javascript &resolve_links &simplify_path &same_file &flush_webmin_caches &list_usermods &available_usermods &get_available_module_infos &get_visible_module_infos &get_visible_modules_categories &is_under_directory &parse_http_url &check_clicks_function &load_entities_map &entities_to_ascii &get_product_name &get_charset &get_display_hostname &save_module_config &save_user_module_config &nice_size &get_perl_path &get_goto_module &select_all_link &select_invert_link &select_rows_link &check_pid_file &get_mod_lib &module_root_directory &list_mime_types &guess_mime_type &open_tempfile &close_tempfile &print_tempfile &is_selinux_enabled &get_clear_file_attributes &reset_file_attributes &cleanup_tempnames &open_lock_tempfile &END &month_to_number &number_to_month &get_rbac_module_acl &supports_rbac &supports_ipv6 &use_rbac_module_acl &execute_command &open_readfile &open_execute_command &translate_filename &translate_command ®ister_filename_callback ®ister_command_callback &capture_function_output &capture_function_output_tempfile &modules_chooser_button &substitute_template &running_in_zone &running_in_vserver &running_in_xen &running_in_openvz &list_categories &is_readonly_mode &command_as_user &list_osdn_mirrors &convert_osdn_url &get_current_dir &supports_users &supports_symlinks "e_path &get_windows_root &read_file_contents &write_file_contents &unix_crypt &split_quoted_string &write_to_http_cache &check_in_http_cache &supports_javascript &ui_link &ui_link_button &ui_img &ui_table_start &ui_table_end &ui_table_row &ui_table_hr &ui_table_span &ui_columns_start &ui_columns_row &ui_columns_header &ui_checked_columns_row &ui_radio_columns_row &ui_columns_end &ui_columns_table &ui_form_columns_table &ui_form_start &ui_form_end &ui_textbox &ui_filebox &ui_bytesbox &ui_upload &ui_password &ui_hidden &ui_select &ui_multi_select &ui_multi_select_javascript &ui_radio &ui_yesno_radio &ui_checkbox &ui_oneradio &ui_textarea &ui_user_textbox &ui_group_textbox &ui_users_textbox &ui_groups_textbox &ui_opt_textbox &ui_submit &ui_reset &ui_button &ui_date_input &ui_buttons_start &ui_buttons_end &ui_buttons_row &ui_buttons_hr &ui_post_header &ui_pre_footer &ui_print_header &ui_print_unbuffered_header &ui_print_footer &ui_config_link &ui_print_endpage &ui_subheading &ui_links_row &ui_hidden_javascript &ui_hidden_start &ui_hidden_end &ui_hidden_table_row_start &ui_hidden_table_row_end &ui_hidden_table_start &ui_hidden_table_end &ui_tabs_start &ui_tabs_end &ui_tabs_start_tab &ui_tabs_start_tabletab &ui_tabs_end_tab &ui_tabs_end_tabletab &ui_max_text_width &ui_radio_selector &ui_radio_selector_javascript &ui_grid_table &ui_radio_table &ui_up_down_arrows &ui_hr &ui_nav_link &ui_confirmation_form &js_disable_inputs &ui_page_flipper &ui_text_color &ui_alert_box &js_checkbox_disable &js_redirect &get_module_name clear_time_locale reset_time_locale eval_as_unix_user get_userdb_string connect_userdb disconnect_userdb split_userdb_string uniquelc &list_combined_webmin_menu &list_modules_webmin_menu &list_combined_system_info &validate_ssl_connection shell_is_bash compare_version_numbers convert_to_json convert_from_json print_json ®ister_error_handler &call_error_handlers); # Add global variables in web-lib.pl push(@EXPORT, qw(&unique)); diff --git a/mount/system_info.pl b/mount/system_info.pl index d403817e4..e2495f5b5 100644 --- a/mount/system_info.pl +++ b/mount/system_info.pl @@ -34,12 +34,12 @@ sub list_system_info my $free_percent_html; if ($free_percent > 49) { - $free_percent_html = ui_text_type("$free_percent%", 'success'); + $free_percent_html = ui_text_color("$free_percent%", 'success'); } elsif ($free_percent > 9) { - $free_percent_html = ui_text_type("$free_percent%", 'warn'); + $free_percent_html = ui_text_color("$free_percent%", 'warn'); } else { $open = 1; - $free_percent_html = ui_text_type("$free_percent%", 'danger'); + $free_percent_html = ui_text_color("$free_percent%", 'danger'); } $html .= ui_columns_row([$dir, $type, $free_percent_html . " ($free_nice)", $total_nice, $dev_id,]); } diff --git a/package-updates/index.cgi b/package-updates/index.cgi index 1c00ea2d6..c0f617181 100755 --- a/package-updates/index.cgi +++ b/package-updates/index.cgi @@ -64,12 +64,18 @@ foreach $p (sort { $a->{'name'} cmp $b->{'name'} } (@current, @avail)) { # Work out the status $c = $current{$p->{'name'}."/".$p->{'system'}}; $a = $avail{$p->{'name'}."/".$p->{'system'}}; + $bp = $a->{'disallowed'} =~ /\/Backports/; if ($a && $c && &compare_versions($a, $c) > 0) { # An update is available - $msg = "". - &text('index_new', $a->{'version'}).""; - $need = 1; + if ($bp) { + $msg = ''.&ui_text_color(&text('index_new_backports', $a->{'version'}), 'success').''; + } + else { + $msg = "". + &text('index_new', $a->{'version'}).""; + $need = 1; + } next if ($in{'mode'} eq 'security' && !$a->{'security'}); next if ($in{'mode'} ne 'updates' && $in{'mode'} ne 'current' && @@ -78,7 +84,12 @@ foreach $p (sort { $a->{'name'} cmp $b->{'name'} } (@current, @avail)) { elsif ($a && !$c) { # Could be installed, but isn't currently next if (!&installation_candiate($a)); - $msg = "$text{'index_caninstall'}"; + if ($bp) { + $msg = &ui_text_color($text{'index_caninstall_backports'}, 'success'); + } + else { + $msg = "$text{'index_caninstall'}"; + } $need = 0; next if ($in{'mode'} ne 'new'); } @@ -100,7 +111,10 @@ foreach $p (sort { $a->{'name'} cmp $b->{'name'} } (@current, @avail)) { next if ($in{'mode'} ne 'current'); } $source = ucfirst($a->{'source'}); - if ($a->{'security'}) { + if ($bp) { + $source = &ui_text_color("$source$a->{'disallowed'} ?", 'info'); + } + elsif ($a->{'security'}) { $source = "$source"; } @@ -117,11 +131,13 @@ foreach $p (sort { $a->{'name'} cmp $b->{'name'} } (@current, @avail)) { push(@rows, [ { 'type' => 'checkbox', 'name' => 'u', 'value' => $p->{'update'}."/".$p->{'system'}, - 'checked' => $need }, - &ui_link("view.cgi?mode=$in{'mode'}&name=". - &urlize($p->{'name'})."&system=". - &urlize($p->{'system'})."&search=". - &urlize($in{'search'}), $p->{'name'}), + 'checked' => $need, + 'disabled' => $bp ? 1 : 0 }, + ($bp ? $p->{'name'} : + &ui_link("view.cgi?mode=$in{'mode'}&name=". + &urlize($p->{'name'})."&system=". + &urlize($p->{'system'})."&search=". + &urlize($in{'search'}), $p->{'name'})), $p->{'desc'}, $msg, $source ? ( $source ) : ( ), diff --git a/package-updates/lang/en b/package-updates/lang/en index a6813fdc1..da5b32289 100644 --- a/package-updates/lang/en +++ b/package-updates/lang/en @@ -148,5 +148,8 @@ repos_enone=None selected repos_title=Delete Repositories repos_rusure=Are you sure you want to delete the $1 selected package repositories? Packages installed from them will still be available, but may not be updatable. repos_ok=Delete Now +index_install_disallowed_backports=By default backports repositories have a lower priority than stable (100), thus they won't be installed or upgraded unless explicitly configured to (or the package only exists in backports) - packages from backports must be installed using command line, with special flags +index_new_backports=Backports new version $1 +index_caninstall_backports=Available for manual installation __norefs=1 diff --git a/pam_login.cgi b/pam_login.cgi index bf047f6c2..2dbe63e09 100755 --- a/pam_login.cgi +++ b/pam_login.cgi @@ -22,11 +22,11 @@ if ($gconfig{'loginbanner'} && $ENV{'HTTP_COOKIE'} !~ /banner=1/ && close(BANNER); return; } +&get_miniserv_config(\%miniserv); $sec = uc($ENV{'HTTPS'}) eq 'ON' ? "; secure" : ""; -if (!$config{'no_httponly'}) { +if (!$miniserv{'no_httponly'}) { $sec .= "; httpOnly"; } -&get_miniserv_config(\%miniserv); $sidname = $miniserv{'sidname'} || "sid"; print "Set-Cookie: banner=0; path=/$sec\r\n" if ($gconfig{'loginbanner'}); print "Set-Cookie: $sidname=x; path=/$sec\r\n" if ($in{'logout'}); diff --git a/session_login.cgi b/session_login.cgi index a0665500f..e4bf2a073 100755 --- a/session_login.cgi +++ b/session_login.cgi @@ -23,11 +23,11 @@ if ($gconfig{'loginbanner'} && $ENV{'HTTP_COOKIE'} !~ /banner=1/ && close(BANNER); return; } +&get_miniserv_config(\%miniserv); $sec = uc($ENV{'HTTPS'}) eq 'ON' ? "; secure" : ""; -if (!$config{'no_httponly'}) { +if (!$miniserv{'no_httponly'}) { $sec .= "; httpOnly"; } -&get_miniserv_config(\%miniserv); $sidname = $miniserv{'sidname'} || "sid"; print "Set-Cookie: banner=0; path=/$sec\r\n" if ($gconfig{'loginbanner'}); print "Set-Cookie: $sidname=x; path=/$sec\r\n" if ($in{'logout'}); diff --git a/software/apt-lib.pl b/software/apt-lib.pl index a93efc105..44f9ddd94 100755 --- a/software/apt-lib.pl +++ b/software/apt-lib.pl @@ -185,6 +185,11 @@ while() { elsif (/^\s*File:\s*(\S+)/ && $pkg) { $pkg->{'file'} ||= $1; } + # By default Debian backports repositories have a lower priority than stable (100) thus they won't + # be installed or upgraded unless explicitly configured to (or the package only exists in backports). + if ($pkg->{'file'} =~ /dists_.*-backports/) { + $pkg->{'disallowed'} = "/Backports"; + } } close(DUMP); &reset_environment(); diff --git a/ui-lib.pl b/ui-lib.pl index 40732abe7..549ea701f 100755 --- a/ui-lib.pl +++ b/ui-lib.pl @@ -2448,7 +2448,7 @@ $rv .= "\n"; return $rv; } -=head2 ui_text_type(text, type) +=head2 ui_text_color(text, type) Returns HTML for a text string, with its color determined by $type. @@ -2458,13 +2458,13 @@ Returns HTML for a text string, with its color determined by $type. =cut -sub ui_text_type +sub ui_text_color { my ($text, $type) = @_; my ($rv, $color); -if (defined (&theme_ui_text_type)) { - return &theme_ui_text_type(@_); +if (defined (&theme_ui_text_color)) { + return &theme_ui_text_color(@_); } if ($type eq "success") { $color = "3c763d"; } @@ -2472,7 +2472,7 @@ elsif ($type eq "info") { $color = "31708f"; } elsif ($type eq "warn") { $color = "8a6d3b"; } elsif ($type eq "danger") { $color = "a94442"; } -$rv .= "$text\n"; +$rv .= "$text\n"; return $rv; }