summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2012-06-13 17:02:18 +0300
committerAlexander Bokovoy <ab@samba.org>2012-06-21 12:11:19 +0200
commit9e116e8a5e2c9ae834b7b500cb0833201bfd148b (patch)
treeaf023d78e6ed9d7f33595503312e643a9db8a951 /source3
parent9089d487c45b7a8959de61bba11f9dd069c503eb (diff)
downloadsamba-9e116e8a5e2c9ae834b7b500cb0833201bfd148b.tar.gz
samba-9e116e8a5e2c9ae834b7b500cb0833201bfd148b.tar.bz2
samba-9e116e8a5e2c9ae834b7b500cb0833201bfd148b.zip
s3-rpcclient: support all known netr_LogonControl2 variants properly
logonctrl2 function in rpcclient did not allow to specify arguments to most of netr_LogonControl2 function code points. In addition, make descriptive help to show what is expected at each function code point. Autobuild-User(master): Alexander Bokovoy <ab@samba.org> Autobuild-Date(master): Thu Jun 21 12:11:19 CEST 2012 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/rpcclient/cmd_netlogon.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index baf2f4f694..01d6da45dd 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -40,10 +40,34 @@ static WERROR cmd_netlogon_logon_ctrl2(struct rpc_pipe_client *cli,
union netr_CONTROL_QUERY_INFORMATION query;
const char *domain = lp_workgroup();
struct dcerpc_binding_handle *b = cli->binding_handle;
-
- if (argc > 5) {
+ int i;
+#define fn_code_level(x, item) { x, #x, #item }
+ struct {
+ enum netr_LogonControlCode code;
+ const char *name;
+ const char *argument;
+ } supported_levels[] = {
+ fn_code_level(NETLOGON_CONTROL_REDISCOVER, domain),
+ fn_code_level(NETLOGON_CONTROL_TC_QUERY, domain),
+ fn_code_level(NETLOGON_CONTROL_TRANSPORT_NOTIFY, domain),
+ fn_code_level(NETLOGON_CONTROL_FIND_USER, user),
+ fn_code_level(NETLOGON_CONTROL_CHANGE_PASSWORD, domain),
+ fn_code_level(NETLOGON_CONTROL_TC_VERIFY, domain),
+ fn_code_level(NETLOGON_CONTROL_SET_DBFLAG, debug_level),
+ {0, 0, 0}
+ };
+#undef fn_code_level
+ if ((argc > 5) || (argc < 2)) {
fprintf(stderr, "Usage: %s <logon_server> <function_code> "
- "<level> <domain>\n", argv[0]);
+ "<level:1..4> <argument>\n", argv[0]);
+ fprintf(stderr, "Supported combinations:\n");
+ fprintf(stderr, "function_code\targument\n");
+ for(i=0; supported_levels[i].code; i++) {
+ fprintf(stderr, "%7d\t\t%s\t(%s)\n",
+ supported_levels[i].code,
+ supported_levels[i].argument,
+ supported_levels[i].name);
+ }
return WERR_OK;
}
@@ -66,8 +90,16 @@ static WERROR cmd_netlogon_logon_ctrl2(struct rpc_pipe_client *cli,
switch (function_code) {
case NETLOGON_CONTROL_REDISCOVER:
case NETLOGON_CONTROL_TC_QUERY:
+ case NETLOGON_CONTROL_CHANGE_PASSWORD:
+ case NETLOGON_CONTROL_TRANSPORT_NOTIFY:
+ case NETLOGON_CONTROL_TC_VERIFY:
data.domain = domain;
break;
+ case NETLOGON_CONTROL_FIND_USER:
+ data.user = domain;
+ break;
+ case NETLOGON_CONTROL_SET_DBFLAG:
+ data.debug_level = atoi(domain);
default:
break;
}