Mailinglist Archive: yast-commit (195 mails)

< Previous Next >
[yast-commit] r63606 - in /branches/SuSE-Code-11-SP2-Branch/ldap-client: src/Ldap.ycp testsuite/tests/Export.out testsuite/tests/Export.ycp testsuite/tests/Read.out testsuite/tests/Read.ycp
Author: jsuchome
Date: Fri Mar 18 16:56:26 2011
New Revision: 63606

URL: http://svn.opensuse.org/viewcvs/yast?rev=63606&view=rev
Log:
- write uri instead of just host name to ldap.conf and sssd.conf
(bnc#663012)

Modified:
branches/SuSE-Code-11-SP2-Branch/ldap-client/src/Ldap.ycp
branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Export.out
branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Export.ycp
branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Read.out
branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Read.ycp

Modified: branches/SuSE-Code-11-SP2-Branch/ldap-client/src/Ldap.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/ldap-client/src/Ldap.ycp?rev=63606&r1=63605&r2=63606&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/ldap-client/src/Ldap.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/ldap-client/src/Ldap.ycp Fri Mar 18
16:56:26 2011
@@ -33,6 +33,7 @@
import "Stage";
import "String";
import "Summary";
+ import "URL";

/**
* show popups with error messages?
@@ -678,6 +679,35 @@
return oes;
}

+ // convert list of uri's to list of hosts
+ string uri2servers (string uri) {
+ return mergestring (maplist (string u, splitstring (uri, " \t"), {
+ map url = URL::Parse (u);
+ string h = url["host"]:"";
+ if (url["port"]:"" != "")
+ h = sformat ("%1:%2", h, url["port"]:"");
+ return h;
+ }), " ");
+ }
+
+ /**
+ * Read values of LDAP hosts from ldap.conf
+ * get them from 'uri' or 'host' values
+ */
+ global string ReadLdapHosts () {
+ string ret = "";
+ string uri = ReadLdapConfEntry ("uri", "");
+ if (uri == "")
+ {
+ ret = ReadLdapConfEntry ("host", "");
+ }
+ else
+ {
+ ret = uri2servers (uri);
+ }
+ return ret;
+ }
+
/**
* Reads LDAP settings from the SCR
* @return success
@@ -724,7 +754,8 @@
size (nsswitch["passwd_compat"]:[]) == 0));
nis_available = nis_available && (Service::Status ("ypbind") == 0);

- server = ReadLdapConfEntry ("host", "");
+ server = ReadLdapHosts ();
+
base_dn = ReadLdapConfEntry ("base", "");

old_base_dn = base_dn;
@@ -1009,7 +1040,7 @@
if (bind_pass == nil && servers == "")
{
y2milestone ("--- server not read yet or empty, reading now");
- servers = ReadLdapConfEntry ("host", "");
+ servers = ReadLdapHosts ();
}

list l_servers = splitstring (servers, " \t");
@@ -1935,8 +1966,23 @@
map out = (map)SCR::Execute(.target.bash_output,
"/bin/rpm -V openldap2-client");

- list open_host = (list) SCR::Read
- (.etc.ldap_conf.v."/etc/openldap/ldap.conf".host);
+ list open_host = [];
+ list open_uri = (list) SCR::Read
+ (.etc.ldap_conf.v."/etc/openldap/ldap.conf".uri);
+ if (open_uri == [])
+ {
+ open_uri = (list) SCR::Read
+ (.etc.ldap_conf.v."/etc/openldap/ldap.conf".URI);
+ }
+ if (open_uri == [])
+ {
+ open_host = (list) SCR::Read
+ (.etc.ldap_conf.v."/etc/openldap/ldap.conf".host);
+ }
+ else
+ {
+ open_host = [ uri2servers (open_uri[0]:"")];
+ }
list open_base = (list) SCR::Read
(.etc.ldap_conf.v."/etc/openldap/ldap.conf".base);

@@ -1952,8 +1998,16 @@
if (write_openldap_conf)
{
// update ldap.conf
- SCR::Write (.etc.ldap_conf.v."/etc/openldap/ldap.conf".host,
- [server]);
+ SCR::Write (.etc.ldap_conf.v."/etc/openldap/ldap.conf".host, nil);
+
+ string uri = mergestring (
+ maplist (string u, splitstring (server, " \t"), {
+ return "ldap://"; + u;
+ }), " ");
+
+ SCR::Write (.etc.ldap_conf.v."/etc/openldap/ldap.conf".uri,
+ [uri]);
+
SCR::Write(.etc.ldap_conf.v."/etc/openldap/ldap.conf".base,
[base_dn]);

@@ -1997,7 +2051,7 @@

path domain = add (.etc.sssd_conf.v, "domain/default");

- string uri = sformat ("ldap%1://%2", ldap_tls ? "s" : "",
String::FirstChunk (server, " \t"));
+ string uri = sformat ("ldap://%1";, String::FirstChunk (server, "
\t"));
SCR::Write (add (domain, "ldap_uri"), uri);
SCR::Write (add (domain, "ldap_search_base"), base_dn);
SCR::Write (add (domain, "ldap_schema"), "rfc2307bis");
@@ -2466,7 +2520,12 @@
if (modified)
{
// update ldap.conf
- WriteLdapConfEntry ("host", server);
+ WriteLdapConfEntry ("host", nil);
+ string uri = mergestring (
+ maplist (string u, splitstring (server, " \t"), {
+ return "ldap://"; + u;
+ }), " ");
+ WriteLdapConfEntry ("uri", uri);
WriteLdapConfEntry ("base", base_dn);

if (member_attribute != old_member_attribute)

Modified:
branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Export.out
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Export.out?rev=63606&r1=63605&r2=63606&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Export.out
(original)
+++ branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Export.out Fri
Mar 18 16:56:26 2011
@@ -1,4 +1,5 @@
Dump ==== reading... ============================
+Read .etc.ldap_conf.v."/etc/ldap.conf"."uri" nil
Read .etc.ldap_conf.v."/etc/ldap.conf"."host" "localhost"
Read .etc.ldap_conf.v."/etc/ldap.conf"."base" "dc=suse,dc=cz"
Read .etc.ldap_conf.v."/etc/ldap.conf"."ldap_version" nil

Modified:
branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Export.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Export.ycp?rev=63606&r1=63605&r2=63606&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Export.ycp
(original)
+++ branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Export.ycp Fri
Mar 18 16:56:26 2011
@@ -31,7 +31,8 @@
"pam_password": "crypt",
"tls_cacertdir" : "/etc/openldap/cacerts/",
"tls_cacertfile": nil,
- "tls_checkpeer" : nil
+ "tls_checkpeer" : nil,
+ "uri" : nil
]
]
],

Modified: branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Read.out
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Read.out?rev=63606&r1=63605&r2=63606&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Read.out
(original)
+++ branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Read.out Fri
Mar 18 16:56:26 2011
@@ -1,5 +1,5 @@
Dump ==== reading... ============================
-Read .etc.ldap_conf.v."/etc/ldap.conf"."host" "localhost"
+Read .etc.ldap_conf.v."/etc/ldap.conf"."uri" "ldap://localhost:333";
Read .etc.ldap_conf.v."/etc/ldap.conf"."base" "dc=suse,dc=cz"
Read .etc.ldap_conf.v."/etc/ldap.conf"."ldap_version" nil
Read .etc.ldap_conf.v."/etc/ldap.conf"."ssl" nil
@@ -22,3 +22,4 @@
Dump nsswitch: -$["group":["compat"], "group_compat":["ldap"],
"passwd":["compat"], "passwd_compat":["ldap"]]-
Dump base config DN: --
Dump bind DN: -uid=manager,dc=suse,dc=cz-
+Dump server: -localhost:333-

Modified: branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Read.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Read.ycp?rev=63606&r1=63605&r2=63606&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Read.ycp
(original)
+++ branches/SuSE-Code-11-SP2-Branch/ldap-client/testsuite/tests/Read.ycp Fri
Mar 18 16:56:26 2011
@@ -31,7 +31,8 @@
"pam_password": "crypt",
"tls_cacertdir" : "/etc/openldap/cacerts/",
"tls_cacertfile": nil,
- "tls_checkpeer" : "no"
+ "tls_checkpeer" : "no",
+ "uri" : "ldap://localhost:333";
]
]
],
@@ -102,4 +103,6 @@
DUMP ( sformat ("base config DN: -%1-", Ldap::base_config_dn) );

DUMP ( sformat ("bind DN: -%1-", Ldap::bind_dn) );
+
+ DUMP ( sformat ("server: -%1-", Ldap::server) );
}

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages