Re: a little bit of samba confusion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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.




[Index of Archives]     [Fedora User Discussion]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora News]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora QA]     [Fedora Triage]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Yosemite Photos]     [Linux Apps]     [Maemo Users]     [Gnome Users]     [KDE Users]     [Fedora Tools]     [Fedora Art]     [Fedora Docs]     [Maemo Users]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Fedora ARM]

  Powered by Linux