Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
fusiondirectory
Commits
c6b0a3fa
Commit
c6b0a3fa
authored
8 years ago
by
Côme Chilliet
Browse files
Options
Download
Patches
Plain Diff
Pulling fusiondirectory-insert-schema from 1.0.19 to avoid diff
parent
88a1919e
dev
6342-update-the-locales-for-1-5
6344-template-issue-when-creating-a-template-with-empty-password-error-message-should-not-be-seen
6365-core-locking-mechanism-is-not-changing-the-mail-ressource-it-does-lock-the-mail-account
6365-core-when-lock-mechanism-is-trigger-the-user-should-not-be-editable-if-not-unlock
6378-orcid-test-method-is-wrong-and-break-orcid-saving
core-php8
master
fusiondirectory-1.5
fusiondirectory-1.4
fusiondirectory-1.3.1
fusiondirectory-1.3
fusiondirectory-1.2.3
fusiondirectory-1.2.2
fusiondirectory-1.2.1
fusiondirectory-1.2
fusiondirectory-1.1.1
fusiondirectory-1.1
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/bin/fusiondirectory-insert-schema
+27
-23
contrib/bin/fusiondirectory-insert-schema
with
27 additions
and
23 deletions
+27
-23
contrib/bin/fusiondirectory-insert-schema
+
27
−
23
View file @
c6b0a3fa
...
@@ -153,18 +153,19 @@ $continue++; # activating continue feature only for insertions
...
@@ -153,18 +153,19 @@ $continue++; # activating continue feature only for insertions
foreach
my
$schema
(
@schemas
)
{
foreach
my
$schema
(
@schemas
)
{
my
$schema_name
=
"";
my
$schema_name
=
"";
my
$ldif_file
;
if
(
$modify
<
2
)
{
if
(
$modify
<
2
)
{
# Searching schema name in ldif file first line.
# Searching schema name in ldif file first line.
open
my
$
file
,
q{<}
,
$path
.
$schema
.
"
.ldif
"
or
die
"
Count not open ldif file : $!
\n
";
open
$ldif_
file
,
q{<}
,
$path
.
$schema
.
"
.ldif
"
or
die
"
Count not open ldif file : $!
\n
";
my
$dn
=
"";
my
$dn
=
"";
while
(
$dn
eq
"")
{
while
(
$dn
eq
"")
{
chomp
(
$dn
=
<
$file
>
);
chomp
(
$dn
=
<
$
ldif_
file
>
);
}
}
if
(
$dn
=~
/^dn: cn=([^,]+),/
)
{
if
(
$dn
=~
/^dn: cn=([^,]+),/
)
{
$schema_name
=
$
1
;
$schema_name
=
$
1
;
}
}
close
(
$file
);
close
(
$
ldif_
file
);
}
}
# Fallback on file name
# Fallback on file name
...
@@ -181,6 +182,9 @@ remove_ldifs();
...
@@ -181,6 +182,9 @@ remove_ldifs();
sub
insert_schema
sub
insert_schema
{
{
my
(
$schema
,
$schema_name
)
=
@_
;
my
(
$schema
,
$schema_name
)
=
@_
;
my
$schema_file
;
my
$update_file
;
my
$empty_file
;
$full_cmd
=
$search_cmd
.
$schema_name
.
"
cn
";
$full_cmd
=
$search_cmd
.
$schema_name
.
"
cn
";
print
("
\n
");
print
("
\n
");
...
@@ -206,18 +210,18 @@ sub insert_schema
...
@@ -206,18 +210,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
$schemafile
,
q{<}
,
$path
.
$schema
.
"
.ldif
")
or
die_with_error
('
Could not open
'
.
"
<
"
.
$path
.
$schema
.
"
.ldif: $!
");
open
(
$schema
_
file
,
q{<}
,
$path
.
$schema
.
"
.ldif
")
or
die_with_error
('
Could not open
'
.
"
<
"
.
$path
.
$schema
.
"
.ldif: $!
");
open
(
my
$updatefile
,
q{>}
,
$path
.
$schema
.
"
_update.ldif
")
or
die_with_error
('
Could not open
'
.
"
>
"
.
$path
.
$schema
.
"
_update.ldif: $!
");
open
(
$update
_
file
,
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
(
<
$schemafile
>
)
{
while
(
<
$schema
_
file
>
)
{
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$/
)
{
$updatefile
->
print
(
"
dn:
$dn_part
,cn=schema,cn=config
\n
"
)
;
print
$update
_
file
"
dn:
$dn_part
,cn=schema,cn=config
\n
";
$updatefile
->
print
(
"
changetype: modify
\n
"
)
;
print
$update
_
file
"
changetype: modify
\n
";
next
;
next
;
}
}
if
(
!
m/^olcAttributeTypes:/
&&
!
m/^olcObjectClasses:/
&&
!
m/^ /
)
{
if
(
!
m/^olcAttributeTypes:/
&&
!
m/^olcObjectClasses:/
&&
!
m/^ /
)
{
...
@@ -231,29 +235,29 @@ sub insert_schema
...
@@ -231,29 +235,29 @@ sub insert_schema
if
(
!
$attrs
&&
m/^olcAttributeTypes:/
)
{
if
(
!
$attrs
&&
m/^olcAttributeTypes:/
)
{
$attrs
=
1
;
$attrs
=
1
;
$updatefile
->
print
(
"
replace: olcAttributeTypes
\n
"
)
;
print
$update
_
file
"
replace: olcAttributeTypes
\n
";
}
}
if
(
!
$classes
&&
m/^olcObjectClasses:/
)
{
if
(
!
$classes
&&
m/^olcObjectClasses:/
)
{
$classes
=
1
;
$classes
=
1
;
$updatefile
->
print
(
"
-
\n
"
)
;
print
$update
_
file
"
-
\n
";
$updatefile
->
print
(
"
replace: olcObjectClasses
\n
"
)
;
print
$update
_
file
"
replace: olcObjectClasses
\n
";
}
}
$updatefile
->
print
(
$_
)
;
print
$update
_
file
$_
;
$updatefile
->
print
(
"
\n
"
)
;
print
$update
_
file
"
\n
";
}
}
$schemafile
->
close
()
;
close
$schema
_
file
;
$updatefile
->
close
()
;
close
$update
_
file
;
}
else
{
# Emptying schema
}
else
{
# Emptying schema
open
(
my
$update
file
,
q{>}
,
$path
.
$schema
.
"
_update.ldif
")
or
die_with_error
('
Could not open
'
.
"
>
"
.
$path
.
$schema
.
"
_update.ldif: $!
");
open
(
$empty_
file
,
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
";
$updatefile
->
print
(
"
dn:
$dn_part
,cn=schema,cn=config
\n
"
)
;
print
$empty_file
"
dn:
$dn_part
,cn=schema,cn=config
\n
";
$updatefile
->
print
(
"
changetype: modify
\n
"
)
;
print
$empty_file
"
changetype: modify
\n
";
$updatefile
->
print
(
"
delete: olcAttributeTypes
\n
"
)
;
print
$empty_file
"
delete: olcAttributeTypes
\n
";
$updatefile
->
print
(
"
-
\n
"
)
;
print
$empty_file
"
-
\n
";
$updatefile
->
print
(
"
delete: olcObjectClasses
\n
"
)
;
print
$empty_file
"
delete: olcObjectClasses
\n
";
$updatefile
->
print
(
"
-
\n
"
)
;
print
$empty_file
"
-
\n
";
$updatefile
->
close
()
;
close
$empty_file
;
}
}
$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
";
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets