[Fedora-directory-users] Schema Conversion

Nathan Benson nathan.benson at sourcefire.com
Wed Oct 26 15:59:48 UTC 2005


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

hi,

i've updated my perl script to do RFC 2252 ordering as well as
formatting.  Steven Bonneville (RedHat) brought it to my attention that
RHDS/FDS was very strict about following the RFC while OpenLDAP was not.
~ so, if an OL schema was out of order, it caused problems when being
converted to RHDS/FDS.

anyway, i've attached my script.  it should also be useful for
reordering already converted schemas just in case the order might not be
correct.

i hope everyone finds it useful, please let me know how it works out.

thanks,
nathan

Nathan Benson thus spake on 06/09/2005 04:13 PM:
| DC / list,
|
| i have a quick and dirty perl script i had cooked up to do this.  it was
| enough to allow me to convert some openldap schema to FDS.  i was able
| to successfully start FDS after converting a few of them (samba3, etc).
|
| i probably went about it all wrong.  for instance the dn: line is
| probably written out incorrectly (i just did what i could to make it
| work).  i haven't even tried importing a database using the newly
| converted schemas, so your milage will almost certainly vary.
|
| anyway, i've pasted it in the message below because i'm not sure if the
| list allows attachments.  i hope it's of some use to people trying to
| make the switch from openldap to FDS.
|
| ------------- SNIP ------------------
|
| #!/usr/bin/perl -w
| #
| # this is a quick perl script to convert OpenLDAP schema files
| # to FDS ldif (schema) files.  it is probably not anywhere near
| # useful, but it did allow me to convert a few of my .schema
| # files and have FDS successfully start with them.
| #
| # -Nathan Benson (nathan.benson at sourcefire.com)
| #
|
|
| use strict;
|
|
| die "usage: $0 <openldap.schema>\n" unless my $file = $ARGV[0];
| die "$! '$file'\n" unless -e $file;
|
|
| my $start;
|
|
| print "dn: cn=schema\n";
|
|
| open SCHEMA, $file;
| while (<SCHEMA>)
| {
| ~        next if /^(#|$)/;
|
|
| ~        if (/^(objectclass|attributetype)\s/)
| ~        {
| ~                print "\n" if ($start);
| ~                chomp;
|
|
| ~                $_     =~ s/^objectclass/objectclasses:/i;
| ~                $_     =~ s/^attributetype/attributetypes:/i;
| ~                $_     =~ s/(\t|\s)/ /;
|
|
| ~                $start = 1;
| ~                print;
| ~        }
| ~        elsif ((/^\s*\w/) && ($start))
| ~        {
| ~                chomp;
| ~                $_     =~ s/^(\s*)/ /;
| ~                print;
| ~        }
| }
| close SCHEMA;
|
| ------------- SNIP ------------------
|
| D Canfield thus spake on 06/08/2005 07:51 PM:
| | I don't suppose anyone has found an easy way to convert OpenLDAP schema
| | into fedora-ds compatible ldif files?  We've got about 100 attributes
| | defined, and I'm really not looking forward to entering them all by
| hand...
| |
| | Thanks
| | DC
| |
| | --
| | Fedora-directory-users mailing list
| | Fedora-directory-users at redhat.com
| | https://www.redhat.com/mailman/listinfo/fedora-directory-users
| |
|

- --
Fedora-directory-users mailing list
Fedora-directory-users at redhat.com
https://www.redhat.com/mailman/listinfo/fedora-directory-users


- --
Nathan Benson
http://sourcefire.com/

1C1A F2C1 82AD F75F 9B6B  E501 0D73 DC9B E96B DD96
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFDX6f0DXPcm+lr3ZYRAlmAAJ9CgySM8J7KCTdbfhgUQYNPNkrjfACgiNex
saZih7lWJKsgHwCq5z8V5zk=
=Dhr5
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ol2rhds.pl
Type: application/x-perl
Size: 12847 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-directory-users/attachments/20051026/4f57e390/attachment.pl>


More information about the Fedora-directory-users mailing list