9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: benavento@gmail.com (Federico G. Benavento)
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Laptop!
Date: Sun,  1 Apr 2007 02:57:22 -0300	[thread overview]
Message-ID: <9ddea4a75d97dd4c46decb5efb45f6e4@yourdomain.dom> (raw)
In-Reply-To: <9ab217670703312229l712e6d5bl708ab42ee7944993@mail.gmail.com>

> I'm sending this mail with abaco +
> the webfs patch. Though the cookie handling seems like it could use
> with some help in any case -- it is broken for eBay.
> 

I think I fixed some of the bugs in the cookie's code, I'm not sure
my changes are fixes or hacks, that's why this is not patch.
I'd really like someone to review them and submit the appropriate
patch. thanks.


g% 9fs sources
post...
g% diff -c /n/sources/plan9/sys/src/cmd/webfs /sys/src/cmd/webfs
diff -c /n/sources/plan9/sys/src/cmd/webfs/cookies.c /sys/src/cmd/webfs/cookies.c
/n/sources/plan9/sys/src/cmd/webfs/cookies.c:533,545 - /sys/src/cmd/webfs/cookies.c:533,548
  {
  	int lname, lpattern;
  
- 	if(cistrcmp(name, pattern)==0)
+ 	 if(pattern[0] != '.')
+ 		return 0;
+ 
+ 	if(cistrcmp(name, pattern+1) == 0)
  		return 1;
  
  	if(strcmp(ipattr(name), "dom")==0 && pattern[0]=='.'){
  		lname = strlen(name);
  		lpattern = strlen(pattern);
- 		if(lname >= lpattern && cistrcmp(name+lname-lpattern, pattern)==0)
+ 		if(lname>=lpattern && cistrcmp(name+lname-lpattern, pattern)==0)
  			return 1;
  	}
  
/n/sources/plan9/sys/src/cmd/webfs/cookies.c:557,563 - /sys/src/cmd/webfs/cookies.c:560,566
  {
  	return isdomainmatch(dom, c->dom)
  		&& strncmp(c->path, path, strlen(c->path))==0
- 		&& c->expire >= now;
+ 		&& (c->expire==0 || c->expire>=now);
  }
  
  /* 
/n/sources/plan9/sys/src/cmd/webfs/cookies.c:578,584 - /sys/src/cmd/webfs/cookies.c:581,587
  	for(i=0; i<jar->nc; i++){
  		if(cookiedebug)
  			fprint(2, "\ttry %s %s %d %s\n", jar->c[i].dom, jar->c[i].path, jar->c[i].secure, jar->c[i].name);
- 		if((issecure || !jar->c[i].secure) && iscookiematch(&jar->c[i], dom, path, now)){
+ 		if(/*(issecure || !jar->c[i].secure) &&*/ iscookiematch(&jar->c[i], dom, path, now)){
  			if(cookiedebug)
  				fprint(2, "\tmatched\n");
  			addcookie(j, &jar->c[i]);
/n/sources/plan9/sys/src/cmd/webfs/cookies.c:612,618 - /sys/src/cmd/webfs/cookies.c:615,621
  		return "request host does not match cookie domain";
  
  	if(strcmp(ipattr(dom), "dom")==0
- 	&& memchr(dom, '.', strlen(dom)-strlen(c->dom)) != nil)
+ 	&& memchr(dom, '.', strlen(c->dom)-strlen(dom)) != nil)
  		return "request host contains dots before cookie domain";
  
  	return 0;

Federico G. Benavento

---
/bin/fortune:
It's not Camelot, but it's not Cleveland, either.  -Boston Mayor Kevin White



  reply	other threads:[~2007-04-01  5:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-01  5:29 Devon H. O'Dell
2007-04-01  5:57 ` Federico G. Benavento [this message]
2007-04-01  7:40   ` Federico Benavento

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9ddea4a75d97dd4c46decb5efb45f6e4@yourdomain.dom \
    --to=benavento@gmail.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).