diff options
author | Günther Deschner <gd@samba.org> | 2009-02-03 14:14:39 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-02-04 22:51:23 +0100 |
commit | 8b126e942d5251cc7be08634dd73a598f8a834eb (patch) | |
tree | 03dfe7268eade207426818c9fcc6f4b82d05dd2f /source3/rpc_server | |
parent | abb4faf813dcc70435d4b47c94c50e0da004fa4f (diff) | |
download | samba-8b126e942d5251cc7be08634dd73a598f8a834eb.tar.gz samba-8b126e942d5251cc7be08634dd73a598f8a834eb.tar.bz2 samba-8b126e942d5251cc7be08634dd73a598f8a834eb.zip |
s3-eventlog: remove write_eventlog_tdb.
Guenther
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_eventlog_lib.c | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/source3/rpc_server/srv_eventlog_lib.c b/source3/rpc_server/srv_eventlog_lib.c index c5d2ad737e..95aca087b1 100644 --- a/source3/rpc_server/srv_eventlog_lib.c +++ b/source3/rpc_server/srv_eventlog_lib.c @@ -447,110 +447,6 @@ int elog_close_tdb( ELOG_TDB *etdb, bool force_close ) /******************************************************************* - write an eventlog entry. Note that we have to lock, read next - eventlog, increment, write, write the record, unlock - - coming into this, ee has the eventlog record, and the auxilliary date - (computer name, etc.) filled into the other structure. Before packing - into a record, this routine will calc the appropriate padding, etc., - and then blast out the record in a form that can be read back in -*******************************************************************/ - -#define MARGIN 512 - -int write_eventlog_tdb( TDB_CONTEXT * the_tdb, Eventlog_entry * ee ) -{ - int32 next_record; - uint8 *packed_ee; - TALLOC_CTX *mem_ctx = NULL; - TDB_DATA kbuf, ebuf; - uint32_t n_packed; - - if ( !ee ) - return 0; - - mem_ctx = talloc_init( "write_eventlog_tdb" ); - - if ( mem_ctx == NULL ) - return 0; - - /* discard any entries that have bogus time, which usually indicates a bogus entry as well. */ - if ( ee->record.time_generated == 0 ) - return 0; - - /* todo - check for sanity in next_record */ - - fixup_eventlog_entry( ee ); - - if ( !can_write_to_eventlog( the_tdb, ee->record.length ) ) { - DEBUG( 3, ( "Can't write to Eventlog, no room \n" ) ); - talloc_destroy( mem_ctx ); - return 0; - } - - /* alloc mem for the packed version */ - packed_ee = (uint8 *)TALLOC( mem_ctx, ee->record.length + MARGIN ); - if ( !packed_ee ) { - talloc_destroy( mem_ctx ); - return 0; - } - - /* need to read the record number and insert it into the entry here */ - - /* lock */ - tdb_lock_bystring_with_timeout( the_tdb, EVT_NEXT_RECORD, 1 ); - /* read */ - next_record = tdb_fetch_int32( the_tdb, EVT_NEXT_RECORD ); - - n_packed = - tdb_pack( (uint8 *)packed_ee, ee->record.length + MARGIN, - "ddddddwwwwddddddBBdBBBd", ee->record.length, - ee->record.reserved1, next_record, - 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, - ee->data_record.source_name, - ee->data_record.computer_name_len, - ee->data_record.computer_name, - ee->data_record.sid_padding, - ee->record.user_sid_length, ee->data_record.sid, - ee->data_record.strings_len, - ee->data_record.strings, - ee->data_record.user_data_len, - ee->data_record.user_data, - ee->data_record.data_padding ); - - /*DEBUG(3,("write_eventlog_tdb: packed into %d\n",n_packed)); */ - - /* increment the record count */ - - kbuf.dsize = sizeof( int32 ); - kbuf.dptr = (uint8 * ) & next_record; - - ebuf.dsize = n_packed; - ebuf.dptr = (uint8 *)packed_ee; - - if ( tdb_store( the_tdb, kbuf, ebuf, 0 ) ) { - /* DEBUG(1,("write_eventlog_tdb: Can't write record %d to eventlog\n",next_record)); */ - tdb_unlock_bystring( the_tdb, EVT_NEXT_RECORD ); - talloc_destroy( mem_ctx ); - return 0; - } - next_record++; - tdb_store_int32( the_tdb, EVT_NEXT_RECORD, next_record ); - tdb_unlock_bystring( the_tdb, EVT_NEXT_RECORD ); - talloc_destroy( mem_ctx ); - return ( next_record - 1 ); -} - -/******************************************************************* calculate the correct fields etc for an eventlog entry *******************************************************************/ |