diff options
author | Andreas Schneider <asn@samba.org> | 2012-12-13 17:50:55 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2012-12-21 13:55:59 +0100 |
commit | 6fd4724fb95cda3adfee37b6bde7e526e423083d (patch) | |
tree | f6291fe51e5a20a510393f7784e40104b2fd1b81 /source3/lib | |
parent | ae6947cc48d032ad8af76f8a9e3dbae6a074d10e (diff) | |
download | samba-6fd4724fb95cda3adfee37b6bde7e526e423083d.tar.gz samba-6fd4724fb95cda3adfee37b6bde7e526e423083d.tar.bz2 samba-6fd4724fb95cda3adfee37b6bde7e526e423083d.zip |
s3-eventlog: Make sure the eventlog directory exists.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/eventlog/eventlog.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c index 67583b8666..0cc0240bcc 100644 --- a/source3/lib/eventlog/eventlog.c +++ b/source3/lib/eventlog/eventlog.c @@ -340,6 +340,7 @@ ELOG_TDB *elog_open_tdb( const char *logname, bool force_clear, bool read_only ) ELOG_TDB *tdb_node = NULL; char *eventlogdir; TALLOC_CTX *ctx = talloc_tos(); + bool ok; /* check for invalid options */ @@ -372,8 +373,10 @@ ELOG_TDB *elog_open_tdb( const char *logname, bool force_clear, bool read_only ) /* make sure that the eventlog dir exists */ eventlogdir = state_path( "eventlog" ); - if ( !directory_exist( eventlogdir ) ) - mkdir( eventlogdir, 0755 ); + ok = directory_create_or_exist(eventlogdir, geteuid(), 0755); + if (!ok) { + return NULL; + } /* get the path on disk */ |