smbd: avoid double chdir() in chdir_current_service()
authorRalph Boehme <slow@samba.org>
Wed, 22 Jan 2020 09:52:39 +0000 (10:52 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 6 Feb 2020 11:44:07 +0000 (11:44 +0000)
commitf705629a171c1411131164f3adff36175154c093
tree0b5bc5d0e5a26828ebe5b033166dd19b76f080a1
parent8bfa0d58671e42509b5b4408ec4076cc4cb046f1
smbd: avoid double chdir() in chdir_current_service()

Since 8e81090789e4cc3ba9e5aa792d4e52971909c894 we're doing chdir() twice, first
into conn->connectpath, then into conn->origpath.

Before commit 8e81090789e4cc3ba9e5aa792d4e52971909c894 if
chdir(conn->connectpath) succeeded, we wouldn't do the second chdir().

While at it, simplify the logging logic: if chdir() fails in this core function,
just always log is as error including the unix token.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14256
RN: smbd does a chdir() twice per request

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Feb  6 11:44:07 UTC 2020 on sn-devel-184
source3/smbd/service.c