libwbclient: Fix bug 8087 -- wbcChangeUserPasswordEx in RESPONSE mode does not work
authorVolker Lendecke <vl@samba.org>
Fri, 23 Apr 2010 17:41:29 +0000 (19:41 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 14 Jun 2011 10:58:02 +0000 (12:58 +0200)
This is 03115efae89c8c4f51dea1ce82613817bd9fcf5b from master

Actually copy something in wbcChangeUserPasswordEx

The length argument for memcpy was initialized to 0 and not initialized
(cherry picked from commit c707b1f3b199b8c785a79db308d80eee2926b060)

nsswitch/libwbclient/wbc_pam.c

index 25475ce5cf6bfe1feec74f59a8e51b864a831309..8c725d2fca05d3cc90e2f00832e648dc800b1ba4 100644 (file)
@@ -865,35 +865,35 @@ wbcErr wbcChangeUserPasswordEx(const struct wbcChangePasswordParams *params,
                        sizeof(request.data.chng_pswd_auth_crap.domain) - 1);
 
                if (params->new_password.response.nt_data) {
+                       request.data.chng_pswd_auth_crap.new_nt_pswd_len =
+                               params->new_password.response.nt_length;
                        memcpy(request.data.chng_pswd_auth_crap.new_nt_pswd,
                               params->new_password.response.nt_data,
                               request.data.chng_pswd_auth_crap.new_nt_pswd_len);
-                       request.data.chng_pswd_auth_crap.new_nt_pswd_len =
-                               params->new_password.response.nt_length;
                }
 
                if (params->new_password.response.lm_data) {
+                       request.data.chng_pswd_auth_crap.new_lm_pswd_len =
+                               params->new_password.response.lm_length;
                        memcpy(request.data.chng_pswd_auth_crap.new_lm_pswd,
                               params->new_password.response.lm_data,
                               request.data.chng_pswd_auth_crap.new_lm_pswd_len);
-                       request.data.chng_pswd_auth_crap.new_lm_pswd_len =
-                               params->new_password.response.lm_length;
                }
 
                if (params->old_password.response.old_nt_hash_enc_data) {
+                       request.data.chng_pswd_auth_crap.old_nt_hash_enc_len =
+                               params->old_password.response.old_nt_hash_enc_length;
                        memcpy(request.data.chng_pswd_auth_crap.old_nt_hash_enc,
                               params->old_password.response.old_nt_hash_enc_data,
                               request.data.chng_pswd_auth_crap.old_nt_hash_enc_len);
-                       request.data.chng_pswd_auth_crap.old_nt_hash_enc_len =
-                               params->old_password.response.old_nt_hash_enc_length;
                }
 
                if (params->old_password.response.old_lm_hash_enc_data) {
+                       request.data.chng_pswd_auth_crap.old_lm_hash_enc_len =
+                               params->old_password.response.old_lm_hash_enc_length;
                        memcpy(request.data.chng_pswd_auth_crap.old_lm_hash_enc,
                               params->old_password.response.old_lm_hash_enc_data,
                               request.data.chng_pswd_auth_crap.old_lm_hash_enc_len);
-                       request.data.chng_pswd_auth_crap.old_lm_hash_enc_len =
-                               params->old_password.response.old_lm_hash_enc_length;
                }
 
                break;