summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-06-17 19:49:58 +0200
committerGünther Deschner <gd@samba.org>2008-06-17 19:55:16 +0200
commitfefcb70f870cae351d29a937df674db8c4ee9abe (patch)
tree7834142cc66f48f796f5641302d4ff8e438ed1df /source3/utils
parent49b269f50fc2fc2817bdee97e9670b8579113060 (diff)
downloadsamba-fefcb70f870cae351d29a937df674db8c4ee9abe.tar.gz
samba-fefcb70f870cae351d29a937df674db8c4ee9abe.tar.bz2
samba-fefcb70f870cae351d29a937df674db8c4ee9abe.zip
net_vampire: add error and result_message to samsync_context.
Guenther (This used to be commit e0b117200441f842fbc11cc817ab2cde4d63a22e)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_rpc_samsync.c48
1 files changed, 28 insertions, 20 deletions
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index 797598c48e..5161bb3ef5 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -1199,29 +1199,33 @@ NTSTATUS rpc_vampire_internals(struct net_context *c,
/* fetch domain */
result = samsync_process_database(pipe_hnd, SAM_DATABASE_DOMAIN,
fetch_sam_entries, ctx);
- if (!NT_STATUS_IS_OK(result)) {
- d_fprintf(stderr, "Failed to fetch domain database: %s\n",
- nt_errstr(result));
- if (NT_STATUS_EQUAL(result, NT_STATUS_NOT_SUPPORTED))
- d_fprintf(stderr, "Perhaps %s is a Windows 2000 "
- "native mode domain?\n", domain_name);
+
+ if (!NT_STATUS_IS_OK(result) && ctx->error_message) {
+ d_fprintf(stderr, "%s\n", ctx->error_message);
goto fail;
}
+ if (ctx->result_message) {
+ d_fprintf(stdout, "%s\n", ctx->result_message);
+ }
+
/* fetch builtin */
ctx->domain_sid = sid_dup_talloc(mem_ctx, &global_sid_Builtin);
ctx->domain_sid_str = sid_string_talloc(mem_ctx, ctx->domain_sid);
result = samsync_process_database(pipe_hnd, SAM_DATABASE_BUILTIN,
fetch_sam_entries, ctx);
- if (!NT_STATUS_IS_OK(result)) {
- d_fprintf(stderr, "Failed to fetch builtin database: %s\n",
- nt_errstr(result));
+
+ if (!NT_STATUS_IS_OK(result) && ctx->error_message) {
+ d_fprintf(stderr, "%s\n", ctx->error_message);
goto fail;
}
- TALLOC_FREE(ctx);
+ if (ctx->result_message) {
+ d_fprintf(stdout, "%s\n", ctx->result_message);
+ }
fail:
+ TALLOC_FREE(ctx);
return result;
}
@@ -1253,29 +1257,33 @@ NTSTATUS rpc_vampire_ldif_internals(struct net_context *c,
/* fetch domain */
status = samsync_process_database(pipe_hnd, SAM_DATABASE_DOMAIN,
fetch_sam_entries_ldif, ctx);
- if (!NT_STATUS_IS_OK(status)) {
- d_fprintf(stderr, "Failed to fetch domain database: %s\n",
- nt_errstr(status));
- if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED))
- d_fprintf(stderr, "Perhaps %s is a Windows 2000 "
- "native mode domain?\n", domain_name);
+
+ if (!NT_STATUS_IS_OK(status) && ctx->error_message) {
+ d_fprintf(stderr, "%s\n", ctx->error_message);
goto fail;
}
+ if (ctx->result_message) {
+ d_fprintf(stdout, "%s\n", ctx->result_message);
+ }
+
/* fetch builtin */
ctx->domain_sid = sid_dup_talloc(mem_ctx, &global_sid_Builtin);
ctx->domain_sid_str = sid_string_talloc(mem_ctx, ctx->domain_sid);
status = samsync_process_database(pipe_hnd, SAM_DATABASE_BUILTIN,
fetch_sam_entries_ldif, ctx);
- if (!NT_STATUS_IS_OK(status)) {
- d_fprintf(stderr, "Failed to fetch builtin database: %s\n",
- nt_errstr(status));
+
+ if (!NT_STATUS_IS_OK(status) && ctx->error_message) {
+ d_fprintf(stderr, "%s\n", ctx->error_message);
goto fail;
}
- TALLOC_FREE(ctx);
+ if (ctx->result_message) {
+ d_fprintf(stdout, "%s\n", ctx->result_message);
+ }
fail:
+ TALLOC_FREE(ctx);
return status;
}