]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3-rpc_client: Added dcerpc_samr_chgpasswd_user.
authorAndreas Schneider <asn@samba.org>
Tue, 11 Jan 2011 12:07:02 +0000 (13:07 +0100)
committerAndreas Schneider <asn@samba.org>
Fri, 21 Jan 2011 13:34:17 +0000 (14:34 +0100)
source3/rpc_client/cli_samr.c
source3/rpc_client/cli_samr.h

index 7f5e6fca4a92725aa15b92b7190f3939cfe6ec24..03acafe515515049ed08397b9843eb9a7702148f 100644 (file)
 
 /* User change password */
 
-NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli,
+NTSTATUS dcerpc_samr_chgpasswd_user(struct dcerpc_binding_handle *h,
                                    TALLOC_CTX *mem_ctx,
                                    struct policy_handle *user_handle,
                                    const char *newpassword,
-                                   const char *oldpassword)
+                                   const char *oldpassword,
+                                   NTSTATUS *presult)
 {
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+       NTSTATUS status;
        struct samr_Password hash1, hash2, hash3, hash4, hash5, hash6;
 
        uchar old_nt_hash[16];
@@ -64,7 +65,8 @@ NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli,
        E_old_pw_hash(old_lm_hash, new_nt_hash, hash5.hash);
        E_old_pw_hash(old_nt_hash, new_lm_hash, hash6.hash);
 
-       result = rpccli_samr_ChangePasswordUser(cli, mem_ctx,
+       status = dcerpc_samr_ChangePasswordUser(h,
+                                               mem_ctx,
                                                user_handle,
                                                true,
                                                &hash1,
@@ -75,11 +77,33 @@ NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli,
                                                true,
                                                &hash5,
                                                true,
-                                               &hash6);
+                                               &hash6,
+                                               presult);
 
-       return result;
+       return status;
 }
 
+NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *user_handle,
+                                   const char *newpassword,
+                                   const char *oldpassword)
+{
+       NTSTATUS status;
+       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+
+       status = dcerpc_samr_chgpasswd_user(cli->binding_handle,
+                                           mem_ctx,
+                                           user_handle,
+                                           newpassword,
+                                           oldpassword,
+                                           &result);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       return result;
+}
 
 /* User change password */
 
index 404987caa7b7bfb94613f56d4501e79eeb024d39..aa0e5f9883f12322bab8fe636b6d6e7dce6a7c98 100644 (file)
 
 /* The following definitions come from rpc_client/cli_samr.c  */
 
+/**
+ * @brief Change the password of a user.
+ *
+ * @param[in]  h        The dcerpc binding hanlde to use.
+ *
+ * @param[in]  mem_ctx  The memory context to use.
+ *
+ * @param[in]  user_handle The password of the user to chang the handle
+ *
+ * @param[in]  newpassword The new password to set.
+ *
+ * @param[in]  oldpassword The old password for verification
+ *
+ * @param[out] presult  A pointer for the NDR NTSTATUS error code.
+ *
+ * @return              A corresponding NTSTATUS error code for the connection.
+ */
+NTSTATUS dcerpc_samr_chgpasswd_user(struct dcerpc_binding_handle *h,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *user_handle,
+                                   const char *newpassword,
+                                   const char *oldpassword,
+                                   NTSTATUS *presult);
+
 NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli,
                                    TALLOC_CTX *mem_ctx,
                                    struct policy_handle *user_handle,