pax_global_header00006660000000000000000000000064123555466720014531gustar00rootroot0000000000000052 comment=e0ca4ec2b40f2b121255ef987fd6b2abf4011704 schema2ldif-1.1/000077500000000000000000000000001235554667200135535ustar00rootroot00000000000000schema2ldif-1.1/Changelog000066400000000000000000000006151235554667200153670ustar00rootroot00000000000000Schema2ldif changelog ========================= * Schema2ldif 1.1 [Fix] Bugs #2831: create a changelog for schema2ldif * Schema2ldif 1.0 [Fix] Bugs #2282: cn inside schema conversion should not have .schema behind schema name [Fix] Bugs #2337: nova_openldap schema failed insertion [Fix] Bugs #2368: Doesn't work for schac.schema [Fix] Wishlist #2283: A license should be chosen for the tool schema2ldif-1.1/LICENSE000066400000000000000000000026161235554667200145650ustar00rootroot00000000000000License: BSD Copyright: 2013 FusionDirectory project Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. schema2ldif-1.1/README000066400000000000000000000040041235554667200144310ustar00rootroot00000000000000This is a tool for converting .schema file to .ldif file, in order to use cn=config backend instead of slapd.conf It's easy to use: schema2ldif < myschema.schema > myschema.ldif It was orignally written by OpenSides for FusionDirectory. It's written in perl. It follows these directions found in schema/openldap.ldif : # This openldap.ldif file is provided as a demonstration of how to # convert a *.schema file into *.ldif format. The key points: # In LDIF, a blank line terminates an entry. Blank lines in a *.schema # file should be replaced with a single '#' to turn them into # comments, or they should just be removed. # In addition to the actual schema directives, the file needs a small # header to make it a valid LDAP entry. This header must provide the # dn of the entry, the objectClass, and the cn, as shown here: # dn: cn=openldap,cn=schema,cn=config objectClass: olcSchemaConfig cn: openldap # # The schema directives need to be changed to LDAP Attributes. # First a basic string substitution can be done on each of the keywords: # objectIdentifier -> olcObjectIdentifier: # objectClass -> olcObjectClasses: # attributeType -> olcAttributeTypes: # Then leading whitespace must be fixed. The slapd.conf format allows # tabs or spaces to denote line continuation, while LDIF only allows # the space character. # Also slapd.conf preserves the continuation character, while LDIF strips # it out. So a single TAB/SPACE in slapd.conf must be replaced with # two SPACEs in LDIF, otherwise the continued text may get joined as # a single word. # The directives must be listed in a proper sequence: # All olcObjectIdentifiers must be first, so they may be referenced by # any following definitions. # All olcAttributeTypes must be next, so they may be referenced by any # following objectClass definitions. # All olcObjectClasses must be after the olcAttributeTypes. # And of course, any superior must occur before anything that inherits # from it. schema2ldif-1.1/bin/000077500000000000000000000000001235554667200143235ustar00rootroot00000000000000schema2ldif-1.1/bin/schema2ldif000077500000000000000000000066151235554667200164420ustar00rootroot00000000000000#!/usr/bin/perl # # schema2ldif: Tool for converting OpenLDAP-style schemas to the LDIF format # See pod documentation at the end of the file # use strict; use warnings; use 5.008; use Getopt::Long; use Pod::Usage; my $cn = "" ; my $branch = "cn=schema,cn=config"; my $help = 0; # Process command-line GetOptions( 'help|?' => \$help, 'cn=s' => \$cn, 'branch=s' => \$branch, ) or pod2usage(2); pod2usage(1) if $help; if ($cn eq '') { if (@ARGV <= 0) { pod2usage(2); } $cn = $ARGV[0]; die "Error: $cn is not a file\n" unless -f $cn; $cn =~ s|^(.*/)?([^/]+)\.[^.]+$|$2|; } # [openldap.ldif] # In addition to the actual schema directives, the file needs a small # header to make it a valid LDAP entry. This header must provide the # dn of the entry, the objectClass, and the cn, as shown here: print "dn: cn=$cn,$branch\n"; print "objectClass: olcSchemaConfig\n"; print "cn: $cn\n"; # Reading the input schema file in loop # processing definitions while (<>) { # Comments if (/^\s*#/) { # Pass the comments to output file print; next; } chomp; # [openldap.ldif] # In LDIF, a blank line terminates an entry. Blank lines in a *.schema # file should be replaced with a single '#' to turn them into # comments, or they should just be removed. next if m/^$/; # [openldap.ldif] # First a basic string substitution can be done on each of the keywords: # objectIdentifier -> olcObjectIdentifier: # objectClass -> olcObjectClasses: # attributeType -> olcAttributeTypes: s/^objectidentifier/olcObjectIdentifier:/i; s/^attributetype/olcAttributeTypes:/i; s/^objectclass/olcObjectClasses:/i; # [openldap.ldif] # Then leading whitespace must be fixed. The slapd.conf format allows # tabs or spaces to denote line continuation, while LDIF only allows # the space character. # Also slapd.conf preserves the continuation character, while LDIF strips # it out. So a single TAB/SPACE in slapd.conf must be replaced with # two SPACEs in LDIF, otherwise the continued text may get joined as # a single word. s/^\s+/ /; print; print "\n"; } __END__ =head1 NAME schema2ldif - Tool for converting OpenLDAP-style schemas to the LDIF format =head1 SYNOPSIS B [I] [I] > file.ldif =head1 DESCRIPTION B will read the given input file and convert it to an LDIF file that you can insert into your LDAP directory. If B is not provided, will read from standard input. In this case, cn option is mandatory. Otherwise, the name of the file (without extension) will be used as cn. =head1 OPTIONS =over 8 =item B<-h>, B<--help> Print a brief help message and exits. =item B<-c>, B<--cn>=I Use CN as cn for the schema (mandatory if no file provided) =item B<-b>, B<--branch>=I Use BRANCH instead of cn=schema,cn=config =back =head1 BUGS Please report any bugs, or post any suggestions, to the fusiondirectory mailing list fusiondirectory-users or to =head1 AUTHOR Come Bernigaud =head1 LICENCE AND COPYRIGHT =over 2 =item Copyright (C) 2013 FusionDirectory project =back License BSD This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file for more details. =cut schema2ldif-1.1/man/000077500000000000000000000000001235554667200143265ustar00rootroot00000000000000schema2ldif-1.1/man/schema2ldif.1000066400000000000000000000125441235554667200165770ustar00rootroot00000000000000.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "SCHEMA2LDIF 1" .TH SCHEMA2LDIF 1 "2013-04-17" "Schema2ldif 0.1" "Schema2ldif" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" schema2ldif \- Tool for converting OpenLDAP\-style schemas to the LDIF format .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBschema2ldif\fR [\fIoptions\fR] [\fI\s-1FILE\s0\fR] > file.ldif .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBschema2ldif\fR will read the given input file and convert it to an \s-1LDIF\s0 file that you can insert into your \s-1LDAP\s0 directory. If \fB\s-1FILE\s0\fR is not provided, will read from standard input. In this case, cn option is mandatory. Otherwise, the name of the file (without extension) will be used as cn. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-h\fR, \fB\-\-help\fR" 8 .IX Item "-h, --help" Print a brief help message and exits. .IP "\fB\-c\fR, \fB\-\-cn\fR=\fI\s-1CN\s0\fR" 8 .IX Item "-c, --cn=CN" Use \s-1CN\s0 as cn for the schema (mandatory if no file provided) .IP "\fB\-b\fR, \fB\-\-branch\fR=\fI\s-1BRANCH\s0\fR" 8 .IX Item "-b, --branch=BRANCH" Use \s-1BRANCH\s0 instead of cn=schema,cn=config .SH "BUGS" .IX Header "BUGS" Please report any bugs, or post any suggestions, to the fusiondirectory mailing list fusiondirectory-users or to .SH "AUTHOR" .IX Header "AUTHOR" Come Bernigaud .SH "LICENCE AND COPYRIGHT" .IX Header "LICENCE AND COPYRIGHT" .IP "Copyright (C) 2013 FusionDirectory project" 2 .IX Item "Copyright (C) 2013 FusionDirectory project" .PP License \s-1BSD\s0 .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the \s-1LICENSE\s0 file for more details.