Changeset 1875
- Timestamp:
- 06/15/2007 04:22:30 PM (15 months ago)
- Location:
- branches/lighttpd-1.4.x
- Files:
-
- 3 modified
-
NEWS (modified) (1 diff)
-
src/http_auth.c (modified) (3 diffs)
-
tests/mod-auth.t (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/lighttpd-1.4.x/NEWS
r1874 r1875 14 14 * fixed crash on duplicate headers with trailing WS (#1232) 15 15 * fixed accepting more connections then requested (#1216) 16 * fixed mem-leak in mod_auth (reported by Stefan Esser) 17 * fixed crash with md5-sess and cnonce not set in mod_auth (reported by Stefan Esser) 18 * fixed missing check for base64 encoded string in mod_auth and Basic auth 19 (reported by Stefan Esser) 20 * fixed possible crash in Auth-Digest header parser on trailing WS in 21 mod_auth (reported by Stefan Esser) 16 22 17 23 - 1.4.15 - 2007-04-13 -
branches/lighttpd-1.4.x/src/http_auth.c
r1721 r1875 831 831 username = buffer_init(); 832 832 833 base64_decode(username, realm_str); 833 if (!base64_decode(username, realm_str)) { 834 buffer_free(username); 835 836 log_error_write(srv, __FILE__, __LINE__, "sb", "decodeing base64-string failed", username); 837 838 return 0; 839 } 834 840 835 841 /* r2 == user:password */ … … 968 974 /* skip whitespaces */ 969 975 while (*c == ' ' || *c == '\t') c++; 970 if (! c) break;976 if (!*c) break; 971 977 972 978 for (i = 0; dkv[i].key; i++) { … … 1017 1023 log_error_write(srv, __FILE__, __LINE__, "s", 1018 1024 "digest: missing field"); 1025 1026 buffer_free(b); 1027 return -1; 1028 } 1029 1030 /** 1031 * protect the md5-sess against missing cnonce and nonce 1032 */ 1033 if (algorithm && 1034 0 == strcasecmp(algorithm, "md5-sess") && 1035 (!nonce || !cnonce)) { 1036 log_error_write(srv, __FILE__, __LINE__, "s", 1037 "digest: (md5-sess: missing field"); 1038 1039 buffer_free(b); 1019 1040 return -1; 1020 1041 } -
branches/lighttpd-1.4.x/tests/mod-auth.t
r1374 r1875 9 9 use strict; 10 10 use IO::Socket; 11 use Test::More tests => 1 0;11 use Test::More tests => 13; 12 12 use LightyTest; 13 13 … … 94 94 ok($tf->handle_http($t) == 0, 'Digest-Auth: missing nc (noncecount instead), no crash'); 95 95 96 $t->{REQUEST} = ( <<EOF 97 GET /server-status HTTP/1.0 98 Authorization: Basic = 99 EOF 100 ); 101 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; 102 ok($tf->handle_http($t) == 0, 'Basic-Auth: Invalid Base64'); 103 104 105 $t->{REQUEST} = ( <<EOF 106 GET /server-status HTTP/1.0 107 User-Agent: Wget/1.9.1 108 Authorization: Digest username="jan", realm="jan", 109 nonce="b1d12348b4620437c43dd61c50ae4639", algorithm="md5-sess", 110 uri="/MJ-BONG.xm.mpc", qop=auth, noncecount=00000001", 111 cnonce="036FCA5B86F7E7C4965C7F9B8FE714B7", 112 nc="asd", 113 response="29B32C2953C763C6D033C8A49983B87E" 114 EOF 115 ); 116 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; 117 ok($tf->handle_http($t) == 0, 'Digest-Auth: md5-sess + missing cnonce'); 118 119 $t->{REQUEST} = ( <<EOF 120 GET /server-status HTTP/1.0 121 User-Agent: Wget/1.9.1 122 Authorization: Digest username="jan", realm="jan", 123 nonce="b1d12348b4620437c43dd61c50ae4639", algorithm="md5-sess", 124 uri="/MJ-BONG.xm.mpc", qop=auth, noncecount=00000001", 125 cnonce="036FCA5B86F7E7C4965C7F9B8FE714B7", 126 nc="asd", 127 response="29B32C2953C763C6D033C8A49983B87E" 128 EOF 129 ); 130 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; 131 ok($tf->handle_http($t) == 0, 'Digest-Auth: trailing WS'); 132 96 133 97 134

