summaryrefslogtreecommitdiff
path: root/lib/http_ntlm.c
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2009-01-21 04:42:47 +0000
committerDan Fandrich <dan@coneharvesters.com>2009-01-21 04:42:47 +0000
commit5591550167092c0e5f307b3c2c87f44518e7159f (patch)
tree7fc43fd73fc132099fc7a9c6c740484ad29d4c82 /lib/http_ntlm.c
parent6bb9ef8de4273e0f5f5e499eb61a972b3644f70f (diff)
downloadcurl-5591550167092c0e5f307b3c2c87f44518e7159f.tar.gz
Fixed a couple more locale-dependent toupper conversions, mainly for
clarity. This does fix one problem that causes ;type=i FTP URLs to fail in the Turkish locale when CURLOPT_PROXY_TRANSFER_MODE is used (test case 561) Added tests 561 and 1092 through 1094 to test various combinations of ;type= and ;mode= URLs that could potentially fail in the Turkish locale.
Diffstat (limited to 'lib/http_ntlm.c')
-rw-r--r--lib/http_ntlm.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/lib/http_ntlm.c b/lib/http_ntlm.c
index afed953e2..869a247a0 100644
--- a/lib/http_ntlm.c
+++ b/lib/http_ntlm.c
@@ -323,7 +323,7 @@ CURLntlm Curl_input_ntlm(struct connectdata *conn,
* Turns a 56 bit key into the 64 bit, odd parity key and sets the key. The
* key schedule ks is also set.
*/
-static void setup_des_key(unsigned char *key_56,
+static void setup_des_key(const unsigned char *key_56,
DES_key_schedule DESKEYARG(ks))
{
DES_cblock key;
@@ -346,9 +346,9 @@ static void setup_des_key(unsigned char *key_56,
* 8 byte plaintext is encrypted with each key and the resulting 24
* bytes are stored in the results array.
*/
-static void lm_resp(unsigned char *keys,
- unsigned char *plaintext,
- unsigned char *results)
+static void lm_resp(const unsigned char *keys,
+ const unsigned char *plaintext,
+ unsigned char *results)
{
DES_key_schedule ks;
@@ -377,17 +377,10 @@ static void mk_lm_hash(struct SessionHandle *data,
static const unsigned char magic[] = {
0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 /* i.e. KGS!@#$% */
};
- unsigned int i;
- size_t len = strlen(password);
-
- if(len > 14)
- len = 14;
-
- for (i=0; i<len; i++)
- pw[i] = (unsigned char)toupper(password[i]);
+ size_t len = CURLMIN(strlen(password), 14);
- for (; i<14; i++)
- pw[i] = 0;
+ Curl_strntoupper((char *)pw, password, len);
+ memset(&pw[len], 0, 14-len);
#ifdef CURL_DOES_CONVERSIONS
/*