mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
need a regular file (ITS#3865)
This commit is contained in:
parent
ae385b3af0
commit
395207029b
@ -34,6 +34,10 @@
|
||||
#include <ac/socket.h>
|
||||
#include <ac/errno.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "slap.h"
|
||||
#ifdef LDAP_SLAPI
|
||||
#include "slapi/slapi.h"
|
||||
@ -549,6 +553,7 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
|
||||
ConfigTable *ct;
|
||||
ConfigArgs *c;
|
||||
int rc;
|
||||
struct stat s;
|
||||
|
||||
c = ch_calloc( 1, sizeof( ConfigArgs ) );
|
||||
if ( c == NULL ) {
|
||||
@ -567,6 +572,22 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
|
||||
c->fname = fname;
|
||||
init_config_argv( c );
|
||||
|
||||
if ( stat( fname, &s ) != 0 ) {
|
||||
ldap_syslog = 1;
|
||||
Debug(LDAP_DEBUG_ANY,
|
||||
"could not stat config file \"%s\": %s (%d)\n",
|
||||
fname, strerror(errno), errno);
|
||||
return(1);
|
||||
}
|
||||
|
||||
if ( !S_ISREG( s.st_mode ) ) {
|
||||
ldap_syslog = 1;
|
||||
Debug(LDAP_DEBUG_ANY,
|
||||
"regular file expected, got \"%s\"\n",
|
||||
fname, 0, 0 );
|
||||
return(1);
|
||||
}
|
||||
|
||||
fp = fopen( fname, "r" );
|
||||
if ( fp == NULL ) {
|
||||
ldap_syslog = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user