[Yum] Basic auth fails in 1.97, works in previous versions

seth vidal skvidal at phy.duke.edu
Fri May 16 14:43:32 UTC 2003


> Hi Seth,
> 
> Thanks for your quick reply.  I'm going to tackle it myself, since I 
> have to have it in order to roll out Red Hat 9 to clients.

gotcha.




> 
> I think I have most of it covered.  I've added two arguments to 
> retrygrab/urlgrab for user and password.  I've created the 
> HTTPBasicAuthHandler(), and made an optional opener.add_handler along 
> the lines of the Keepalive stuff that is already in there.
> 
> Anyway, I think I have all of the back-end bits.  But now I'm looking at 
> the way arguments are passed around (and more importantly, how 
> infrequently the serveridlist is being passed around), and I don't see 
> how to get the user and password into the places where I need it (i.e. 
> everywhere a retrygrab and urlgrab happen).  It looks like I'm going to 
> have to re-write large chunks of code to haul extra stuff around, when 
> it seems like it ought to be very simple.

it's actually not hard

you can store the user/pass as a per-server variable in the config file
and they get hauled around in the config class.

pretty much anything in the config class can get pushed in.

Here is what I would suggest:
urlgrab inherits from retrygrab so just do it in one place
 - urlgrab  - add the user and pass there
 - add the basic auth there
 - we would be wise to make it smart enough to build up the url 
correctly for ftp users so there is one interface
 - check to see if conf.serveruser[serverid] and serverpass are not None
 - if not then pass them into the grab() call and let grab() handle it
internally.


internally I think urlgrab should look to see if it is http, ftp or file
urls

if http - build up the basicauthhandler
if ftp put them inline ftp://user:pass@foo.com/path/bar/
if file ignore them and maybe even complain that the user is a moron.


Then that should be able to deal with it nicely and not require dragging
a lot of data around.

Joe - you might be wise to smack Jack Neely in the head and see if you
two can merge your patch for this into his failover patches. It would
make my life easier b/c y'all are working on more or less the same
section(s) of code.

-sv








More information about the Yum mailing list