[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Mon Nov 20 04:50:02 UTC 2023


The branch, master has been updated
       via  5119d5540de s4-winreg: fix dcesrv_winreg_EnumValue behavior
       via  1fd0689f0ef s3-winreg: fix _winreg_EnumValue behavior
       via  43a8a03767a s4-torture: add test to check for Windows behavior of EnumValue call
       via  36745d63d68 s4-torture: add torture_assert_werr_equal_goto and torture_assert_werr_ok_goto macros
       via  9501dbeeb1e s3-rpcclient: add winreg_enumval command
       via  baa67024bca s4/server.c: move some log messages from ERR to NOTICE
       via  55d895dc422 profile: issues info message with lower log level
       via  72f20311acc source3/nmbd/nmbd.c: use DBG_STARTUP_NOTICE
       via  50337acaa56 lib/util/become_daemon.c: use DBG_STARTUP_NOTICE
       via  bb370b9381e README.Coding.md: add DBG_STARTUP_NOTICE macro
       via  159cfde446c logging: use DBG_STARTUP_NOTICE for startup message
       via  ccfe345fece debug.h: introduce DEBUG_STARTUP_NOTICE
       via  b7631bf603f lib/util: move copyright define to copyright.h
      from  19105f51d03 vfs_ceph: Fix some uninitialized structs and pointers

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5119d5540de6fa56cb92c82a2bf719c6656a2988
Author: Günther Deschner <gd at samba.org>
Date:   Thu Nov 16 21:05:12 2023 +0100

    s4-winreg: fix dcesrv_winreg_EnumValue behavior
    
    When returning WERR_MORE_DATA the winreg server needs to indicate the
    required buffer size.
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Mon Nov 20 04:50:00 UTC 2023 on atb-devel-224

commit 1fd0689f0ef3e833ffd23683d89fa39077a7ce63
Author: Günther Deschner <gd at samba.org>
Date:   Wed Nov 15 17:13:20 2023 +0100

    s3-winreg: fix _winreg_EnumValue behavior
    
    When returning WERR_MORE_DATA the winreg server needs to indicate the
    required buffer size.
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 43a8a03767a0758e9dbe7a4d3473bfba4aa784c3
Author: Günther Deschner <gd at samba.org>
Date:   Wed Nov 15 17:36:46 2023 +0100

    s4-torture: add test to check for Windows behavior of EnumValue call
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 36745d63d687bdd310be0415c1a871a65a5ee724
Author: Günther Deschner <gd at samba.org>
Date:   Wed Nov 15 19:07:32 2023 +0100

    s4-torture: add torture_assert_werr_equal_goto and torture_assert_werr_ok_goto macros
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 9501dbeeb1e98ce0dfe2f6a6df63605734bd4ae4
Author: Günther Deschner <gd at samba.org>
Date:   Mon Nov 13 16:49:32 2023 +0100

    s3-rpcclient: add winreg_enumval command
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit baa67024bca391f2e212b91131f544cc911c6895
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Sep 18 13:45:54 2023 +0200

    s4/server.c: move some log messages from ERR to NOTICE
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 55d895dc42248ad524a10812b9975ac05a722fdc
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Sep 18 23:42:31 2023 +0200

    profile: issues info message with lower log level
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 72f20311acc4ab8851f18ac2b87f7ecc7803afad
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Sep 18 14:35:55 2023 +0200

    source3/nmbd/nmbd.c: use DBG_STARTUP_NOTICE
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 50337acaa566b6696e035e38f6408f65805182a0
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Sep 18 14:34:29 2023 +0200

    lib/util/become_daemon.c: use DBG_STARTUP_NOTICE
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit bb370b9381e5d223ff4ac62f612888f90a63fcc5
Author: Björn Jacke <bj at sernet.de>
Date:   Wed Nov 15 19:44:38 2023 +0100

    README.Coding.md: add DBG_STARTUP_NOTICE macro
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 159cfde446c95c387ef212be103b109ea0dca93d
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Jun 5 18:10:07 2023 +0200

    logging: use DBG_STARTUP_NOTICE for startup message
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ccfe345fece0a5a44d766fb9426d43c2e046d040
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Sep 18 13:48:06 2023 +0200

    debug.h: introduce DEBUG_STARTUP_NOTICE
    
    this is log level -1 and lowest syslog priority. This is used for start up
    messages and copyright notices, which should always be printed but which are no
    errors or warnings.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b7631bf603fbce9b80b19410f0680ce8c4170a1b
Author: Björn Jacke <bj at sernet.de>
Date:   Tue Jun 6 17:25:35 2023 +0200

    lib/util: move copyright define to copyright.h
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 README.Coding.md                                   |  11 +-
 lib/torture/torture.h                              |  12 ++
 lib/util/become_daemon.c                           |   2 +-
 .../echo_server.h => lib/util/copyright.h          |  17 +--
 lib/util/debug.h                                   |   2 +
 source3/include/includes.h                         |   3 +
 source3/include/smb.h                              |   3 -
 source3/nmbd/nmbd.c                                |   4 +-
 source3/profile/profile_dummy.c                    |   2 +-
 source3/rpc_server/rpc_host.c                      |   6 +-
 source3/rpc_server/rpc_worker.c                    |   8 +-
 source3/rpc_server/winreg/srv_winreg_nt.c          |   1 +
 source3/rpcclient/cmd_winreg.c                     | 144 ++++++++++++++++++++-
 source3/smbd/server.c                              |   5 +-
 source3/winbindd/winbindd.c                        |   5 +-
 source4/include/includes.h                         |   3 +
 source4/rpc_server/winreg/rpc_winreg.c             |   8 +-
 source4/samba/server.c                             |  11 +-
 source4/torture/rpc/winreg.c                       |  90 +++++++++++++
 19 files changed, 290 insertions(+), 47 deletions(-)
 copy source4/echo_server/echo_server.h => lib/util/copyright.h (70%)


Changeset truncated at 500 lines:

diff --git a/README.Coding.md b/README.Coding.md
index 76f2c70e95a..132f3f4fa58 100644
--- a/README.Coding.md
+++ b/README.Coding.md
@@ -539,11 +539,12 @@ It should be:
 Use these following macros instead of DEBUG:
 
 ```
-DBG_ERR         log level 0		error conditions
-DBG_WARNING     log level 1		warning conditions
-DBG_NOTICE      log level 3		normal, but significant, condition
-DBG_INFO        log level 5		informational message
-DBG_DEBUG       log level 10		debug-level message
+DBG_STARTUP_NOTICE  log level -1	startup like notice
+DBG_ERR             log level 0		error conditions
+DBG_WARNING         log level 1		warning conditions
+DBG_NOTICE          log level 3		normal, but significant, condition
+DBG_INFO            log level 5		informational message
+DBG_DEBUG           log level 10	debug-level message
 ```
 
 Example usage:
diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index ad343cb030b..2d4376a3eb3 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -307,6 +307,15 @@ void torture_result(struct torture_context *test,
 	} \
 	} while (0)
 
+#define torture_assert_werr_equal_goto(torture_ctx, got, expected, ret, label, cmt) \
+	do { WERROR __got = got, __expected = expected; \
+	if (!W_ERROR_EQUAL(__got, __expected)) { \
+		torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %s, expected %s: %s", win_errstr(__got), win_errstr(__expected), cmt); \
+		ret = false; \
+		goto label; \
+	} \
+	} while (0)
+
 #define torture_assert_ntstatus_equal(torture_ctx,got,expected,cmt) \
 	do { NTSTATUS __got = got, __expected = expected; \
 	if (!NT_STATUS_EQUAL(__got, __expected)) { \
@@ -802,6 +811,9 @@ static inline void torture_dump_data_str_cb(const char *buf, void *private_data)
 #define torture_assert_werr_ok(torture_ctx,expr,cmt) \
 		torture_assert_werr_equal(torture_ctx,expr,WERR_OK,cmt)
 
+#define torture_assert_werr_ok_goto(torture_ctx,expr,ret,label,cmt) \
+		torture_assert_werr_equal_goto(torture_ctx,expr,WERR_OK,ret,label,cmt)
+
 #define torture_assert_ndr_success(torture_ctx,expr,cmt) \
 		torture_assert_ndr_err_equal(torture_ctx,expr,NDR_ERR_SUCCESS,cmt)
 
diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c
index 9424656d403..c6795c585c8 100644
--- a/lib/util/become_daemon.c
+++ b/lib/util/become_daemon.c
@@ -147,5 +147,5 @@ void daemon_status(const char *daemon, const char *msg)
 		sd_notifyf(0, "STATUS=%s: %s", daemon, msg);
 	}
 #endif
-	DBG_ERR("daemon '%s' : %s\n", daemon, msg);
+	DBG_STARTUP_NOTICE("daemon '%s' : %s\n", daemon, msg);
 }
diff --git a/source4/echo_server/echo_server.h b/lib/util/copyright.h
similarity index 70%
copy from source4/echo_server/echo_server.h
copy to lib/util/copyright.h
index 3c3e1ae9349..a29f2285d13 100644
--- a/source4/echo_server/echo_server.h
+++ b/lib/util/copyright.h
@@ -1,9 +1,7 @@
 /*
    Unix SMB/CIFS implementation.
 
-   Echo structures, server service example
-
-   Copyright (C) 2010 Kai Blin  <kai at samba.org>
+   Copyright (C) Björn Jacke 2023
 
    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
@@ -19,15 +17,12 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef __ECHO_SERVER_H__
-#define __ECHO_SERVER_H__
+#ifndef __LIB_UTIL_COPYRIGHT_H__
+#define __LIB_UTIL_COPYRIGHT_H__
 
-struct task_server;
+/* logged when starting the various Samba daemons */
+#define COPYRIGHT_STARTUP_MESSAGE	"Copyright Andrew Tridgell and the Samba Team 1992-2023"
 
-struct echo_server {
-        struct task_server *task;
-};
+#endif /* __LIB_UTIL_COPYRIGHT_H__ */
 
-#define ECHO_SERVICE_PORT 7
 
-#endif /*__ECHO_SERVER_H__*/
diff --git a/lib/util/debug.h b/lib/util/debug.h
index dc86fa8acee..90230a2d88f 100644
--- a/lib/util/debug.h
+++ b/lib/util/debug.h
@@ -269,12 +269,14 @@ void debuglevel_set_class(size_t idx, int level);
 /*
  * Debug levels matching RFC 3164
  */
+#define DBGLVL_STARTUP_NOTICE	 -1	/* startup notice */
 #define DBGLVL_ERR	 0	/* error conditions */
 #define DBGLVL_WARNING	 1	/* warning conditions */
 #define DBGLVL_NOTICE	 3	/* normal, but significant, condition */
 #define DBGLVL_INFO	 5	/* informational message */
 #define DBGLVL_DEBUG	10	/* debug-level message */
 
+#define DBG_STARTUP_NOTICE(...)	DBG_PREFIX(DBGLVL_STARTUP_NOTICE,	(__VA_ARGS__))
 #define DBG_ERR(...)		DBG_PREFIX(DBGLVL_ERR,		(__VA_ARGS__))
 #define DBG_WARNING(...)	DBG_PREFIX(DBGLVL_WARNING,	(__VA_ARGS__))
 #define DBG_NOTICE(...)		DBG_PREFIX(DBGLVL_NOTICE,	(__VA_ARGS__))
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 02beb0a0c88..8bb6ee88803 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -242,6 +242,9 @@ enum timestamp_set_resolution {
 typedef char fstring[FSTRING_LEN];
 #endif
 
+/* copyright define */
+#include "../lib/util/copyright.h"
+
 /* debug.h need to be included before samba_util.h for the macro SMB_ASSERT */
 #include "../lib/util/debug.h"
 
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 487a8b316d8..81d761d2280 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -29,9 +29,6 @@
 #include "libcli/smb/smb_common.h"
 #include "libds/common/roles.h"
 
-/* logged when starting the various Samba daemons */
-#define COPYRIGHT_STARTUP_MESSAGE	"Copyright Andrew Tridgell and the Samba Team 1992-2023"
-
 #define LARGE_WRITEX_HDR_SIZE 65
 #define LARGE_WRITEX_BUFFER_SIZE (128*1024)
 
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index f4ffad66c8b..63a81a17326 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -898,7 +898,9 @@ static bool open_sockets(bool isdaemon, int port)
 
 	reopen_logs();
 
-	DBG_ERR("nmbd version %s started.\n%s\n", samba_version_string(), COPYRIGHT_STARTUP_MESSAGE);
+	DBG_STARTUP_NOTICE("nmbd version %s started.\n"
+			COPYRIGHT_STARTUP_MESSAGE "\n",
+		samba_version_string());
 
 	if (lp_server_role() == ROLE_ACTIVE_DIRECTORY_DC
 	    && !lp_parm_bool(-1, "server role check", "inhibit", false)) {
diff --git a/source3/profile/profile_dummy.c b/source3/profile/profile_dummy.c
index 7d34d209fce..5d3213eec1a 100644
--- a/source3/profile/profile_dummy.c
+++ b/source3/profile/profile_dummy.c
@@ -27,5 +27,5 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
 
 void set_profile_level(int level, const struct server_id *src)
 {
-	DEBUG(1,("INFO: Profiling support unavailable in this build.\n"));
+	DBG_NOTICE("INFO: Profiling support unavailable in this build.\n");
 }
diff --git a/source3/rpc_server/rpc_host.c b/source3/rpc_server/rpc_host.c
index 337076b5063..c3c4cb97e21 100644
--- a/source3/rpc_server/rpc_host.c
+++ b/source3/rpc_server/rpc_host.c
@@ -2902,10 +2902,10 @@ int main(int argc, const char *argv[])
 
 	reopen_logs();
 
-	DEBUG(0, ("%s version %s started.\n",
+	DBG_STARTUP_NOTICE("%s version %s started.\n"
+			COPYRIGHT_STARTUP_MESSAGE "\n",
 		  progname,
-		  samba_version_string()));
-	DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE));
+		  samba_version_string());
 
 	(void)winbind_off();
 	ok = init_guest_session_info(frame);
diff --git a/source3/rpc_server/rpc_worker.c b/source3/rpc_server/rpc_worker.c
index 8ed7444e003..691e0ec57f0 100644
--- a/source3/rpc_server/rpc_worker.c
+++ b/source3/rpc_server/rpc_worker.c
@@ -1152,10 +1152,10 @@ int rpc_worker_main(
 
 	reopen_logs();
 
-	DEBUG(0, ("%s version %s started.\n",
-		  progname,
-		  samba_version_string()));
-	DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE));
+	DBG_STARTUP_NOTICE("%s version %s started.\n"
+			COPYRIGHT_STARTUP_MESSAGE "\n",
+		progname,
+		samba_version_string());
 
 	msg_ctx = global_messaging_context();
 	if (msg_ctx == NULL) {
diff --git a/source3/rpc_server/winreg/srv_winreg_nt.c b/source3/rpc_server/winreg/srv_winreg_nt.c
index 67e81422e4c..132213a6e86 100644
--- a/source3/rpc_server/winreg/srv_winreg_nt.c
+++ b/source3/rpc_server/winreg/srv_winreg_nt.c
@@ -502,6 +502,7 @@ WERROR _winreg_EnumValue(struct pipes_struct *p,
 		}
 
 		if (val->data.length > *r->out.size) {
+			*r->out.size = val->data.length;
 			return WERR_MORE_DATA;
 		}
 
diff --git a/source3/rpcclient/cmd_winreg.c b/source3/rpcclient/cmd_winreg.c
index 5821ec9d734..26fa146cedd 100644
--- a/source3/rpcclient/cmd_winreg.c
+++ b/source3/rpcclient/cmd_winreg.c
@@ -111,16 +111,16 @@ static void display_winreg_data(const char *v,
 
 	switch (type) {
 	case REG_DWORD:
-		printf("%s: REG_DWORD: 0x%08x\n", v, r.value);
+		printf("%-20s: REG_DWORD: 0x%08x\n", v, r.value);
 		break;
 	case REG_SZ:
-		printf("%s: REG_SZ: %s\n", v, r.string);
+		printf("%-20s: REG_SZ: %s\n", v, r.string);
 		break;
 	case REG_BINARY: {
 		char *hex = hex_encode_talloc(NULL,
 			r.binary.data, r.binary.length);
 		size_t len;
-		printf("%s: REG_BINARY:", v);
+		printf("%-20s: REG_BINARY:", v);
 		len = strlen(hex);
 		for (i=0; i<len; i++) {
 			if (hex[i] == '\0') {
@@ -136,14 +136,14 @@ static void display_winreg_data(const char *v,
 		break;
 	}
 	case REG_MULTI_SZ:
-		printf("%s: REG_MULTI_SZ: ", v);
+		printf("%-20s: REG_MULTI_SZ: ", v);
 		for (i=0; r.string_array[i] != NULL; i++) {
 			printf("%s ", r.string_array[i]);
 		}
 		printf("\n");
 		break;
 	default:
-		printf("%s: unknown type 0x%02x:\n", v, type);
+		printf("%-20ss: unknown type 0x%02x:\n", v, type);
 		break;
 	}
 }
@@ -314,6 +314,130 @@ static WERROR cmd_winreg_querymultiplevalues2(struct rpc_pipe_client *cli,
 	return cmd_winreg_querymultiplevalues_ex(cli, mem_ctx, argc, argv, true);
 }
 
+static WERROR cmd_winreg_enumval(struct rpc_pipe_client *cli,
+				 TALLOC_CTX *mem_ctx, int argc,
+				 const char **argv)
+{
+	NTSTATUS status;
+	WERROR werr, ignore;
+	struct dcerpc_binding_handle *b = cli->binding_handle;
+	struct policy_handle parent_handle, handle;
+	uint32_t enum_index = 0;
+
+	if (argc < 1 || argc > 3) {
+		printf("usage: %s [name]\n", argv[0]);
+		return WERR_OK;
+	}
+
+	status = dcerpc_winreg_OpenHKLM(b, mem_ctx,
+					NULL,
+					SEC_FLAG_MAXIMUM_ALLOWED,
+					&parent_handle,
+					&werr);
+	if (!NT_STATUS_IS_OK(status)) {
+		return ntstatus_to_werror(status);
+	}
+	if (!W_ERROR_IS_OK(werr)) {
+		return werr;
+	}
+
+	if (argc >= 2) {
+
+		struct winreg_String keyname;
+
+		ZERO_STRUCT(keyname);
+
+		keyname.name = argv[1];
+
+		status = dcerpc_winreg_OpenKey(b, mem_ctx,
+					       &parent_handle,
+					       keyname,
+					       0,
+					       SEC_FLAG_MAXIMUM_ALLOWED,
+					       &handle,
+					       &werr);
+		if (!NT_STATUS_IS_OK(status)) {
+			return ntstatus_to_werror(status);
+		}
+		if (!W_ERROR_IS_OK(werr)) {
+			return werr;
+		}
+	} else {
+		handle = parent_handle;
+	}
+
+	do {
+		struct winreg_ValNameBuf name;
+		enum winreg_Type type = REG_NONE;
+		uint32_t size = 0, length = 0;
+		struct winreg_EnumValue r;
+
+		name.name = "";
+		name.size = 1024;
+
+		r.in.handle = &handle;
+		r.in.enum_index = enum_index;
+		r.in.name = &name;
+		r.in.type = &type;
+		r.in.size = &size;
+		r.in.length = &length;
+		r.in.value = talloc_array(mem_ctx, uint8_t, size);
+		if (r.in.value == NULL) {
+			werr = WERR_NOT_ENOUGH_MEMORY;
+			goto done;
+		}
+		r.out.name = &name;
+		r.out.type = &type;
+		r.out.size = &size;
+		r.out.length = &length;
+		r.out.value = r.in.value;
+
+		status = dcerpc_winreg_EnumValue_r(b, mem_ctx, &r);
+		if (!NT_STATUS_IS_OK(status)) {
+			werr = ntstatus_to_werror(status);
+			goto done;
+		}
+
+		werr = r.out.result;
+
+		if (W_ERROR_EQUAL(werr, WERR_MORE_DATA)) {
+			*r.in.size = *r.out.size;
+			r.in.value = talloc_zero_array(mem_ctx, uint8_t, *r.in.size);
+			if (r.in.value == NULL) {
+				werr = WERR_NOT_ENOUGH_MEMORY;
+				goto done;
+			}
+
+			status = dcerpc_winreg_EnumValue_r(b, mem_ctx, &r);
+			if (!NT_STATUS_IS_OK(status)) {
+				werr = ntstatus_to_werror(status);
+				goto done;
+			}
+
+			werr = r.out.result;
+		}
+		if (!W_ERROR_IS_OK(r.out.result)) {
+			goto done;
+		}
+
+		printf("%02d: ", enum_index++);
+
+		display_winreg_data(r.out.name->name,
+				    *r.out.type,
+				    r.out.value,
+				    *r.out.size);
+
+	} while (W_ERROR_IS_OK(werr));
+
+ done:
+	if (argc >= 2) {
+		dcerpc_winreg_CloseKey(b, mem_ctx, &handle, &ignore);
+	}
+	dcerpc_winreg_CloseKey(b, mem_ctx, &parent_handle, &ignore);
+
+	return werr;
+}
+
 /* List of commands exported by this module */
 
 struct cmd_set winreg_commands[] = {
@@ -351,6 +475,16 @@ struct cmd_set winreg_commands[] = {
 		.description        = "Query multiple values",
 		.usage              = "",
 	},
+	{
+		.name               = "winreg_enumval",
+		.returntype         = RPC_RTYPE_WERROR,
+		.ntfn               = NULL,
+		.wfn                = cmd_winreg_enumval,
+		.table              = &ndr_table_winreg,
+		.rpc_pipe           = NULL,
+		.description        = "Enumerate Values",
+		.usage              = "",
+	},
 	{
 		.name = NULL,
 	},
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 18c79f9df35..ddef5b6de16 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1743,8 +1743,9 @@ extern void build_options(bool screen);
 
 	reopen_logs();
 
-	DEBUG(0,("smbd version %s started.\n", samba_version_string()));
-	DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE));
+	DBG_STARTUP_NOTICE("smbd version %s started.\n"
+			COPYRIGHT_STARTUP_MESSAGE "\n",
+		samba_version_string());
 
 	DEBUG(2,("uid=%d gid=%d euid=%d egid=%d\n",
 		 (int)getuid(),(int)getgid(),(int)geteuid(),(int)getegid()));
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 765e5a2561b..cdd6d4319cb 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -1438,8 +1438,9 @@ int main(int argc, const char **argv)
 
 	reopen_logs();
 
-	DEBUG(0,("winbindd version %s started.\n", samba_version_string()));
-	DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE));
+	DBG_STARTUP_NOTICE("winbindd version %s started.\n"
+			COPYRIGHT_STARTUP_MESSAGE "\n",
+		samba_version_string());
 
 	/* After parsing the configuration file we setup the core path one more time
 	 * as the log file might have been set in the configuration and cores's
diff --git a/source4/include/includes.h b/source4/include/includes.h
index e7abf1a2492..8832b97ed02 100644
--- a/source4/include/includes.h
+++ b/source4/include/includes.h
@@ -57,6 +57,9 @@
 #endif
 #include "../lib/util/attr.h"
 
+/* copyright define */
+#include "../lib/util/copyright.h"
+
 /* debug.h need to be included before samba_util.h for the macro SMB_ASSERT */
 #include "../lib/util/debug.h"
 #include "../lib/util/samba_util.h"
diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c
index 3adaafead7c..f8bd8c1926b 100644
--- a/source4/rpc_server/winreg/rpc_winreg.c
+++ b/source4/rpc_server/winreg/rpc_winreg.c
@@ -312,6 +312,10 @@ static WERROR dcesrv_winreg_EnumValue(struct dcesrv_call_state *dce_call,
 	}
 	*r->out.type = (enum winreg_Type) data_type;
 
+	if (r->in.size != NULL) {
+		r->out.size = talloc(mem_ctx, uint32_t);
+		*r->out.size = data.length;
+	}
 	/* check the client has enough room for the value */
 	if (r->in.value != NULL &&
 	    r->in.size != NULL &&
@@ -323,9 +327,7 @@ static WERROR dcesrv_winreg_EnumValue(struct dcesrv_call_state *dce_call,
 		r->out.value = data.data;
 	}
 
-	if (r->in.size != NULL) {
-		r->out.size = talloc(mem_ctx, uint32_t);
-		*r->out.size = data.length;
+	if (r->in.length != NULL) {
 		r->out.length = r->out.size;
 	}
 
diff --git a/source4/samba/server.c b/source4/samba/server.c
index 4698ac0320b..d2bd3a59708 100644
--- a/source4/samba/server.c
+++ b/source4/samba/server.c
@@ -630,11 +630,10 @@ static int binary_smbd_main(TALLOC_CTX *mem_ctx,
 	   so set our umask to 0 */
 	umask(0);
 
-	DEBUG(0,("%s version %s started.\n",
+	DBG_STARTUP_NOTICE("%s version %s started.\n"
+			COPYRIGHT_STARTUP_MESSAGE "\n",
 		binary_name,
-		SAMBA_VERSION_STRING));
-	DEBUGADD(0,("Copyright Andrew Tridgell and the Samba Team"
-		" 1992-2023\n"));


-- 
Samba Shared Repository



More information about the samba-cvs mailing list