Closed Bug 280742 Opened 20 years ago Closed 19 years ago

ignore_host GCONF key is not read in firefox proxy settings

Categories

(Core :: Preferences: Backend, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: rganesan, Assigned: alfred.peng)

References

Details

Attachments

(2 files, 8 obsolete files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041109 Firefox/1.0
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041109 Firefox/1.0

ignore_host GCONF key is not read in firefox proxy settings

Reproducible: Always

Steps to Reproduce:
1.Set somethign in ignore_hosts key in gconf-editor
2.Open firefox preferences
3.

Actual Results:  
Values are not read

Expected Results:  
Values should be read.
Attached patch patch for this (aviary) (obsolete) — Splinter Review
Attachment #173144 - Flags: superreview?(roc)
Attachment #173144 - Flags: review?(darin)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Is this just for Aviary? Because the trunk seems to handle no_proxies_on
already, but in a different way. Is the trunk correct?

I don't think we want this for the Aviary 1.0.x branch; that branch is mainly
for security work.
Is this just for Aviary? Because the trunk seems to handle no_proxies_on
already, but in a different way. Is the trunk correct?

I don't think we want this for the Aviary 1.0.x branch; that branch is mainly
for security work.
hmm, Ganesh may know better. But for me it seems the patch on the trunk was
incomplete (and wrong?) in that respect.
One question is if "/system/proxy/ignore_hosts" or
"/system/http_proxy/ignore_hosts" is correct.
Attached patch updated diff (aviary-branch) (obsolete) — Splinter Review
The patch in the trunk doesn't seem to handle the ignore_hosts well. Firest of
all the ignore_hosts key location isn't correct and secondly it doesn't seem to
convert the list GCONF preference to sting.
The current patch does it. I am including a new diff as I have missed out to
take a diff of nsSystemPref.cpp in the earlier one.
This diff I took form firefox 1.0 source I would pull the latest mozilla trunk
and attach one if you like.
Attachment #173144 - Attachment is obsolete: true
*** Bug 280861 has been marked as a duplicate of this bug. ***
Attached patch patch for trunk (obsolete) — Splinter Review
Attachment #173242 - Flags: superreview?(roc)
Attachment #173242 - Flags: review?(darin)
Attachment #173144 - Flags: superreview?(roc)
Attachment #173144 - Flags: review?(darin)
Attachment #173235 - Attachment description: updated diff → updated diff (aviary-branch)
Attached patch next try for trunk (obsolete) — Splinter Review
first part of the prior patch isn't needed on trunk
Attachment #173242 - Attachment is obsolete: true
Attachment #173243 - Flags: superreview?(roc)
Attachment #173243 - Flags: review?(darin)
Attachment #173242 - Flags: superreview?(roc)
Attachment #173242 - Flags: review?(darin)
+        gchar *tmp=(gchar *)gslist->next->data;
+        str=(gchar *)g_realloc(str,strlen(str)+strlen(tmp+1));
+	strcat(str,",");
+	strcat(str,tmp);
+	gslist=gslist->next;

can we use some string class here? I mean, even glib offers string helper
functions, does it not
(http://developer.gnome.org/doc/API/2.0/glib/glib-Strings.html)? although using
mozilla's C++ string classes is probably better.

(I the calculation here is too short. it forgets the terminating zero, the
comma, and due to tmp+1 the length is one further character too short)
Comment on attachment 173243 [details] [diff] [review]
next try for trunk

or
+	 str=(gchar *)g_realloc(str,strlen(str)+strlen(tmp+1));
+	strcat(str,",");

g_realloc just fails and you strcat onto NULL and *CRASH*.
Attachment #173243 - Attachment is obsolete: true
Yeah, we should definitely use a real string class here, preferably Mozilla's.

Also the code needs to be reindented. Thanks...
Attachment #173243 - Flags: superreview?(roc)
Attachment #173243 - Flags: superreview-
Attachment #173243 - Flags: review?(darin)
Assignee: bugs → prefs
Component: OS Integration → Preferences: Backend
Product: Firefox → Core
QA Contact: os-integration
Version: unspecified → Trunk
This patch uses the gstring functions. 
I don't see we are converting the string to mozilla strings(in
nsSystemPrefService.cpp) in case of other char prefs.
Attachment #173235 - Attachment is obsolete: true
Comment on attachment 173341 [details] [diff] [review]
using gstring function (trunk patch)

>+      GString *g_string=g_string_new((gchar *)gslist->data);
>+      while(gslist->next)
>+           {
>+           g_string_append_c(g_string,',');

this will *still* crash when g_string_new fails.
Attachment #173341 - Flags: review-
Attached patch Patch based on review comments (obsolete) — Splinter Review
Attachment #173341 - Attachment is obsolete: true
That creates no-proxy strings with a leading comma, e.g.

,blah.com,foo.com

That might work but it'd be cleaner to not add a comma in the first iteration.

Also, could you indent properly here?

+    else
+    {
+    GSList* gslist =
GConfClientGetList(mGConfClient,MozKey2GConfKey(aMozKey),GCONF_VALUE_STRING,NULL);

thanks
Comment on attachment 173587 [details] [diff] [review]
Patch based on review comments

it looks like the style of the file is to put the braces on the same line of
the if and else...
Yeah but "GSList* gslist = ..." still needs to be indented.
Roc, I don't think the proxy string would get created with leading comma. Say if
there is only one entry int eh list it won't even bother about get into the
while loop to append.
I will look into the indentation stuff. I see int eh file I attached it is fine
but when I copy and paste it here it get garbled.
My mistake. Sorry about that. It looks good.

Make sure that your editor inserts spaces and never tabs. Tabs are evil...
Attachment #173587 - Attachment is obsolete: true
Comment on attachment 173721 [details] [diff] [review]
corrected indentation

Not sure who should review this ... blizzard?
Attachment #173721 - Flags: superreview+
Attachment #173721 - Flags: review?(blizzard)
Comment on attachment 173721 [details] [diff] [review]
corrected indentation

>+    if (strcmp (aMozKey, "network.proxy.no_proxies_on") != 0) { 
>     gchar *str = GConfClientGetString(mGConfClient,
>                                       MozKey2GConfKey(aMozKey), NULL);
>     if (str) {
>         *retval = PL_strdup(str);
>         g_free(str);
>     }
>+    }
>+    else
>+    {

[ code removed ]

>+        }
>+      }
>+    }
>     return NS_OK;
> }

The indentation for the if is wrong here.  You need to indent the code.  You've
also got an else before return.  Good pattern to use in this function is:

if (foo) {
    // do stuff
    return NS_OK;
}

// else code as it exists now
return NS_OK;
Attachment #173721 - Flags: review?(blizzard) → review-
Ganesh, please ask for review again to get it approved.
Attachment #173926 - Flags: review?
Attachment #173926 - Flags: review? → review?(blizzard)
Attachment #173926 - Flags: review?(blizzard) → review?(shaver)
Comment on attachment 173926 [details] [diff] [review]
second try based on comments

Sorry, I thought I sent this to Chris weeks ago. =/
Attachment #173926 - Flags: review?(shaver) → review?(caillon)
Comment on attachment 173926 [details] [diff] [review]
second try based on comments

Please also attach a diff without the -w flag

>@@ -697,6 +705,24 @@
>     }
>     return NS_OK;
> }
>+    GSList* gslist = GConfClientGetList(mGConfClient,MozKey2GConfKey(aMozKey),GCONF_VALUE_STRING,NULL);
>+    if(gslist){ 
>+      GString *g_string=g_string_new((gchar *)gslist->data);

Please assert that gslist->data is in fact a GCONF_VALUE_STRING?

>+      if (g_string == nsnull)
>+            return NS_ERROR_OUT_OF_MEMORY;
>+      while(gslist->next)
>+           {

I realize this is a diff -w, but the whitespace is still extremely goofy here. 
Please fix it to use K&R style instead of what you are using (whitesmiths?)

>+           g_string_append_c(g_string,',');
>+           g_string_append(g_string,(gchar *)gslist->next->data);
>+           gslist=gslist->next;
>+           }
>+      if (g_string) {

We returned early already if g_string was null.  No need to check again here.

>+         *retval = PL_strdup(g_string->str);
>+         g_string_free(g_string,TRUE);
>+      }
>+    }

You're leaking a bunch of stuff.  Everything gchar member in the GSList must be
freed with g_free().  The GSList itself must then be freed with g_slist_free().
Attachment #173926 - Flags: review?(caillon) → review-
Attached patch patch for trunk (obsolete) — Splinter Review
This patch has fixed the similar bug in our internal Mozilla1.7 build.
Since we connect to the internet through internal proxy, I don't really know how to reproduce the bug on Firefox. If you have the exact reproduce steps for this bug, I can do some further test for this patch.
Attachment #205225 - Flags: review?(caillon)
Attached patch patch v2 for trunk (obsolete) — Splinter Review
Improve on the previous patch. Build and verify on Solaris platform.
Attachment #205225 - Attachment is obsolete: true
Attachment #206288 - Flags: review?(timeless)
Attachment #205225 - Flags: review?(caillon)
Attachment #206288 - Flags: review?(timeless) → review?(timeless)
Attachment #206288 - Flags: superreview?(roc)
Attachment #206288 - Flags: review?(timeless)
Attachment #206288 - Flags: review+
Comment on attachment 206288 [details] [diff] [review]
patch v2 for trunk

I should let you know that I have a new gconf prefs backend that fixes a lot of problems in the current code and adds a lot more preference mappings.
Attachment #206288 - Flags: superreview?(roc) → superreview+
That will be great. I'm also thinking about adding some system prefs function for some other platforms. Where can I get the new gconf prefs backend? Or is there a bug for it?
timeless, could you help me check the patch into trunk? Thanks.
Created bug 321315. Please let any Sun people know who might be affected.
Assignee: prefs → alfred.peng
QA Contact: prefs
Comment on attachment 206288 [details] [diff] [review]
patch v2 for trunk

mozilla/extensions/pref/system-pref/src/gconf/nsSystemPrefService.cpp 	1.9
mozilla/extensions/pref/system-pref/src/gconf/gconf_pref_list.inc 	1.4
Attachment #206288 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: