Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
orbea -
OpenLDAP
Commits
3c12993f
Commit
3c12993f
authored
Mar 17, 2021
by
Ondřej Kuzník
Committed by
Quanah Gibson-Mount
Mar 18, 2021
Browse files
ITS#9016 Check confdir is empty before generating from scratch
parent
d28a933b
Changes
1
Hide whitespace changes
Inline
Side-by-side
servers/slapd/bconfig.c
View file @
3c12993f
...
...
@@ -23,6 +23,7 @@
#include
<stdio.h>
#include
<ac/string.h>
#include
<ac/ctype.h>
#include
<ac/dirent.h>
#include
<ac/errno.h>
#include
<sys/stat.h>
#include
<ac/unistd.h>
...
...
@@ -4520,6 +4521,21 @@ config_setup_ldif( BackendDB *be, const char *dir, int readit ) {
rc
=
op
->
o_bd
->
be_add
(
op
,
&
rs
);
}
ldap_pvt_thread_pool_context_reset
(
thrctx
);
}
else
{
/* ITS#9016 Check directory is empty (except perhaps hidden files) */
DIR
*
dir_of_path
;
struct
dirent
*
entry
;
dir_of_path
=
opendir
(
dir
);
while
(
(
entry
=
readdir
(
dir_of_path
))
!=
NULL
)
{
if
(
entry
->
d_name
[
0
]
!=
'.'
)
{
Debug
(
LDAP_DEBUG_ANY
,
"config_setup_ldif: "
"expected directory %s to be empty!
\n
"
,
dir
);
rc
=
LDAP_ALREADY_EXISTS
;
break
;
}
}
}
/* ITS#4194 - only use if it's present, or we're converting. */
...
...
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!
Cancel
Please
register
or
sign in
to comment