From b84b83801588142c15ccbb4afdc961bdd25ecfa6 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Wed, 11 Oct 2000 04:50:14 +0000 Subject: [PATCH] chdir before chroot --- CHANGES | 1 + servers/slapd/main.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index e2359e8862..aee75807db 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ OpenLDAP 2.0.X Engineering Updated -lldap SASL error reporting Updated -lldap TLS error reporting Updated slapadd error reporting + Updated slapd chroot handling (ITS#810) Added slapd numericString indexing Build Environment Fixed make comment bug (ITS#811) diff --git a/servers/slapd/main.c b/servers/slapd/main.c index d0bbbe7e1d..4b38c3f9b9 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -301,10 +301,17 @@ int main( int argc, char **argv ) } #if defined(HAVE_CHROOT) - if ( sandbox && chroot( sandbox ) ) { - perror("chroot"); - rc = 1; - goto stop; + if ( sandbox ) { + if ( chdir( sandbox ) ) { + perror("chdir"); + rc = 1; + goto stop; + } + if ( chroot( sandbox ) ) { + perror("chroot"); + rc = 1; + goto stop; + } } #endif