Commit 3c12993f authored by Ondřej Kuzník's avatar Ondřej Kuzník Committed by Quanah Gibson-Mount
Browse files

ITS#9016 Check confdir is empty before generating from scratch

parent d28a933b
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <stdio.h> #include <stdio.h>
#include <ac/string.h> #include <ac/string.h>
#include <ac/ctype.h> #include <ac/ctype.h>
#include <ac/dirent.h>
#include <ac/errno.h> #include <ac/errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <ac/unistd.h> #include <ac/unistd.h>
...@@ -4520,6 +4521,21 @@ config_setup_ldif( BackendDB *be, const char *dir, int readit ) { ...@@ -4520,6 +4521,21 @@ config_setup_ldif( BackendDB *be, const char *dir, int readit ) {
rc = op->o_bd->be_add( op, &rs ); rc = op->o_bd->be_add( op, &rs );
} }
ldap_pvt_thread_pool_context_reset( thrctx ); 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. */ /* ITS#4194 - only use if it's present, or we're converting. */
......
Markdown is supported
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