mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 00:29:35 -05:00
Revert prev commit, different fix
This commit is contained in:
parent
e9ab15ba87
commit
3d632e79d8
1 changed files with 25 additions and 19 deletions
|
|
@ -660,23 +660,29 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
|
|||
int rc;
|
||||
struct stat s;
|
||||
|
||||
if ( cf ) {
|
||||
c = cf;
|
||||
} else {
|
||||
c = ch_calloc( 1, sizeof( ConfigArgs ) );
|
||||
|
||||
c->valx = -1;
|
||||
c->fname = fname;
|
||||
init_config_argv( c );
|
||||
c = ch_calloc( 1, sizeof( ConfigArgs ) );
|
||||
if ( c == NULL ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( depth ) {
|
||||
memcpy( c, cf, sizeof( ConfigArgs ) );
|
||||
} else {
|
||||
c->depth = depth; /* XXX */
|
||||
c->bi = NULL;
|
||||
c->be = NULL;
|
||||
}
|
||||
|
||||
c->valx = -1;
|
||||
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);
|
||||
if ( !cf )
|
||||
ch_free( c );
|
||||
ch_free( c );
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
|
@ -685,8 +691,7 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
|
|||
Debug(LDAP_DEBUG_ANY,
|
||||
"regular file expected, got \"%s\"\n",
|
||||
fname, 0, 0 );
|
||||
if ( !cf )
|
||||
ch_free( c );
|
||||
ch_free( c );
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
|
@ -696,8 +701,7 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
|
|||
Debug(LDAP_DEBUG_ANY,
|
||||
"could not open config file \"%s\": %s (%d)\n",
|
||||
fname, strerror(errno), errno);
|
||||
if ( !cf )
|
||||
ch_free( c );
|
||||
ch_free( c );
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
|
@ -839,12 +843,14 @@ read_config_file(const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
|
|||
rc = 0;
|
||||
|
||||
done:
|
||||
fclose(fp);
|
||||
if ( !cf ) {
|
||||
ch_free(c->tline);
|
||||
ch_free(c->argv);
|
||||
ch_free(c);
|
||||
if ( cf ) {
|
||||
cf->be = c->be;
|
||||
cf->bi = c->bi;
|
||||
}
|
||||
ch_free(c->tline);
|
||||
fclose(fp);
|
||||
ch_free(c->argv);
|
||||
ch_free(c);
|
||||
return(rc);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue