Author: mzugec
Date: Tue Dec 4 17:43:00 2007
New Revision: 42675
URL: http://svn.opensuse.org/viewcvs/yast?rev=42675&view=rev
Log:
into IP addresses include also IPs from dhcp interfaces
improved vhost validation for name-based vhost (#342844)
Modified:
trunk/http-server/VERSION
trunk/http-server/package/yast2-http-server.changes
trunk/http-server/src/HttpServer.ycp
trunk/http-server/src/HttpServerWidgets.ycp
trunk/http-server/src/dialogs.ycp
trunk/http-server/src/wizards.ycp
Modified: trunk/http-server/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/http-server/VERSION?rev=42675&r1=42674&r2=42675&view=diff
==============================================================================
--- trunk/http-server/VERSION (original)
+++ trunk/http-server/VERSION Tue Dec 4 17:43:00 2007
@@ -1 +1 @@
-2.15.7
+2.15.8
Modified: trunk/http-server/package/yast2-http-server.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/http-server/package/yast2-http-server.changes?rev=42675&r1=42674&r2=42675&view=diff
==============================================================================
--- trunk/http-server/package/yast2-http-server.changes (original)
+++ trunk/http-server/package/yast2-http-server.changes Tue Dec 4 17:43:00 2007
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Tue Dec 4 17:41:00 CET 2007 - mzugec@suse.cz
+
+- into IP addresses include also IPs from dhcp interfaces
+- improved vhost validation for name-based vhost (#342844)
+- 2.15.8
+
+-------------------------------------------------------------------
Wed Aug 22 14:46:04 CEST 2007 - mzugec@suse.cz
- don't forget values for vhost when go next-back (#299223)
Modified: trunk/http-server/src/HttpServer.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/http-server/src/HttpServer.ycp?rev=42675&r1=42674&r2=42675&view=diff
==============================================================================
--- trunk/http-server/src/HttpServer.ycp (original)
+++ trunk/http-server/src/HttpServer.ycp Tue Dec 4 17:43:00 2007
@@ -245,6 +245,8 @@
// add DHCP ones, if we can find out the current IP
devs = NetworkDevices::Locate("BOOTPROTO", "dhcp");
foreach(string dev, devs, {
+/*
+y2internal("dhcp devs %1", devs);
// first, convert to the current name
map output = (map)SCR::Execute (.target.bash_output, "/sbin/getcfg-interface " + dev);
@@ -254,8 +256,8 @@
}
string device = output["stdout"]:"";
-
- output = (map)SCR::Execute (.target.bash_output, "/sbin/ifconfig "+device, $["LC_MESSAGES":"C"] );
+*/
+ map output = (map)SCR::Execute (.target.bash_output, "/sbin/ifconfig "+dev, $["LC_MESSAGES":"C"] );
if (output["exit"]:-1 == 0)
{
// lookup the correct line first
Modified: trunk/http-server/src/HttpServerWidgets.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/http-server/src/HttpServerWidgets.ycp?rev=42675&r1=42674&r2=42675&view=diff
==============================================================================
--- trunk/http-server/src/HttpServerWidgets.ycp (original)
+++ trunk/http-server/src/HttpServerWidgets.ycp Tue Dec 4 17:43:00 2007
@@ -1042,19 +1042,19 @@
global define void storeVhostId (string opt_id, map event) ``{
}
-define string changeVHostPopup(){
+define string changeVHostPopup(string value){
string vhost="";
- string servername = ""; foreach(integer num, map row, host_options, {if (row["KEY"]:"" == "ServerName") servername = row["VALUE"]:"";});
list items = maplist( string ip, string dev, HttpServer::ip2device, ``(ip) );
UI::OpenDialog(
`RadioButtonGroup(`id(`rb),
`VBox(
- `Left(`RadioButton(`id(`ms),`opt(`notify), "", true)),
+ `Left( `RadioButton(`id(`all_addr),`opt(`notify), _("All addresses (*)"), true)),
+ `Left(`RadioButton(`id(`multiselect),`opt(`notify), "")),
`MultiSelectionBox( `id(`ipaddress),
_("IP Adresses"), items )
,
- `Left(`RadioButton(`id(`sn),`opt(`notify), "")),
- `TextEntry(`id(`serv_name), _("ServerName"), servername)
+ `Left(`RadioButton(`id(`custom),`opt(`notify), "")),
+ `TextEntry(`id(`serv_name), _("ServerName"))
,
`VSpacing(),
`HBox(
@@ -1064,27 +1064,49 @@
)
)
);
+ if (value=="*" || value=="") UI::ChangeWidget(`serv_name, `Value, value);
+ else {
+ list<term> it=[];
+ foreach(string ip, (list<string>)items, {
+ it=add(it, `item(`id(ip), ip, contains(splitstring(value, " "), ip)) );
+ });
+ boolean unknown = false;
+ foreach(string ip, splitstring(value, " "), {
+ if (!contains(items, ip)) unknown = true;
+ });
+ if (unknown){
+ UI::ChangeWidget(`serv_name, `Value, value);
+ UI::ChangeWidget(`rb, `CurrentButton, `custom);
+ } else {
+ UI::ChangeWidget(`ipaddress, `Items, it);
+ UI::ChangeWidget(`rb, `CurrentButton, `multiselect);
+ }
+ }
symbol ret = nil;
do{
- if(UI::QueryWidget(`id(`rb), `CurrentButton)==`ms){
- UI::ChangeWidget(`id(`ipaddress), `Enabled, true);
- UI::ChangeWidget(`id(`serv_name), `Enabled, false);
- }else{
- UI::ChangeWidget(`id(`ipaddress), `Enabled, false);
- UI::ChangeWidget(`id(`serv_name), `Enabled, true);
- }
+ symbol rb = (symbol)UI::QueryWidget(`id(`rb), `CurrentButton);
+ UI::ChangeWidget(`id(`ipaddress), `Enabled, rb==`multiselect);
+ UI::ChangeWidget(`id(`serv_name), `Enabled, rb==`custom);
ret = (symbol) UI::UserInput();
} while( ret != `ok && ret != `cancel );
if( ret == `ok ) {
- if(UI::QueryWidget(`id(`rb), `CurrentButton)==`ms){
+ switch((symbol)UI::QueryWidget(`id(`rb), `CurrentButton)){
+ case `all_addr:
+ vhost="*";
+ break;
+ case `multiselect:
list<string> selected=(list<string>)UI::QueryWidget(`id(`ipaddress), `SelectedItems);
- if (size(selected)==size(items)) vhost="*";
- else vhost = mergestring(selected, " ");
- } else {
- vhost=(string)UI::QueryWidget(`id(`serv_name), `Value);
- }
- } else vhost="";
+ vhost = mergestring(selected, " ");
+ break;
+ case `custom:
+ vhost=(string)UI::QueryWidget(`id(`serv_name), `Value);
+ break;
+ default:
+ vhost="";
+ y2warning("unrecognized selection");
+ }
+ }
UI::CloseDialog();
return vhost;
}
@@ -1092,7 +1114,7 @@
global define symbol handleVhostRest (string key, map event){
if (event["EventReason"]:""=="Activated" && event["ID"]:nil ==`change_vhost){
- string vhost = changeVHostPopup();
+ string vhost = changeVHostPopup((string)UI::QueryWidget(`virtual_host, `Value));
if (size(vhost)>0) UI::ChangeWidget(`id(`virtual_host), `Value, vhost);
}
return nil;
@@ -1105,6 +1127,22 @@
Popup::Error(_("Name for VirtualHost ID can't be empty."));
return false;
}
+
+ // for name-based vhost only IP address is allowed
+ // or regexp (* or *:port) or list of IP addresses
+ if (UI::QueryWidget(`resolution, `Value)==`name_based) {
+ // regexp matches '*' and '*:80'
+ if (regexpmatch(vhost, "^\\*$\|^\\*:[[:digit:]]\+$")) return true;
+ boolean ok=true;
+ foreach(string ip, splitstring(vhost, " "), {
+ if (!IP::Check4(ip)) ok=false;
+ });
+ if (!ok) Popup::Warning(_("To use name-based virtual hosting,
+you must designate the IP address on the server
+that will be accepting requests for the hosts.
+Also * for all addresses and *:port are acceptable."));
+ return ok;
+ }
return true;
}
Modified: trunk/http-server/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/http-server/src/dialogs.ycp?rev=42675&r1=42674&r2=42675&view=diff
==============================================================================
--- trunk/http-server/src/dialogs.ycp (original)
+++ trunk/http-server/src/dialogs.ycp Tue Dec 4 17:43:00 2007
@@ -129,6 +129,7 @@
contents = CWM::PrepareDialog(contents, w);
Wizard::SetContentsButtons(caption, contents, help, Label::BackButton (), Label::FinishButton ());
+ Wizard::RestoreAbortButton();
Wizard::DisableBackButton();
symbol ret = CWM::Run(w, $[`abort:ReallyAbort ]);
Modified: trunk/http-server/src/wizards.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/http-server/src/wizards.ycp?rev=42675&r1=42674&r2=42675&view=diff
==============================================================================
--- trunk/http-server/src/wizards.ycp (original)
+++ trunk/http-server/src/wizards.ycp Tue Dec 4 17:43:00 2007
@@ -91,9 +91,11 @@
`add : "add-vh",
],
"add-vh" : $[
+ `abort : `abort,
`next : "overview" //`next
],
"edit-vh" : $[
+ `abort : `abort,
`next : "overview" //`next
],
"setvhost": $[
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org