Author: metze
Date: 2007-04-22 17:00:58 +0000 (Sun, 22 Apr 2007)
New Revision: 22464

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22464

Log:
remove double code and use a function

metze
Modified:
   branches/SAMBA_3_0/source/rpc_client/cli_samr.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_client/cli_samr.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_client/cli_samr.c     2007-04-22 16:45:03 UTC 
(rev 22463)
+++ branches/SAMBA_3_0/source/rpc_client/cli_samr.c     2007-04-22 17:00:58 UTC 
(rev 22464)
@@ -1193,11 +1193,6 @@
                                    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;
-
        uchar new_nt_password[516];
        uchar new_lm_password[516];
        uchar old_nt_hash[16];
@@ -1208,13 +1203,8 @@
        uchar new_nt_hash[16];
        uchar new_lanman_hash[16];
 
-       char *srv_name_slash = talloc_asprintf(mem_ctx, "\\\\%s", 
cli->cli->desthost);
-
        DEBUG(10,("rpccli_samr_chgpasswd_user\n"));
 
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
        /* Calculate the MD4 hash (NT compatible) of the password */
        E_md4hash(oldpassword, old_nt_hash);
        E_md4hash(newpassword, new_nt_hash);
@@ -1241,30 +1231,11 @@
        SamOEMhash( new_nt_password, old_nt_hash, 516);
        E_old_pw_hash( new_nt_hash, old_nt_hash, old_nt_hash_enc);
 
-       /* Marshall data and send request */
-
-       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:
-
-       return result;
+       return rpccli_samr_chng_pswd_auth_crap(cli, mem_ctx, username,
+                                              
data_blob_const(new_nt_password,sizeof(new_nt_password)),
+                                              
data_blob_const(old_nt_hash_enc,sizeof(old_nt_hash_enc)),
+                                              
data_blob_const(new_lm_password,sizeof(new_lm_password)),
+                                              
data_blob_const(old_lanman_hash_enc,sizeof(old_lanman_hash_enc)));
 }
 
 /* User change passwd with auth crap */

Reply via email to