[Fedora-directory-users] Re: a little bit of samba confusion
Kevin M. Goess
kgtemp at ensenda.com
Wed Dec 7 17:47:12 UTC 2005
> The samba.schema file was converted with a tool that doesn't avoid
> the "overly picky schema parsing" bug (#170791). You can try the
> new schema conversion script on the website to see if it handles
> this, or for samba.schema the workaround
>
> ./ol-schema-migrate.pl samba.schema | grep -v DESC > 61samba.ldif
Jeez, I spent half a day tracking down that bug on Monday.
Here are some improvements to your migration script so that it handles
objectIdentifier macro expansion
http://www.openldap.org/doc/admin22/schema.html#OID%20Macros and aliases in
names.
If the email mangles the patch, it's also at
http://kevin.goess.org/software/ol-schema-migrate.diff
--- ol-schema-migrate.pl.old 2005-12-07 08:53:49.375263056 -0800
+++ ol-schema-migrate.pl 2005-12-07 09:40:12.609147192 -0800
@@ -18,12 +18,29 @@
my $oc = 0;
my $at_string;
my $oc_string;
+my (%objectidentifier, $objectidentifier_re); #macro replacement
for (@lines)
{
next if (/^\s*\#/); # skip comments
+ if (/^\s*objectidentifier\s+(\S+)\s+(\S+)/)
+ {
+ my $macroname = $1;
+ my $subsval = $2;
+
+ #do the expansion for this one
+ $subsval =~ s/($objectidentifier_re):/$objectidentifier{$1}./;
+
+ $objectidentifier{$macroname} = $subsval;
+
+ $objectidentifier_re = join('|',keys(%objectidentifier));
+
+ next;
+ }
+
+
# going through the loop again
if ($at)
{
@@ -86,8 +103,8 @@
s/\t/ /g; # remove embedded tabs
s/\$ +/\$ /g; # remove multiple spaces after the $ sign
- my $oid = $1 if ( /(\d.+? )/ );
- my $name = $1 if ( /(NAME +'.+?')/ );
+ my $oid = $1 if ( /attributeTypes: \( ([\w:]+) / );
+ my $name = $1 if ( /(NAME +\(?'.+?'\)?)/ );
my $desc = $1 if ( /(DESC +'.+?')/ );
my $obsolete = $1 if ( /(OBSOLETE)/ );
my $sup = $1 if ( /(SUP .+?) / );
@@ -97,6 +114,11 @@
my $syntax = $1 if ( /(SYNTAX .+?) / );
my $single = $1 if ( /(SINGLE-VALUE)/ );
+ #macro expansion
+ $oid =~ s/\b($objectidentifier_re)(:)?/$objectidentifier{$1}.($2?'.':'')/e;
+ $syntax =~ s/\b($objectidentifier_re)(:)?/$objectidentifier{$1}.
($2?'.':'')/e;
+
+
print "attributeTypes: (\n";
print " $oid\n";
print " $name\n";
@@ -123,7 +145,7 @@
#
# OID; NAME; DESC; SUP; (STRUCTURAL|AUXILIARY|ABSTRACT); MUST; MAY
#
- my $oid = $1 if ( /(\d.+?) / );
+ my $oid = $1 if ( /objectClasses: \( ([\w:]+) / );
my $name = $1 if ( /(NAME +'.+?')/ );
my $desc = $1 if ( /(DESC +'.+?')/ );
my $sup = $1 if ( /(SUP .+?) / );
@@ -131,6 +153,9 @@
my $must = $1 if ( /(MUST +\(.+?\))/ );
my $may = $1 if ( /(MAY +\(.+?\))/ );
+ #macro expansion
+ $oid =~ s/\b($objectidentifier_re)(:)?/$objectidentifier{$1}.($2?'.':'')/e;
+
print "objectClasses: (\n";
print " $oid\n";
print " $name\n";
--
Kevin M. Goess
(415) 277-2079
Ensenda, Inc.
More information about the Fedora-directory-users
mailing list