diff options
author | Andreas Schneider <asn@samba.org> | 2010-07-05 19:43:25 +0200 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2010-07-06 18:38:13 +0200 |
commit | c67cff0372d987d13105b81a7625ff42a3ceac43 (patch) | |
tree | 3b934f783910c09e06e14a01614fdbad81dfb54b /source3/winbindd | |
parent | a56c6883661123ed7eb07f7e6f0e947714d1d575 (diff) | |
download | samba-c67cff0372d987d13105b81a7625ff42a3ceac43.tar.gz samba-c67cff0372d987d13105b81a7625ff42a3ceac43.tar.bz2 samba-c67cff0372d987d13105b81a7625ff42a3ceac43.zip |
s3-winbind: Create all logfiles in the same directory.
If log file is set in the config file, we should create the log files of
the winbind child processes in the same directory.
Diffstat (limited to 'source3/winbindd')
-rw-r--r-- | source3/winbindd/winbindd_dual.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index e506d2a53a..277b174306 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -405,10 +405,31 @@ void setup_child(struct winbindd_domain *domain, struct winbindd_child *child, const char *logname) { if (logprefix && logname) { + char *logbase = NULL; + + if (lp_logfile()) { + char *end = NULL; + + if (asprintf(&logbase, "%s", lp_logfile()) < 0) { + smb_panic("Internal error: asprintf failed"); + } + + if ((end = strrchr_m(logbase, '/'))) { + *end = '\0'; + } + } else { + if (asprintf(&logbase, "%s", get_dyn_LOGFILEBASE()) < 0) { + smb_panic("Internal error: asprintf failed"); + } + } + if (asprintf(&child->logfilename, "%s/%s-%s", - get_dyn_LOGFILEBASE(), logprefix, logname) < 0) { + logbase, logprefix, logname) < 0) { + SAFE_FREE(logbase); smb_panic("Internal error: asprintf failed"); } + + SAFE_FREE(logbase); } else { smb_panic("Internal error: logprefix == NULL && " "logname == NULL"); |