summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-07-07 10:55:00 +0200
committerStefan Metzmacher <metze@samba.org>2011-07-07 19:16:28 +0200
commit072a27fd9f0d6a34eb33543e14a708ff0567d0d1 (patch)
tree73ffad59e1dfb99d065527bebf431c936535d957 /source3
parent5b1ac1bcc3d0bd0af4d5b745e0e2e834aae34e54 (diff)
downloadsamba-072a27fd9f0d6a34eb33543e14a708ff0567d0d1.tar.gz
samba-072a27fd9f0d6a34eb33543e14a708ff0567d0d1.tar.bz2
samba-072a27fd9f0d6a34eb33543e14a708ff0567d0d1.zip
s3:libsmb: use trans2_bytes_push_str() in cli_tcon_andx_create() for the plaintext password
This makes sure we push the string always in DOS charset. metze
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/cliconnect.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 62e3a35a36..8c51bea9e3 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -2231,7 +2231,7 @@ struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
if((cli->sec_mode & (NEGOTIATE_SECURITY_USER_LEVEL
|NEGOTIATE_SECURITY_CHALLENGE_RESPONSE))
== 0) {
- char *tmp_pass;
+ uint8_t *tmp_pass;
if (!lp_client_plaintext_auth() && (*pass)) {
DEBUG(1, ("Server requested plaintext "
@@ -2244,21 +2244,20 @@ struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
* Non-encrypted passwords - convert to DOS codepage
* before using.
*/
- tmp_pass = talloc_array(talloc_tos(), char, 128);
- if (tmp_pass == NULL) {
- tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
+ tmp_pass = talloc_array(talloc_tos(), uint8, 0);
+ if (tevent_req_nomem(tmp_pass, req)) {
return tevent_req_post(req, ev);
}
- passlen = clistr_push(cli,
- tmp_pass,
- pass,
- talloc_get_size(tmp_pass),
- STR_TERMINATE);
- if (passlen == -1) {
- tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
+ tmp_pass = trans2_bytes_push_str(tmp_pass,
+ false, /* always DOS */
+ pass,
+ passlen,
+ NULL);
+ if (tevent_req_nomem(tmp_pass, req)) {
return tevent_req_post(req, ev);
}
- pass = tmp_pass;
+ pass = (const char *)tmp_pass;
+ passlen = talloc_get_size(tmp_pass);
}
}