[Fedora-directory-users] Schema Conversion

Rich Megginson rmeggins at redhat.com
Thu Jun 9 23:30:57 UTC 2005


Thanks.  The script looks pretty useful.  I've created an OpenLDAP 
migration section of the wiki - 
http://directory.fedora.redhat.com/wiki/Howto:OpenLDAPMigration#Schema - 
and added your script.  I left in your name but removed your email 
address.  I can add it back if you like.

Nathan Benson wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> 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
> |
>
> - --
> 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)
>
> iD8DBQFCqKLpDXPcm+lr3ZYRAhTqAJ0eBY4Z8Jndv7Bn509p5pe9ZsY4VgCgpuG5
> +neqFO+KnYQmHs17PvQdaMw=
> =v5oZ
> -----END PGP SIGNATURE-----
>
> -- 
> Fedora-directory-users mailing list
> Fedora-directory-users at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-directory-users

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3312 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/fedora-directory-users/attachments/20050609/e7f8f287/attachment.bin>


More information about the Fedora-directory-users mailing list