diff options
Diffstat (limited to 'ldap/admin/src/scripts')
| -rw-r--r-- | ldap/admin/src/scripts/DSCreate.pm.in | 18 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/Inf.pm | 25 | ||||
| -rw-r--r-- | ldap/admin/src/scripts/Setup.pm.in | 18 |
3 files changed, 58 insertions, 3 deletions
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in b/ldap/admin/src/scripts/DSCreate.pm.in index 2557f398..0c43f727 100644 --- a/ldap/admin/src/scripts/DSCreate.pm.in +++ b/ldap/admin/src/scripts/DSCreate.pm.in @@ -306,6 +306,15 @@ sub createConfigFile { push @ldiffiles, "$inf->{General}->{prefix}@templatedir@/template-dnaplugin.ldif"; } + # additional configuration LDIF files + if (exists($inf->{slapd}->{ConfigFile})) { + if (ref($inf->{slapd}->{ConfigFile})) { + push @ldiffiles, @{$inf->{slapd}->{ConfigFile}}; + } else { + push @ldiffiles, $inf->{slapd}->{ConfigFile}; + } + } + getMappedEntries($mapper, \@ldiffiles, \@errs, \&check_and_add_entry, [$conn]); @@ -407,6 +416,15 @@ sub installSchema { } else { push @schemafiles, "$inf->{General}->{prefix}@schemadir@/00core.ldif"; } + + # additional schema files + if (exists($inf->{slapd}->{SchemaFile})) { + if (ref($inf->{slapd}->{SchemaFile})) { + push @schemafiles, @{$inf->{slapd}->{SchemaFile}}; + } else { + push @schemafiles, $inf->{slapd}->{SchemaFile}; + } + } for (@schemafiles) { my $src = $_; my $basename = basename($src); diff --git a/ldap/admin/src/scripts/Inf.pm b/ldap/admin/src/scripts/Inf.pm index 347404aa..4d413630 100644 --- a/ldap/admin/src/scripts/Inf.pm +++ b/ldap/admin/src/scripts/Inf.pm @@ -77,6 +77,7 @@ sub read { my $incontinuation = 0; my $curkey; + my $curval; my $inffh; if ($filename eq "-") { $inffh = \*STDIN; @@ -100,12 +101,32 @@ sub read { $iscontinuation = 1; } if ($incontinuation) { - $self->{$curSection}->{$curkey} .= "\n" . $_; # add line in entirety to current value + if ($curval) { + $self->{$curSection}->{$curkey}->[$curval] .= "\n" . $_; # add line in entirety to current value + } else { + $self->{$curSection}->{$curkey} .= "\n" . $_; # add line in entirety to current value + } } elsif (/^\[(.*?)\]/) { # e.g. [General] $curSection = $1; + $iscontinuation = 0; # disallow section continuations } elsif (/^\s*(.*?)\s*=\s*(.*?)\s*$/) { # key = value $curkey = $1; - $self->{$curSection}->{$curkey} = $2; + # a single value is just a single scalar + # multiple values are represented by an array ref + if (exists($self->{$curSection}->{$curkey})) { + if (!ref($self->{$curSection}->{$curkey})) { + # convert single scalar to array ref + my $ary = [$self->{$curSection}->{$curkey}]; + $self->{$curSection}->{$curkey} = $ary; + } + # just push the new value + push @{$self->{$curSection}->{$curkey}}, $2; + $curval = @{$self->{$curSection}->{$curkey}} - 1; # curval is index of last item + } else { + # single value + $self->{$curSection}->{$curkey} = $2; + $curval = 0; # only 1 value + } } if ($iscontinuation) { # if line ends with a backslash, continue the data on the next line $incontinuation = 1; diff --git a/ldap/admin/src/scripts/Setup.pm.in b/ldap/admin/src/scripts/Setup.pm.in index 512b5aa9..645b0a89 100644 --- a/ldap/admin/src/scripts/Setup.pm.in +++ b/ldap/admin/src/scripts/Setup.pm.in @@ -161,7 +161,23 @@ sub init { # allows the reuse of .inf files with some parameters overridden for (@ARGV) { if (/^([\w_-]+)\.([\w_-]+)=(.*)$/) { # e.g. section.param=value - $self->{inf}->{$1}->{$2} = $3; + my $sec = $1; + my $parm = $2; + my $val = $3; + # a single value is just a single scalar + # multiple values are represented by an array ref + if (exists($self->{inf}->{$sec}->{$parm})) { + if (!ref($self->{inf}->{$sec}->{$parm})) { + # convert single scalar to array ref + my $ary = [$self->{inf}->{$sec}->{$parm}]; + $self->{inf}->{$sec}->{$parm} = $ary; + } + # just push the new value + push @{$self->{inf}->{$sec}->{$parm}}, $val; + } else { + # single value + $self->{inf}->{$sec}->{$parm} = $val; + } } else { # error print STDERR "Error: unknown command line option $_\n"; usage(); |
