The branch, v3-6-test has been updated via 991eaa7 s3-waf: fix the build after winreg and rpc services changes. via 90a3e5a s3-perfcount: Create the directory on tdb open. via e400e58 s3-rpc_server: Migrated spoolss to dcerpc_winreg_set_multi_sz. via 4ae49fb s3-rpc_server: Migrated spoolss to dcerpc_winreg_query_dword. via c5dbecb s3-rpc_server: Migrated spoolss to dcerpc_winreg_set_X. via 4f8c96c s3-rpc_server: Migrated spoolss to dcerpc_winreg_set_X. via a5050d5 s3-rpc_server: Migrated spoolss to dcerpc_winreg_set_dword. via e4c6204 s3-rpc_server: Migrated spoolss to dcerpc_winreg_set_sz.. via ae51aed s3-rpc_server: Migrated spoolss to dcerpc_winreg_enum_keys. via 7635e23 s3-services: Remove obsolete services_db.c. via e1c786f s3-smbd: Init the svcctl registry keys on service startup. via 48b65b0 s3-rpc_server: Added a winreg based svcctl registry init. via beacad3 s3-rpc_server: Added a svcctl shutdown function. via e5a4ad3 s3-services: Migrated svcctl registry functions to winreg. via c42bbfb s3-registry: Remove obsolete reg_eventlog. via 2d9df24 s3-smbd: Init the eventlog registry on service startup. via f9f350c s3-util: Moved eventlog_add_source to admin util. via 0665a11 s3-rpc_server: Added a winreg based eventlog registry init. via 2bc06e8 s3-rpc_server: Migrated eventlog to winreg. via b62eea7 s3-rpc_client: Added a winreg query security descriptor helper. via 64fa681 s3-rpc_client: Added a winreg set security descriptor helper. via 7404d5b s3-rpc_client: Added a winreg set binary helper. via 49ab580 s3-rpc_client: Added a winreg query sz helper. via 0a49f4b s3-rpc_client: Added a winreg helper to enum keys. via 74b7e62 s3-rpc_client: Added a winreg add multi sz helper. via 1a90e2b s3-rpc_client: Added a winreg query multi sz helper. via 3c6b1cd s3-rpc_client: Added a winreg set multi sz helper. via 07ff94f s3-rpc_client: Added a winreg set expand sz helper. via dc24407 s3-rpc_client: Added a winreg set sz helper. via 02aff4d s3-rpc_client: Added a winreg set dword helper. via cd9b8da s3-rpc_client: Added winreg query binary helper. via 7d4f6fc s3-rpc_client: Added winreg query dword helper. via 1362574 s3-rpc_client: Added dcerpc_winreg_int_openkey(). from b12b094 s3-waf: add support for --with-aio-support.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test - Log ----------------------------------------------------------------- commit 991eaa766f8414f6eb15a39c47d122dceb5147b4 Author: Günther Deschner <g...@samba.org> Date: Thu Feb 3 12:25:24 2011 +0100 s3-waf: fix the build after winreg and rpc services changes. Andreas, please check. Guenther Signed-off-by: Günther Deschner <g...@samba.org> Autobuild-User: Günther Deschner <g...@samba.org> Autobuild-Date: Mon Feb 7 13:18:41 CET 2011 on sn-devel-104 (cherry picked from commit 7637e1df8eca417a78d9949b3b776b51ae250d74) commit 90a3e5a9a1e322e89efa5b1c300bef9a1fc8e0d9 Author: Andreas Schneider <a...@samba.org> Date: Wed Feb 2 11:47:37 2011 +0100 s3-perfcount: Create the directory on tdb open. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit a3ee831f2dda047d32750a8c7b4a30b6b7eb7519) commit e400e58976368dc932095e6bbebd7b3f025713e2 Author: Andreas Schneider <a...@samba.org> Date: Tue Feb 1 15:33:02 2011 +0100 s3-rpc_server: Migrated spoolss to dcerpc_winreg_set_multi_sz. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 1c6276ce7a917d7599205e7b3f9640811c0be24b) commit 4ae49fb434853e31213409967661cd4f4f0b516f Author: Andreas Schneider <a...@samba.org> Date: Tue Feb 1 15:29:48 2011 +0100 s3-rpc_server: Migrated spoolss to dcerpc_winreg_query_dword. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 1f0c766fa6f776f7ec25cab8634e2ad1f6c7aa50) commit c5dbecb7ec7e848cb481d7158c8d42a8fecdd56d Author: Andreas Schneider <a...@samba.org> Date: Tue Feb 1 15:25:13 2011 +0100 s3-rpc_server: Migrated spoolss to dcerpc_winreg_set_X. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit df75045e0d52b01f650f40e62c65426b5ce2264e) commit 4f8c96c7b87ca513bbd4ad3f0255d029c841b2ae Author: Andreas Schneider <a...@samba.org> Date: Tue Feb 1 15:11:05 2011 +0100 s3-rpc_server: Migrated spoolss to dcerpc_winreg_set_X. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit ee817f63cec1036ff332667b1e1b0a2478bf51e5) commit a5050d558bbecee7c705bd010c40cab0c2f66cd6 Author: Andreas Schneider <a...@samba.org> Date: Tue Feb 1 14:58:08 2011 +0100 s3-rpc_server: Migrated spoolss to dcerpc_winreg_set_dword. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit e8bf397eb0765db529f9caad7d70639071bcf00c) commit e4c6204252551eaf358a170486c7ed9d5db7f622 Author: Andreas Schneider <a...@samba.org> Date: Tue Feb 1 14:48:11 2011 +0100 s3-rpc_server: Migrated spoolss to dcerpc_winreg_set_sz.. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 460aedc4b1e97a7721183e164f5231e735368b14) commit ae51aed9dd61e5ea9b649c9fee68a8d0e33b0995 Author: Andreas Schneider <a...@samba.org> Date: Tue Feb 1 14:28:39 2011 +0100 s3-rpc_server: Migrated spoolss to dcerpc_winreg_enum_keys. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 8238732330d3dde73b23750d9b5646bfe3d4a39a) commit 7635e232c64372aea4610a7ac03027852aa1a99e Author: Andreas Schneider <a...@samba.org> Date: Tue Feb 1 13:38:16 2011 +0100 s3-services: Remove obsolete services_db.c. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit c6255adc6f027cafeca7247ce58bbeae0733d45a) commit e1c786f91d0d34ac0d5bca748db127020eaadc58 Author: Andreas Schneider <a...@samba.org> Date: Tue Feb 1 11:50:10 2011 +0100 s3-smbd: Init the svcctl registry keys on service startup. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit b2ddfc642d0d6a39e6962c61dd178c69f0cd801b) commit 48b65b061c07f804eccc393c0993c62af97a26a3 Author: Andreas Schneider <a...@samba.org> Date: Mon Jan 31 16:40:16 2011 +0100 s3-rpc_server: Added a winreg based svcctl registry init. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit f1d5cea322f26aae23ee5fb57207648ec15f8218) commit beacad3570af1f934f9cbfd860fe5e48ffa434f2 Author: Andreas Schneider <a...@samba.org> Date: Tue Feb 1 11:49:33 2011 +0100 s3-rpc_server: Added a svcctl shutdown function. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 09dafc4a256c14db6ca8ed68b99d774e118f7051) commit e5a4ad3c68645654462d170bc4d83273f1c3e1c7 Author: Andreas Schneider <a...@samba.org> Date: Mon Jan 31 16:40:33 2011 +0100 s3-services: Migrated svcctl registry functions to winreg. This is a bigger commit. It moves the relevant function to svc_winreg_glue. We need to use them in the same commit else we have problems with prototypes in proto.h. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 96565db5f66f791968ed354fc8f39464ff0a7e5a) commit c42bbfb84bfab0b5b94c61372da2145da9baf0c5 Author: Andreas Schneider <a...@samba.org> Date: Fri Jan 28 12:37:18 2011 +0100 s3-registry: Remove obsolete reg_eventlog. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 1adbbeef32b71450b6c878ea34b431d19ea39523) commit 2d9df2488eaac31cbfcd2adba678e0fc075bdfa5 Author: Andreas Schneider <a...@samba.org> Date: Fri Jan 28 12:33:20 2011 +0100 s3-smbd: Init the eventlog registry on service startup. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit a3a38fdb553f978ae58bc0b62db93e1ca2908658) commit f9f350ca1feeb08d81fa1f06c5c6f70a23dbea47 Author: Andreas Schneider <a...@samba.org> Date: Thu Jan 27 18:06:16 2011 +0100 s3-util: Moved eventlog_add_source to admin util. This function is only used in the admin util. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 34e8a50e5a71ab0d31bd0c5375a84d3b3ecf61e9) commit 0665a11a049b681ebf278cead7417688d5d39772 Author: Andreas Schneider <a...@samba.org> Date: Thu Jan 27 19:22:02 2011 +0100 s3-rpc_server: Added a winreg based eventlog registry init. This enumerates the keys first and only creates them if they don't exist yet. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 22ea2933818824eb6cf2d760fc474922ca8bbe2c) commit 2bc06e8a56b9119396f7195012c2140c58d784f2 Author: Andreas Schneider <a...@samba.org> Date: Thu Jan 27 15:32:48 2011 +0100 s3-rpc_server: Migrated eventlog to winreg. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 75abfa6f949bcc2e472ae19084fa3309025caa1d) commit b62eea7ee3235124bb79cb26b0978193bc27874d Author: Andreas Schneider <a...@samba.org> Date: Tue Feb 1 11:04:16 2011 +0100 s3-rpc_client: Added a winreg query security descriptor helper. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 01b49b1a2b0442954a088035e133bd8f34fd811d) commit 64fa681f15066cd381483c3e5187e318f4835749 Author: Andreas Schneider <a...@samba.org> Date: Mon Jan 31 18:40:06 2011 +0100 s3-rpc_client: Added a winreg set security descriptor helper. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 35439a7b182c235eb8adfc2a6864867b486d1b6a) commit 7404d5b5530d15b1d31712acbf67e7dbd501cc41 Author: Andreas Schneider <a...@samba.org> Date: Mon Jan 31 18:35:06 2011 +0100 s3-rpc_client: Added a winreg set binary helper. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit a370b9605c98551c9dee5c34b53b92943182a1be) commit 49ab5806a0d779ca9d42469f59eb998f679839fa Author: Andreas Schneider <a...@samba.org> Date: Mon Jan 31 16:39:34 2011 +0100 s3-rpc_client: Added a winreg query sz helper. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 56963d1f44d137581627eec672b63993585ebf64) commit 0a49f4b300242dfe4c3b685a26b2dee8b073533d Author: Andreas Schneider <a...@samba.org> Date: Fri Jan 28 12:08:58 2011 +0100 s3-rpc_client: Added a winreg helper to enum keys. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 69e6db1a5354c09f038ca158e08f4426863dab34) commit 74b7e6261f7fd3be4c2919f4799d179772086709 Author: Andreas Schneider <a...@samba.org> Date: Fri Jan 28 10:43:49 2011 +0100 s3-rpc_client: Added a winreg add multi sz helper. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 8ed91d602774155859b9d9acaa5909a1a0a68079) commit 1a90e2bf9df63b7e7d60e1644dd800c063acbd75 Author: Andreas Schneider <a...@samba.org> Date: Fri Jan 28 10:07:57 2011 +0100 s3-rpc_client: Added a winreg query multi sz helper. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 8c119e47578e5dadaad32330a77a0cab8557a4a0) commit 3c6b1cd32145fd5fc74721afa57239cace59e9fd Author: Andreas Schneider <a...@samba.org> Date: Fri Jan 28 09:57:41 2011 +0100 s3-rpc_client: Added a winreg set multi sz helper. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 913426b0c3cd319aa120d4170a99706a007fcd51) commit 07ff94f76fe993760ed53bd7fcac9b425111a2ea Author: Andreas Schneider <a...@samba.org> Date: Fri Jan 28 09:50:48 2011 +0100 s3-rpc_client: Added a winreg set expand sz helper. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 34d3e85f35f5e1c38e686276bc8411fe6d559177) commit dc2440708cccda23d0573f310ca29fc9a65df5f8 Author: Andreas Schneider <a...@samba.org> Date: Fri Jan 28 09:45:44 2011 +0100 s3-rpc_client: Added a winreg set sz helper. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 4b32f6c9d54f0fef6b6f3ae056336221bfe867a3) commit 02aff4dace4aedb48c9d60a501ee3e047e703694 Author: Andreas Schneider <a...@samba.org> Date: Thu Jan 27 16:57:34 2011 +0100 s3-rpc_client: Added a winreg set dword helper. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit e5eb7582d30ec10c3fb89b380b35dffdc55595e1) commit cd9b8da82ab329f36763c225f03f96cfcff85b35 Author: Andreas Schneider <a...@samba.org> Date: Thu Jan 27 16:20:30 2011 +0100 s3-rpc_client: Added winreg query binary helper. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit d24bd4be9186d43c6b438b399aafa2bdff82737e) commit 7d4f6fcfecb7b036f9615a524e7eaa63e53ad181 Author: Andreas Schneider <a...@samba.org> Date: Thu Jan 27 15:20:58 2011 +0100 s3-rpc_client: Added winreg query dword helper. Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 9c7607d3d384240b2777aafa3ea634383431ec4d) commit 1362574b93a3b50beb31122b54ce518df4eff03b Author: Andreas Schneider <a...@samba.org> Date: Thu Jan 27 12:27:23 2011 +0100 s3-rpc_client: Added dcerpc_winreg_int_openkey(). Signed-off-by: Günther Deschner <g...@samba.org> (cherry picked from commit 12cd4002e66164a0a85ae0e4a17f1f0abaef7e42) ----------------------------------------------------------------------- Summary of changes: source3/Makefile.in | 17 +- source3/include/proto.h | 13 +- source3/registry/reg_eventlog.c | 387 ----------- source3/registry/reg_eventlog.h | 29 - source3/registry/reg_init_full.c | 7 - source3/registry/reg_perfcount.c | 20 +- source3/registry/reg_perfcount.h | 1 - source3/rpc_client/cli_winreg.c | 771 +++++++++++++++++++++ source3/rpc_client/cli_winreg.h | 384 +++++++++++ source3/rpc_client/cli_winreg_int.c | 134 ++++ source3/rpc_client/cli_winreg_int.h | 65 ++ source3/rpc_server/srv_eventlog_nt.c | 94 ++- source3/rpc_server/srv_eventlog_reg.c | 266 ++++++++ source3/rpc_server/srv_eventlog_reg.h | 29 + source3/rpc_server/srv_ntsvcs_nt.c | 6 +- source3/rpc_server/srv_rpc_register.c | 33 +- source3/rpc_server/srv_spoolss_util.c | 1210 ++++++++++++++------------------- source3/rpc_server/srv_svcctl_nt.c | 100 ++- source3/rpc_server/srv_svcctl_reg.c | 670 ++++++++++++++++++ source3/rpc_server/srv_svcctl_reg.h | 29 + source3/rpc_server/wscript_build | 10 +- source3/services/services_db.c | 726 -------------------- source3/services/svc_winreg_glue.c | 364 ++++++++++ source3/services/svc_winreg_glue.h | 57 ++ source3/utils/eventlogadm.c | 199 ++++++- source3/wscript_build | 19 +- 26 files changed, 3678 insertions(+), 1962 deletions(-) delete mode 100644 source3/registry/reg_eventlog.c delete mode 100644 source3/registry/reg_eventlog.h create mode 100644 source3/rpc_client/cli_winreg.c create mode 100644 source3/rpc_client/cli_winreg.h create mode 100644 source3/rpc_client/cli_winreg_int.c create mode 100644 source3/rpc_client/cli_winreg_int.h create mode 100644 source3/rpc_server/srv_eventlog_reg.c create mode 100644 source3/rpc_server/srv_eventlog_reg.h create mode 100644 source3/rpc_server/srv_svcctl_reg.c create mode 100644 source3/rpc_server/srv_svcctl_reg.h delete mode 100644 source3/services/services_db.c create mode 100644 source3/services/svc_winreg_glue.c create mode 100644 source3/services/svc_winreg_glue.h Changeset truncated at 500 lines: diff --git a/source3/Makefile.in b/source3/Makefile.in index 8e36b57..7f47bca 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -347,7 +347,11 @@ LIBCLI_SPOOLSS_OBJ = librpc/gen_ndr/ndr_spoolss_c.o \ LIBCLI_EVENTLOG_OBJ = librpc/gen_ndr/ndr_eventlog_c.o -LIBCLI_WINREG_OBJ = librpc/gen_ndr/ndr_winreg_c.o +LIBCLI_WINREG_OBJ = librpc/gen_ndr/ndr_winreg_c.o \ + rpc_client/cli_winreg.o + +LIBCLI_WINREG_INT_OBJ = $(LIBCLI_WINREG_OBJ) \ + rpc_client/cli_winreg_int.o LIBCLI_NTSVCS_OBJ = librpc/gen_ndr/ndr_ntsvcs_c.o @@ -651,7 +655,6 @@ REG_SMBCONF_OBJ = $(REG_BASE_OBJ) \ REG_FULL_OBJ = $(REG_SMBCONF_OBJ) \ $(REG_BACKENDS_EXTRA_OBJ) \ $(REG_INIT_FULL_OBJ) \ - registry/reg_eventlog.o \ registry/reg_perfcount.o \ librpc/gen_ndr/ndr_perfcount.o @@ -684,8 +687,10 @@ RPC_WKSSVC_OBJ = librpc/gen_ndr/srv_wkssvc.o \ rpc_server/srv_wkssvc_nt.o RPC_SVCCTL_OBJ = rpc_server/srv_svcctl_nt.o \ + rpc_server/srv_svcctl_reg.o \ librpc/gen_ndr/srv_svcctl.o \ - services/svc_spoolss.o services/svc_rcinit.o services/services_db.o \ + services/svc_winreg_glue.o \ + services/svc_spoolss.o services/svc_rcinit.o \ services/svc_netlogon.o services/svc_winreg.o \ services/svc_wins.o @@ -700,6 +705,7 @@ RPC_SPOOLSS_OBJ = rpc_server/srv_spoolss_nt.o \ librpc/gen_ndr/srv_spoolss.o RPC_EVENTLOG_OBJ = rpc_server/srv_eventlog_nt.o \ + rpc_server/srv_eventlog_reg.o \ $(LIB_EVENTLOG_OBJ) librpc/gen_ndr/srv_eventlog.o NPA_TSTREAM_OBJ = ../libcli/named_pipe_auth/npa_tstream.o \ @@ -730,7 +736,7 @@ RPC_SERVER_OBJ = $(RPC_LSARPC_OBJ) $(RPC_WINREG_OBJ) $(RPC_INITSHUTDOWN_OBJ) \ $(RPC_SAMR_OBJ) $(RPC_RPCECHO_OBJ) $(RPC_EPMAPPER_OBJ) \ $(RPC_PIPE_OBJ) $(NPA_TSTREAM_OBJ) \ $(LIBCLI_SPOOLSS_OBJ) \ - $(LIBCLI_WINREG_OBJ) \ + $(LIBCLI_WINREG_INT_OBJ) \ $(LIBCLI_SRVSVC_OBJ) \ $(LIBCLI_LSA_OBJ) \ $(LIBCLI_SAMR_OBJ) \ @@ -1256,8 +1262,7 @@ SMBCQUOTAS_OBJ = utils/smbcquotas.o $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ EVTLOGADM_OBJ0 = utils/eventlogadm.o EVTLOGADM_OBJ = $(EVTLOGADM_OBJ0) $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \ - $(LIBSMB_ERR_OBJ) \ - registry/reg_eventlog.o $(LIB_EVENTLOG_OBJ) \ + $(LIBSMB_ERR_OBJ) $(LIB_EVENTLOG_OBJ) \ librpc/gen_ndr/ndr_eventlog.o \ librpc/gen_ndr/ndr_lsa.o diff --git a/source3/include/proto.h b/source3/include/proto.h index 94cd0a9..ddb5c5e 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4372,6 +4372,7 @@ char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname); /* The following definitions come from rpc_server/srv_svcctl_nt.c */ bool init_service_op_table( void ); +bool shutdown_service_op_table(void); /* The following definitions come from rpcclient/cmd_dfs.c */ @@ -4412,18 +4413,6 @@ bool init_service_op_table( void ); /* The following definitions come from rpcclient/rpcclient.c */ -/* The following definitions come from services/services_db.c */ - -void svcctl_init_keys( void ); -struct security_descriptor *svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, struct security_token *token ); -bool svcctl_set_secdesc(const char *name, struct security_descriptor *sec_desc, - struct security_token *token); -const char *svcctl_get_string_value(TALLOC_CTX *ctx, const char *key_name, - const char *value_name, - struct security_token *token); -const char *svcctl_lookup_dispname(TALLOC_CTX *ctx, const char *name, struct security_token *token ); -const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, struct security_token *token ); - /* The following definitions come from services/svc_netlogon.c */ diff --git a/source3/registry/reg_eventlog.c b/source3/registry/reg_eventlog.c deleted file mode 100644 index 6bedf46..0000000 --- a/source3/registry/reg_eventlog.c +++ /dev/null @@ -1,387 +0,0 @@ - -/* - * Unix SMB/CIFS implementation. - * Virtual Windows Registry Layer - * Copyright (C) Marcin Krzysztof Porwit 2005, - * Copyright (C) Brian Moran 2005. - * Copyright (C) Gerald (Jerry) Carter 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 <http://www.gnu.org/licenses/>. - */ - -#include "includes.h" -#include "registry.h" -#include "reg_backend_db.h" -#include "reg_eventlog.h" -#include "reg_objects.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_REGISTRY - -/********************************************************************** - for an eventlog, add in the default values -*********************************************************************/ - -bool eventlog_init_keys(void) -{ - /* Find all of the eventlogs, add keys for each of them */ - const char **elogs = lp_eventlog_list(); - char *evtlogpath = NULL; - char *evtfilepath = NULL; - struct regsubkey_ctr *subkeys; - struct regval_ctr *values; - uint32 uiMaxSize; - uint32 uiRetention; - uint32 uiCategoryCount; - DATA_BLOB data; - TALLOC_CTX *ctx = talloc_tos(); - WERROR werr; - - while (elogs && *elogs) { - werr = regsubkey_ctr_init(ctx, &subkeys); - if (!W_ERROR_IS_OK(werr)) { - DEBUG( 0, ( "talloc() failure!\n" ) ); - return False; - } - regdb_fetch_keys(KEY_EVENTLOG, subkeys); - regsubkey_ctr_addkey( subkeys, *elogs ); - if ( !regdb_store_keys( KEY_EVENTLOG, subkeys ) ) { - TALLOC_FREE(subkeys); - return False; - } - TALLOC_FREE(subkeys); - - /* add in the key of form KEY_EVENTLOG/Application */ - DEBUG( 5, - ( "Adding key of [%s] to path of [%s]\n", *elogs, - KEY_EVENTLOG ) ); - - evtlogpath = talloc_asprintf(ctx, "%s\\%s", - KEY_EVENTLOG, *elogs); - if (!evtlogpath) { - return false; - } - /* add in the key of form KEY_EVENTLOG/Application/Application */ - DEBUG( 5, - ( "Adding key of [%s] to path of [%s]\n", *elogs, - evtlogpath ) ); - werr = regsubkey_ctr_init(ctx, &subkeys); - if (!W_ERROR_IS_OK(werr)) { - DEBUG( 0, ( "talloc() failure!\n" ) ); - return False; - } - regdb_fetch_keys( evtlogpath, subkeys ); - regsubkey_ctr_addkey( subkeys, *elogs ); - - if ( !regdb_store_keys( evtlogpath, subkeys ) ) { - TALLOC_FREE(subkeys); - return False; - } - TALLOC_FREE( subkeys ); - - /* now add the values to the KEY_EVENTLOG/Application form key */ - - werr = regval_ctr_init(ctx, &values); - if (!W_ERROR_IS_OK(werr)) { - DEBUG( 0, ( "talloc() failure!\n" ) ); - return False; - } - DEBUG( 5, - ( "Storing values to eventlog path of [%s]\n", - evtlogpath ) ); - regdb_fetch_values( evtlogpath, values ); - - - if (!regval_ctr_key_exists(values, "MaxSize")) { - - /* assume we have none, add them all */ - - /* hard code some initial values */ - - /* uiDisplayNameId = 0x00000100; */ - uiMaxSize = 0x00080000; - uiRetention = 0x93A80; - - regval_ctr_addvalue(values, "MaxSize", REG_DWORD, - (uint8 *)&uiMaxSize, - sizeof(uint32)); - - regval_ctr_addvalue(values, "Retention", REG_DWORD, - (uint8 *)&uiRetention, - sizeof(uint32)); - - regval_ctr_addvalue_sz(values, "PrimaryModule", *elogs); - push_reg_sz(talloc_tos(), &data, *elogs); - - regval_ctr_addvalue(values, "Sources", REG_MULTI_SZ, - data.data, - data.length); - - evtfilepath = talloc_asprintf(ctx, - "%%SystemRoot%%\\system32\\config\\%s.tdb", - *elogs); - if (!evtfilepath) { - TALLOC_FREE(values); - } - push_reg_sz(talloc_tos(), &data, evtfilepath); - regval_ctr_addvalue(values, "File", REG_EXPAND_SZ, data.data, - data.length); - regdb_store_values(evtlogpath, values); - - } - - TALLOC_FREE(values); - - /* now do the values under KEY_EVENTLOG/Application/Application */ - TALLOC_FREE(evtlogpath); - evtlogpath = talloc_asprintf(ctx, "%s\\%s\\%s", - KEY_EVENTLOG, *elogs, *elogs); - if (!evtlogpath) { - return false; - } - - werr = regval_ctr_init(ctx, &values); - if (!W_ERROR_IS_OK(werr)) { - DEBUG( 0, ( "talloc() failure!\n" ) ); - return False; - } - DEBUG( 5, - ( "Storing values to eventlog path of [%s]\n", - evtlogpath)); - regdb_fetch_values(evtlogpath, values); - if (!regval_ctr_key_exists( values, "CategoryCount")) { - - /* hard code some initial values */ - - uiCategoryCount = 0x00000007; - regval_ctr_addvalue( values, "CategoryCount", - REG_DWORD, - (uint8 *) &uiCategoryCount, - sizeof( uint32 ) ); - push_reg_sz(talloc_tos(), &data, - "%SystemRoot%\\system32\\eventlog.dll"); - - regval_ctr_addvalue( values, "CategoryMessageFile", - REG_EXPAND_SZ, - data.data, - data.length); - regdb_store_values( evtlogpath, values ); - } - TALLOC_FREE(values); - elogs++; - } - - return true; -} - -/********************************************************************* - for an eventlog, add in a source name. If the eventlog doesn't - exist (not in the list) do nothing. If a source for the log - already exists, change the information (remove, replace) -*********************************************************************/ - -bool eventlog_add_source( const char *eventlog, const char *sourcename, - const char *messagefile ) -{ - /* Find all of the eventlogs, add keys for each of them */ - /* need to add to the value KEY_EVENTLOG/<eventlog>/Sources string (Creating if necessary) - need to add KEY of source to KEY_EVENTLOG/<eventlog>/<source> */ - - const char **elogs = lp_eventlog_list( ); - const char **wrklist, **wp; - char *evtlogpath = NULL; - struct regsubkey_ctr *subkeys; - struct regval_ctr *values; - struct regval_blob *rval; - int ii = 0; - bool already_in; - int i; - int numsources = 0; - TALLOC_CTX *ctx = talloc_tos(); - WERROR werr; - DATA_BLOB blob; - - if (!elogs) { - return False; - } - - for ( i = 0; elogs[i]; i++ ) { - if ( strequal( elogs[i], eventlog ) ) - break; - } - - if ( !elogs[i] ) { - DEBUG( 0, - ( "Eventlog [%s] not found in list of valid event logs\n", - eventlog ) ); - return false; /* invalid named passed in */ - } - - /* have to assume that the evenlog key itself exists at this point */ - /* add in a key of [sourcename] under the eventlog key */ - - /* todo add to Sources */ - - werr = regval_ctr_init(ctx, &values); - if(!W_ERROR_IS_OK(werr)) { - DEBUG( 0, ( "talloc() failure!\n" )); - return false; - } - - evtlogpath = talloc_asprintf(ctx, "%s\\%s", KEY_EVENTLOG, eventlog); - if (!evtlogpath) { - TALLOC_FREE(values); - return false; - } - - regdb_fetch_values( evtlogpath, values ); - - - if ( !( rval = regval_ctr_getvalue( values, "Sources" ) ) ) { - DEBUG( 0, ( "No Sources value for [%s]!\n", eventlog ) ); - return False; - } - /* perhaps this adding a new string to a multi_sz should be a fn? */ - /* check to see if it's there already */ - - if ( regval_type(rval) != REG_MULTI_SZ ) { - DEBUG( 0, - ( "Wrong type for Sources, should be REG_MULTI_SZ\n" ) ); - return False; - } - /* convert to a 'regulah' chars to do some comparisons */ - - already_in = False; - wrklist = NULL; - dump_data(1, regval_data_p(rval), regval_size(rval)); - - blob = data_blob_const(regval_data_p(rval), regval_size(rval)); - if (!pull_reg_multi_sz(talloc_tos(), &blob, &wrklist)) { - return false; - } - - for (ii=0; wrklist[ii]; ii++) { - numsources++; - } - - if (numsources > 0) { - /* see if it's in there already */ - wp = wrklist; - - while (wp && *wp ) { - if ( strequal( *wp, sourcename ) ) { - DEBUG( 5, - ( "Source name [%s] already in list for [%s] \n", - sourcename, eventlog ) ); - already_in = True; - break; - } - wp++; - } - } else { - DEBUG( 3, - ( "Nothing in the sources list, this might be a problem\n" ) ); - } - - wp = wrklist; - - if ( !already_in ) { - /* make a new list with an additional entry; copy values, add another */ - wp = TALLOC_ARRAY(ctx, const char *, numsources + 2 ); - - if ( !wp ) { - DEBUG( 0, ( "talloc() failed \n" ) ); - return False; - } - memcpy( wp, wrklist, sizeof( char * ) * numsources ); - *( wp + numsources ) = ( char * ) sourcename; - *( wp + numsources + 1 ) = NULL; - if (!push_reg_multi_sz(ctx, &blob, wp)) { - return false; - } - dump_data( 1, blob.data, blob.length); - regval_ctr_addvalue( values, "Sources", REG_MULTI_SZ, - blob.data, blob.length); - regdb_store_values( evtlogpath, values ); - data_blob_free(&blob); - } else { - DEBUG( 3, - ( "Source name [%s] found in existing list of sources\n", - sourcename ) ); - } - TALLOC_FREE(values); - TALLOC_FREE(wrklist); /* */ - - werr = regsubkey_ctr_init(ctx, &subkeys); - if (!W_ERROR_IS_OK(werr)) { - DEBUG( 0, ( "talloc() failure!\n" ) ); - return False; - } - TALLOC_FREE(evtlogpath); - evtlogpath = talloc_asprintf(ctx, "%s\\%s", KEY_EVENTLOG, eventlog ); - if (!evtlogpath) { - TALLOC_FREE(subkeys); - return false; - } - - regdb_fetch_keys( evtlogpath, subkeys ); - - if ( !regsubkey_ctr_key_exists( subkeys, sourcename ) ) { - DEBUG( 5, - ( " Source name [%s] for eventlog [%s] didn't exist, adding \n", - sourcename, eventlog ) ); - regsubkey_ctr_addkey( subkeys, sourcename ); - if ( !regdb_store_keys( evtlogpath, subkeys ) ) - return False; - } - TALLOC_FREE(subkeys); - - /* at this point KEY_EVENTLOG/<eventlog>/<sourcename> key is in there. Now need to add EventMessageFile */ - - /* now allocate room for the source's subkeys */ - - werr = regsubkey_ctr_init(ctx, &subkeys); - if (!W_ERROR_IS_OK(werr)) { - DEBUG( 0, ( "talloc() failure!\n" ) ); - return False; - } - TALLOC_FREE(evtlogpath); - evtlogpath = talloc_asprintf(ctx, "%s\\%s\\%s", - KEY_EVENTLOG, eventlog, sourcename); - if (!evtlogpath) { - TALLOC_FREE(subkeys); - return false; - } - - regdb_fetch_keys( evtlogpath, subkeys ); - - /* now add the values to the KEY_EVENTLOG/Application form key */ - werr = regval_ctr_init(ctx, &values); - if (!W_ERROR_IS_OK(werr)) { - DEBUG( 0, ( "talloc() failure!\n" ) ); - return False; - } - DEBUG( 5, - ( "Storing EventMessageFile [%s] to eventlog path of [%s]\n", - messagefile, evtlogpath ) ); - - regdb_fetch_values( evtlogpath, values ); - - regval_ctr_addvalue_sz(values, "EventMessageFile", messagefile); - regdb_store_values( evtlogpath, values ); - - TALLOC_FREE(values); - - return True; -} diff --git a/source3/registry/reg_eventlog.h b/source3/registry/reg_eventlog.h deleted file mode 100644 index 69f2f99..0000000 --- a/source3/registry/reg_eventlog.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * Virtual Windows Registry Layer - * Copyright (C) Marcin Krzysztof Porwit 2005, - * Copyright (C) Brian Moran 2005. - * Copyright (C) Gerald (Jerry) Carter 2005. -- Samba Shared Repository