Share

Grip

Tracker: Patches

5 Fix for authenticating proxy crash - ID: 1156880
Last Update: Comment added ( oliphant )

I found the problem and fixed it for bug 1156801.

Turns out that grip in discdb.c incorrectly forms the
proxy configuration information for curl. In addition,
it frees the gstrings used by curl before curl finishes
with them, which causes multiple seg faults. All this
occurs within DiscDBMakeRequest() so the changes are
very localized and minimal.

I created a patch for it against grip-3.2.0. I'll
paste it below.
diff -Naur grip-3.2.0/src/discdb.c
grip-3.2.0-fixed/src/discdb.c
--- grip-3.2.0/src/discdb.c 2004-04-15
12:23:37.000000000 -0600
+++ grip-3.2.0-fixed/src/discdb.c 2005-03-04
11:51:07.000000000 -0700
@@ -187,17 +187,19 @@
g_string_sprintf(proxy,"%s:%d",server->proxy->name,
server->proxy->port);

- curl_easy_setopt(curl_handle,CURLOPT_PROXY,proxy);
-
- g_string_free(proxy,TRUE);
+
curl_easy_setopt(curl_handle,CURLOPT_PROXY,proxy->str);

+ // Don't delete strings here, curl will keep
references to
+ // them for use when it makes the query.
+
if(*server->proxy->username) {
+ user=g_string_new(NULL);

g_string_sprintf(user,"%s:%s",server->proxy->username,
server->proxy->pswd);
-
curl_easy_setopt(curl_handle,CURLOPT_PROXYUSERPWD,user);
-
- g_string_free(user,TRUE);
+
curl_easy_setopt(curl_handle,CURLOPT_PROXYUSERPWD,user->str);
+
+ // Don't delete strings here. See note above.
}
}

@@ -237,12 +239,21 @@

fclose(outfile);
}
+
+ // Don't delete strings here. See note above.

- g_string_free(uri,TRUE);
-
curl_slist_free_all(headers);

curl_easy_cleanup(curl_handle);
+
+ // Now cleanup the strings used by curl
+ g_string_free(uri,TRUE);
+ if(server->use_proxy) {
+ g_string_free(proxy,TRUE);
+ if(*server->proxy->username) {
+ g_string_free(user,TRUE);
+ }
+ }
}

curl_global_cleanup();


Nobody/Anonymous ( nobody ) - 2005-03-04 19:15

5

Closed

Out of Date

Nobody/Anonymous

None

None

Public


Comment ( 1 )




Date: 2005-06-25 18:43
Sender: oliphantProject Admin

Logged In: YES
user_id=20614

Should be fixed in 3.3.0.


Log in to comment.

Attached File ( 1 )

Filename Description Download
grip-fixauthproxy.patch Fix for thread crash at grip startup (CDDB request failure) Download

Changes ( 4 )

Field Old Value Date By
status_id Open 2005-06-25 18:43 oliphant
resolution_id None 2005-06-25 18:43 oliphant
close_date - 2005-06-25 18:43 oliphant
File Added 124188: grip-fixauthproxy.patch 2005-03-04 19:15 nobody