Login | Register
My pages Projects Community openCollabNet

Discussions > dev > Re: [Patch] 2/5: multichan

Project highlights: Stable Version: 1.6.1, Development Version: 1.7.6

current
Discussion topic

Back to topic list

Re: [Patch] 2/5: multichan

Reply

Author hunterm
Full name Hunter Matthews
Date 2005-02-03 19:12:14 PST
Message Also keep in mind that ConstructParser was a bit of a hack we had to
have because we had no client database. As soon as we have a client
database, we can ditch construct parser.

What?

Simple - In days of yore I looked at that header and said "That looks
like what happens when you print a list of lists from python" - we'll
parse that list and know which channels you're authenticated for. Early
pre 1.0 versions did the quick but scary "eval()". RHN itself never
parsed the sucker at all - it used this and a couple of other headers
plus a hash to make sure the client hadn't tampered with anything, but
to actually figure out which channels client N was subscribed to, it did
a lookup against its database.

At some point the RHN people made this header something that eval()
can't handle. And ConstructParser was meant to be a safe eval().

Jack,
  At this point, ConstructParser probably makes no sense - write a
smaller (simpler) parser and plug it in.


On Wed, 2005-01-19 at 22:08, Jack Neely wrote:
> I see now...the headers look like this now:
>
> headers_in[x-rhn-auth-channels] == ['rawhide',
> '20050119190046'],['test', '20050119220409']
>
> This is new. Well...new-ish.
>
> Jack
>
>
> On Tue, 18 Jan 2005 11:21:07 +0100, Pauline Middelink
> <middelink at polyware dot nl> wrote:
> > On Mon, 17 Jan 2005 around 18:18:41 -0500, Jack Neely wrote:
> > > Pauline,
> >
> > PS Its dudete :)
> >
> > > This one I'm not going to take. Although I can agree that the code your
> > > are trying to replace is blatently confusing. (It confused me.)
> >
> > The current code is simply wrong. When talking to a current with more
> > than one matching channel, the resulting header from up2date has a list
> > of channel names, seperated with a comma. No brackets however.
> >
> > The problem is not in how to represent the list as a returnvalue,
> > but the ConstructParser simply croaks on such an input. It NEEDS
> > brackets before the parser even accepts comma's. Hence the patch.
> >
> > Its also very easy to create, as soon as you have a parent channel
> > and do an 'up2date -l', current goes byebye. So its not really an
> > exotic feature, its a patch for a real problem.
> >
> > > It does look to me that the HTTP headers always contain a list of
> > > elements here, where XMLRPC wants a list of a list of elements.
> >
> > Check.
> >
> > > Although, I'd bet that at one point up2date may have sent headers where
> > > this was a list of lists, hence the code.
> >
> > Could very well be. But i'm not quite sure if such a pre-95 version
> > a) is still existing, b) really had such a problem.
> >
> > > On Mon, Jan 10, 2005 at 09:23:47PM +0100, Pauline Middelink wrote:
> > > > LS,
> > > >
> > > > Attached you ill find a small correction to make little better
> > > > handeling of the parsing of the channel subscription.
> > > >
> > > > Met vriendelijke groet,
> > > > Pauline Middelink
> > > > --
> > > > GPG Key fingerprint = 2D5B 87A7 DDA6 0378 5DEA BD3B 9A50 B416 E2D0 C3C2
> > > > For more details look at my website http://www.polyware.​nl/~middelink
> > >
> > > > diff -ur current-1.5.9.orig/auth.py /usr/share/current/auth.py
> > > > --- current-1.5.9.orig/auth.py 2005-01-05 15:04:55.000000000 +0100
> > > > +++ /usr/share/current/auth.py 2005-01-05 15:07:34.000000000 +0100
> > > > @@ -181,14 +181,11 @@
> > > > if not headers.has_key(attr):
> > > > raise Exception("Missing authentication header: %s" % attr)
> > > > else:
> > > > - cp = ConstructParser.Cons​tructParser(headers[​attr])
> > > > + cp = ConstructParser.Cons​tructParser("["+head​ers[attr]+"]")
> > > > try:
> > > > tmpHdr = cp.parseIt()
> > > > log ("Header object successfully parsed: %s" % tmpHdr, DEBUG2)
> > > > - if not type(tmpHdr[0]) == type([]):
> > > > - self.data['X-RHN-Aut​h-Channels'] = [tmpHdr]
> > > > - else:
> > > > - self.data['X-RHN-Aut​h-Channels'] = tmpHdr
> > > > + self.data['X-RHN-Aut​h-Channels'] = tmpHdr
> > > > except Exception, e:
> > > > log ("Exception caught: %s" % e, DEBUG2)
> > > > self.data['X-RHN-Aut​h-Channels'] = ''
> > > >
> > >
> > > > --------------------​--------------------​--------------------​---------
> > > > To unsubscribe, e-mail: dev-unsubscribe@curr​ent.tigris.org
> > > > For additional commands, e-mail: dev-help at current dot tigris dot org
> > >
> > > --
> > > Jack Neely <slack at quackmaster dot net>
> > > Realm Linux Administration and Development
> > > PAMS Computer Operations at NC State University
> > > GPG Fingerprint: 1917 5AC1 E828 9337 7AA4 EA6B 213B 765F 3B6A 5B89
> > >
> > > --------------------​--------------------​--------------------​---------
> > > To unsubscribe, e-mail: dev-unsubscribe@curr​ent.tigris.org
> > > For additional commands, e-mail: dev-help at current dot tigris dot org
> >
> > Met vriendelijke groet,
> > Pauline Middelink
> > --
> > GPG Key fingerprint = 2D5B 87A7 DDA6 0378 5DEA BD3B 9A50 B416 E2D0 C3C2
> > For more details look at my website http://www.polyware.​nl/~middelink
> >
> >
> >
>
> --------------------​--------------------​--------------------​---------
> To unsubscribe, e-mail: dev-unsubscribe@curr​ent.tigris.org
> For additional commands, e-mail: dev-help at current dot tigris dot org
--
Hunter Matthews Unix / Network Administrator
Office: BioScience 145/244 Duke Univ. Biology Department
Key: F0F88438 / FFB5 34C0 B350 99A4 BB02 9779 A5DB 8B09 F0F8 8438
Never take candy from strangers. Especially on the internet.


--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: dev-unsubscribe@curr​ent.tigris.org
For additional commands, e-mail: dev-help at current dot tigris dot org

« Previous message in topic | 5 of 7 | Next message in topic »

Messages

Show all messages in topic

[Patch] 2/5: multichan Pauline Middelink <middelink at polyware dot nl> Pauline Middelink <middelink at polyware dot nl> 2005-01-10 12:23:47 PST
     Re: [Patch] 2/5: multichan Jack Neely <jjneely at pams dot ncsu dot edu> Jack Neely <jjneely at pams dot ncsu dot edu> 2005-01-17 15:18:41 PST
         Re: [Patch] 2/5: multichan Pauline Middelink <middelink at polyware dot nl> Pauline Middelink <middelink at polyware dot nl> 2005-01-18 02:21:07 PST
             Re: [Patch] 2/5: multichan theslack Jack Neely 2005-01-19 19:08:59 PST
                 Re: [Patch] 2/5: multichan hunterm Hunter Matthews 2005-02-03 19:12:14 PST
                     Re: [Patch] 2/5: multichan theslack Jack Neely 2005-02-09 13:08:45 PST
                         Re: [Patch] 2/5: multichan theslack Jack Neely 2005-02-20 17:58:07 PST
Messages per page: