The branch, v3-0-test has been updated
       via  008c7535b4bbd804952ac3d3c51da4223000ce60 (commit)
      from  ad29a26c4226aa4d4a6a586413dcb0749bfea6b3 (commit)

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


- Log -----------------------------------------------------------------
commit 008c7535b4bbd804952ac3d3c51da4223000ce60
Author: Günther Deschner <[EMAIL PROTECTED]>
Date:   Wed Jun 4 20:02:13 2008 +0200

    net: for robustness reasons, fallback to level 24 pwd set while joining.
    
    DCERPC_FAULT_INVALID_TAG is returned by older windows releases, in that 
case it
    is wise to do what we did prior to 3.0.28.
    
    Guenther

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

Summary of changes:
 source/utils/net_domain.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/utils/net_domain.c b/source/utils/net_domain.c
index 533bb9c..1c19a61 100644
--- a/source/utils/net_domain.c
+++ b/source/utils/net_domain.c
@@ -213,6 +213,7 @@ NTSTATUS netdom_join_domain( TALLOC_CTX *mem_ctx, struct 
cli_state *cli,
        uint32 fields_present;
        uchar pwbuf[532];
        SAM_USERINFO_CTR ctr;
+       SAM_USER_INFO_24 p24;
        SAM_USER_INFO_25 p25;
        const int infolevel = 25;
        struct MD5Context md5ctx;
@@ -337,6 +338,27 @@ NTSTATUS netdom_join_domain( TALLOC_CTX *mem_ctx, struct 
cli_state *cli,
        status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol,
                                           infolevel, &cli->user_session_key, 
&ctr);
 
+       if (NT_STATUS_EQUAL(status, NT_STATUS(DCERPC_FAULT_INVALID_TAG))) {
+
+               uchar pwbuf2[516];
+
+               ZERO_STRUCT(p24);
+
+               encode_pw_buffer(pwbuf2, clear_pw, STR_UNICODE);
+
+               /* retry with level 24 */
+               init_sam_user_info24(&p24, (char *)pwbuf2, 24);
+
+               ctr.switch_value = 24;
+               ctr.info.id24    = &p24;
+
+               status = rpccli_samr_set_userinfo(pipe_hnd, mem_ctx,
+                                                 &user_pol,
+                                                 24,
+                                                 &cli->user_session_key,
+                                                 &ctr);
+       }
+
        if ( !NT_STATUS_IS_OK(status) ) {
                d_fprintf( stderr, "Failed to set password for machine account 
(%s)\n", 
                        nt_errstr(status));


-- 
Samba Shared Repository

Reply via email to