freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "James K. Lowden" <jklowden AT schemamania.org>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Non-ascii characters in password
- Date: Sat, 22 Nov 2003 15:57:12 -0500
On Sat, 22 Nov 2003, SV Subramanian <mani_svs AT rediffmail.com> wrote:
> I have a difficulty in connecting from a linux machine to MSSQL 7 using
> TDS version 7.
> I am using unixODBC and freetds 0.61.2. Everything woorks perfectly when
> I connect as a user
> whose password contains ascii characters. Some of the accounts have
> passwords that have been created by custom algorithm and contain
> non-ascii characters. Is there a a way I can put character
> translation off during connect? I suppose that could be the reason.
The password is provided in the client's local character set, and we
convert it with iconv(3) to UCS-2. We can't turn "character translation
off" for passwords, because there's no way to pass in a UCS-2 password
(unless of course that's the client's encoding).
Rather, the way to ensure sending the server the correct UCS-2 password is
to make sure iconv(3) knows the client's true character set. The best way
to do that is with the "client charset" in freetds.conf.
I've attached a snippet of our current code, so you can see what's going
on. You'll find similar code in login.c::tds7_send_login() for 0.61.2.
You might try logging the input and output buffers to verify that we're
sending the right string (or not).
HTH.
--jkl
In CVS, src/tds/login.c:884:
unicode_left = sizeof(unicode_string);
if (tds_iconv(tds, tds->iconv_info[client2ucs2], to_server, &p,
&password_len, &punicode, &unicode_left) ==
(size_t) - 1) {
tdsdump_log(TDS_DBG_INFO1, "%L password \"%s\" could not be
converted to UCS-2\n", p);
assert(0);
}
password_len = punicode - unicode_string;
tds7_crypt_pass((unsigned char *) unicode_string, password_len,
(unsigned
char *) unicode_string);
tds_put_n(tds, unicode_string, password_len);
-
[freetds] Non-ascii characters in password,
SV Subramanian, 11/22/2003
- Re: [freetds] Non-ascii characters in password, James K. Lowden, 11/22/2003
Archive powered by MHonArc 2.6.24.