summaryrefslogtreecommitdiffstats
path: root/source3/rpc_server/srv_eventlog_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_server/srv_eventlog_lib.c')
-rw-r--r--source3/rpc_server/srv_eventlog_lib.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source3/rpc_server/srv_eventlog_lib.c b/source3/rpc_server/srv_eventlog_lib.c
index 8cbb319e9b0..88e246a94f3 100644
--- a/source3/rpc_server/srv_eventlog_lib.c
+++ b/source3/rpc_server/srv_eventlog_lib.c
@@ -312,7 +312,7 @@ bool can_write_to_eventlog( TDB_CONTEXT * tdb, int32_t needed )
/*******************************************************************
*******************************************************************/
-ELOG_TDB *elog_open_tdb( char *logname, bool force_clear )
+ELOG_TDB *elog_open_tdb( char *logname, bool force_clear, bool read_only )
{
TDB_CONTEXT *tdb = NULL;
uint32_t vers_id;
@@ -322,6 +322,13 @@ ELOG_TDB *elog_open_tdb( char *logname, bool force_clear )
char *eventlogdir;
TALLOC_CTX *ctx = talloc_tos();
+ /* check for invalid options */
+
+ if (force_clear && read_only) {
+ DEBUG(1,("elog_open_tdb: Invalid flags\n"));
+ return NULL;
+ }
+
/* first see if we have an open context */
for ( ptr=open_elog_list; ptr; ptr=ptr->next ) {
@@ -363,7 +370,7 @@ ELOG_TDB *elog_open_tdb( char *logname, bool force_clear )
if ( !force_clear ) {
- tdb = tdb_open_log( tdbpath, 0, TDB_DEFAULT, O_RDWR , 0 );
+ tdb = tdb_open_log( tdbpath, 0, TDB_DEFAULT, read_only ? O_RDONLY : O_RDWR , 0 );
if ( tdb ) {
vers_id = tdb_fetch_int32( tdb, EVT_VERSION );