summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-02-02 13:38:38 +0100
committerGünther Deschner <gd@samba.org>2009-02-03 15:45:09 +0100
commitb94946697dc1d2915f6330f3a02cca7d69bc7cff (patch)
tree5672fbb636cbad20a0929736a884656a4d4bce7d /source3
parent4976777e3b0f3d8c18182a822937f62c082027c7 (diff)
downloadsamba-b94946697dc1d2915f6330f3a02cca7d69bc7cff.tar.gz
samba-b94946697dc1d2915f6330f3a02cca7d69bc7cff.tar.bz2
samba-b94946697dc1d2915f6330f3a02cca7d69bc7cff.zip
s3-eventlog: pass down talloc context to parse_logentry().
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/rpc_server/srv_eventlog_lib.c15
-rw-r--r--source3/utils/eventlogadm.c3
3 files changed, 10 insertions, 10 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 6f9474e3fb..19d131cb63 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -6262,7 +6262,7 @@ 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( char *line, Eventlog_entry * entry, bool * eor );
+bool parse_logentry( TALLOC_CTX *mem_ctx, char *line, Eventlog_entry * entry, bool * eor );
/* The following definitions come from rpc_server/srv_eventlog_nt.c */
diff --git a/source3/rpc_server/srv_eventlog_lib.c b/source3/rpc_server/srv_eventlog_lib.c
index 70673f73e9..2890dc9528 100644
--- a/source3/rpc_server/srv_eventlog_lib.c
+++ b/source3/rpc_server/srv_eventlog_lib.c
@@ -594,9 +594,8 @@ void fixup_eventlog_entry( Eventlog_entry * ee )
going in.
********************************************************************/
-bool parse_logentry( char *line, Eventlog_entry * entry, bool * eor )
+bool parse_logentry( TALLOC_CTX *mem_ctx, char *line, Eventlog_entry * entry, bool * eor )
{
- TALLOC_CTX *ctx = talloc_tos();
char *start = NULL, *stop = NULL;
start = line;
@@ -667,7 +666,7 @@ bool parse_logentry( char *line, Eventlog_entry * entry, bool * eor )
while ( isspace( stop[0] ) ) {
stop++;
}
- entry->data_record.source_name_len = rpcstr_push_talloc(ctx,
+ entry->data_record.source_name_len = rpcstr_push_talloc(mem_ctx,
&entry->data_record.source_name,
stop);
if (entry->data_record.source_name_len == (uint32_t)-1 ||
@@ -679,7 +678,7 @@ bool parse_logentry( char *line, Eventlog_entry * entry, bool * eor )
while ( isspace( stop[0] ) ) {
stop++;
}
- entry->data_record.computer_name_len = rpcstr_push_talloc(ctx,
+ entry->data_record.computer_name_len = rpcstr_push_talloc(mem_ctx,
&entry->data_record.computer_name,
stop);
if (entry->data_record.computer_name_len == (uint32_t)-1 ||
@@ -691,7 +690,7 @@ bool parse_logentry( char *line, Eventlog_entry * entry, bool * eor )
while ( isspace( stop[0] ) ) {
stop++;
}
- entry->record.user_sid_length = rpcstr_push_talloc(ctx,
+ entry->record.user_sid_length = rpcstr_push_talloc(mem_ctx,
&entry->data_record.sid,
stop);
if (entry->record.user_sid_length == (uint32_t)-1 ||
@@ -708,14 +707,14 @@ bool parse_logentry( char *line, Eventlog_entry * entry, bool * eor )
while ( isspace(stop[0])) {
stop++;
}
- tmp_len = rpcstr_push_talloc(ctx,
+ tmp_len = rpcstr_push_talloc(mem_ctx,
&temp,
stop);
if (tmp_len == (size_t)-1 || !temp) {
return false;
}
old_len = entry->data_record.strings_len;
- entry->data_record.strings = (smb_ucs2_t *)TALLOC_REALLOC_ARRAY(ctx,
+ entry->data_record.strings = (smb_ucs2_t *)TALLOC_REALLOC_ARRAY(mem_ctx,
entry->data_record.strings,
char,
old_len + tmp_len);
@@ -735,7 +734,7 @@ bool parse_logentry( char *line, Eventlog_entry * entry, bool * eor )
stop++;
}
entry->data_record.user_data_len = strlen(stop);
- entry->data_record.user_data = talloc_strdup(ctx,
+ entry->data_record.user_data = talloc_strdup(mem_ctx,
stop);
if (!entry->data_record.user_data) {
return false;
diff --git a/source3/utils/eventlogadm.c b/source3/utils/eventlogadm.c
index 7d40772423..fb0bc602cc 100644
--- a/source3/utils/eventlogadm.c
+++ b/source3/utils/eventlogadm.c
@@ -89,6 +89,7 @@ static int DoWriteCommand( int argc, char **argv, bool debugflag, char *exename
bool is_eor;
Eventlog_entry ee;
int rcnum;
+ TALLOC_CTX *mem_ctx = talloc_tos();
f1 = stdin;
if ( !f1 ) {
@@ -122,7 +123,7 @@ static int DoWriteCommand( int argc, char **argv, bool debugflag, char *exename
is_eor = False;
- parse_logentry( ( char * ) &linein, &ee, &is_eor );
+ parse_logentry( mem_ctx, ( char * ) &linein, &ee, &is_eor );
/* should we do something with the return code? */
if ( is_eor ) {