diff options
-rw-r--r-- | source3/rpc_client/cli_samr.c | 85 | ||||
-rw-r--r-- | source3/rpcclient/cmd_samr.c | 44 |
2 files changed, 23 insertions, 106 deletions
diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c index 7cf8726052..a752717e8c 100644 --- a/source3/rpc_client/cli_samr.c +++ b/source3/rpc_client/cli_samr.c @@ -1981,91 +1981,6 @@ NTSTATUS rpccli_samr_set_sec_obj(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return result; } - -/* Get domain password info */ - -NTSTATUS rpccli_samr_get_dom_pwinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - uint16 *min_pwd_length, uint32 *password_properties) -{ - prs_struct qbuf, rbuf; - SAMR_Q_GET_DOM_PWINFO q; - SAMR_R_GET_DOM_PWINFO r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_get_dom_pwinfo\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_get_dom_pwinfo(&q, cli->cli->desthost); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_GET_DOM_PWINFO, - q, r, - qbuf, rbuf, - samr_io_q_get_dom_pwinfo, - samr_io_r_get_dom_pwinfo, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - if (NT_STATUS_IS_OK(result)) { - if (min_pwd_length) - *min_pwd_length = r.min_pwd_length; - if (password_properties) - *password_properties = r.password_properties; - } - - return result; -} - -/* Get domain password info */ - -NTSTATUS rpccli_samr_get_usrdom_pwinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, uint16 *min_pwd_length, - uint32 *password_properties, uint32 *unknown1) -{ - prs_struct qbuf, rbuf; - SAMR_Q_GET_USRDOM_PWINFO q; - SAMR_R_GET_USRDOM_PWINFO r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_get_usrdom_pwinfo\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_get_usrdom_pwinfo(&q, pol); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_GET_USRDOM_PWINFO, - q, r, - qbuf, rbuf, - samr_io_q_get_usrdom_pwinfo, - samr_io_r_get_usrdom_pwinfo, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - if (NT_STATUS_IS_OK(result)) { - if (min_pwd_length) - *min_pwd_length = r.min_pwd_length; - if (password_properties) - *password_properties = r.password_properties; - if (unknown1) - *unknown1 = r.unknown_1; - } - - return result; -} - - /* Lookup Domain Name */ NTSTATUS rpccli_samr_lookup_domain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index 1bb13f3fe0..ae22a68deb 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -122,7 +122,7 @@ static void display_sam_user_info_21(SAM_USER_INFO_21 *usr) } -static void display_password_properties(uint32 password_properties) +static void display_password_properties(uint32_t password_properties) { printf("password_properties: 0x%08x\n", password_properties); @@ -2012,14 +2012,14 @@ static NTSTATUS cmd_samr_get_usrdom_pwinfo(struct rpc_pipe_client *cli, { NTSTATUS result = NT_STATUS_UNSUCCESSFUL; POLICY_HND connect_pol, domain_pol, user_pol; - uint16 min_pwd_length; - uint32 password_properties, unknown1, rid; + struct samr_PwInfo info; + uint32_t rid; if (argc != 2) { printf("Usage: %s rid\n", argv[0]); return NT_STATUS_OK; } - + sscanf(argv[1], "%i", &rid); result = try_samr_connects(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, @@ -2044,14 +2044,10 @@ static NTSTATUS cmd_samr_get_usrdom_pwinfo(struct rpc_pipe_client *cli, goto done; } - result = rpccli_samr_get_usrdom_pwinfo(cli, mem_ctx, &user_pol, - &min_pwd_length, &password_properties, - &unknown1) ; - + result = rpccli_samr_GetUserPwInfo(cli, mem_ctx, &user_pol, &info); if (NT_STATUS_IS_OK(result)) { - printf("min_pwd_length: %d\n", min_pwd_length); - printf("unknown1: %d\n", unknown1); - display_password_properties(password_properties); + printf("min_password_length: %d\n", info.min_password_length); + display_password_properties(info.password_properties); } done: @@ -2062,25 +2058,31 @@ static NTSTATUS cmd_samr_get_usrdom_pwinfo(struct rpc_pipe_client *cli, return result; } +static void init_lsa_String(struct lsa_String *name, const char *s) +{ + name->string = s; +} -static NTSTATUS cmd_samr_get_dom_pwinfo(struct rpc_pipe_client *cli, +static NTSTATUS cmd_samr_get_dom_pwinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - int argc, const char **argv) + int argc, const char **argv) { NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - uint16 min_pwd_length; - uint32 password_properties; + struct lsa_String domain_name; + struct samr_PwInfo info; - if (argc != 1) { - printf("Usage: %s\n", argv[0]); + if (argc < 1 || argc > 3) { + printf("Usage: %s <domain>\n", argv[0]); return NT_STATUS_OK; } - result = rpccli_samr_get_dom_pwinfo(cli, mem_ctx, &min_pwd_length, &password_properties) ; - + init_lsa_String(&domain_name, argv[1]); + + result = rpccli_samr_GetDomPwInfo(cli, mem_ctx, &domain_name, &info); + if (NT_STATUS_IS_OK(result)) { - printf("min_pwd_length: %d\n", min_pwd_length); - display_password_properties(password_properties); + printf("min_password_length: %d\n", info.min_password_length); + display_password_properties(info.password_properties); } return result; |