Bug#500560: [patch] proxy auth percent encoding

2010-03-31 Thread David Kalnischkies
Hi Jean-Baptiste Lallement,

2010/3/29 Jean-Baptiste Lallement jeanbaptiste.lallem...@gmail.com:
 Tags: patch
Thanks for the patch!

 Here is a patch proposed to Ubuntu
Patches in Ubuntu/Debian (at least for APT) went to the vise versa
relatively fast as Michael is for both the Gatekeeper so pinging at
one place is mostly enough.
(but doesn't hurt - and i don't need to fiddle with lp) ;)

 It does the following things:
 - in QuoteString: escape '%'
 - unescape proxy credentials
 credentials need to be percent encoded in apt.conf (RFC3986)

I have modified it a bit:
- ParseQuoteWord includes a slightly modified code copy of DeQuoteString:
  add the isxdigit() tests also here
- use of array-style addressing instead of funky pointer casting
- overload DeQuoteString to avoid the string-creation in URI::CopyFrom
- replace RFC number in the comment as you suggested
- add your changes to debian/changelog
- add two comments to be able to understand the hex-values still tomorrow

So in essence: Your patch - with a bit of juicy in my debian-sid :)
http://bazaar.launchpad.net/~donkult/apt/sid/revision/1985

Again: Thanks and best regards / Mit freundlichen Grüßen,

David Kalnischkies



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#500560: [patch] proxy auth percent encoding

2010-03-29 Thread Jean-Baptiste Lallement
Tags: patch
Package: apt
Version: 0.7.25.3

Here is a patch proposed to Ubuntu
(https://bugs.edge.launchpad.net/ubuntu/+source/gnome-terminal/+bug/130289)

It does the following things:
- in QuoteString: escape '%'
- unescape proxy credentials

credentials need to be percent encoded in apt.conf (RFC3986)

=== modified file 'apt-pkg/contrib/strutl.cc'
--- apt-pkg/contrib/strutl.cc	2010-03-08 16:46:43 +
+++ apt-pkg/contrib/strutl.cc	2010-03-27 00:05:30 +
@@ -273,7 +273,7 @@
for (string::const_iterator I = Str.begin(); I != Str.end(); I++)
{
   if (strchr(Bad,*I) != 0 || isprint(*I) == 0 || 
-	  *I = 0x20 || *I = 0x7F)
+	  *I = 0x20 || *I = 0x7F || *I == 0x25)
   {
 	 char Buf[10];
 	 sprintf(Buf,%%%02x,(int)*I);
@@ -293,7 +293,8 @@
string Res;
for (string::const_iterator I = Str.begin(); I != Str.end(); I++)
{
-  if (*I == '%'  I + 2  Str.end())
+  if (*I == '%'  I + 2  Str.end()  
+  isxdigit(int(*(I+1)))  isxdigit(int(*(I+2
   {
 	 char Tmp[3];
 	 Tmp[0] = I[1];
@@ -1216,10 +1217,11 @@
}
else
{
+  // username and password must be encoded (RFC2396)
   Host.assign(At+1,SingleSlash);
-  User.assign(FirstColon,SecondColon);
+  User.assign(DeQuoteString(string(FirstColon,SecondColon)));
   if (SecondColon  At)
-	 Password.assign(SecondColon+1,At);
+	 Password.assign(DeQuoteString(string(SecondColon+1,At)));
}   

// Now we parse the RFC 2732 [] hostnames.