diff options
author | Günther Deschner <gd@samba.org> | 2008-11-11 19:00:26 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-11-18 16:01:01 +0100 |
commit | 4be8d9cca011cc090e19b2b43b59455d7e6a4b89 (patch) | |
tree | 31c1715ccc2eefa9325192d3349afc2afb0c4760 | |
parent | b8fee9d863054e18e5103fa197acbf58129db09d (diff) | |
download | samba-4be8d9cca011cc090e19b2b43b59455d7e6a4b89.tar.gz samba-4be8d9cca011cc090e19b2b43b59455d7e6a4b89.tar.bz2 samba-4be8d9cca011cc090e19b2b43b59455d7e6a4b89.zip |
s3-net: use net_scan_dc in net rpc vampire keytab.
Guenther
-rw-r--r-- | source3/utils/net_rpc_samsync.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c index 9fab949130..22c6d25402 100644 --- a/source3/utils/net_rpc_samsync.c +++ b/source3/utils/net_rpc_samsync.c @@ -457,6 +457,9 @@ static NTSTATUS rpc_vampire_keytab_ds_internals(struct net_context *c, int rpc_vampire_keytab(struct net_context *c, int argc, const char **argv) { int ret = 0; + NTSTATUS status; + struct cli_state *cli = NULL; + struct net_dc_info dc_info; if (c->display_usage || (argc < 1)) { d_printf("Usage:\n" @@ -465,14 +468,30 @@ int rpc_vampire_keytab(struct net_context *c, int argc, const char **argv) return 0; } - ret = run_rpc_command(c, NULL, &ndr_table_drsuapi.syntax_id, - NET_FLAGS_SEAL, - rpc_vampire_keytab_ds_internals, argc, argv); - if (ret == 0) { - return 0; + status = net_make_ipc_connection(c, 0, &cli); + if (!NT_STATUS_IS_OK(status)) { + return -1; } - return run_rpc_command(c, NULL, &ndr_table_netlogon.syntax_id, 0, - rpc_vampire_keytab_internals, - argc, argv); + status = net_scan_dc(c, cli, &dc_info); + if (!NT_STATUS_IS_OK(status)) { + return -1; + } + + if (!dc_info.is_ad) { + printf("DC is not running Active Directory\n"); + return -1; + } + + if (dc_info.is_mixed_mode) { + ret = run_rpc_command(c, cli, &ndr_table_netlogon.syntax_id, + 0, + rpc_vampire_keytab_internals, argc, argv); + } else { + ret = run_rpc_command(c, cli, &ndr_table_drsuapi.syntax_id, + NET_FLAGS_SEAL, + rpc_vampire_keytab_ds_internals, argc, argv); + } + + return ret; } |