From 46d1d136e72c69b62f09b8523c437576f8d2051c Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 25 Jun 2004 15:09:21 +0000 Subject: Fixed to handle :pass in proto://user:pass@host. Fixes bug #60104. 2004-06-25 Jeffrey Stedfast * camel-url-scanner.c (camel_url_web_end): Fixed to handle :pass in proto://user:pass@host. Fixes bug #60104. svn path=/trunk/; revision=26514 --- camel/ChangeLog | 5 +++++ camel/camel-url-scanner.c | 45 ++++++++++++++++++++++++++++++++++++--------- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index e96c83fa6e..7fd7c209c4 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,8 @@ +2004-06-25 Jeffrey Stedfast + + * camel-url-scanner.c (camel_url_web_end): Fixed to handle :pass + in proto://user:pass@host. Fixes bug #60104. + 2004-06-24 Jeffrey Stedfast * providers/pop3/camel-pop3-store.c (connect_to_server): Error out diff --git a/camel/camel-url-scanner.c b/camel/camel-url-scanner.c index 486b42c34e..466cec3a15 100644 --- a/camel/camel-url-scanner.c +++ b/camel/camel-url-scanner.c @@ -325,6 +325,8 @@ camel_url_web_end (const char *in, const char *pos, const char *inend, urlmatch_ { register const char *inptr = pos; int parts = 0, digits, port; + gboolean passwd = FALSE; + const char *save; char close_brace; inptr += strlen (match->pattern); @@ -351,8 +353,6 @@ camel_url_web_end (const char *in, const char *pos, const char *inend, urlmatch_ } while (parts < 4); } else if (is_atom (*inptr)) { /* might be a domain or user@domain */ - const char *save = inptr; - while (inptr < inend) { if (!is_atom (*inptr)) break; @@ -392,15 +392,42 @@ camel_url_web_end (const char *in, const char *pos, const char *inend, urlmatch_ if (inptr < inend) { switch (*inptr) { - case ':': /* port notation */ + case ':': /* we either have a port or a password */ inptr++; - port = 0; - - while (inptr < inend && is_digit (*inptr) && port < 65536) - port = (port * 10) + (*inptr++ - '0'); - if (port >= 65536) - inptr--; + if (is_digit (*inptr) || passwd) { + port = 0; + + while (inptr < inend && is_digit (*inptr) && port < 65536) + port = (port * 10) + (*inptr++ - '0'); + + if (port >= 65536) { + if (!passwd) { + /* this must be a password? */ + goto passwd; + } + + inptr--; + } + } else { + passwd: + passwd = TRUE; + save = inptr; + + while (inptr < inend && is_atom (*inptr)) + inptr++; + + if (inptr < inend) { + if (*inptr == '@') { + /* there should be a domain next */ + inptr++; + goto domain; + } else { + /* no idea what this is... so don't keep it */ + inptr = save; + } + } + } if (inptr >= inend || *inptr != '/') break; -- cgit v1.2.3