#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"
ConfigTable *ct;
ConfigArgs *c;
int rc;
+ struct stat s;
c = ch_calloc( 1, sizeof( ConfigArgs ) );
if ( c == NULL ) {
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;