s3-eventlog: remove write_eventlog_tdb.
authorGünther Deschner <gd@samba.org>
Tue, 3 Feb 2009 13:14:39 +0000 (14:14 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 4 Feb 2009 21:51:23 +0000 (22:51 +0100)
Guenther

source3/include/proto.h
source3/rpc_server/srv_eventlog_lib.c

index 9067dcd..db45d97 100644 (file)
@@ -6251,7 +6251,6 @@ int elog_tdb_size( TDB_CONTEXT * tdb, int *MaxSize, int *Retention );
 bool prune_eventlog( TDB_CONTEXT * tdb );
 ELOG_TDB *elog_open_tdb( const char *logname, bool force_clear, bool read_only );
 int elog_close_tdb( ELOG_TDB *etdb, bool force_close );
-int write_eventlog_tdb( TDB_CONTEXT * the_tdb, Eventlog_entry * ee );
 void fixup_eventlog_entry( Eventlog_entry * ee );
 bool parse_logentry( TALLOC_CTX *mem_ctx, char *line, struct eventlog_Record_tdb *entry, bool * eor );
 size_t fixup_eventlog_record_tdb(struct eventlog_Record_tdb *r);
index c5d2ad7..95aca08 100644 (file)
@@ -446,110 +446,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
 *******************************************************************/