From 673626936db6541c7d556cf7581cad86a627b136 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Fri, 3 Jun 2011 12:49:52 +0000 Subject: [PATCH] MGR: Fixes for cookie detection on Google Chrome browser svn path=/trunk/boinc/; revision=23632 --- checkin_notes | 6 ++++++ clientgui/browser.cpp | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/checkin_notes b/checkin_notes index 7267bcd418..9898ceeb90 100644 --- a/checkin_notes +++ b/checkin_notes @@ -3245,3 +3245,9 @@ Charlie 2 Jun 2011 clientgui/ browser.cpp + +Charlie 3 Jun 2011 + - MGR: Fixes for cookie detection on Google Chrome browser. + + clientgui/ + browser.cpp diff --git a/clientgui/browser.cpp b/clientgui/browser.cpp index 1ee4921132..e29c6d818b 100644 --- a/clientgui/browser.cpp +++ b/clientgui/browser.cpp @@ -413,6 +413,8 @@ bool find_site_cookie_mozilla_v2( buf, #ifdef _WIN32 "%255s\t%15s\t%255s\t%15s\t%I64d\t%255s\t%255s", +#elif defined(__APPLE__) + "%255s\t%15s\t%255s\t%15s\t%lld\t%255s\t%255s", #else "%255s\t%15s\t%255s\t%15s\t%Ld\t%255s\t%255s", #endif @@ -463,6 +465,8 @@ static int find_site_cookie_mozilla_v3( sscanf( argv[3], #ifdef _WIN32 "%I64d", +#elif defined(__APPLE__) + "%lld", #else "%Ld", #endif @@ -743,8 +747,8 @@ static int find_site_cookie_chrome( ) { CHROME_COOKIE_SQL* _cookie = (CHROME_COOKIE_SQL*)cookie; char host[256], cookie_name[256], cookie_value[256]; - long long expires, httponly; - + long long expires; + long httponly; strcpy(host, ""); strcpy(cookie_name, ""); @@ -757,17 +761,15 @@ static int find_site_cookie_chrome( sscanf( argv[3], #ifdef _WIN32 "%I64d", +#elif defined(__APPLE__) + "%lld", #else "%Ld", #endif &expires ); sscanf( argv[4], -#ifdef _WIN32 - "%I64d", -#else - "%Ld", -#endif + "%ld", &httponly ); @@ -800,7 +802,7 @@ bool get_chrome_profile_root( std::string& profile_root ) { #ifdef _WIN32 profile_root += std::string("Google\\Chrome\\User Data\\Default\\"); #elif defined(__APPLE__) - profile_root += std::string("Library/Application Support/Chrome/"); + profile_root += std::string("Library/Application Support/Google/Chrome/Default/"); #else profile_root += std::string(".google/chrome/"); #endif @@ -841,7 +843,7 @@ bool detect_cookie_chrome( // construct SQL query to extract the desired cookie // SELECT host_key, name, value, expires_utc, httponly from cookies WHERE name = '%s' AND host_key LIKE '%%%s' snprintf(query, sizeof(query), - "SELECT host_key, name, value, expires_utc, httponly WHERE name = '%s' AND host_key LIKE '%%%s'", + "SELECT host_key, name, value, expires_utc, httponly from cookies WHERE name = '%s' AND host_key LIKE '%%%s'", name.c_str(), hostname.c_str() );