diff options
author | Günther Deschner <gd@samba.org> | 2009-01-14 18:09:25 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-01-16 00:28:45 +0100 |
commit | 6dc18f2cab3cf028c189ce870059f46c15f5593a (patch) | |
tree | 5cf8b3bf0a73e20c39fac12101edf26e3c694be9 /source3 | |
parent | 288c4691952a4688f05ae3a5cd137db346a2a276 (diff) | |
download | samba-6dc18f2cab3cf028c189ce870059f46c15f5593a.tar.gz samba-6dc18f2cab3cf028c189ce870059f46c15f5593a.tar.bz2 samba-6dc18f2cab3cf028c189ce870059f46c15f5593a.zip |
s3-eventlog: some minor code cleanup in eventlog server.
Guenther
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpc_server/srv_eventlog_nt.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/source3/rpc_server/srv_eventlog_nt.c b/source3/rpc_server/srv_eventlog_nt.c index 637070b874..ec35e4bc9b 100644 --- a/source3/rpc_server/srv_eventlog_nt.c +++ b/source3/rpc_server/srv_eventlog_nt.c @@ -178,7 +178,7 @@ static NTSTATUS elog_open( pipes_struct * p, const char *logname, POLICY_HND *hn EVENTLOG_INFO *elog; /* first thing is to validate the eventlog name */ - + if ( !elog_validate_logname( logname ) ) return NT_STATUS_OBJECT_PATH_INVALID; @@ -610,36 +610,26 @@ static bool add_record_to_resp( Eventlog_entry *entry, NTSTATUS _eventlog_OpenEventLogW(pipes_struct *p, struct eventlog_OpenEventLogW *r) { - const char *servername = ""; - const char *logname = ""; EVENTLOG_INFO *info; NTSTATUS result; - if (r->in.servername->string) { - servername = r->in.servername->string; - } - - if (r->in.logname->string) { - logname = r->in.logname->string; - } - - DEBUG( 10,("_eventlog_open_eventlog: Server [%s], Log [%s]\n", - servername, logname )); + DEBUG( 10,("_eventlog_OpenEventLogW: Server [%s], Log [%s]\n", + r->in.servername->string, r->in.logname->string )); /* according to MSDN, if the logfile cannot be found, we should default to the "Application" log */ - if ( !NT_STATUS_IS_OK( result = elog_open( p, logname, r->out.handle )) ) + if ( !NT_STATUS_IS_OK( result = elog_open( p, r->in.logname->string, r->out.handle )) ) return result; if ( !(info = find_eventlog_info_by_hnd( p, r->out.handle )) ) { - DEBUG(0,("_eventlog_open_eventlog: eventlog (%s) opened but unable to find handle!\n", - logname )); + DEBUG(0,("_eventlog_OpenEventLogW: eventlog (%s) opened but unable to find handle!\n", + r->in.logname->string )); elog_close( p, r->out.handle ); return NT_STATUS_INVALID_HANDLE; } - DEBUG(10,("_eventlog_open_eventlog: Size [%d]\n", elog_size( info ))); + DEBUG(10,("_eventlog_OpenEventLogW: Size [%d]\n", elog_size( info ))); sync_eventlog_params( info ); prune_eventlog( ELOG_TDB_CTX(info->etdb) ); @@ -669,18 +659,15 @@ NTSTATUS _eventlog_ClearEventLogW(pipes_struct *p, struct eventlog_ClearEventLogW *r) { EVENTLOG_INFO *info = find_eventlog_info_by_hnd( p, r->in.handle ); - const char *backup_file_name = NULL; if ( !info ) return NT_STATUS_INVALID_HANDLE; if (r->in.backupfile && r->in.backupfile->string) { - backup_file_name = r->in.backupfile->string; - - DEBUG(8,( "_eventlog_clear_eventlog: Using [%s] as the backup " + DEBUG(8,( "_eventlog_ClearEventLogW: Using [%s] as the backup " "file name for log [%s].", - backup_file_name, info->logname ) ); + r->in.backupfile->string, info->logname ) ); } /* check for WRITE access to the file */ @@ -740,7 +727,7 @@ NTSTATUS _eventlog_read_eventlog( pipes_struct * p, elog_read_type = q_u->flags & (EVENTLOG_SEQUENTIAL_READ|EVENTLOG_SEEK_READ); elog_read_dir = q_u->flags & (EVENTLOG_FORWARDS_READ|EVENTLOG_BACKWARDS_READ); - if ( elog_read_type == (EVENTLOG_SEQUENTIAL_READ|EVENTLOG_SEEK_READ) + if ( elog_read_type == (EVENTLOG_SEQUENTIAL_READ|EVENTLOG_SEEK_READ) || elog_read_dir == (EVENTLOG_FORWARDS_READ|EVENTLOG_BACKWARDS_READ) ) { DEBUG(3,("_eventlog_read_eventlog: Invalid flags [0x%x] for ReadEventLog\n", q_u->flags)); |