pax_global_header00006660000000000000000000000064130760742230014516gustar00rootroot0000000000000052 comment=67b32fc75a3cf5d2e121b19720c713e0600a2eee schema2ldif-1.3/000077500000000000000000000000001307607422300135425ustar00rootroot00000000000000schema2ldif-1.3/Changelog000066400000000000000000000012551307607422300153570ustar00rootroot00000000000000Schema2ldif changelog ========================= * Schema2ldif 1.3 [Feature] Bugs #5478: We should have a generic tool ldap-schema-manager * Schema2ldif 1.2 [Fix] Bugs #4572: update and correct BSD license [Fix] Bugs #4573: refresh the manpage that have a wrong version number [Fix] Bugs #4574: refresh copyright date on schema2ldif * 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.3/LICENSE000066400000000000000000000030711307607422300145500ustar00rootroot00000000000000License: BSD-3-clause Copyright (c) 2013 FusionDirectory project All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: . - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 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. - Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. . THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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.3/bin/000077500000000000000000000000001307607422300143125ustar00rootroot00000000000000schema2ldif-1.3/bin/ldap-schema-manager000077500000000000000000000350251307607422300200330ustar00rootroot00000000000000#!/usr/bin/perl ######################################################################## # # ldap-schema-manager # # Manipulate, insert and update schemas into the ldap server # # This code is part of FusionDirectory (http://www.fusiondirectory.org/) # Copyright (C) 2011-2017 FusionDirectory # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # 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 # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # ######################################################################## use strict; use warnings; use 5.008; my $ldap_host_options = '-Y EXTERNAL -H ldapi:///'; my $defaultpath = "/etc/ldap/schema/"; my $full_cmd = ""; my $schema2ldif = "schema2ldif"; my $listschemas = 0; my $modify = 0; my $schemalist = 0; my $yes_flag = 0; my $pathunset = 1; my $continue = 0; my @schemaargs = (); my @schemas = (); my @gen_files = (); my $delete_ldif = 1; my $toolname = $0; my @defaultschemas = (); my $defaultschemalist = 0; my $path = $defaultpath; foreach my $arg ( @ARGV ) { if (not defined $defaultpath) { # --default-path $defaultpath = $arg; if ($pathunset) { $path = $defaultpath; } else { usage(); } } elsif (not defined $toolname) { # --tool-name $toolname = $arg; } elsif (not defined $ldap_host_options) { # --options $ldap_host_options = $arg; } elsif (lc($arg) eq '--tool-name') { undef $toolname; } elsif (lc($arg) eq '--default-path') { undef $defaultpath; } elsif (lc($arg) eq '--default-schemas') { $defaultschemalist = 1; } elsif ((lc($arg) eq '-i') || (lc($arg) eq '--insert')) { if ($schemalist) { usage(); } $schemalist = 1; } elsif ((lc($arg) eq '-l') || (lc($arg) eq '--list')) { $listschemas = 1; } elsif ((lc($arg) eq '-c') || (lc($arg) eq '--continue')) { $continue = 1; } elsif ((lc($arg) eq '-e') || (lc($arg) eq '--empty')) { if ($schemalist) { usage(); } $modify = 2; $schemalist = 1; } elsif ((lc($arg) eq '-m') || (lc($arg) eq '--modify')) { if ($schemalist) { usage(); } $modify = 1; $schemalist = 1; } elsif ((lc($arg) eq '-o') || (lc($arg) eq '--options')) { undef $ldap_host_options; } elsif ((lc($arg) eq '-n') || (lc($arg) eq '--nodelete')) { $delete_ldif = 0; } elsif ((lc($arg) eq '-y') || (lc($arg) eq '--yes')) { $yes_flag = 1; } elsif ((lc($arg) eq '-h') || (lc($arg) eq '--help')) { usage(); } elsif ($defaultschemalist) { if (lc($arg) eq '--end') { $defaultschemalist = 0; } else { push @defaultschemas, $arg; } } elsif ($schemalist) { push @schemaargs, $arg; } elsif ($pathunset) { $path = $arg; if ($path !~ m|/$|) { # add path prefix if not a path $path = $path."/"; } $pathunset = 0; } else { usage(); } } # if --options is used with no value usage ('Missing options after --options') if (not defined $ldap_host_options); # die if user is not "root" die_with_error ("! You have to run this script as root\n") if ($/dev/null"; my $cnconfig_cmd = $ldapsearch." -b \"cn=config\" cn=config dn 2>/dev/null | grep dn:"; if ($listschemas) { list_schemas(); exit 0; } # die if the path doesn't exists die_with_error ("! $path doesn't seems to exists\n") if (!-e $path); #die if we are not in cn=config my $cnconfig = `$cnconfig_cmd`; if (!($cnconfig =~ m/^dn:\s*cn=config$/)) { die_with_error ("! This tool is only intended to be with with a cn=config backend, cn=config could not be found in the LDAP"); } if (scalar(@schemaargs) == 0) { @schemaargs = @defaultschemas; } foreach my $arg (@schemaargs) { if ($arg !~ m|/|) { # add path prefix if not a path $arg = $path.$arg; } if ($arg =~ /^(.*)\.ldif$/) { # ignore ".ldif" if it is there push @schemas, $1; } elsif ($arg =~ /^(.*)\.schema$/) { if (system("$schema2ldif $arg > $1.ldif") == 0) { push @schemas, $1; push @gen_files, $1; } else { push @gen_files, $1; die_with_error("Something went wrong while trying to convert $arg to ldif\n"); } } else { push @schemas, $arg; } } if (scalar(@schemas) == 0) { usage("Missing schema list\n"); } if ($modify == 2) { unless (ask_yn_question("Are you sure you want to empty schema(s) ".join(", ",@schemas)."?")) { die_with_error("Aborting…\n"); } } $continue++; # activating continue feature only for insertions foreach my $schema (@schemas) { my $schema_name = ""; my $ldif_file; if ($modify < 2) { # Searching schema name in ldif file first line. open $ldif_file, q{<}, $schema.".ldif" or die "Could not open $schema.ldif file : $!\n"; my $dn = ""; while ($dn eq "") { chomp($dn = <$ldif_file>); } if ($dn =~ /^dn: cn=([^,]+),/) { $schema_name = $1; } close($ldif_file); } # Fallback on file name if ($schema_name eq "") { $schema_name = $schema; $schema_name =~ s|^.*/||; } insert_schema($schema, $schema_name); } remove_ldifs(); sub insert_schema { my($schema, $schema_name) = @_; my $schema_file; my $update_file; my $empty_file; $full_cmd = $search_cmd.$schema_name." cn"; print ("\n"); my $search = `$full_cmd`; if ($search !~ /# numEntries: 1/m) { if ($modify) { print "$schema_name does not exists in the LDAP, skipping…\n"; } else { # if the schema doesn't already exists in the LDAP server, adding it $full_cmd = $add_cmd.$schema.".ldif"; print "executing '$full_cmd'\n"; if (system ($full_cmd) != 0) { die_with_error ("Insertion failed!\n"); } } } else { if ($modify) { if ($search !~ m/dn: ([^,]+),cn=schema,cn=config/) { print "Could not parse existing dn for $schema_name, skipping…\n"; return; } my $dn_part = $1; # if the schema already exists in the LDAP server, modify it if ($modify == 1) { open($schema_file, q{<}, $schema.".ldif") or die_with_error('Could not open '."<".$schema.".ldif: $!"); open($update_file, q{>}, $schema."_update.ldif") or die_with_error('Could not open '.">".$schema."_update.ldif: $!"); push @gen_files, $schema."_update"; my $attrs = 0; my $classes = 0; while (<$schema_file>) { next if m/^#/; # remove comments chomp; next if m/^$/; # remove empty lines if (m/^dn: cn=([^,]+),cn=schema,cn=config$/) { print $update_file "dn: $dn_part,cn=schema,cn=config\n"; print $update_file "changetype: modify\n"; next; } if (!m/^olcAttributeTypes:/ && !m/^olcObjectClasses:/ && !m/^ /) { #skip cn, objectClass, … next; } if (!$attrs && $classes) { die "Malformed schema\n"; } if (!$attrs && m/^olcAttributeTypes:/) { $attrs = 1; print $update_file "replace: olcAttributeTypes\n"; } if (!$classes && m/^olcObjectClasses:/) { $classes = 1; print $update_file "-\n"; print $update_file "replace: olcObjectClasses\n"; } print $update_file $_; print $update_file "\n"; } close $schema_file; close $update_file; } else { # Emptying schema open($empty_file, q{>}, $schema."_update.ldif") or die_with_error('Could not open '.">".$schema."_update.ldif: $!"); push @gen_files, $schema."_update"; print $empty_file "dn: $dn_part,cn=schema,cn=config\n"; print $empty_file "changetype: modify\n"; print $empty_file "delete: olcAttributeTypes\n"; print $empty_file "-\n"; print $empty_file "delete: olcObjectClasses\n"; print $empty_file "-\n"; close $empty_file; } $full_cmd = $mod_cmd.$schema."_update.ldif"; print "executing '$full_cmd'\n"; if (system ($full_cmd) != 0) { die_with_error ("Insertion failed!\n"); } } else { print "$schema_name already exists in the LDAP, skipping…\n"; } } } sub remove_ldifs { if ($delete_ldif) { foreach my $file (@gen_files) { unlink "$file.ldif" or print "Could not delete $file.ldif\n"; } } } sub die_with_error { my ($error) = @_; if ($continue == 2) { print "Error: $error\nContinuing…\n"; } else { remove_ldifs(); die $error; } } sub list_schemas { my @schemas = `$list_cmd`; foreach my $schema (@schemas) { if ($schema =~ m/cn:\s*{[0-9]+}(.*)$/) { print "$1\n"; } } } # ask a question send as parameter, and return true if the answer is "yes" sub ask_yn_question { return 1 if ($yes_flag); my ($question) = @_; print ( "$question [Yes/No]?\n" ); while ( my $input = ) { # remove the \n at the end of $input chomp $input; # if user's answer is "yes" if ( lc($input) eq "yes" || lc($input) eq "y") { return 1; # else if he answer "no" } elsif ( lc($input) eq "no" || lc($input) eq "n") { return 0; } } } sub usage { (@_) && print STDERR "\n@_\n\n"; print STDERR << "EOF"; usage: $toolname [-y] [-n] [-c] [-o options] [path] [-h|-l|-i schema1 schema2|-m schema1 schema2|-e schema1 schema2] -h, --help : this (help) message path : where to find the schemas -i, --insert : specify the schemas to insert -l, --list : list inserted schemas -m, --modify : modify exising inserted schemas -e, --empty : empty exising inserted schemas (do not remove them) -n, --nodelete : do not delete generated ldifs at the end -o, --options : set ldap options used (default is -Y EXTERNAL -H ldapi:///) -c, --continue : continue on error(s) -y, --yes : answer yes to all questions Default path is $defaultpath EOF if (scalar(@defaultschemas) > 0) { print STDERR " If -i, -m or -e is used but no schemas are given, this list is used instead: ".join(', ',@defaultschemas)."\n"; } print STDERR "\n"; exit -1; } exit 0; =head1 NAME ldap-schema-manager - manage schema to be inserted into in openldap server in cn=config mode =head1 SYNOPSIS ldap-schema-manager [-y] [-n] [-c] [-o options] [path] [-h|-l|-i schema1 schema2|-m schema1 schema2|-e schema1 schema2] =head1 DESCRIPTION This program will list, insert, empty or modify the ldap schemas into the ldap server. If a schema is not listed as a path, it will be searched for in the provided path, or in /etc/ldap/schema/ if no path has been provided. To insert schemas from working directory prepend them with "./". Schema with no extension is assumed to be .ldif. Specify .schema if you want the tool to autoconvert the schema to ldif file. See the examples for more information =head2 Options =over 6 =item -i This option insert the given list of schemas =item -m This option insert the given list of schemas, replacing already inserted versions of those schemas =item -e This option empty the given list of schemas, removing attributes and objectClasses from those. This is useful because you cannot delete a schema without restarting slapd. =item -l This option list inserted schemas =item -n This option will make generated ldifs file to not be deleted after execution. Might be useful to understand errors. =item -c This option make the program continue even if an error occur =item -y This option answer yes to all questions. The only question right now is the confirmation one when you ask to empty a schema. =item -o This option allow you to specify specifics options to give to ldap commands such as ldapmodify, but beware that you will not be able to see things like password prompts as the output of these commands is piped. =back =head2 Special options =over 6 =item --tool-name This option allows you to set the binary name to use in usage output, only useful if you wish to create a tool based upon ldap-schema-manager. =item --default-path This option defines the default path, which is otherwise /etc/ldap/schema/ =item --default-schemas This option specifies the default list of schemas to use in case no schema list is given. Only useful if you create a tool based upon this one. The list needs to end with "--end". =back =head1 EXAMPLES admin@ldapserver$ ldap-schema-manager -i /etc/ldap/otherschema/myschema.ldif Insert the schema /etc/ldap/otherschema/myschema.ldif admin@ldapserver$ ldap-schema-manager -i /etc/ldap/otherschema/myschema.schema Convert /etc/ldap/otherschema/myschema.schema to ldif and insert it admin@ldapserver$ ldap-schema-manager -i myschema Insert the schema myschema.ldif from default directory (/etc/ldap/schema/) admin@ldapserver$ ldap-schema-manager -i myschema.schema Insert the schema myschema.schema from default directory (/etc/ldap/schema/) admin@ldapserver$ ldap-schema-manager -m /etc/ldap/otherschema/myschema.schema Convert /etc/ldap/otherschema/myschema.schema to ldif and replace the existing schema by this one admin@ldapserver$ ldap-schema-manager -e myschema Empty the schema myschema admin@ldapserver$ ldap-schema-manager -o "-H ldap://my.ldap.com -ZZ -D 'cn=admin,cn=config' -w password -x" -l Connect to another ldap server and list schemas =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 This code is part of FusionDirectory =over 1 =item Copyright (C) 2011-2017 FusionDirectory Project =back 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 GNU General Public License for more details. =cut schema2ldif-1.3/bin/schema2ldif000077500000000000000000000066221307607422300164270ustar00rootroot00000000000000#!/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-2017 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.3/man/000077500000000000000000000000001307607422300143155ustar00rootroot00000000000000schema2ldif-1.3/man/ldap-schema-manager.1000066400000000000000000000203521307607422300201670ustar00rootroot00000000000000.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" 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" '' . ds C` . ds C' '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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "LDAP-SCHEMA-MANAGER 1" .TH LDAP-SCHEMA-MANAGER 1 "2017-04-19" "Schema2ldif 1.3" "Schema2ldif Documentation" .\" 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" ldap\-schema\-manager \- manage schema to be inserted into in openldap server in cn=config mode .SH "SYNOPSIS" .IX Header "SYNOPSIS" ldap-schema-manager [\-y] [\-n] [\-c] [\-o options] [path] [\-h|\-l|\-i schema1 schema2|\-m schema1 schema2|\-e schema1 schema2] .SH "DESCRIPTION" .IX Header "DESCRIPTION" This program will list, insert, empty or modify the ldap schemas into an openldap server in cn=config mode. If a schema is not listed as a path, it will be searched for in the provided path, or in /etc/ldap/schema/ if no path has been provided. To insert schemas from working directory prepend them with \*(L"./\*(R". Schema with no extension is assumed to be .ldif. Specify .schema if you want the tool to autoconvert the schema to ldif file. See the examples for more information .SS "Options" .IX Subsection "Options" .IP "\-i" 6 .IX Item "-i" This option insert the given list of schemas .IP "\-m" 6 .IX Item "-m" This option insert the given list of schemas, replacing already inserted versions of those schemas .IP "\-e" 6 .IX Item "-e" This option empty the given list of schemas, removing attributes and objectClasses from those. This is useful because you cannot delete a schema without restarting slapd. .IP "\-l" 6 .IX Item "-l" This option list inserted schemas .IP "\-n" 6 .IX Item "-n" This option will make generated ldifs file to not be deleted after execution. Might be useful to understand errors. .IP "\-c" 6 .IX Item "-c" This option make the program continue even if an error occur .IP "\-y" 6 .IX Item "-y" This option answer yes to all questions. The only question right now is the confirmation one when you ask to empty a schema. .IP "\-o" 6 .IX Item "-o" This option allow you to specify specifics options to give to ldap commands such as ldapmodify, but beware that you will not be able to see things like password prompts as the output of these commands is piped. .SS "Special options" .IX Subsection "Special options" .IP "\-\-tool\-name" 6 .IX Item "--tool-name" This option allows you to set the binary name to use in usage output, only useful if you wish to create a tool based upon ldap-schema-manager. .IP "\-\-default\-path" 6 .IX Item "--default-path" This option defines the default path, which is otherwise /etc/ldap/schema/ .IP "\-\-default\-schemas" 6 .IX Item "--default-schemas" This option specifies the default list of schemas to use in case no schema list is given. Only useful if you create a tool based upon this one. The list needs to end with \*(L"\-\-end\*(R". .SH "EXAMPLES" .IX Header "EXAMPLES" .Vb 2 \& admin@ldapserver$ ldap\-schema\-manager \-i /etc/ldap/otherschema/myschema.ldif \& Insert the schema /etc/ldap/otherschema/myschema.ldif \& \& admin@ldapserver$ ldap\-schema\-manager \-i /etc/ldap/otherschema/myschema.schema \& Convert /etc/ldap/otherschema/myschema.schema to ldif and insert it \& \& admin@ldapserver$ ldap\-schema\-manager \-i myschema \& Insert the schema myschema.ldif from default directory (/etc/ldap/schema/) \& \& admin@ldapserver$ ldap\-schema\-manager \-i myschema.schema \& Insert the schema myschema.schema from default directory (/etc/ldap/schema/) \& \& admin@ldapserver$ ldap\-schema\-manager \-m /etc/ldap/otherschema/myschema.schema \& Convert /etc/ldap/otherschema/myschema.schema to ldif and replace the existing schema by this one \& \& admin@ldapserver$ ldap\-schema\-manager \-e myschema \& Empty the schema myschema \& \& admin@ldapserver$ ldap\-schema\-manager \-o "\-H ldap://my.ldap.com \-ZZ \-D \*(Aqcn=admin,cn=config\*(Aq \-w password \-x" \-l \& Connect to another ldap server and list schemas .Ve .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" This code is part of FusionDirectory .IP "Copyright (C) 2011\-2017 FusionDirectory Project" 1 .IX Item "Copyright (C) 2011-2017 FusionDirectory Project" .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE. \s0 See the \&\s-1GNU\s0 General Public License for more details. schema2ldif-1.3/man/schema2ldif.1000066400000000000000000000130531307607422300165620ustar00rootroot00000000000000.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" 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" '' . ds C` . ds C' '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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "2017-04-19" "Schema2ldif 1.3" "Schema2ldif Documentation" .\" 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\-2017 FusionDirectory project" 2 .IX Item "Copyright (C) 2013-2017 FusionDirectory project" .PP License \s-1BSD\s0 .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE. \s0 See the \s-1LICENSE\s0 file for more details.