Re: urpmi and ldap

Buchan Milne <[email protected]> Mon, 16 May 2005 18:37:48 +0200
Newsgroups gmane.linux.mandrake.server
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------040607050808020306040301
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Scherer wrote:
> Hi.
> As already said on this list, I was working on a ldap enabled urpmi. 
> 
> Well, good news, it works : http://www.zarb.org/~misc/urpmi-ldap/. 
> 
> Even better, you can deploy it on LE2005/10.2 without patch or anything, and 
> update the module without change. In the future, we could even place it in a 
> rpm usable on this release.
> 
> There is a minimal doc,  a  schema using private oid,

Hmm, 1.1.1 isn't really private, quoting from rfc 3383:

"
   To avoid interoperability problems between early implementations of
   "works in progress" and implementations of the published
   specification (e.g., the RFC), experimental OIDs SHOULD be used in
   "works in progress" and early implementations.  OIDs under the
   Internet Experimental OID arc (1.3.6.1.3.x) may be used for this
   purpose.
"

See attached patch ...

> and i didn't tested more 
> than urpmq. 

I couldn't urpmi.update until I made the other change in the patch.

> 
> There is also some know problem, like hdlist being left when you change the 
> sources.
> I think a urpmi.clean utility ( something that clean /var/lib/urpmi/* from 
> spurious files )  would be a solution,
> 
> I will also add the missing features ( autoconfiguration from dns ) later once 
> someone ( buchan ) give me guidelines.
> 

urpmi-ldap should also use upper-case for configuration items from
/etc/openldap/ldap.conf (OpenLDAP libs use upper-case, nss_ldap/pam_ldap
use lower case and fall back to the upper-case ones AFAIK), or use
/etc/ldap.conf

Since some of the items we might need are not valid for OpenLDAP libs, I
 changed to use /etc/ldap.conf

For dns-autoconfiguration, I don't think the OpenLDAP libs support it
(but pam_ldap and nss_ldap do to some extent, though I am not sure about
autofs and sudo - which use /etc/ldap.conf as well ...).

So, I'll need to think about this some more.

> Tests, comments, patchs and chocolates welcome.

Not so sure about chocolates ... but maybe we can arrange a t-shirt ...

I'll probably have a package by tomorrow that we'll use internally for
our PXE-deployed 10.2.

Regards,
Buchan

- --
Buchan Milne                      Senior Support Technician
Obsidian Systems                  http://www.obsidian.co.za
B.Eng          RHCE (803004789010797),LPIC-1 (LPI000074592)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCiMxcrJK6UGDSBKcRAmgDAJ9w3Nln/7QF25WIDvsRmsr8IEWKjACfXTzt
t3EcJyv8A5Qr3idUS4UDdzI=
=G3iS
-----END PGP SIGNATURE-----

--------------040607050808020306040301
Content-Type: text/x-patch;
 name="urpmi-ldap-fixes.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="urpmi-ldap-fixes.patch"

--- urpmi-ldap/urpmi.schema.1	2005-04-19 11:23:44.000000000 +0200
+++ urpmi-ldap/urpmi.schema	2005-05-16 12:20:35.613172655 +0200
@@ -6,8 +6,14 @@
 #    Frederic Lepied
 #      [email protected]
 
+objectidentifier MANDRIVA 1.3.6.1.4.1.21103
+#objectidentifier MANDRIVA:1
+objectidentifier URPMI 1.3.6.4.1.3.1.21103.1
+objectidentifier URPMIA URPMI:1
+objectidentifier URPMIO URPMI:2
+
 # name is already taken
-attributetype ( 1.1.1.1
+attributetype ( URPMIA:1
 		NAME 'source-name'
 		DESC 'Name appended to the source'
 		EQUALITY caseExactMatch
@@ -15,35 +21,35 @@
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
 
 
-attributetype ( 1.1.1.2
+attributetype (URPMIA:2
 		NAME 'url'
 		DESC 'Url of the rpm repository'
 		EQUALITY caseExactMatch
 		SUBSTR caseIgnoreSubstringsMatch
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
 
-attributetype ( 1.1.1.3
+attributetype (URPMIA:3
 		NAME 'downloader'
 		DESC 'Software used to download ( curl or wget )'
 		EQUALITY caseExactMatch
 		SUBSTR caseIgnoreSubstringsMatch
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
 
-attributetype ( 1.1.1.4
+attributetype (URPMIA:4
 		NAME 'hdlist'
 		DESC 'Name of the hdlist'
 		EQUALITY caseExactMatch
 		SUBSTR caseIgnoreSubstringsMatch
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
 
-attributetype ( 1.1.1.5
+attributetype (URPMIA:5
 		NAME 'key-ids'
 		DESC 'Key identifier'
 		EQUALITY caseExactMatch
 		SUBSTR caseIgnoreSubstringsMatch
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
 
-attributetype ( 1.1.1.6
+attributetype (URPMIA:6
 		NAME 'list'
 		DESC 'Name of the list file'
 		EQUALITY caseExactMatch
@@ -51,7 +57,7 @@
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
 
 #           md5sum => ?? 
-attributetype ( 1.1.1.7
+attributetype (URPMIA:7
 		NAME 'md5sum'
 		DESC '??'
 		EQUALITY caseExactMatch
@@ -60,7 +66,7 @@
 
 #           priority => ??
 # TODO maybe a integer ?
-attributetype ( 1.1.1.8
+attributetype (URPMIA:8
 		NAME 'priority'
 		DESC '??'
 		EQUALITY caseExactMatch
@@ -68,7 +74,7 @@
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
 
 #           removable => ?? 
-attributetype ( 1.1.1.9
+attributetype (URPMIA:9
 		NAME 'removable'
 		DESC '??'
 		EQUALITY caseExactMatch
@@ -76,7 +82,7 @@
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
 
 # _ is forbidden, so i use -
-attributetype ( 1.1.1.10
+attributetype (URPMIA:10
 		NAME 'with-hdlist'
 		DESC 'Path to the hdlist'
 		EQUALITY caseExactMatch
@@ -86,21 +92,21 @@
 
 # 1.3.6.1.4.1.1466.115.121.1.7
 #           verify-rpm 
-attributetype ( 1.1.1.11
+attributetype (URPMIA:11
 		NAME 'verify-rpm'
 		DESC 'Check if rpm needs to be verified'
 		EQUALITY booleanMatch
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
 
 #           synthesis
-attributetype ( 1.1.1.12
+attributetype (URPMIA:12
 		NAME 'synthesis'
 		DESC 'Use synthesis index'
 		EQUALITY booleanMatch
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
 
 #           virtual   bool
-attributetype ( 1.1.1.13
+attributetype (URPMIA:13
 		NAME 'virtual'
 		DESC 'Is the repostiroy constructed on the fly'
 		EQUALITY booleanMatch
@@ -108,48 +114,48 @@
 
 #           noreconfigure bool
 # TODO isn't this implied, as urpmi cannot write to ldap
-attributetype ( 1.1.1.14
+attributetype (URPMIA:14
 		NAME 'noreconfigure'
 		DESC 'Do not attempt to reconfigure the source'
 		EQUALITY booleanMatch
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
 
 #           update bool
-attributetype ( 1.1.1.15
+attributetype (URPMIA:15
 		NAME 'update'
 		DESC 'Source is a update one'
 		EQUALITY booleanMatch
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
 
 #           ignore   bool
-attributetype ( 1.1.1.16
+attributetype (URPMIA:16
 		NAME 'ignore'
 		DESC 'Source is ignored'
 		EQUALITY booleanMatch
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
 
-attributetype ( 1.1.1.2
+attributetype (URPMIA:17
 		NAME 'http-proxy'
 		DESC 'Http proxy specification'
 		EQUALITY caseExactMatch
 		SUBSTR caseIgnoreSubstringsMatch
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
 
-attributetype ( 1.1.1.2
+attributetype (URPMIA:18
 		NAME 'ftp-proxy'
 		DESC 'Ftp proxy'
 		EQUALITY caseExactMatch
 		SUBSTR caseIgnoreSubstringsMatch
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
 
-attributetype ( 1.1.1.2
+attributetype (URPMIA:19
 		NAME 'proxy-user'
 		DESC 'User of the proxy'
 		EQUALITY caseExactMatch
 		SUBSTR caseIgnoreSubstringsMatch
 		SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
 
-attributetype ( 1.1.1.2
+attributetype (URPMIA:20
 		NAME 'proxy-password'
 		DESC 'Password of the proxy'
 		EQUALITY caseExactMatch
@@ -160,13 +166,14 @@
 
 
 # TODO if virtual is TRUE, no need for hdlist
-objectclass ( 1.1.2.1 NAME 'urpmiRepository'	
+objectclass (URPMIO:1 NAME 'urpmiRepository'	
 			DESC 'A urpmi repository'
 			SUP top
-			AUXILIARY
+			STRUCTURAL
 			MUST ( source-name $ url $ hdlist $ with-hdlist )
 			MAY ( downloader $ key-ids $ list $ priority $
 				md5sum $ removable $ verify-rpm $ synthesis $ virtual $
 				noreconfigure $ update $ ignore $ http-proxy $ ftp-proxy $
-                proxy-user $ proxy-password )
+                proxy-user $ proxy-password $
+				cn )
 			)
--- urpmi-ldap/ldap.pm.1	2005-04-19 11:23:44.000000000 +0200
+++ urpmi-ldap/ldap.pm	2005-05-16 17:43:31.571897755 +0200
@@ -7,7 +7,7 @@
 use Net::LDAP;
 use MDK::Common;
 
-my $LDAP_CONFIG_FILE = '/etc/openldap/ldap.conf'; 
+my $LDAP_CONFIG_FILE = '/etc/ldap.conf'; 
 # FIXME duplication 
 my @per_media_opt = qw(
     downloader 
@@ -25,6 +25,7 @@
     verify-rpm 
     virtual
     with_hdlist
+    http_proxy
 );
 
 # TODO
@@ -183,7 +184,8 @@
             my  %ldap_changed_attributes = (
                 'source-name' => 'name',
                 'url' => 'clear_url',
-                'with-hdlist' => 'with_hdlist'
+                'with-hdlist' => 'with_hdlist',
+		'http-proxy' => 'http_proxy'
             );
 
             foreach my $opt (@per_media_opt, keys %ldap_changed_attributes) {
@@ -204,7 +206,7 @@
             $medium->{'ldap'} = 1;
             next if ! check_ldap_medium($medium);
             $urpm->probe_medium($medium, %options) and push @{$urpm->{media}}, $medium;
-            $urpm->write_ldap_cache($medium) or $urpm->{log}(N("Could not write ldap cache : ") . $_ );
+            $urpm->urpm::ldap::write_ldap_cache($medium) or $urpm->{log}(N("Could not write ldap cache : ") . $_ );
         } 
     };
     if ($@)

--------------040607050808020306040301--