mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-22 23:59:34 -05:00
ITS#5276 don't stack config state for includes
This commit is contained in:
parent
d84eb76d57
commit
e9ab15ba87
1 changed files with 18 additions and 20 deletions
|
|
@ -660,29 +660,23 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
|
||||||
int rc;
|
int rc;
|
||||||
struct stat s;
|
struct stat s;
|
||||||
|
|
||||||
c = ch_calloc( 1, sizeof( ConfigArgs ) );
|
if ( cf ) {
|
||||||
if ( c == NULL ) {
|
c = cf;
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( depth ) {
|
|
||||||
memcpy( c, cf, sizeof( ConfigArgs ) );
|
|
||||||
} else {
|
} else {
|
||||||
c->depth = depth; /* XXX */
|
c = ch_calloc( 1, sizeof( ConfigArgs ) );
|
||||||
c->bi = NULL;
|
|
||||||
c->be = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
c->valx = -1;
|
c->valx = -1;
|
||||||
c->fname = fname;
|
c->fname = fname;
|
||||||
init_config_argv( c );
|
init_config_argv( c );
|
||||||
|
}
|
||||||
|
|
||||||
if ( stat( fname, &s ) != 0 ) {
|
if ( stat( fname, &s ) != 0 ) {
|
||||||
ldap_syslog = 1;
|
ldap_syslog = 1;
|
||||||
Debug(LDAP_DEBUG_ANY,
|
Debug(LDAP_DEBUG_ANY,
|
||||||
"could not stat config file \"%s\": %s (%d)\n",
|
"could not stat config file \"%s\": %s (%d)\n",
|
||||||
fname, strerror(errno), errno);
|
fname, strerror(errno), errno);
|
||||||
ch_free( c );
|
if ( !cf )
|
||||||
|
ch_free( c );
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -691,7 +685,8 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
|
||||||
Debug(LDAP_DEBUG_ANY,
|
Debug(LDAP_DEBUG_ANY,
|
||||||
"regular file expected, got \"%s\"\n",
|
"regular file expected, got \"%s\"\n",
|
||||||
fname, 0, 0 );
|
fname, 0, 0 );
|
||||||
ch_free( c );
|
if ( !cf )
|
||||||
|
ch_free( c );
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -701,7 +696,8 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
|
||||||
Debug(LDAP_DEBUG_ANY,
|
Debug(LDAP_DEBUG_ANY,
|
||||||
"could not open config file \"%s\": %s (%d)\n",
|
"could not open config file \"%s\": %s (%d)\n",
|
||||||
fname, strerror(errno), errno);
|
fname, strerror(errno), errno);
|
||||||
ch_free( c );
|
if ( !cf )
|
||||||
|
ch_free( c );
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -843,10 +839,12 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
ch_free(c->tline);
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
ch_free(c->argv);
|
if ( !cf ) {
|
||||||
ch_free(c);
|
ch_free(c->tline);
|
||||||
|
ch_free(c->argv);
|
||||||
|
ch_free(c);
|
||||||
|
}
|
||||||
return(rc);
|
return(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue