Fix cookie parsing error
This commit is contained in:
parent
3ef58da988
commit
2c5c8bc3aa
@ -1,6 +1,11 @@
|
|||||||
ChangeLog for davfs2
|
ChangeLog for davfs2
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
2016-08-18 Werner Baumann (werner.baumann@onlinehome.de)
|
||||||
|
* webdav.c, get_cookies:
|
||||||
|
Fix cookie parsing error (Debian Bug#834615, Thanks
|
||||||
|
to Harald Braumann).
|
||||||
|
|
||||||
2016-05-16 Werner Baumann (werner.baumann@onlinehome.de)
|
2016-05-16 Werner Baumann (werner.baumann@onlinehome.de)
|
||||||
* Fix some spelling errors.
|
* Fix some spelling errors.
|
||||||
|
|
||||||
|
11
src/webdav.c
11
src/webdav.c
@ -1554,14 +1554,10 @@ file_reader(void *userdata, const char *block, size_t length)
|
|||||||
When a cookie with the same name as an already stored cookie, but with
|
When a cookie with the same name as an already stored cookie, but with
|
||||||
a different value is received, it's value is updated if necessary.
|
a different value is received, it's value is updated if necessary.
|
||||||
Only n_cookies cookies will be stored. If the server sends more
|
Only n_cookies cookies will be stored. If the server sends more
|
||||||
different cookies these will be ignored.
|
different cookies these will be ignored. */
|
||||||
status must be of class 2XX or 3XX, otherwise the cookie is ignored. */
|
|
||||||
static void
|
static void
|
||||||
get_cookies(ne_request *req, void *userdata, const ne_status *status)
|
get_cookies(ne_request *req, void *userdata, const ne_status *status)
|
||||||
{
|
{
|
||||||
if (status->klass != 2 && status->klass != 3)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const char *cookie_hdr = ne_get_response_header(req, "Set-Cookie");
|
const char *cookie_hdr = ne_get_response_header(req, "Set-Cookie");
|
||||||
if (!cookie_hdr)
|
if (!cookie_hdr)
|
||||||
return;
|
return;
|
||||||
@ -1584,14 +1580,13 @@ get_cookies(ne_request *req, void *userdata, const ne_status *status)
|
|||||||
while (end > start && *(end - 1) == ' ')
|
while (end > start && *(end - 1) == ' ')
|
||||||
end--;
|
end--;
|
||||||
|
|
||||||
if ((start + 4) > end || *start == '=' || *(end - 1) == '=')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
char *es = strchr(start, '=');
|
char *es = strchr(start, '=');
|
||||||
if (!es)
|
if (!es)
|
||||||
continue;
|
continue;
|
||||||
size_t nl = es - start;
|
size_t nl = es - start;
|
||||||
size_t vl = end - es - 1;
|
size_t vl = end - es - 1;
|
||||||
|
if (nl == 0 || vl == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (i = 0; i < n_cookies; i++) {
|
for (i = 0; i < n_cookies; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user