1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-31 17:18:04 +03:00

s3-eventlog: remove read_package_entry.

Guenther
This commit is contained in:
Günther Deschner 2009-02-04 21:34:35 +01:00
parent 58ded409ab
commit 96fd6b5a01

View File

@ -350,98 +350,6 @@ done:
return ret; return ret;
} }
/********************************************************************
********************************************************************/
static Eventlog_entry *read_package_entry( TALLOC_CTX *mem_ctx,
Eventlog_entry * entry )
{
uint8 *offset;
Eventlog_entry *ee_new = NULL;
ee_new = TALLOC_ZERO_ARRAY(mem_ctx, Eventlog_entry, 1 );
if ( ee_new == NULL ) {
return NULL;
}
entry->data_record.sid_padding =
( ( 4 -
( ( entry->data_record.source_name_len +
entry->data_record.computer_name_len ) % 4 ) ) % 4 );
entry->data_record.data_padding =
( 4 -
( ( entry->data_record.strings_len +
entry->data_record.user_data_len ) % 4 ) ) % 4;
entry->record.length = sizeof( Eventlog_record );
entry->record.length += entry->data_record.source_name_len;
entry->record.length += entry->data_record.computer_name_len;
if ( entry->record.user_sid_length == 0 ) {
/* Should not pad to a DWORD boundary for writing out the sid if there is
no SID, so just propagate the padding to pad the data */
entry->data_record.data_padding +=
entry->data_record.sid_padding;
entry->data_record.sid_padding = 0;
}
DEBUG( 10,
( "sid_padding is [%d].\n", entry->data_record.sid_padding ) );
DEBUG( 10,
( "data_padding is [%d].\n",
entry->data_record.data_padding ) );
entry->record.length += entry->data_record.sid_padding;
entry->record.length += entry->record.user_sid_length;
entry->record.length += entry->data_record.strings_len;
entry->record.length += entry->data_record.user_data_len;
entry->record.length += entry->data_record.data_padding;
/* need another copy of length at the end of the data */
entry->record.length += sizeof( entry->record.length );
DEBUG( 10,
( "entry->record.length is [%d].\n", entry->record.length ) );
entry->data =
TALLOC_ZERO_ARRAY(mem_ctx, uint8_t,
entry->record.length -
sizeof( Eventlog_record ) -
sizeof( entry->record.length ));
if ( entry->data == NULL ) {
return NULL;
}
offset = entry->data;
memcpy( offset, entry->data_record.source_name,
entry->data_record.source_name_len );
offset += entry->data_record.source_name_len;
memcpy( offset, entry->data_record.computer_name,
entry->data_record.computer_name_len );
offset += entry->data_record.computer_name_len;
/* SID needs to be DWORD-aligned */
offset += entry->data_record.sid_padding;
entry->record.user_sid_offset =
sizeof( Eventlog_record ) + ( offset - entry->data );
memcpy( offset, entry->data_record.sid,
entry->record.user_sid_length );
offset += entry->record.user_sid_length;
/* Now do the strings */
entry->record.string_offset =
sizeof( Eventlog_record ) + ( offset - entry->data );
memcpy( offset, entry->data_record.strings,
entry->data_record.strings_len );
offset += entry->data_record.strings_len;
/* Now do the data */
entry->record.data_length = entry->data_record.user_data_len;
entry->record.data_offset =
sizeof( Eventlog_record ) + ( offset - entry->data );
memcpy( offset, entry->data_record.user_data,
entry->data_record.user_data_len );
offset += entry->data_record.user_data_len;
memcpy( &( ee_new->record ), &entry->record,
sizeof( Eventlog_record ) );
memcpy( &( ee_new->data_record ), &entry->data_record,
sizeof( Eventlog_data_record ) );
ee_new->data = entry->data;
return ee_new;
}
/******************************************************************** /********************************************************************
********************************************************************/ ********************************************************************/