Sync trunk -> 3.0 for 3.0.24 code. Still need
[metze/old/v3-2-winbind-ndr.git] / source / utils / ntlm_auth_diagnostics.c
index 7fae0ede978874c213d0e53b335b737d71b1e992..e69715affd024300c9a1860176aae6d3000c542f 100644 (file)
@@ -445,6 +445,7 @@ static BOOL test_plaintext(enum ntlm_break break_which)
        DATA_BLOB nt_response = data_blob(NULL, 0);
        DATA_BLOB lm_response = data_blob(NULL, 0);
        char *password;
+       smb_ucs2_t *nt_response_ucs2;
 
        uchar user_session_key[16];
        uchar lm_key[16];
@@ -457,26 +458,30 @@ static BOOL test_plaintext(enum ntlm_break break_which)
        flags |= WBFLAG_PAM_LMKEY;
        flags |= WBFLAG_PAM_USER_SESSION_KEY;
 
-       if ((push_ucs2_allocate((smb_ucs2_t **)&nt_response.data, opt_password)) == -1) {
+       if ((push_ucs2_allocate(&nt_response_ucs2, opt_password)) == -1) {
                DEBUG(0, ("push_ucs2_allocate failed!\n"));
                exit(1);
        }
 
-       nt_response.length = strlen_w(((void *)nt_response.data))*sizeof(smb_ucs2_t);
+       nt_response.data = (unsigned char *)nt_response_ucs2;
+       nt_response.length = strlen_w(nt_response_ucs2)*sizeof(smb_ucs2_t);
 
-       password = strdup_upper(opt_password);
+       if ((password = strdup_upper(opt_password)) == NULL) {
+               DEBUG(0, ("strdup_upper failed!\n"));
+               exit(1);
+       }
 
        if ((convert_string_allocate(NULL, CH_UNIX, 
                                     CH_DOS, password,
                                     strlen(password)+1, 
-                                    (void**)&lm_response.data,True)) == -1) {
-               DEBUG(0, ("push_ascii_allocate failed!\n"));
+                                    &lm_response.data,True)) == -1) {
+               DEBUG(0, ("convert_string_allocate failed!\n"));
                exit(1);
        }
 
        SAFE_FREE(password);
 
-       lm_response.length = strlen(lm_response.data);
+       lm_response.length = strlen((const char *)lm_response.data);
 
        switch (break_which) {
        case BREAK_NONE: