[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-test-1384-g2c045a8
Günther Deschner
gd at samba.org
Tue Jan 15 22:07:59 GMT 2008
The branch, v3-2-test has been updated
via 2c045a8c817b4ec200830c4f8b508c1cd4c4d9aa (commit)
via 50ab169f581b4efff5185fd86d1b9ceaaf3974dd (commit)
from ecbe08897c9cc47790f3d4f5680d25202bc0f6c3 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit 2c045a8c817b4ec200830c4f8b508c1cd4c4d9aa
Author: Günther Deschner <gd at samba.org>
Date: Tue Jan 15 23:06:23 2008 +0100
Use NDR_PRINT_UNION_STRING instead of NDR_PRINT_UNION_DEBUG in rpcclient.
Guenther
commit 50ab169f581b4efff5185fd86d1b9ceaaf3974dd
Author: Günther Deschner <gd at samba.org>
Date: Tue Jan 15 23:04:47 2008 +0100
Add some NDR_PRINT_*_STRING macros (returning talloced strings).
Guenther
-----------------------------------------------------------------------
Summary of changes:
source/librpc/ndr/libndr.h | 10 +++++++++-
source/rpcclient/cmd_lsarpc.c | 22 ++++++++++++++--------
2 files changed, 23 insertions(+), 9 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/librpc/ndr/libndr.h b/source/librpc/ndr/libndr.h
index 6341e20..d0c2c74 100644
--- a/source/librpc/ndr/libndr.h
+++ b/source/librpc/ndr/libndr.h
@@ -149,7 +149,7 @@ struct ndr_print {
/* set to avoid recursion in ndr_size_*() calculation */
#define LIBNDR_FLAG_NO_NDR_SIZE (1<<31)
-/* useful macro for debugging */
+/* useful macro for debugging with DEBUG */
#define NDR_PRINT_DEBUG(type, p) ndr_print_debug((ndr_print_fn_t)ndr_print_ ##type, #p, p)
#define NDR_PRINT_UNION_DEBUG(type, level, p) ndr_print_union_debug((ndr_print_fn_t)ndr_print_ ##type, #p, level, p)
#define NDR_PRINT_FUNCTION_DEBUG(type, flags, p) ndr_print_function_debug((ndr_print_function_t)ndr_print_ ##type, #type, flags, p)
@@ -157,6 +157,14 @@ struct ndr_print {
#define NDR_PRINT_OUT_DEBUG(type, p) NDR_PRINT_FUNCTION_DEBUG(type, NDR_OUT, p)
#define NDR_PRINT_IN_DEBUG(type, p) NDR_PRINT_FUNCTION_DEBUG(type, NDR_IN | NDR_SET_VALUES, p)
+/* useful macro for debugging in strings */
+#define NDR_PRINT_STRUCT_STRING(ctx, type, p) ndr_print_struct_string(ctx, (ndr_print_fn_t)ndr_print_ ##type, #p, p)
+#define NDR_PRINT_UNION_STRING(ctx, type, level, p) ndr_print_union_string(ctx, (ndr_print_fn_t)ndr_print_ ##type, #p, level, p)
+#define NDR_PRINT_FUNCTION_STRING(ctx, type, flags, p) ndr_print_function_string(ctx, (ndr_print_function_t)ndr_print_ ##type, #type, flags, p)
+#define NDR_PRINT_BOTH_STRING(ctx, type, p) NDR_PRINT_FUNCTION_STRING(ctx, type, NDR_BOTH, p)
+#define NDR_PRINT_OUT_STRING(ctx, type, p) NDR_PRINT_FUNCTION_STRING(ctx, type, NDR_OUT, p)
+#define NDR_PRINT_IN_STRING(ctx, type, p) NDR_PRINT_FUNCTION_STRING(ctx, type, NDR_IN | NDR_SET_VALUES, p)
+
#define NDR_BE(ndr) (((ndr)->flags & (LIBNDR_FLAG_BIGENDIAN|LIBNDR_FLAG_LITTLE_ENDIAN)) == LIBNDR_FLAG_BIGENDIAN)
enum ndr_err_code {
diff --git a/source/rpcclient/cmd_lsarpc.c b/source/rpcclient/cmd_lsarpc.c
index 7743269..05269d7 100644
--- a/source/rpcclient/cmd_lsarpc.c
+++ b/source/rpcclient/cmd_lsarpc.c
@@ -916,7 +916,8 @@ static void display_trust_dom_info_4(struct lsa_TrustDomainInfoPassword *p, cons
data_blob_free(&data_old);
}
-static void display_trust_dom_info(union lsa_TrustedDomainInfo *info,
+static void display_trust_dom_info(TALLOC_CTX *mem_ctx,
+ union lsa_TrustedDomainInfo *info,
enum lsa_TrustDomInfoEnum info_class,
const char *pass)
{
@@ -924,12 +925,17 @@ static void display_trust_dom_info(union lsa_TrustedDomainInfo *info,
case LSA_TRUSTED_DOMAIN_INFO_PASSWORD:
display_trust_dom_info_4(&info->password, pass);
break;
- default:
- NDR_PRINT_UNION_DEBUG(lsa_TrustedDomainInfo,
- info_class, info);
+ default: {
+ const char *str = NULL;
+ str = NDR_PRINT_UNION_STRING(mem_ctx,
+ lsa_TrustedDomainInfo,
+ info_class, info);
+ if (str) {
+ d_printf("%s\n", str);
+ }
break;
+ }
}
-
}
static NTSTATUS cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client *cli,
@@ -967,7 +973,7 @@ static NTSTATUS cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(result))
goto done;
- display_trust_dom_info(&info, info_class, cli->pwd.password);
+ display_trust_dom_info(mem_ctx, &info, info_class, cli->pwd.password);
done:
if (&pol)
@@ -1015,7 +1021,7 @@ static NTSTATUS cmd_lsa_query_trustdominfobyname(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(result))
goto done;
- display_trust_dom_info(&info, info_class, cli->pwd.password);
+ display_trust_dom_info(mem_ctx, &info, info_class, cli->pwd.password);
done:
if (&pol)
@@ -1069,7 +1075,7 @@ static NTSTATUS cmd_lsa_query_trustdominfo(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(result))
goto done;
- display_trust_dom_info(&info, info_class, cli->pwd.password);
+ display_trust_dom_info(mem_ctx, &info, info_class, cli->pwd.password);
done:
if (&pol)
--
Samba Shared Repository
More information about the samba-cvs
mailing list