[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-1956-gac8db3d

Günther Deschner gd at samba.org
Thu Feb 7 09:15:43 GMT 2008


The branch, v3-2-test has been updated
       via  ac8db3d29bf3f99a492b8265a64430538c8c1cc4 (commit)
       via  a49220b5c881b618739bc4735c595e32be7073c7 (commit)
       via  2f877d730be786cd6e3840ea3ef5746d1fc745da (commit)
       via  41fc592f3a7745e7e34f0e0e4c92c66033547f16 (commit)
       via  ffbfd19ad7065caf05688c5748178d30115d47f4 (commit)
       via  07c28f308624207c0c8a75d2f1783aa1d1aae05a (commit)
       via  297ad1fe5d10ab67fae51f88df8f74d44db28b0a (commit)
       via  42fc1fdb100079bd24491c5d448cd01ce229d182 (commit)
      from  ecc4e5fb3852a9966b5184482d573268d8bd0cd7 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit ac8db3d29bf3f99a492b8265a64430538c8c1cc4
Author: Günther Deschner <gd at samba.org>
Date:   Wed Feb 6 01:53:29 2008 +0100

    Remove unused marshalling for SAMR_CHGPASSWD_USER.
    
    Guenther

commit a49220b5c881b618739bc4735c595e32be7073c7
Author: Günther Deschner <gd at samba.org>
Date:   Wed Feb 6 01:50:01 2008 +0100

    Use rpccli_samr_ChangePasswordUser2 in rpccli_samr_chgpasswd_user() and friends.
    
    Guenther

commit 2f877d730be786cd6e3840ea3ef5746d1fc745da
Author: Günther Deschner <gd at samba.org>
Date:   Tue Feb 5 20:18:09 2008 +0100

    Remove last SAM_UNK struct defines.
    
    Guenther

commit 41fc592f3a7745e7e34f0e0e4c92c66033547f16
Author: Günther Deschner <gd at samba.org>
Date:   Tue Feb 5 20:17:13 2008 +0100

    Remove marshalling for SAMR_CHGPASSWD3.
    
    Guenther

commit ffbfd19ad7065caf05688c5748178d30115d47f4
Author: Günther Deschner <gd at samba.org>
Date:   Tue Feb 5 20:14:54 2008 +0100

    Let rpccli_samr_chgpasswd3 use rpccli_samr_ChangePasswordUser3 internally.
    
    Guenther

commit 07c28f308624207c0c8a75d2f1783aa1d1aae05a
Author: Günther Deschner <gd at samba.org>
Date:   Tue Feb 5 18:44:30 2008 +0100

    Use pidl for _samr_ChangePasswordUser3().
    
    Guenther

commit 297ad1fe5d10ab67fae51f88df8f74d44db28b0a
Author: Günther Deschner <gd at samba.org>
Date:   Thu Feb 7 10:06:44 2008 +0100

    Re-run make idl.
    
    Guenther

commit 42fc1fdb100079bd24491c5d448cd01ce229d182
Author: Günther Deschner <gd at samba.org>
Date:   Thu Feb 7 10:00:49 2008 +0100

    Fix IDL for samr_ChangePasswordUser3().
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source/include/rpc_samr.h        |  107 ----------
 source/librpc/gen_ndr/cli_samr.c |    4 +-
 source/librpc/gen_ndr/cli_samr.h |    4 +-
 source/librpc/gen_ndr/ndr_samr.c |   54 +++++-
 source/librpc/gen_ndr/samr.h     |    4 +-
 source/librpc/gen_ndr/srv_samr.c |    4 +-
 source/librpc/idl/samr.idl       |    4 +-
 source/rpc_client/cli_samr.c     |  242 ++++++++++------------
 source/rpc_parse/parse_samr.c    |  428 --------------------------------------
 source/rpc_server/srv_samr.c     |   24 +--
 source/rpc_server/srv_samr_nt.c  |   76 ++++---
 source/rpcclient/cmd_samr.c      |   26 ++-
 source/winbindd/winbindd_pam.c   |   37 ++--
 13 files changed, 250 insertions(+), 764 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/rpc_samr.h b/source/include/rpc_samr.h
index 971a1a7..63f6c27 100644
--- a/source/include/rpc_samr.h
+++ b/source/include/rpc_samr.h
@@ -445,24 +445,6 @@ typedef struct sam_user_info_9
 } SAM_USER_INFO_9;
 
 
-typedef struct sam_unknown_info_1_inf
-{
-	uint16 min_length_password;
-	uint16 password_history;
-	uint32 password_properties;
-	NTTIME expire;
-	NTTIME min_passwordage;
-
-} SAM_UNK_INFO_1;
-
-typedef struct sam_unknown_info_3_info
-{
-	NTTIME logout;	
-	/* 0x8000 0000 */ /* DON'T forcibly disconnect remote users from server when logon hours expire*/
-	/* 0x0000 0000 */ /* forcibly disconnect remote users from server when logon hours expire*/
-
-} SAM_UNK_INFO_3;
-
 #define MAX_SAM_ENTRIES_W2K 0x400
 #define MAX_SAM_ENTRIES_W95 50
 /* The following should be the greater of the preceeding two. */
@@ -1148,95 +1130,6 @@ typedef struct r_samr_lookup_rids_info
 
 } SAMR_R_LOOKUP_RIDS;
 
-
-/* SAMR_ENC_PASSWD */
-typedef struct enc_passwd_info
-{
-	uint32 ptr;
-	uint8 pass[516];
-
-} SAMR_ENC_PASSWD;
-
-/* SAMR_ENC_HASH */
-typedef struct enc_hash_info
-{
-	uint32 ptr;
-	uint8 hash[16];
-
-} SAMR_ENC_HASH;
-
-/* SAMR_Q_CHGPASSWD_USER */
-typedef struct q_samr_chgpasswd_user_info
-{
-	uint32 ptr_0;
-
-	UNIHDR hdr_dest_host; /* server name unicode header */
-	UNISTR2 uni_dest_host; /* server name unicode string */
-
-	UNIHDR hdr_user_name;    /* username unicode string header */
-	UNISTR2 uni_user_name;    /* username unicode string */
-
-	SAMR_ENC_PASSWD nt_newpass;
-	SAMR_ENC_HASH nt_oldhash;
-
-	uint32 unknown; /* 0x0000 0001 */
-
-	SAMR_ENC_PASSWD lm_newpass;
-	SAMR_ENC_HASH lm_oldhash;
-
-} SAMR_Q_CHGPASSWD_USER;
-
-/* SAMR_R_CHGPASSWD_USER */
-typedef struct r_samr_chgpasswd_user_info
-{
-	NTSTATUS status; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */
-
-} SAMR_R_CHGPASSWD_USER;
-
-/* SAMR_Q_CHGPASSWD3 */
-typedef struct q_samr_chgpasswd_user3
-{
-	uint32 ptr_0;
-
-	UNIHDR hdr_dest_host; /* server name unicode header */
-	UNISTR2 uni_dest_host; /* server name unicode string */
-
-	UNIHDR hdr_user_name;    /* username unicode string header */
-	UNISTR2 uni_user_name;    /* username unicode string */
-
-	SAMR_ENC_PASSWD nt_newpass;
-	SAMR_ENC_HASH nt_oldhash;
-
-	uint32 lm_change; /* 0x0000 0001 */
-
-	SAMR_ENC_PASSWD lm_newpass;
-	SAMR_ENC_HASH lm_oldhash;
-
-	SAMR_ENC_PASSWD password3;
-
-} SAMR_Q_CHGPASSWD_USER3;
-
-/* SAMR_CHANGE_REJECT */
-typedef struct samr_change_reject
-{
-	uint32 reject_reason;
-	uint32 unknown1;
-	uint32 unknown2;
-
-} SAMR_CHANGE_REJECT;
-
-/* SAMR_R_CHGPASSWD3 */
-typedef struct r_samr_chgpasswd_user3
-{
-	uint32 ptr_info;
-	uint32 ptr_reject;
-	SAM_UNK_INFO_1 *info;
-	SAMR_CHANGE_REJECT *reject;
-	NTSTATUS status; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */
-
-} SAMR_R_CHGPASSWD_USER3;
-
-
 /* these are from the old rpc_samr.h - they are needed while the merge
    is still going on */
 #define MAX_SAM_SIDS 15
diff --git a/source/librpc/gen_ndr/cli_samr.c b/source/librpc/gen_ndr/cli_samr.c
index 339f02b..4bd4e5c 100644
--- a/source/librpc/gen_ndr/cli_samr.c
+++ b/source/librpc/gen_ndr/cli_samr.c
@@ -2803,8 +2803,8 @@ NTSTATUS rpccli_samr_ChangePasswordUser3(struct rpc_pipe_client *cli,
 					 struct samr_CryptPassword *lm_password,
 					 struct samr_Password *lm_verifier,
 					 struct samr_CryptPassword *password3,
-					 struct samr_DomInfo1 *dominfo,
-					 struct samr_ChangeReject *reject)
+					 struct samr_DomInfo1 **dominfo,
+					 struct samr_ChangeReject **reject)
 {
 	struct samr_ChangePasswordUser3 r;
 	NTSTATUS status;
diff --git a/source/librpc/gen_ndr/cli_samr.h b/source/librpc/gen_ndr/cli_samr.h
index 9a89578..0855ade 100644
--- a/source/librpc/gen_ndr/cli_samr.h
+++ b/source/librpc/gen_ndr/cli_samr.h
@@ -360,8 +360,8 @@ NTSTATUS rpccli_samr_ChangePasswordUser3(struct rpc_pipe_client *cli,
 					 struct samr_CryptPassword *lm_password,
 					 struct samr_Password *lm_verifier,
 					 struct samr_CryptPassword *password3,
-					 struct samr_DomInfo1 *dominfo,
-					 struct samr_ChangeReject *reject);
+					 struct samr_DomInfo1 **dominfo,
+					 struct samr_ChangeReject **reject);
 NTSTATUS rpccli_samr_Connect5(struct rpc_pipe_client *cli,
 			      TALLOC_CTX *mem_ctx,
 			      const char *system_name,
diff --git a/source/librpc/gen_ndr/ndr_samr.c b/source/librpc/gen_ndr/ndr_samr.c
index a531515..a7c0f4d 100644
--- a/source/librpc/gen_ndr/ndr_samr.c
+++ b/source/librpc/gen_ndr/ndr_samr.c
@@ -11256,11 +11256,17 @@ static enum ndr_err_code ndr_push_samr_ChangePasswordUser3(struct ndr_push *ndr,
 		if (r->out.dominfo == NULL) {
 			return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
 		}
-		NDR_CHECK(ndr_push_samr_DomInfo1(ndr, NDR_SCALARS, r->out.dominfo));
+		NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.dominfo));
+		if (*r->out.dominfo) {
+			NDR_CHECK(ndr_push_samr_DomInfo1(ndr, NDR_SCALARS, *r->out.dominfo));
+		}
 		if (r->out.reject == NULL) {
 			return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
 		}
-		NDR_CHECK(ndr_push_samr_ChangeReject(ndr, NDR_SCALARS, r->out.reject));
+		NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.reject));
+		if (*r->out.reject) {
+			NDR_CHECK(ndr_push_samr_ChangeReject(ndr, NDR_SCALARS, *r->out.reject));
+		}
 		NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
 	}
 	return NDR_ERR_SUCCESS;
@@ -11274,6 +11280,8 @@ static enum ndr_err_code ndr_pull_samr_ChangePasswordUser3(struct ndr_pull *ndr,
 	uint32_t _ptr_lm_password;
 	uint32_t _ptr_lm_verifier;
 	uint32_t _ptr_password3;
+	uint32_t _ptr_dominfo;
+	uint32_t _ptr_reject;
 	TALLOC_CTX *_mem_save_server_0;
 	TALLOC_CTX *_mem_save_account_0;
 	TALLOC_CTX *_mem_save_nt_password_0;
@@ -11282,7 +11290,9 @@ static enum ndr_err_code ndr_pull_samr_ChangePasswordUser3(struct ndr_pull *ndr,
 	TALLOC_CTX *_mem_save_lm_verifier_0;
 	TALLOC_CTX *_mem_save_password3_0;
 	TALLOC_CTX *_mem_save_dominfo_0;
+	TALLOC_CTX *_mem_save_dominfo_1;
 	TALLOC_CTX *_mem_save_reject_0;
+	TALLOC_CTX *_mem_save_reject_1;
 	if (flags & NDR_IN) {
 		ZERO_STRUCT(r->out);
 
@@ -11377,14 +11387,36 @@ static enum ndr_err_code ndr_pull_samr_ChangePasswordUser3(struct ndr_pull *ndr,
 		}
 		_mem_save_dominfo_0 = NDR_PULL_GET_MEM_CTX(ndr);
 		NDR_PULL_SET_MEM_CTX(ndr, r->out.dominfo, LIBNDR_FLAG_REF_ALLOC);
-		NDR_CHECK(ndr_pull_samr_DomInfo1(ndr, NDR_SCALARS, r->out.dominfo));
+		NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dominfo));
+		if (_ptr_dominfo) {
+			NDR_PULL_ALLOC(ndr, *r->out.dominfo);
+		} else {
+			*r->out.dominfo = NULL;
+		}
+		if (*r->out.dominfo) {
+			_mem_save_dominfo_1 = NDR_PULL_GET_MEM_CTX(ndr);
+			NDR_PULL_SET_MEM_CTX(ndr, *r->out.dominfo, 0);
+			NDR_CHECK(ndr_pull_samr_DomInfo1(ndr, NDR_SCALARS, *r->out.dominfo));
+			NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dominfo_1, 0);
+		}
 		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dominfo_0, LIBNDR_FLAG_REF_ALLOC);
 		if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
 			NDR_PULL_ALLOC(ndr, r->out.reject);
 		}
 		_mem_save_reject_0 = NDR_PULL_GET_MEM_CTX(ndr);
 		NDR_PULL_SET_MEM_CTX(ndr, r->out.reject, LIBNDR_FLAG_REF_ALLOC);
-		NDR_CHECK(ndr_pull_samr_ChangeReject(ndr, NDR_SCALARS, r->out.reject));
+		NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_reject));
+		if (_ptr_reject) {
+			NDR_PULL_ALLOC(ndr, *r->out.reject);
+		} else {
+			*r->out.reject = NULL;
+		}
+		if (*r->out.reject) {
+			_mem_save_reject_1 = NDR_PULL_GET_MEM_CTX(ndr);
+			NDR_PULL_SET_MEM_CTX(ndr, *r->out.reject, 0);
+			NDR_CHECK(ndr_pull_samr_ChangeReject(ndr, NDR_SCALARS, *r->out.reject));
+			NDR_PULL_SET_MEM_CTX(ndr, _mem_save_reject_1, 0);
+		}
 		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_reject_0, LIBNDR_FLAG_REF_ALLOC);
 		NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
 	}
@@ -11449,11 +11481,21 @@ _PUBLIC_ void ndr_print_samr_ChangePasswordUser3(struct ndr_print *ndr, const ch
 		ndr->depth++;
 		ndr_print_ptr(ndr, "dominfo", r->out.dominfo);
 		ndr->depth++;
-		ndr_print_samr_DomInfo1(ndr, "dominfo", r->out.dominfo);
+		ndr_print_ptr(ndr, "dominfo", *r->out.dominfo);
+		ndr->depth++;
+		if (*r->out.dominfo) {
+			ndr_print_samr_DomInfo1(ndr, "dominfo", *r->out.dominfo);
+		}
+		ndr->depth--;
 		ndr->depth--;
 		ndr_print_ptr(ndr, "reject", r->out.reject);
 		ndr->depth++;
-		ndr_print_samr_ChangeReject(ndr, "reject", r->out.reject);
+		ndr_print_ptr(ndr, "reject", *r->out.reject);
+		ndr->depth++;
+		if (*r->out.reject) {
+			ndr_print_samr_ChangeReject(ndr, "reject", *r->out.reject);
+		}
+		ndr->depth--;
 		ndr->depth--;
 		ndr_print_NTSTATUS(ndr, "result", r->out.result);
 		ndr->depth--;
diff --git a/source/librpc/gen_ndr/samr.h b/source/librpc/gen_ndr/samr.h
index 64e1733..0108396 100644
--- a/source/librpc/gen_ndr/samr.h
+++ b/source/librpc/gen_ndr/samr.h
@@ -1677,8 +1677,8 @@ struct samr_ChangePasswordUser3 {
 	} in;
 
 	struct {
-		struct samr_DomInfo1 *dominfo;/* [ref] */
-		struct samr_ChangeReject *reject;/* [ref] */
+		struct samr_DomInfo1 **dominfo;/* [ref] */
+		struct samr_ChangeReject **reject;/* [ref] */
 		NTSTATUS result;
 	} out;
 
diff --git a/source/librpc/gen_ndr/srv_samr.c b/source/librpc/gen_ndr/srv_samr.c
index 0d7b47c..470c45c 100644
--- a/source/librpc/gen_ndr/srv_samr.c
+++ b/source/librpc/gen_ndr/srv_samr.c
@@ -5024,13 +5024,13 @@ static bool api_samr_ChangePasswordUser3(pipes_struct *p)
 	}
 
 	ZERO_STRUCT(r->out);
-	r->out.dominfo = talloc_zero(r, struct samr_DomInfo1);
+	r->out.dominfo = talloc_zero(r, struct samr_DomInfo1 *);
 	if (r->out.dominfo == NULL) {
 		talloc_free(r);
 		return false;
 	}
 
-	r->out.reject = talloc_zero(r, struct samr_ChangeReject);
+	r->out.reject = talloc_zero(r, struct samr_ChangeReject *);
 	if (r->out.reject == NULL) {
 		talloc_free(r);
 		return false;
diff --git a/source/librpc/idl/samr.idl b/source/librpc/idl/samr.idl
index 113b66c..4d618ad 100644
--- a/source/librpc/idl/samr.idl
+++ b/source/librpc/idl/samr.idl
@@ -1263,8 +1263,8 @@ import "misc.idl", "lsa.idl", "security.idl";
 		[in,unique]       samr_CryptPassword *lm_password,
 		[in,unique]       samr_Password *lm_verifier,
 		[in,unique]       samr_CryptPassword *password3,
-		[out,ref]         samr_DomInfo1 *dominfo,
-		[out,ref]         samr_ChangeReject *reject
+		[out,ref]         samr_DomInfo1 **dominfo,
+		[out,ref]         samr_ChangeReject **reject
 		);
 
 	/************************/
diff --git a/source/rpc_client/cli_samr.c b/source/rpc_client/cli_samr.c
index 4765e52..6a4d0dd 100644
--- a/source/rpc_client/cli_samr.c
+++ b/source/rpc_client/cli_samr.c
@@ -22,6 +22,11 @@
 
 #include "includes.h"
 
+static void init_lsa_String(struct lsa_String *name, const char *s)
+{
+	name->string = s;
+}
+
 /* Query user info */
 
 NTSTATUS rpccli_samr_query_userinfo(struct rpc_pipe_client *cli,
@@ -470,81 +475,68 @@ NTSTATUS rpccli_samr_query_alias_info(struct rpc_pipe_client *cli, TALLOC_CTX *m
 /* User change password */
 
 NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli,
-				    TALLOC_CTX *mem_ctx, 
-				    const char *username, 
-				    const char *newpassword, 
-				    const char *oldpassword )
+				    TALLOC_CTX *mem_ctx,
+				    const char *username,
+				    const char *newpassword,
+				    const char *oldpassword)
 {
-	prs_struct qbuf, rbuf;
-	SAMR_Q_CHGPASSWD_USER q;
-	SAMR_R_CHGPASSWD_USER r;
 	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+	struct samr_CryptPassword new_nt_password;
+	struct samr_CryptPassword new_lm_password;
+	struct samr_Password old_nt_hash_enc;
+	struct samr_Password old_lanman_hash_enc;
 
-	uchar new_nt_password[516];
-	uchar new_lm_password[516];
 	uchar old_nt_hash[16];
 	uchar old_lanman_hash[16];
-	uchar old_nt_hash_enc[16];
-	uchar old_lanman_hash_enc[16];
-
 	uchar new_nt_hash[16];
 	uchar new_lanman_hash[16];
-
-	char *srv_name_slash = talloc_asprintf(mem_ctx, "\\\\%s", cli->cli->desthost);
+	struct lsa_String server, account;
+	char *srv_name_slash = NULL;
 
 	DEBUG(10,("rpccli_samr_chgpasswd_user\n"));
 
-	ZERO_STRUCT(q);
-	ZERO_STRUCT(r);
+	init_lsa_String(&server, srv_name_slash);
+	init_lsa_String(&account, username);
+
+	srv_name_slash = talloc_asprintf(mem_ctx, "\\\\%s", cli->cli->desthost);
+	if (!srv_name_slash) {
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	/* Calculate the MD4 hash (NT compatible) of the password */
 	E_md4hash(oldpassword, old_nt_hash);
 	E_md4hash(newpassword, new_nt_hash);
 
-	if (lp_client_lanman_auth() 
-	    && E_deshash(newpassword, new_lanman_hash) 
-	    && E_deshash(oldpassword, old_lanman_hash)) {
+	if (lp_client_lanman_auth() &&
+	    E_deshash(newpassword, new_lanman_hash) &&
+	    E_deshash(oldpassword, old_lanman_hash)) {
 		/* E_deshash returns false for 'long' passwords (> 14
 		   DOS chars).  This allows us to match Win2k, which
 		   does not store a LM hash for these passwords (which
 		   would reduce the effective password length to 14) */
 
-		encode_pw_buffer(new_lm_password, newpassword, STR_UNICODE);
+		encode_pw_buffer(new_lm_password.data, newpassword, STR_UNICODE);
 
-		SamOEMhash( new_lm_password, old_nt_hash, 516);
-		E_old_pw_hash( new_nt_hash, old_lanman_hash, old_lanman_hash_enc);
+		SamOEMhash(new_lm_password.data, old_nt_hash, 516);
+		E_old_pw_hash(new_nt_hash, old_lanman_hash, old_lanman_hash_enc.hash);
 	} else {
 		ZERO_STRUCT(new_lm_password);
 		ZERO_STRUCT(old_lanman_hash_enc);
 	}
 
-	encode_pw_buffer(new_nt_password, newpassword, STR_UNICODE);
-	
-	SamOEMhash( new_nt_password, old_nt_hash, 516);
-	E_old_pw_hash( new_nt_hash, old_nt_hash, old_nt_hash_enc);
+	encode_pw_buffer(new_nt_password.data, newpassword, STR_UNICODE);
 
-	/* Marshall data and send request */
+	SamOEMhash(new_nt_password.data, old_nt_hash, 516);
+	E_old_pw_hash(new_nt_hash, old_nt_hash, old_nt_hash_enc.hash);
 
-	init_samr_q_chgpasswd_user(&q, srv_name_slash, username, 
-				   new_nt_password, 
-				   old_nt_hash_enc, 
-				   new_lm_password,
-				   old_lanman_hash_enc);
-
-	CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_CHGPASSWD_USER,
-		q, r,
-		qbuf, rbuf,
-		samr_io_q_chgpasswd_user,
-		samr_io_r_chgpasswd_user,
-		NT_STATUS_UNSUCCESSFUL); 
-
-	/* Return output parameters */
-
-	if (!NT_STATUS_IS_OK(result = r.status)) {
-		goto done;
-	}
-
- done:
+	result = rpccli_samr_ChangePasswordUser2(cli, mem_ctx,
+						 &server,
+						 &account,
+						 &new_nt_password,
+						 &old_nt_hash_enc,
+						 true,
+						 &new_lm_password,
+						 &old_lanman_hash_enc);
 
 	return result;
 }
@@ -552,48 +544,44 @@ NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli,
 /* User change password given blobs */
 
 NTSTATUS rpccli_samr_chng_pswd_auth_crap(struct rpc_pipe_client *cli,
-				    TALLOC_CTX *mem_ctx, 
-				    const char *username, 
-				    DATA_BLOB new_nt_password,
-				    DATA_BLOB old_nt_hash_enc,
-				    DATA_BLOB new_lm_password,
-				    DATA_BLOB old_lm_hash_enc)
+					 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)
 {
-	prs_struct qbuf, rbuf;
-	SAMR_Q_CHGPASSWD_USER q;
-	SAMR_R_CHGPASSWD_USER r;
 	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
-	char *srv_name_slash = talloc_asprintf(mem_ctx, "\\\\%s", cli->cli->desthost);
+	struct samr_CryptPassword new_nt_password;
+	struct samr_CryptPassword new_lm_password;
+	struct samr_Password old_nt_hash_enc;
+	struct samr_Password old_lm_hash_enc;
+	struct lsa_String server, account;
+	char *srv_name_slash = NULL;
 
 	DEBUG(10,("rpccli_samr_chng_pswd_auth_crap\n"));
 
-	ZERO_STRUCT(q);
-	ZERO_STRUCT(r);
-
-	/* Marshall data and send request */
-
-	init_samr_q_chgpasswd_user(&q, srv_name_slash, username, 
-				   new_nt_password.data, 
-				   old_nt_hash_enc.data, 
-				   new_lm_password.data,
-				   old_lm_hash_enc.data);
-
-	CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_CHGPASSWD_USER,
-		q, r,
-		qbuf, rbuf,
-		samr_io_q_chgpasswd_user,
-		samr_io_r_chgpasswd_user,
-		NT_STATUS_UNSUCCESSFUL); 
-
-	/* Return output parameters */
-
-	if (!NT_STATUS_IS_OK(result = r.status)) {
-		goto done;
+	srv_name_slash = talloc_asprintf(mem_ctx, "\\\\%s", cli->cli->desthost);
+	if (!srv_name_slash) {
+		return NT_STATUS_NO_MEMORY;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list