diff options
Diffstat (limited to 'source3/lib/eventlog')
-rw-r--r-- | source3/lib/eventlog/eventlog.c | 13 | ||||
-rw-r--r-- | source3/lib/eventlog/eventlog.h | 2 | ||||
-rw-r--r-- | source3/lib/eventlog/proto.h | 27 |
3 files changed, 36 insertions, 6 deletions
diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c index 4941199c5e..67583b8666 100644 --- a/source3/lib/eventlog/eventlog.c +++ b/source3/lib/eventlog/eventlog.c @@ -24,6 +24,7 @@ #include "system/filesys.h" #include "lib/eventlog/eventlog.h" #include "../libcli/security/security.h" +#include "util_tdb.h" /* maintain a list of open eventlog tdbs with reference counts */ @@ -202,7 +203,7 @@ static bool make_way_for_eventlogs( TDB_CONTEXT * the_tdb, int32_t needed, /* read a record, add the amt to nbytes */ key.dsize = sizeof(int32_t); key.dptr = (unsigned char *)&i; - ret = tdb_fetch( the_tdb, key ); + ret = tdb_fetch_compat( the_tdb, key ); if ( ret.dsize == 0 ) { DEBUG( 8, ( "Can't find a record for the key, record [%d]\n", @@ -415,7 +416,7 @@ ELOG_TDB *elog_open_tdb( const char *logname, bool force_clear, bool read_only ) return ptr; } - if ( !(tdb_node = TALLOC_ZERO_P( NULL, ELOG_TDB)) ) { + if ( !(tdb_node = talloc_zero( NULL, ELOG_TDB)) ) { DEBUG(0,("elog_open_tdb: talloc() failure!\n")); tdb_close( tdb ); return NULL; @@ -678,7 +679,7 @@ struct eventlog_Record_tdb *evlog_pull_record_tdb(TALLOC_CTX *mem_ctx, key.dptr = (unsigned char *)&srecno; key.dsize = sizeof(int32_t); - data = tdb_fetch(tdb, key); + data = tdb_fetch_compat(tdb, key); if (data.dsize == 0) { DEBUG(8,("evlog_pull_record_tdb: " "Can't find a record for the key, record %d\n", @@ -780,7 +781,7 @@ NTSTATUS evlog_push_record_tdb(TALLOC_CTX *mem_ctx, /* lock */ ret = tdb_lock_bystring_with_timeout(tdb, EVT_NEXT_RECORD, 1); - if (ret == -1) { + if (ret != 0) { return NT_STATUS_LOCK_NOT_GRANTED; } @@ -803,13 +804,13 @@ NTSTATUS evlog_push_record_tdb(TALLOC_CTX *mem_ctx, ebuf.dptr = blob.data; ret = tdb_store(tdb, kbuf, ebuf, 0); - if (ret == -1) { + if (ret != 0) { tdb_unlock_bystring(tdb, EVT_NEXT_RECORD); return NT_STATUS_EVENTLOG_FILE_CORRUPT; } ret = tdb_store_int32(tdb, EVT_NEXT_RECORD, r->record_number + 1); - if (ret == -1) { + if (ret != 0) { tdb_unlock_bystring(tdb, EVT_NEXT_RECORD); return NT_STATUS_EVENTLOG_FILE_CORRUPT; } diff --git a/source3/lib/eventlog/eventlog.h b/source3/lib/eventlog/eventlog.h index 29c25c3122..694732d184 100644 --- a/source3/lib/eventlog/eventlog.h +++ b/source3/lib/eventlog/eventlog.h @@ -17,6 +17,8 @@ * along with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "tdb_compat.h" + /* Defines for TDB keys */ #define EVT_OLDEST_ENTRY "INFO/oldest_entry" #define EVT_NEXT_RECORD "INFO/next_record" diff --git a/source3/lib/eventlog/proto.h b/source3/lib/eventlog/proto.h index 21790d0795..d3341ce16d 100644 --- a/source3/lib/eventlog/proto.h +++ b/source3/lib/eventlog/proto.h @@ -1,3 +1,28 @@ +/* + * Unix SMB/CIFS implementation. + * Eventlog utility routines + * + * Copyright (C) Marcin Krzysztof Porwit 2005 + * Copyright (C) Brian Moran 2005 + * Copyright (C) Gerald (Jerry) Carter 2005 + * Copyright (C) Guenther Deschner 2009 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _LIB_EVENTLOG_PROTO_H_ +#define _LIB_EVENTLOG_PROTO_H_ /* The following definitions come from lib/eventlog/eventlog.c */ @@ -33,3 +58,5 @@ NTSTATUS evlog_convert_tdb_to_evt(TALLOC_CTX *mem_ctx, ELOG_TDB *etdb, DATA_BLOB *blob_p, uint32_t *num_records_p); + +#endif /* _LIB_EVENTLOG_PROTO_H_ */ |