Commit 88a1919e authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes bugs introduced by latest sonar fixes

Showing with 20 additions and 21 deletions
+20 -21
...@@ -206,18 +206,18 @@ sub insert_schema ...@@ -206,18 +206,18 @@ sub insert_schema
my $dn_part = $1; my $dn_part = $1;
# if the schema already exists in the LDAP server, modify it # if the schema already exists in the LDAP server, modify it
if ($modify == 1) { if ($modify == 1) {
open(my $schema, q{<}, $path.$schema.".ldif") or die_with_error('Could not open '."<".$path.$schema.".ldif: $!"); open(my $schemafile, q{<}, $path.$schema.".ldif") or die_with_error('Could not open '."<".$path.$schema.".ldif: $!");
open(my $update, q{>}, $path.$schema."_update.ldif") or die_with_error('Could not open '.">".$path.$schema."_update.ldif: $!"); open(my $updatefile, q{>}, $path.$schema."_update.ldif") or die_with_error('Could not open '.">".$path.$schema."_update.ldif: $!");
push @gen_files, $path.$schema."_update"; push @gen_files, $path.$schema."_update";
my $attrs = 0; my $attrs = 0;
my $classes = 0; my $classes = 0;
while (<$schema>) { while (<$schemafile>) {
next if m/^#/; # remove comments next if m/^#/; # remove comments
chomp; chomp;
next if m/^$/; # remove empty lines next if m/^$/; # remove empty lines
if (m/^dn: cn=([^,]+),cn=schema,cn=config$/) { if (m/^dn: cn=([^,]+),cn=schema,cn=config$/) {
print $update "dn: $dn_part,cn=schema,cn=config\n"; $updatefile->print("dn: $dn_part,cn=schema,cn=config\n");
print $update "changetype: modify\n"; $updatefile->print("changetype: modify\n");
next; next;
} }
if (!m/^olcAttributeTypes:/ && !m/^olcObjectClasses:/ && !m/^ /) { if (!m/^olcAttributeTypes:/ && !m/^olcObjectClasses:/ && !m/^ /) {
...@@ -231,29 +231,29 @@ sub insert_schema ...@@ -231,29 +231,29 @@ sub insert_schema
if (!$attrs && m/^olcAttributeTypes:/) { if (!$attrs && m/^olcAttributeTypes:/) {
$attrs = 1; $attrs = 1;
print $update "replace: olcAttributeTypes\n"; $updatefile->print("replace: olcAttributeTypes\n");
} }
if (!$classes && m/^olcObjectClasses:/) { if (!$classes && m/^olcObjectClasses:/) {
$classes = 1; $classes = 1;
print $update "-\n"; $updatefile->print("-\n");
print $update "replace: olcObjectClasses\n"; $updatefile->print("replace: olcObjectClasses\n");
} }
print $update; $updatefile->print($_);
print $update "\n"; $updatefile->print("\n");
} }
close $schema; $schemafile->close();
close $update; $updatefile->close();
} else { # Emptying schema } else { # Emptying schema
open(my $update, q{>}, $path.$schema."_update.ldif") or die_with_error('Could not open '.">".$path.$schema."_update.ldif: $!"); open(my $updatefile, q{>}, $path.$schema."_update.ldif") or die_with_error('Could not open '.">".$path.$schema."_update.ldif: $!");
push @gen_files, $path.$schema."_update"; push @gen_files, $path.$schema."_update";
print $update "dn: $dn_part,cn=schema,cn=config\n"; $updatefile->print("dn: $dn_part,cn=schema,cn=config\n");
print $update "changetype: modify\n"; $updatefile->print("changetype: modify\n");
print $update "delete: olcAttributeTypes\n"; $updatefile->print("delete: olcAttributeTypes\n");
print $update "-\n"; $updatefile->print("-\n");
print $update "delete: olcObjectClasses\n"; $updatefile->print("delete: olcObjectClasses\n");
print $update "-\n"; $updatefile->print("-\n");
close $update; $updatefile->close();
} }
$full_cmd = $mod_cmd.$path.$schema."_update.ldif"; $full_cmd = $mod_cmd.$path.$schema."_update.ldif";
print "executing '$full_cmd'\n"; print "executing '$full_cmd'\n";
......
...@@ -108,4 +108,3 @@ objectclass ( 1.3.6.1.4.1.10098.1.2.1.19.19 NAME 'gosaSnapshotObject' ...@@ -108,4 +108,3 @@ objectclass ( 1.3.6.1.4.1.10098.1.2.1.19.19 NAME 'gosaSnapshotObject'
objectclass ( 1.3.6.1.4.1.38414.62.2.1 NAME 'fdLockEntry' SUP top STRUCTURAL objectclass ( 1.3.6.1.4.1.38414.62.2.1 NAME 'fdLockEntry' SUP top STRUCTURAL
DESC 'GOsa - Class for FD locking' DESC 'GOsa - Class for FD locking'
MUST ( fdUserDn $ fdObjectDn $ cn $ fdLockTimestamp )) MUST ( fdUserDn $ fdObjectDn $ cn $ fdLockTimestamp ))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment