mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +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/socket.h>
|
||||||
#include <ac/errno.h>
|
#include <ac/errno.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "slap.h"
|
#include "slap.h"
|
||||||
#ifdef LDAP_SLAPI
|
#ifdef LDAP_SLAPI
|
||||||
#include "slapi/slapi.h"
|
#include "slapi/slapi.h"
|
||||||
@ -549,6 +553,7 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
|
|||||||
ConfigTable *ct;
|
ConfigTable *ct;
|
||||||
ConfigArgs *c;
|
ConfigArgs *c;
|
||||||
int rc;
|
int rc;
|
||||||
|
struct stat s;
|
||||||
|
|
||||||
c = ch_calloc( 1, sizeof( ConfigArgs ) );
|
c = ch_calloc( 1, sizeof( ConfigArgs ) );
|
||||||
if ( c == NULL ) {
|
if ( c == NULL ) {
|
||||||
@ -567,6 +572,22 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
|
|||||||
c->fname = fname;
|
c->fname = fname;
|
||||||
init_config_argv( c );
|
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" );
|
fp = fopen( fname, "r" );
|
||||||
if ( fp == NULL ) {
|
if ( fp == NULL ) {
|
||||||
ldap_syslog = 1;
|
ldap_syslog = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user