1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Declare ntlmbuf as char, to avoid warning with icc.

Join strings to support pre-C89 compilers.
This commit is contained in:
hniksic 2005-04-08 15:34:43 -07:00
parent 603375697b
commit db9855f2be
2 changed files with 59 additions and 53 deletions

View File

@ -1,3 +1,11 @@
2005-04-09 Hrvoje Niksic <hniksic@xemacs.org>
* http-ntlm.c (ntlm_output): Use "char", not "unsigned char" for
ntlmbuf. Our base64 functions accept char anyway.
(ntlm_output): Join up the format string, since we nominally
support K&R compilers.
(ntlm_output): Ditto.
2005-04-08 Hrvoje Niksic <hniksic@xemacs.org> 2005-04-08 Hrvoje Niksic <hniksic@xemacs.org>
* ptimer.c: Use Windows timers under Cygwin, whose POSIX timer * ptimer.c: Use Windows timers under Cygwin, whose POSIX timer

View File

@ -145,7 +145,7 @@ int ntlm_input (struct ntlmdata *ntlm, const char *header)
32 (48) start of data block 32 (48) start of data block
*/ */
int size; int size;
unsigned char *buffer = (unsigned char *) alloca (strlen (header)); char *buffer = (char *) alloca (strlen (header));
size = base64_decode (header, buffer); size = base64_decode (header, buffer);
if (size < 0) if (size < 0)
@ -306,7 +306,7 @@ char *ntlm_output (struct ntlmdata *ntlm, const char *user, const char *passwd,
int domoff; /* domain name offset */ int domoff; /* domain name offset */
int size; int size;
char *base64; char *base64;
unsigned char ntlmbuf[256]; /* enough, unless the host/domain is very long */ char ntlmbuf[256]; /* enough, unless the host/domain is very long */
/* point to the address of the pointer that holds the string to sent to the /* point to the address of the pointer that holds the string to sent to the
server, which is for a plain host or for a HTTP proxy */ server, which is for a plain host or for a HTTP proxy */
@ -338,21 +338,24 @@ char *ntlm_output (struct ntlmdata *ntlm, const char *user, const char *passwd,
24 Supplied Workstation security buffer(*) 24 Supplied Workstation security buffer(*)
32 start of data block 32 start of data block
Format string (merged for pre-ANSI compilers):
"NTLMSSP%c"
"\x01%c%c%c" 32-bit type = 1
"%c%c%c%c" 32-bit NTLM flag field
"%c%c" domain length
"%c%c" domain allocated space
"%c%c" domain name offset
"%c%c" 2 zeroes
"%c%c" host length
"%c%c" host allocated space
"%c%c" host name offset
"%c%c" 2 zeroes
"%s" host name
"%s" domain string
*/ */
snprintf((char *)ntlmbuf, sizeof(ntlmbuf), "NTLMSSP%c" snprintf(ntlmbuf, sizeof(ntlmbuf),
"\x01%c%c%c" /* 32-bit type = 1 */ "NTLMSSP%c\x01%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%s%s",
"%c%c%c%c" /* 32-bit NTLM flag field */
"%c%c" /* domain length */
"%c%c" /* domain allocated space */
"%c%c" /* domain name offset */
"%c%c" /* 2 zeroes */
"%c%c" /* host length */
"%c%c" /* host allocated space */
"%c%c" /* host name offset */
"%c%c" /* 2 zeroes */
"%s" /* host name */
"%s", /* domain string */
0, /* trailing zero */ 0, /* trailing zero */
0,0,0, /* part of type-1 long */ 0,0,0, /* part of type-1 long */
@ -434,47 +437,42 @@ char *ntlm_output (struct ntlmdata *ntlm, const char *user, const char *passwd,
lmrespoff = hostoff + hostlen; lmrespoff = hostoff + hostlen;
ntrespoff = lmrespoff + 0x18; ntrespoff = lmrespoff + 0x18;
/* Create the big type-3 message binary blob */ /* Create the big type-3 message binary blob:
size = snprintf((char *)ntlmbuf, sizeof(ntlmbuf), "NTLMSSP%c"
"NTLMSSP%c" "\x03%c%c%c" type-3, 32 bits
"\x03%c%c%c" /* type-3, 32 bits */
"%c%c%c%c" /* LanManager length + allocated space */ "%c%c%c%c" LanManager length + allocated space
"%c%c" /* LanManager offset */ "%c%c" LanManager offset
"%c%c" /* 2 zeroes */ "%c%c" 2 zeroes
"%c%c" /* NT-response length */ "%c%c" NT-response length
"%c%c" /* NT-response allocated space */ "%c%c" NT-response allocated space
"%c%c" /* NT-response offset */ "%c%c" NT-response offset
"%c%c" /* 2 zeroes */ "%c%c" 2 zeroes
"%c%c" /* domain length */ "%c%c" domain length
"%c%c" /* domain allocated space */ "%c%c" domain allocated space
"%c%c" /* domain name offset */ "%c%c" domain name offset
"%c%c" /* 2 zeroes */ "%c%c" 2 zeroes
"%c%c" /* user length */ "%c%c" user length
"%c%c" /* user allocated space */ "%c%c" user allocated space
"%c%c" /* user offset */ "%c%c" user offset
"%c%c" /* 2 zeroes */ "%c%c" 2 zeroes
"%c%c" /* host length */ "%c%c" host length
"%c%c" /* host allocated space */ "%c%c" host allocated space
"%c%c" /* host offset */ "%c%c" host offset
"%c%c%c%c%c%c" /* 6 zeroes */ "%c%c%c%c%c%c" 6 zeroes
"\xff\xff" /* message length */ "\xff\xff" message length
"%c%c" /* 2 zeroes */ "%c%c" 2 zeroes
"\x01\x82" /* flags */ "\x01\x82" flags
"%c%c" /* 2 zeroes */ "%c%c" 2 zeroes */
/* domain string */ size = snprintf(ntlmbuf, sizeof(ntlmbuf),
/* user string */ "NTLMSSP%c\x03%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\xff\xff%c%c\x01\x82%c%c",
/* host string */
/* LanManager response */
/* NT response */
,
0, /* zero termination */ 0, /* zero termination */
0,0,0, /* type-3 long, the 24 upper bits */ 0,0,0, /* type-3 long, the 24 upper bits */