mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=12344
This commit is contained in:
parent
00e3cad82b
commit
d489fcae55
|
@ -3374,3 +3374,15 @@ David 10 Apr 2007
|
|||
client/
|
||||
cpu_sched.C
|
||||
sim.C,h
|
||||
|
||||
Charlie 11 Apr 2007
|
||||
- Mac: Add support for Safari on Mac.
|
||||
- Fix bugs in Firefx / Mozilla cookie detection:
|
||||
- Don't require match for a leading "www" in URL.
|
||||
- Don't return true if is_authenticator_valid(cookie) fails.
|
||||
- Check for std::string.find() returning npos if it fails, not -1.
|
||||
- Add extern "C" to browser.h file.
|
||||
|
||||
lib/
|
||||
browser.C,h
|
||||
mac_browser.m (new, Mac only)
|
||||
|
|
|
@ -87,7 +87,7 @@ bool parse_name_value_pair(char* buf, std::string& name, std::string& value) {
|
|||
|
||||
s = std::string(buf);
|
||||
i = s.find("=", 0);
|
||||
if ( i != -1 ) {
|
||||
if ( i < s.npos ) {
|
||||
name = s.substr(0, i);
|
||||
value = s.substr(i + 1);
|
||||
strip_whitespace(name);
|
||||
|
@ -107,6 +107,8 @@ bool parse_hostname(std::string& project_url, std::string& hostname) {
|
|||
end = project_url.find("/", start);
|
||||
|
||||
hostname = project_url.substr(start, end - start);
|
||||
if (starts_with(hostname.c_str(), "www"))
|
||||
hostname.erase(0, 3);
|
||||
if (!hostname.empty())
|
||||
return true;
|
||||
return false;
|
||||
|
@ -295,8 +297,8 @@ bool find_project_cookie_mozilla_generic(
|
|||
authenticator = "";
|
||||
} else {
|
||||
authenticator = cookie;
|
||||
retval = true;
|
||||
}
|
||||
retval = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -486,6 +488,11 @@ bool detect_setup_authenticator(
|
|||
if (detect_setup_authenticator_ie(project_url, authenticator)) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
if (detect_setup_authenticator_safari(project_url, authenticator)) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
if (detect_setup_authenticator_firefox(project_url, authenticator)) {
|
||||
return true;
|
||||
|
|
|
@ -26,13 +26,26 @@
|
|||
// cookie.
|
||||
//
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool detect_setup_authenticator(std::string& project_url, std::string& authenticator);
|
||||
// is_authenticator_valid() is used by detect_setup_authenticator_safari() in mac_bowser.m
|
||||
bool is_authenticator_valid(const std::string authenticator);
|
||||
|
||||
// These functions are browser specific functions
|
||||
//
|
||||
#ifdef __APPLE__
|
||||
bool detect_setup_authenticator_safari(std::string& project_url, std::string& authenticator);
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
bool detect_setup_authenticator_ie(std::string& project_url, std::string& authenticator);
|
||||
#endif
|
||||
bool detect_setup_authenticator_firefox(std::string& project_url, std::string& authenticator);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
// Berkeley Open Infrastructure for Network Computing
|
||||
// http://boinc.berkeley.edu
|
||||
// Copyright (C) 2005 University of California
|
||||
//
|
||||
// This is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation;
|
||||
// either version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This software is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// To view the GNU Lesser General Public License visit
|
||||
// http://www.gnu.org/copyleft/lesser.html
|
||||
// or write to the Free Software Foundation, Inc.,
|
||||
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#include "str_util.h"
|
||||
#include "browser.h"
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
bool detect_setup_authenticator_safari(std::string& project_url, std::string& authenticator)
|
||||
{
|
||||
NSHTTPCookieStorage *cookieStorage;
|
||||
NSArray *theCookies;
|
||||
NSHTTPCookie *aCookie;
|
||||
NSURL *theURL;
|
||||
NSString *theURLString, *theValueString, *theNameString;
|
||||
NSDate *expirationDate;
|
||||
unsigned int i, n;
|
||||
bool retval = false;
|
||||
|
||||
NSAutoreleasePool* pool;
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
|
||||
theURLString = [ NSString stringWithCString:project_url.c_str() ];
|
||||
|
||||
theURL = [ NSURL URLWithString:theURLString ];
|
||||
|
||||
cookieStorage = [ NSHTTPCookieStorage sharedHTTPCookieStorage ];
|
||||
|
||||
if (cookieStorage == NULL)
|
||||
goto bail;
|
||||
|
||||
theCookies = [ cookieStorage cookiesForURL:theURL ];
|
||||
|
||||
if (theCookies == NULL)
|
||||
goto bail;
|
||||
|
||||
n = [ theCookies count ];
|
||||
for (i=0; i<n; i++) {
|
||||
aCookie = (NSHTTPCookie*)[ theCookies objectAtIndex:i ];
|
||||
|
||||
// has the cookie expired?
|
||||
expirationDate = [ aCookie expiresDate ];
|
||||
if ([ expirationDate compare:[ NSDate date ]] == NSOrderedAscending)
|
||||
continue;
|
||||
|
||||
theNameString = [ aCookie name ];
|
||||
// is this the right cookie?
|
||||
if (starts_with([ theNameString cStringUsingEncoding:NSMacOSRomanStringEncoding ], "Setup")) {
|
||||
theValueString = [ aCookie value ];
|
||||
authenticator = [ theValueString cStringUsingEncoding:NSMacOSRomanStringEncoding ];
|
||||
|
||||
// If validation failed, null out the authenticator just in case
|
||||
// somebody tries to use it, otherwise copy in the real deal.
|
||||
if (is_authenticator_valid(authenticator)) {
|
||||
retval = true;
|
||||
break;
|
||||
} else {
|
||||
authenticator = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bail:
|
||||
[pool release];
|
||||
|
||||
return retval;
|
||||
}
|
|
@ -213,6 +213,7 @@
|
|||
DD7DD79A0B8BFA2F00B11279 /* ViewMessagesGrid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDCDCDF00B532433009BB03C /* ViewMessagesGrid.cpp */; };
|
||||
DD7DD79B0B8BFA4000B11279 /* ViewResources.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD81C42307C5D1D70098A04D /* ViewResources.cpp */; };
|
||||
DD7DD7C90B8BFD4800B11279 /* ViewMessages.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD81C42507C5D1D70098A04D /* ViewMessages.cpp */; };
|
||||
DD893FB60BCCCE89009EA401 /* mac_browser.mm in Sources */ = {isa = PBXBuildFile; fileRef = DD893FB50BCCCE89009EA401 /* mac_browser.mm */; };
|
||||
DD9986830BBDF11000B690C2 /* browser.C in Sources */ = {isa = PBXBuildFile; fileRef = DD9986810BBDF11000B690C2 /* browser.C */; };
|
||||
DDA12A6D0A36974600FBDD12 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD1929D80918A2F100C31BCF /* Security.framework */; };
|
||||
DDA12AA20A369B5500FBDD12 /* SetupSecurity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD7748B40A356D6C0025D05E /* SetupSecurity.cpp */; };
|
||||
|
@ -1019,6 +1020,7 @@
|
|||
DD81C5CC07C5D7D90098A04D /* gui_rpc_client.C */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = gui_rpc_client.C; path = ../lib/gui_rpc_client.C; sourceTree = SOURCE_ROOT; };
|
||||
DD81C5F007C5D8290098A04D /* boinc_win.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = boinc_win.h; path = ../lib/boinc_win.h; sourceTree = SOURCE_ROOT; };
|
||||
DD81C60307C5D8630098A04D /* gui_rpc_client.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = gui_rpc_client.h; path = ../lib/gui_rpc_client.h; sourceTree = SOURCE_ROOT; };
|
||||
DD893FB50BCCCE89009EA401 /* mac_browser.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = mac_browser.mm; sourceTree = "<group>"; };
|
||||
DD8DD4A509D9432F0043019E /* BOINCDialupManager.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = BOINCDialupManager.cpp; path = ../clientgui/BOINCDialupManager.cpp; sourceTree = SOURCE_ROOT; };
|
||||
DD8DD4A609D9432F0043019E /* BOINCDialupManager.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = BOINCDialupManager.h; path = ../clientgui/BOINCDialupManager.h; sourceTree = SOURCE_ROOT; };
|
||||
DD96AFF90811075000A06F22 /* BOINCSaver.saver */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BOINCSaver.saver; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
|
@ -1541,6 +1543,7 @@
|
|||
DD344BB707C5AEEE0043025C /* hostinfo.h */,
|
||||
DDF166A908DF898A00C8C4A5 /* mac_backtrace.C */,
|
||||
DDF166AA08DF898A00C8C4A5 /* mac_backtrace.h */,
|
||||
DD893FB50BCCCE89009EA401 /* mac_browser.mm */,
|
||||
F5159562029EB02001F5651B /* md5.c */,
|
||||
F5159563029EB02001F5651B /* md5.h */,
|
||||
F5159564029EB02001F5651B /* md5_file.C */,
|
||||
|
@ -2442,6 +2445,7 @@
|
|||
DD7BF7E60B8E7B6C00A009F7 /* str_util.C in Sources */,
|
||||
DD205A1A0BAF596E0008D473 /* ProjectListCtrl.cpp in Sources */,
|
||||
DD9986830BBDF11000B690C2 /* browser.C in Sources */,
|
||||
DD893FB60BCCCE89009EA401 /* mac_browser.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue