Author: mcalmer
Date: Tue Jul 1 16:00:10 2008
New Revision: 48723
URL: http://svn.opensuse.org/viewcvs/yast?rev=48723&view=rev
Log:
add IPv6 addresses to Subject Alternativ Names too
Modified:
trunk/ca-management/src/ca_mgm_proposal.ycp
trunk/ca-management/src/util.ycp
Modified: trunk/ca-management/src/ca_mgm_proposal.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ca-management/src/ca_mgm_proposal.ycp?rev=48723&r1=48722&r2=48723&view=diff
==============================================================================
--- trunk/ca-management/src/ca_mgm_proposal.ycp (original)
+++ trunk/ca-management/src/ca_mgm_proposal.ycp Tue Jul 1 16:00:10 2008
@@ -43,16 +43,20 @@
string warning = nil;
symbol warning_level = nil;
- list<map> host_ips = getHostIPs ();
+ map host_ips = getHostIPs ();
string hostname_bak = "";
+ CaMgm::prop_subject_alt_name_list = [];
- foreach(map elem, host_ips, {
- if(elem["kind"]:"" == "DNS")
+ foreach(string key, string value, host_ips, {
+ if(value == "DNS")
{
- hostname_bak = elem["name"]:"";
+ hostname_bak = key;
}
+ map elem = $[];
+ elem["kind"] = value;
+ elem["name"] = key;
CaMgm::prop_subject_alt_name_list = add (CaMgm::prop_subject_alt_name_list, elem);
- });
+ });
map retmap = (map) SCR::Execute (.target.bash_output,
"/bin/hostname --long",
@@ -274,15 +278,21 @@
}
string passwordString = (string) (CaMgm::prop_passwordChanged ? _("[manually set]") : _("[root password]"));
+
+ string subAltName = "";
+ foreach(map elem, CaMgm::prop_subject_alt_name_list, {
+ subAltName = subAltName + elem["kind"]:"" + ":" + elem["name"]:"" + " ";
+ });
+
proposal = proposal+ HTML::List( [ _("CA Name: ") + CaMgm::prop_CAName,
_("Common Name: ") + CaMgm::prop_ca_commonName,
_("Server Name: ") + CaMgm::prop_server_commonName,
_("Country: ") + CaMgm::prop_country,
_("Password: ") + passwordString,
- _("E-Mail: ") + CaMgm::prop_email
+ _("E-Mail: ") + CaMgm::prop_email,
+ _("Alternative Names: ") + subAltName,
] );
-
-
+
if ( size(CaMgm::prop_password) < 4)
{
ret = add( ret, "warning", _("The root password is too short for use as the password for the certificates.
Modified: trunk/ca-management/src/util.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ca-management/src/util.ycp?rev=48723&r1=48722&r2=48723&view=diff
==============================================================================
--- trunk/ca-management/src/util.ycp (original)
+++ trunk/ca-management/src/util.ycp Tue Jul 1 16:00:10 2008
@@ -1426,24 +1426,29 @@
}
- define list<map> getHostIPs () ``{
- list<map> ret = [];
+ define map getHostIPs () ``{
+ map ret = $[];
+
list <string> ip_addresses = splitstring(
((map)SCR::Execute(.target.bash_output, "ip -f inet -o addr | awk '{print $4}' | awk -F \/ '{print $1}' | tr '\n' ','"))["stdout"]:"", ",") ;
+ list <string> ip6_addresses = splitstring(
+ ((map)SCR::Execute(.target.bash_output, "ip -f inet6 -o addr | awk '{print $4}' | awk -F \/ '{print $1}' | tr '\n' ','"))["stdout"]:"", ",") ;
+ foreach(string ip6, ip6_addresses, {
+ if(ip6 != "::1" && ip6 != "")
+ {
+ ip_addresses = add( ip_addresses, ip6);
+ }
+ });
foreach(string ip, ip_addresses, {
// skip localhost addresses
if(ip != "127.0.0.1" && ip != "127.0.0.2" && ip != "")
{
// add the IP address
- map new_entry = $[];
- new_entry["kind"] = "IP";
- new_entry["name"] = ip;
-
- ret = add (ret, new_entry);
-
+ ret[ip] = "IP";
+
// first ask the DNS server about the name for this IP address
list<string> hostnames = splitstring(
((map)SCR::Execute(.target.bash_output, sformat("dig +noall +answer -x %1 | awk '{print $5}' | sed 's/\.$//'| tr '\n' '|'", ip)))["stdout"]:"", "|");
@@ -1454,11 +1459,7 @@
{
// add the names
found = true;
- map new_entry = $[];
- new_entry["kind"] = "DNS";
- new_entry["name"] = hname;
-
- ret = add (ret, new_entry);
+ ret[hname] = "DNS";
}
});
// If not found, ask the hosts file about the IP address
@@ -1471,11 +1472,7 @@
if(hname != "")
{
// add the names
- map new_entry = $[];
- new_entry["kind"] = "DNS";
- new_entry["name"] = hname;
-
- ret = add (ret, new_entry);
+ ret[hname] = "DNS";
}
});
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org