From d2d7174394c1283a3ae8e313f9a6d97df8708334 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 6 May 2010 11:42:52 +0200 Subject: s3-eventlog: move all eventlog headers to lib/eventlog and only include where required. Guenther --- source3/include/eventlog.h | 41 ---------------------------------- source3/include/includes.h | 1 - source3/include/proto.h | 36 ------------------------------ source3/lib/eventlog/eventlog.c | 1 + source3/lib/eventlog/eventlog.h | 43 ++++++++++++++++++++++++++++++++++++ source3/lib/eventlog/proto.h | 35 +++++++++++++++++++++++++++++ source3/rpc_server/srv_eventlog_nt.c | 1 + source3/utils/eventlogadm.c | 1 + source3/utils/net_eventlog.c | 1 + 9 files changed, 82 insertions(+), 78 deletions(-) delete mode 100644 source3/include/eventlog.h create mode 100644 source3/lib/eventlog/eventlog.h create mode 100644 source3/lib/eventlog/proto.h diff --git a/source3/include/eventlog.h b/source3/include/eventlog.h deleted file mode 100644 index 16affe3313..0000000000 --- a/source3/include/eventlog.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * RPC Pipe client / server routines - * Copyright (C) Marcin Krzysztof Porwit 2005. - * - * 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 . - */ - -/* Defines for TDB keys */ -#define EVT_OLDEST_ENTRY "INFO/oldest_entry" -#define EVT_NEXT_RECORD "INFO/next_record" -#define EVT_VERSION "INFO/version" -#define EVT_MAXSIZE "INFO/maxsize" -#define EVT_RETENTION "INFO/retention" - -#define ELOG_APPL "Application" -#define ELOG_SYS "System" -#define ELOG_SEC "Security" - -typedef struct elog_tdb { - struct elog_tdb *prev, *next; - char *name; - TDB_CONTEXT *tdb; - int ref_count; -} ELOG_TDB; - -#define ELOG_TDB_CTX(x) ((x)->tdb) - - -#define EVENTLOG_DATABASE_VERSION_V1 1 diff --git a/source3/include/includes.h b/source3/include/includes.h index 5b682bb4e3..9ab25569a4 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -686,7 +686,6 @@ struct ntlmssp_state; #include "../lib/async_req/async_sock.h" #include "talloc_dict.h" #include "services.h" -#include "eventlog.h" #include "../lib/util/smb_threads.h" #include "../lib/util/smb_threads_internal.h" #include "tldap.h" diff --git a/source3/include/proto.h b/source3/include/proto.h index 9c169ed11c..43de9e5b33 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -2107,7 +2107,6 @@ WERROR reg_apply_registry_entry(TALLOC_CTX *mem_ctx, uint32_t flags); -#include "librpc/gen_ndr/ndr_eventlog.h" #include "librpc/gen_ndr/ndr_krb5pac.h" #include "librpc/gen_ndr/ndr_spoolss.h" @@ -5760,41 +5759,6 @@ void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, uint32 auth_context_id); bool smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth); -/* The following definitions come from lib/eventlog/eventlog.c */ - -TDB_CONTEXT *elog_init_tdb( char *tdbfilename ); -char *elog_tdbname(TALLOC_CTX *ctx, const char *name ); -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 ); -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); -struct eventlog_Record_tdb *evlog_pull_record_tdb(TALLOC_CTX *mem_ctx, - TDB_CONTEXT *tdb, - uint32_t record_number); -NTSTATUS evlog_push_record_tdb(TALLOC_CTX *mem_ctx, - TDB_CONTEXT *tdb, - struct eventlog_Record_tdb *r, - uint32_t *record_number); -NTSTATUS evlog_push_record(TALLOC_CTX *mem_ctx, - TDB_CONTEXT *tdb, - struct EVENTLOGRECORD *r, - uint32_t *record_number); -struct EVENTLOGRECORD *evlog_pull_record(TALLOC_CTX *mem_ctx, - TDB_CONTEXT *tdb, - uint32_t record_number); -NTSTATUS evlog_evt_entry_to_tdb_entry(TALLOC_CTX *mem_ctx, - const struct EVENTLOGRECORD *e, - struct eventlog_Record_tdb *t); -NTSTATUS evlog_tdb_entry_to_evt_entry(TALLOC_CTX *mem_ctx, - const struct eventlog_Record_tdb *t, - struct EVENTLOGRECORD *e); -NTSTATUS evlog_convert_tdb_to_evt(TALLOC_CTX *mem_ctx, - ELOG_TDB *etdb, - DATA_BLOB *blob_p, - uint32_t *num_records_p); - /* The following definitions come from rpc_server/srv_eventlog_nt.c */ /* The following definitions come from rpc_server/srv_lsa_hnd.c */ diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c index dc14214e36..c218467c47 100644 --- a/source3/lib/eventlog/eventlog.c +++ b/source3/lib/eventlog/eventlog.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "lib/eventlog/eventlog.h" /* maintain a list of open eventlog tdbs with reference counts */ diff --git a/source3/lib/eventlog/eventlog.h b/source3/lib/eventlog/eventlog.h new file mode 100644 index 0000000000..29c25c3122 --- /dev/null +++ b/source3/lib/eventlog/eventlog.h @@ -0,0 +1,43 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Copyright (C) Marcin Krzysztof Porwit 2005. + * + * 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 . + */ + +/* Defines for TDB keys */ +#define EVT_OLDEST_ENTRY "INFO/oldest_entry" +#define EVT_NEXT_RECORD "INFO/next_record" +#define EVT_VERSION "INFO/version" +#define EVT_MAXSIZE "INFO/maxsize" +#define EVT_RETENTION "INFO/retention" + +#define ELOG_APPL "Application" +#define ELOG_SYS "System" +#define ELOG_SEC "Security" + +typedef struct elog_tdb { + struct elog_tdb *prev, *next; + char *name; + TDB_CONTEXT *tdb; + int ref_count; +} ELOG_TDB; + +#define ELOG_TDB_CTX(x) ((x)->tdb) + +#define EVENTLOG_DATABASE_VERSION_V1 1 + +#include "../librpc/gen_ndr/ndr_eventlog.h" +#include "lib/eventlog/proto.h" diff --git a/source3/lib/eventlog/proto.h b/source3/lib/eventlog/proto.h new file mode 100644 index 0000000000..21790d0795 --- /dev/null +++ b/source3/lib/eventlog/proto.h @@ -0,0 +1,35 @@ + +/* The following definitions come from lib/eventlog/eventlog.c */ + +TDB_CONTEXT *elog_init_tdb( char *tdbfilename ); +char *elog_tdbname(TALLOC_CTX *ctx, const char *name ); +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 ); +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); +struct eventlog_Record_tdb *evlog_pull_record_tdb(TALLOC_CTX *mem_ctx, + TDB_CONTEXT *tdb, + uint32_t record_number); +NTSTATUS evlog_push_record_tdb(TALLOC_CTX *mem_ctx, + TDB_CONTEXT *tdb, + struct eventlog_Record_tdb *r, + uint32_t *record_number); +NTSTATUS evlog_push_record(TALLOC_CTX *mem_ctx, + TDB_CONTEXT *tdb, + struct EVENTLOGRECORD *r, + uint32_t *record_number); +struct EVENTLOGRECORD *evlog_pull_record(TALLOC_CTX *mem_ctx, + TDB_CONTEXT *tdb, + uint32_t record_number); +NTSTATUS evlog_evt_entry_to_tdb_entry(TALLOC_CTX *mem_ctx, + const struct EVENTLOGRECORD *e, + struct eventlog_Record_tdb *t); +NTSTATUS evlog_tdb_entry_to_evt_entry(TALLOC_CTX *mem_ctx, + const struct eventlog_Record_tdb *t, + struct EVENTLOGRECORD *e); +NTSTATUS evlog_convert_tdb_to_evt(TALLOC_CTX *mem_ctx, + ELOG_TDB *etdb, + DATA_BLOB *blob_p, + uint32_t *num_records_p); diff --git a/source3/rpc_server/srv_eventlog_nt.c b/source3/rpc_server/srv_eventlog_nt.c index 52ecc89112..3b109558f0 100644 --- a/source3/rpc_server/srv_eventlog_nt.c +++ b/source3/rpc_server/srv_eventlog_nt.c @@ -22,6 +22,7 @@ #include "includes.h" #include "../librpc/gen_ndr/srv_eventlog.h" +#include "lib/eventlog/eventlog.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV diff --git a/source3/utils/eventlogadm.c b/source3/utils/eventlogadm.c index d94f25b42d..73d851db6f 100644 --- a/source3/utils/eventlogadm.c +++ b/source3/utils/eventlogadm.c @@ -23,6 +23,7 @@ #include "includes.h" +#include "lib/eventlog/eventlog.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_UTIL_EVENTLOG diff --git a/source3/utils/net_eventlog.c b/source3/utils/net_eventlog.c index c889efbf95..28a010c5a7 100644 --- a/source3/utils/net_eventlog.c +++ b/source3/utils/net_eventlog.c @@ -21,6 +21,7 @@ #include "includes.h" #include "utils/net.h" +#include "lib/eventlog/eventlog.h" /** * Dump an *evt win32 eventlog file -- cgit