[Evolution-hackers] Fwd: Anonymous NNTP broken caused by
camel-url
Not Zed
notzed@ximian.com
Fri, 11 Mar 2005 09:10:04 +0800
--=-U6lvfuYn9lrM+KnXyCkK
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Are you saying newly created accounts don't work? The patch was only to
fix those, it didn' fix ones which were already created wrongly.
The patch below is no good, camel-url is used everwhere, and a blank uid
is valid in a uri afaik.
On Thu, 2005-03-10 at 23:41 +0100, Karl Vogel wrote:
> anonymous nntp access is broken. There recently was a bugzilla entry
> for this http://bugzilla.ximian.com/show_bug.cgi?id=70990 which should
> have resolved the issue. However it still happens on my system.
>
> Looking through the code, it appears the nntp provider, checks whether
> a user is given by comparing the url->url field to NULL. However
> camel-url will set user to a blanko string ("") if given an url like:
> nntp://@news.gmane.org (which is how it is currently created by the
> new account wizard)
>
> I'm not sure what the semantic of the URL object was supposed to be?
> Should empty fields be NULL or should callers compare for an empty
> string aswell?
>
> Either way.. following patch fixes the camel-url to consider
> protocol://@host as not having a user and thus leave the user
> properties as a NULL value.
>
> For reference, tested on Fedora Rawhide using packages:
> evolution-2.2.0-4
> evolution-data-server-1.2.0-2
>
>
> NOTE: try adding a new anonymous NNTP account if your installation
> currently works.. as it does work if your config has an url without
> the @ in it.. like nttp://news.server.com (which I believe was the way
> it was created some time ago)
>
>
> Index: camel/camel-url.c
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/camel-url.c,v
> retrieving revision 1.42
> diff -u -p -r1.42 camel-url.c
> --- camel/camel-url.c 12 Jan 2005 08:46:49 -0000 1.42
> +++ camel/camel-url.c 6 Mar 2005 01:08:26 -0000
> @@ -119,8 +119,10 @@ camel_url_new_with_base (CamelURL *base,
> semi = colon;
> }
>
> - url->user = g_strndup (url_string, semi - url_string);
> - camel_url_decode (url->user);
> + if (semi - url_string) {
> + url->user = g_strndup (url_string,
> semi - url_string);
> + camel_url_decode (url->user);
> + }
> url_string = at + 1;
> } else
> url->user = url->passwd = url->authmech = NULL;
> _______________________________________________
> evolution-hackers maillist - evolution-hackers@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/evolution-hackers
--=-U6lvfuYn9lrM+KnXyCkK
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.5.7">
</HEAD>
<BODY>
<BR>
Are you saying newly created accounts don't work? The patch was only to fix those, it didn' fix ones which were already created wrongly.<BR>
<BR>
The patch below is no good, camel-url is used everwhere, and a blank uid is valid in a uri afaik.<BR>
<BR>
On Thu, 2005-03-10 at 23:41 +0100, Karl Vogel wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">anonymous nntp access is broken. There recently was a bugzilla entry</FONT>
<FONT COLOR="#000000">for this <A HREF="http://bugzilla.ximian.com/show_bug.cgi?id=70990">http://bugzilla.ximian.com/show_bug.cgi?id=70990</A> which should</FONT>
<FONT COLOR="#000000">have resolved the issue. However it still happens on my system.</FONT>
<FONT COLOR="#000000">Looking through the code, it appears the nntp provider, checks whether</FONT>
<FONT COLOR="#000000">a user is given by comparing the url->url field to NULL. However</FONT>
<FONT COLOR="#000000">camel-url will set user to a blanko string ("") if given an url like:</FONT>
<FONT COLOR="#000000">nntp://@news.gmane.org (which is how it is currently created by the</FONT>
<FONT COLOR="#000000">new account wizard)</FONT>
<FONT COLOR="#000000">I'm not sure what the semantic of the URL object was supposed to be?</FONT>
<FONT COLOR="#000000">Should empty fields be NULL or should callers compare for an empty</FONT>
<FONT COLOR="#000000">string aswell?</FONT>
<FONT COLOR="#000000">Either way.. following patch fixes the camel-url to consider</FONT>
<FONT COLOR="#000000">protocol://@host as not having a user and thus leave the user</FONT>
<FONT COLOR="#000000">properties as a NULL value.</FONT>
<FONT COLOR="#000000">For reference, tested on Fedora Rawhide using packages:</FONT>
<FONT COLOR="#000000"> evolution-2.2.0-4</FONT>
<FONT COLOR="#000000"> evolution-data-server-1.2.0-2</FONT>
<FONT COLOR="#000000">NOTE: try adding a new anonymous NNTP account if your installation</FONT>
<FONT COLOR="#000000">currently works.. as it does work if your config has an url without</FONT>
<FONT COLOR="#000000">the @ in it.. like nttp://news.server.com (which I believe was the way</FONT>
<FONT COLOR="#000000">it was created some time ago)</FONT>
<FONT COLOR="#000000">Index: camel/camel-url.c</FONT>
<FONT COLOR="#000000">===================================================================</FONT>
<FONT COLOR="#000000">RCS file: /cvs/gnome/evolution-data-server/camel/camel-url.c,v</FONT>
<FONT COLOR="#000000">retrieving revision 1.42</FONT>
<FONT COLOR="#000000">diff -u -p -r1.42 camel-url.c</FONT>
<FONT COLOR="#000000">--- camel/camel-url.c 12 Jan 2005 08:46:49 -0000 1.42</FONT>
<FONT COLOR="#000000">+++ camel/camel-url.c 6 Mar 2005 01:08:26 -0000</FONT>
<FONT COLOR="#000000">@@ -119,8 +119,10 @@ camel_url_new_with_base (CamelURL *base,</FONT>
<FONT COLOR="#000000"> semi = colon;</FONT>
<FONT COLOR="#000000"> }</FONT>
<FONT COLOR="#000000">- url->user = g_strndup (url_string, semi - url_string);</FONT>
<FONT COLOR="#000000">- camel_url_decode (url->user);</FONT>
<FONT COLOR="#000000">+ if (semi - url_string) {</FONT>
<FONT COLOR="#000000">+ url->user = g_strndup (url_string,</FONT>
<FONT COLOR="#000000">semi - url_string);</FONT>
<FONT COLOR="#000000">+ camel_url_decode (url->user);</FONT>
<FONT COLOR="#000000">+ }</FONT>
<FONT COLOR="#000000"> url_string = at + 1;</FONT>
<FONT COLOR="#000000"> } else</FONT>
<FONT COLOR="#000000"> url->user = url->passwd = url->authmech = NULL;</FONT>
<FONT COLOR="#000000">_______________________________________________</FONT>
<FONT COLOR="#000000">evolution-hackers maillist - <A HREF="mailto:evolution-hackers@lists.ximian.com">evolution-hackers@lists.ximian.com</A></FONT>
<FONT COLOR="#000000"><A HREF="http://lists.ximian.com/mailman/listinfo/evolution-hackers">http://lists.ximian.com/mailman/listinfo/evolution-hackers</A></FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>
--=-U6lvfuYn9lrM+KnXyCkK--