diff options
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_eventlog_nt.c | 134 |
1 files changed, 0 insertions, 134 deletions
diff --git a/source3/rpc_server/srv_eventlog_nt.c b/source3/rpc_server/srv_eventlog_nt.c index b4f7afc2b7..b378556f43 100644 --- a/source3/rpc_server/srv_eventlog_nt.c +++ b/source3/rpc_server/srv_eventlog_nt.c @@ -277,140 +277,6 @@ static int elog_size( EVENTLOG_INFO *info ) } /******************************************************************** - For the given tdb, get the next eventlog record into the passed - Eventlog_entry. returns NULL if it can't get the record for some reason. - ********************************************************************/ - -static Eventlog_entry *get_eventlog_record(TALLOC_CTX *mem_ctx, - TDB_CONTEXT *tdb, - int recno) -{ - Eventlog_entry *ee = NULL; - TDB_DATA ret, key; - - int32_t srecno; - int32_t reclen; - int len; - - char *wpsource = NULL; - char *wpcomputer = NULL; - char *wpsid = NULL; - char *wpstrs = NULL; - char *puserdata = NULL; - - key.dsize = sizeof(int32_t); - - srecno = recno; - key.dptr = (unsigned char *)&srecno; - - ret = tdb_fetch( tdb, key ); - - if ( ret.dsize == 0 ) { - DEBUG( 8, - ( "Can't find a record for the key, record %d\n", - recno ) ); - return NULL; - } - - len = tdb_unpack( ret.dptr, ret.dsize, "d", &reclen ); - - DEBUG( 10, ( "Unpacking record %d, size is %d\n", srecno, len ) ); - - if ( !len ) - return NULL; - - ee = TALLOC_ARRAY(mem_ctx, Eventlog_entry, 1); - if (!ee) { - return NULL; - } - ZERO_STRUCTP(ee); - - len = tdb_unpack( ret.dptr, ret.dsize, "ddddddwwwwddddddBBdBBBd", - &ee->record.length, &ee->record.reserved1, - &ee->record.record_number, - &ee->record.time_generated, - &ee->record.time_written, &ee->record.event_id, - &ee->record.event_type, &ee->record.num_strings, - &ee->record.event_category, &ee->record.reserved2, - &ee->record.closing_record_number, - &ee->record.string_offset, - &ee->record.user_sid_length, - &ee->record.user_sid_offset, - &ee->record.data_length, &ee->record.data_offset, - &ee->data_record.source_name_len, &wpsource, - &ee->data_record.computer_name_len, &wpcomputer, - &ee->data_record.sid_padding, - &ee->record.user_sid_length, &wpsid, - &ee->data_record.strings_len, &wpstrs, - &ee->data_record.user_data_len, &puserdata, - &ee->data_record.data_padding ); - DEBUG( 10, - ( "Read record %d, len in tdb was %d\n", - ee->record.record_number, len ) ); - - /* have to do the following because the tdb_unpack allocs a buff, stuffs a pointer to the buff - into it's 2nd argment for 'B' */ - - if (wpcomputer) { - ee->data_record.computer_name = (smb_ucs2_t *)TALLOC_MEMDUP( - ee, wpcomputer, ee->data_record.computer_name_len); - if (!ee->data_record.computer_name) { - TALLOC_FREE(ee); - goto out; - } - } - if (wpsource) { - ee->data_record.source_name = (smb_ucs2_t *)TALLOC_MEMDUP( - ee, wpsource, ee->data_record.source_name_len); - if (!ee->data_record.source_name) { - TALLOC_FREE(ee); - goto out; - } - } - - if (wpsid) { - ee->data_record.sid = (smb_ucs2_t *)TALLOC_MEMDUP( - ee, wpsid, ee->record.user_sid_length); - if (!ee->data_record.sid) { - TALLOC_FREE(ee); - goto out; - } - } - if (wpstrs) { - ee->data_record.strings = (smb_ucs2_t *)TALLOC_MEMDUP( - ee, wpstrs, ee->data_record.strings_len); - if (!ee->data_record.strings) { - TALLOC_FREE(ee); - goto out; - } - } - - if (puserdata) { - ee->data_record.user_data = (char *)TALLOC_MEMDUP( - ee, puserdata, ee->data_record.user_data_len); - if (!ee->data_record.user_data) { - TALLOC_FREE(ee); - goto out; - } - } - - out: - - SAFE_FREE(wpcomputer); - SAFE_FREE(wpsource); - SAFE_FREE(wpsid); - SAFE_FREE(wpstrs); - SAFE_FREE(puserdata); - - DEBUG( 10, ( "get_eventlog_record: read back %d\n", len ) ); - DEBUG( 10, - ( "get_eventlog_record: computer_name %d is ", - ee->data_record.computer_name_len ) ); - SAFE_FREE(ret.dptr); - return ee; -} - -/******************************************************************** note that this can only be called AFTER the table is constructed, since it uses the table to find the tdb handle ********************************************************************/ |