s3-rpc_client: Added dcerpc_samr_chng_pswd_auth_crap.
authorAndreas Schneider <asn@samba.org>
Wed, 12 Jan 2011 08:04:19 +0000 (09:04 +0100)
committerAndreas Schneider <asn@samba.org>
Fri, 21 Jan 2011 13:34:18 +0000 (14:34 +0100)
source3/rpc_client/cli_samr.c
source3/rpc_client/cli_samr.h

index 236981a2f1f2c4fd17edbf98683d48b9f0cfa605..ae91c1c1652e07ecb284ee112acf9fa51c96b13c 100644 (file)
@@ -197,15 +197,17 @@ NTSTATUS rpccli_samr_chgpasswd_user2(struct rpc_pipe_client *cli,
 
 /* User change password given blobs */
 
-NTSTATUS rpccli_samr_chng_pswd_auth_crap(struct rpc_pipe_client *cli,
+NTSTATUS dcerpc_samr_chng_pswd_auth_crap(struct dcerpc_binding_handle *h,
                                         TALLOC_CTX *mem_ctx,
+                                        const char *srv_name_slash,
                                         const char *username,
                                         DATA_BLOB new_nt_password_blob,
                                         DATA_BLOB old_nt_hash_enc_blob,
                                         DATA_BLOB new_lm_password_blob,
-                                        DATA_BLOB old_lm_hash_enc_blob)
+                                        DATA_BLOB old_lm_hash_enc_blob,
+                                        NTSTATUS *presult)
 {
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+       NTSTATUS status;
        struct samr_CryptPassword new_nt_password;
        struct samr_CryptPassword new_lm_password;
        struct samr_Password old_nt_hash_enc;
@@ -214,7 +216,7 @@ NTSTATUS rpccli_samr_chng_pswd_auth_crap(struct rpc_pipe_client *cli,
 
        DEBUG(10,("rpccli_samr_chng_pswd_auth_crap\n"));
 
-       init_lsa_String(&server, cli->srv_name_slash);
+       init_lsa_String(&server, srv_name_slash);
        init_lsa_String(&account, username);
 
        if (new_nt_password_blob.length > 0) {
@@ -241,17 +243,46 @@ NTSTATUS rpccli_samr_chng_pswd_auth_crap(struct rpc_pipe_client *cli,
                ZERO_STRUCT(old_lm_hash_enc);
        }
 
-       result = rpccli_samr_ChangePasswordUser2(cli, mem_ctx,
+       status = dcerpc_samr_ChangePasswordUser2(h,
+                                                mem_ctx,
                                                 &server,
                                                 &account,
                                                 &new_nt_password,
                                                 &old_nt_hash_enc,
                                                 true,
                                                 &new_lm_password,
-                                                &old_lm_hash_enc);
-       return result;
+                                                &old_lm_hash_enc,
+                                                presult);
+
+       return status;
 }
 
+NTSTATUS rpccli_samr_chng_pswd_auth_crap(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *username,
+                                        DATA_BLOB new_nt_password_blob,
+                                        DATA_BLOB old_nt_hash_enc_blob,
+                                        DATA_BLOB new_lm_password_blob,
+                                        DATA_BLOB old_lm_hash_enc_blob)
+{
+       NTSTATUS status;
+       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+
+       status = dcerpc_samr_chng_pswd_auth_crap(cli->binding_handle,
+                                                mem_ctx,
+                                                cli->srv_name_slash,
+                                                username,
+                                                new_nt_password_blob,
+                                                old_nt_hash_enc_blob,
+                                                new_lm_password_blob,
+                                                old_lm_hash_enc_blob,
+                                                &result);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       return result;
+}
 
 /* change password 3 */
 
index d73171209b178d3c8040c3b37dd31a1aba6f3e91..14a3cd64d22ea2d904044e131e4b107ac748891e 100644 (file)
@@ -91,6 +91,41 @@ NTSTATUS rpccli_samr_chgpasswd_user2(struct rpc_pipe_client *cli,
                                     const char *username,
                                     const char *newpassword,
                                     const char *oldpassword);
+
+/**
+ * @brief Change the password of a user based on the user name given and using
+ * blobs.
+ *
+ * @param[in]  h        The dcerpc binding hanlde to use.
+ *
+ * @param[in]  mem_ctx  The memory context to use.
+ *
+ * @param[in]  srv_name_slash The server name with leading slashes.
+ *
+ * @param[in]  username The name of ther user.
+ *
+ * @param[in]  new_nt_password_blob The new password as a crypted blob.
+ *
+ * @param[in]  old_nt_hash_enc_blob The old password as a hash encoded blob.
+ *
+ * @param[in]  new_lm_password_blob The new password as a lanman encoded blob.
+ *
+ * @param[in]  old_lm_hash_enc_blob The old password as a lanman encoded blob.
+ *
+ * @param[out] presult  A pointer for the NDR NTSTATUS error code.
+ *
+ * @return              A corresponding NTSTATUS error code for the connection.
+ */
+NTSTATUS dcerpc_samr_chng_pswd_auth_crap(struct dcerpc_binding_handle *h,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *srv_name_slash,
+                                        const char *username,
+                                        DATA_BLOB new_nt_password_blob,
+                                        DATA_BLOB old_nt_hash_enc_blob,
+                                        DATA_BLOB new_lm_password_blob,
+                                        DATA_BLOB old_lm_hash_enc_blob,
+                                        NTSTATUS *presult);
+
 NTSTATUS rpccli_samr_chng_pswd_auth_crap(struct rpc_pipe_client *cli,
                                         TALLOC_CTX *mem_ctx,
                                         const char *username,