[yast-commit] r52741 - in /trunk/printer/src: printingvianetwork.ycp sharing.ycp

Author: jsmeix Date: Thu Oct 30 15:05:19 2008 New Revision: 52741 URL: http://svn.opensuse.org/viewcvs/yast?rev=52741&view=rev Log: Added Firewall Settings to the Printing via Network dialog. Fixed bug in Firewall Settings for the Share Printers dialog. Modified: trunk/printer/src/printingvianetwork.ycp trunk/printer/src/sharing.ycp Modified: trunk/printer/src/printingvianetwork.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/printingvianetwork.yc... ============================================================================== --- trunk/printer/src/printingvianetwork.ycp (original) +++ trunk/printer/src/printingvianetwork.ycp Thu Oct 30 15:05:19 2008 @@ -55,6 +55,9 @@ // remote CUPS servers with specific addresses // where the specific addresses are specified in a TextEntry below: string browse_allow_specific_string = _("only specific addresses"); +// Firewall related widget types: +boolean firewall_first_browsing_widget_is_checkbox = false; +boolean firewall_second_browsing_widget_is_checkbox = false; term widgetNetworkPrinting = `VBox ( `VStretch(), @@ -122,6 +125,36 @@ // from where remote printer information is accepted: _("(each nnn.nnn.nnn.nnn or nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm separated by one space)") ) + ), + `Left + ( `Label + ( `id(`firewall_browsing_settings_label), + // A caption to make a Firewall settings + // to allow incomming printer information + // from remote CUPS servers: + _("Firewall Settings") + ) + ), + `HBox + ( `HSpacing( 2 ), + `VBox + ( `Left + ( `ReplacePoint + ( `id(`firewall_first_browsing_replace_point), + `Empty + ( `id(`firewall_first_browsing_widget) + ) + ) + ), + `Left + ( `ReplacePoint + ( `id(`firewall_second_browsing_replace_point), + `Empty + ( `id(`firewall_second_browsing_widget) + ) + ) + ) + ) ) ) ), @@ -341,6 +374,30 @@ boolean ApplyNetworkPrintingSettings() { printing_via_network_has_changed = false; + // Do the Firewall stuff first of all: + boolean firewall_allow_browsing_from_int = true; + boolean firewall_deny_browsing_from_ext = true; + if( firewall_first_browsing_widget_is_checkbox ) + { firewall_allow_browsing_from_int = (boolean)UI::QueryWidget( `firewall_first_browsing_widget, `Value ); + y2milestone( "firewall_allow_browsing_from_int value: '%1'", firewall_allow_browsing_from_int ); + Printer::firewall_config["ui_browsing_from_int"] = firewall_allow_browsing_from_int; + } + if( firewall_second_browsing_widget_is_checkbox ) + { firewall_deny_browsing_from_ext = (boolean)UI::QueryWidget( `firewall_second_browsing_widget, `Value ); + y2milestone( "firewall_deny_browsing_from_ext value: '%1'", firewall_deny_browsing_from_ext ); + Printer::firewall_config["ui_deny_from_ext"] = firewall_deny_browsing_from_ext; + } + if( Printer::firewall_config["browsing_from_int"]:false != Printer::firewall_config["ui_browsing_from_int"]:true + || Printer::firewall_config["deny_from_ext"]:false != Printer::firewall_config["ui_deny_from_ext"]:true + ) + { // The user has changed a Firewall setting: + printing_via_network_has_changed = true; + if( ! Printer::FirewallConfig( "write" ) ) + { // No error message here because Printer::FirewallConfig shows already error messages: + return false; + } + } + // Do the CUPS stuff after the Firewall stuff. // Get the actual settings and values from the dialog: any current_radio_button = UI::QueryWidget( `id(`browsing_or_client_only_check_boxes), `CurrentButton ); any current_browse_allow = UI::QueryWidget( `id(`browse_allow_combo_box), `Value ); @@ -780,6 +837,100 @@ UI::ChangeWidget( `id(`browsing_off_radio_button), `Value, true ); } } + // Determine the Firewall settings. + // Ignore errors because Printer::FirewallConfig results a firewall_config fallback map. + Printer::FirewallConfig( "read" ); + // Set the content and values for the firewall related widgets in the dialog: + if( ! Printer::firewall_config["suse_firewall_used"]:true ) + { // Not the Suse Firewall but another firewall is used: + UI::ReplaceWidget( `firewall_first_browsing_replace_point, + `Label + ( `id(`firewall_first_browsing_widget), + // Label when not the Suse Firewall but another firewall is used: + _("Not the Suse Firewall but another firewall is used") + ) + ); + UI::ReplaceWidget( `firewall_second_browsing_replace_point, + `Empty + ( `id(`firewall_second_browsing_widget) + ) + ); + } + else + { // The Suse Firewall is used: + if( ! Printer::firewall_config["firewall_active"]:true ) + { // The Suse Firewall is not running: + UI::ReplaceWidget( `firewall_first_browsing_replace_point, + `Label + ( `id(`firewall_first_browsing_widget), + // Label when the Suse Firewall is not running: + _("The Suse Firewall is not active") + ) + ); + UI::ReplaceWidget( `firewall_second_browsing_replace_point, + `Empty + ( `id(`firewall_second_browsing_widget) + ) + ); + } + else + { // The Suse Firewall is running: + if( ! Printer::firewall_config["no_firewall_for_int"]:true ) + { // The Suse Firewall does potect the INT zone: + // Let the user deny or allow CUPS Browsing from the INT zone here: + UI::ReplaceWidget( `firewall_first_browsing_replace_point, + `CheckBox + ( `id(`firewall_first_browsing_widget), + // CheckBox whether or not the Suse Firewall allows + // incomming printer information (CUPS Browsing packages) + // from the internal network zone (INT zone): + _("Allow printer information from the internal network zone"), + Printer::firewall_config["browsing_from_int"]:true + ) + ); + firewall_first_browsing_widget_is_checkbox = true; + } + else + { // The Suse Firewall does not potect the INT zone: + UI::ReplaceWidget( `firewall_first_browsing_replace_point, + `Label + ( `id(`firewall_first_browsing_widget), + // Label when the Suse Firewall does not potect the internal network zone + // which means that incomming printer information from the INT zone is allowed: + _("Printer information from the internal network zone is allowed") + ) + ); + } + if( ! Printer::firewall_config["deny_from_ext"]:true ) + { // The Suse Firewall does not deny incomming printer information from the EXT zone. + // Let the user deny incomming printer information from the EXT zone here: + UI::ReplaceWidget( `firewall_second_browsing_replace_point, + `CheckBox + ( `id(`firewall_second_browsing_widget), + // CheckBox whether or not the Suse Firewall denies + // incomming printer information from the external network zone. + // This is done by denying any access from the EXT zone. + _("Deny access and printer information from the external network zone"), + false + ) + ); + firewall_second_browsing_widget_is_checkbox = true; + } + else + { // The Suse Firewall denies incomming printer information from the EXT zone. + // Do not let the user allow incomming printer information from the EXT zone here: + UI::ReplaceWidget( `firewall_second_browsing_replace_point, + `Label + ( `id(`firewall_second_browsing_widget), + // Label when the Suse Firewall denies printer information + // from the external network zone. + // This is done by denying any access from the EXT zone. + _("Access and printer information from the external network zone is denied") + ) + ); + } + } + } y2milestone( "leaving initNetworkPrinting with\ninitial_radio_button = '%1'\ninitial_browse_allow = '%2'\ninitial_browse_allow_input_value = '%3'\ninitial_server_name_input_value = '%4'", initial_radio_button, initial_browse_allow, initial_browse_allow_input_value, initial_server_name_input_value ); } Modified: trunk/printer/src/sharing.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/sharing.ycp?rev=52741... ============================================================================== --- trunk/printer/src/sharing.ycp (original) +++ trunk/printer/src/sharing.ycp Thu Oct 30 15:05:19 2008 @@ -49,8 +49,8 @@ list< term > initial_interface_table_items = []; string initial_allow_input_value = ""; string initial_browse_address_input_value = ""; -boolean firewall_first_widget_is_checkbox = false; -boolean firewall_second_widget_is_checkbox = false; +boolean firewall_first_sharing_widget_is_checkbox = false; +boolean firewall_second_sharing_widget_is_checkbox = false; term widgetSharing = `VBox ( `VSpacing( 1 ), @@ -200,7 +200,7 @@ `VSpacing( 1 ), `Left ( `Label - ( `id(`firewall_settings_label), + ( `id(`firewall_sharing_settings_label), // A caption to make Firewall settings to allow remote access to CUPS: _("Firewall Settings") ) @@ -210,17 +210,17 @@ `VBox ( `Left ( `ReplacePoint - ( `id(`firewall_first_replace_point), + ( `id(`firewall_first_sharing_replace_point), `Empty - ( `id(`firewall_first_widget) + ( `id(`firewall_first_sharing_widget) ) ) ), `Left ( `ReplacePoint - ( `id(`firewall_second_replace_point), + ( `id(`firewall_second_sharing_replace_point), `Empty - ( `id(`firewall_second_widget) + ( `id(`firewall_second_sharing_widget) ) ) ) @@ -280,18 +280,18 @@ // Do the Firewall stuff first of all: boolean firewall_allow_from_int = true; boolean firewall_deny_from_ext = true; - if( firewall_first_widget_is_checkbox ) - { firewall_allow_from_int = (boolean)UI::QueryWidget( `firewall_first_widget, `Value ); + if( firewall_first_sharing_widget_is_checkbox ) + { firewall_allow_from_int = (boolean)UI::QueryWidget( `firewall_first_sharing_widget, `Value ); y2milestone( "firewall_allow_from_int value: '%1'", firewall_allow_from_int ); Printer::firewall_config["ui_access_from_int"] = firewall_allow_from_int; } - if( firewall_second_widget_is_checkbox ) - { firewall_deny_from_ext = (boolean)UI::QueryWidget( `firewall_second_widget, `Value ); + if( firewall_second_sharing_widget_is_checkbox ) + { firewall_deny_from_ext = (boolean)UI::QueryWidget( `firewall_second_sharing_widget, `Value ); y2milestone( "firewall_deny_from_ext value: '%1'", firewall_deny_from_ext ); Printer::firewall_config["ui_deny_from_ext"] = firewall_deny_from_ext; } - if( Printer::firewall_config["access_from_int"]:false != firewall_allow_from_int - || Printer::firewall_config["deny_from_ext"]:false != firewall_deny_from_ext + if( Printer::firewall_config["access_from_int"]:false != Printer::firewall_config["ui_access_from_int"]:true + || Printer::firewall_config["deny_from_ext"]:false != Printer::firewall_config["ui_deny_from_ext"]:true ) { // The user has changed a Firewall setting: sharing_has_changed = true; @@ -597,9 +597,9 @@ UI::ChangeWidget( `allow_input_label, `Enabled, false ); UI::ChangeWidget( `browse_address_input, `Enabled, false ); UI::ChangeWidget( `browse_address_input_label, `Enabled, false ); - UI::ChangeWidget( `firewall_settings_label, `Enabled, false ); - UI::ChangeWidget( `firewall_first_widget, `Enabled, false ); - UI::ChangeWidget( `firewall_second_widget, `Enabled, false ); + UI::ChangeWidget( `firewall_sharing_settings_label, `Enabled, false ); + UI::ChangeWidget( `firewall_first_sharing_widget, `Enabled, false ); + UI::ChangeWidget( `firewall_second_sharing_widget, `Enabled, false ); } // Regardless whether or not the "Share Printers" dialog is useless, // fill in the values of the current settings in the system: @@ -813,16 +813,16 @@ // Set the content and values for the firewall related widgets in the dialog: if( ! Printer::firewall_config["suse_firewall_used"]:true ) { // Not the Suse Firewall but another firewall is used: - UI::ReplaceWidget( `firewall_first_replace_point, + UI::ReplaceWidget( `firewall_first_sharing_replace_point, `Label - ( `id(`firewall_first_widget), + ( `id(`firewall_first_sharing_widget), // Label when not the Suse Firewall but another firewall is used: _("Not the Suse Firewall but another firewall is used") ) ); - UI::ReplaceWidget( `firewall_second_replace_point, + UI::ReplaceWidget( `firewall_second_sharing_replace_point, `Empty - ( `id(`firewall_second_widget) + ( `id(`firewall_second_sharing_widget) ) ); } @@ -830,16 +830,16 @@ { // The Suse Firewall is used: if( ! Printer::firewall_config["firewall_active"]:true ) { // The Suse Firewall is not running: - UI::ReplaceWidget( `firewall_first_replace_point, + UI::ReplaceWidget( `firewall_first_sharing_replace_point, `Label - ( `id(`firewall_first_widget), + ( `id(`firewall_first_sharing_widget), // Label when the Suse Firewall is not running: _("The Suse Firewall is not active") ) ); - UI::ReplaceWidget( `firewall_second_replace_point, + UI::ReplaceWidget( `firewall_second_sharing_replace_point, `Empty - ( `id(`firewall_second_widget) + ( `id(`firewall_second_sharing_widget) ) ); } @@ -848,21 +848,21 @@ if( ! Printer::firewall_config["no_firewall_for_int"]:true ) { // The Suse Firewall does potect the INT zone: // Let the user deny or allow CUPS access from the INT zone here: - UI::ReplaceWidget( `firewall_first_replace_point, + UI::ReplaceWidget( `firewall_first_sharing_replace_point, `CheckBox - ( `id(`firewall_first_widget), + ( `id(`firewall_first_sharing_widget), // CheckBox whether or not the Suse Firewall allows CUPS access from the INT zone: _("Allow access from the internal network zone"), Printer::firewall_config["access_from_int"]:true ) ); - firewall_first_widget_is_checkbox = true; + firewall_first_sharing_widget_is_checkbox = true; } else { // The Suse Firewall does not potect the INT zone: - UI::ReplaceWidget( `firewall_first_replace_point, + UI::ReplaceWidget( `firewall_first_sharing_replace_point, `Label - ( `id(`firewall_first_widget), + ( `id(`firewall_first_sharing_widget), // Label when the Suse Firewall does not potect the internal network zone // which means that CUPS access from the INT zone is allowed: _("Access from the internal network zone is allowed") @@ -872,22 +872,22 @@ if( ! Printer::firewall_config["deny_from_ext"]:true ) { // The Suse Firewall does not deny CUPS access from the EXT zone. // Let the user deny CUPS access from the EXT zone here: - UI::ReplaceWidget( `firewall_second_replace_point, + UI::ReplaceWidget( `firewall_second_sharing_replace_point, `CheckBox - ( `id(`firewall_second_widget), + ( `id(`firewall_second_sharing_widget), // CheckBox whether or not the Suse Firewall denies CUPS access from the EXT zone: _("Deny access from the external network zone"), false ) ); - firewall_second_widget_is_checkbox = true; + firewall_second_sharing_widget_is_checkbox = true; } else { // The Suse Firewall denies CUPS access from the EXT zone. // Do not let the user allow CUPS access from the EXT zone here: - UI::ReplaceWidget( `firewall_second_replace_point, + UI::ReplaceWidget( `firewall_second_sharing_replace_point, `Label - ( `id(`firewall_second_widget), + ( `id(`firewall_second_sharing_widget), // Label when the Suse Firewall denies CUPS access from the external network zone: _("Access from the external network zone is denied") ) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
jsmeix@svn.opensuse.org