MGR: Sync browser cookie lookups to David's commit last night.

This commit is contained in:
Rom Walton 2014-10-04 09:27:11 +02:00
parent 15ff82b9f8
commit 7ef53b13b4
3 changed files with 83 additions and 77 deletions

View File

@ -1229,79 +1229,6 @@ bool detect_cookie_ie(std::string& project_url, std::string& name, std::string&
#endif
//
// walk through the various browsers looking up the
// various cookies that make up the simple account creation scheme.
//
// give preference to the default platform specific browers first before going
// to the platform independant browsers since most people don't switch from
// the default.
//
bool detect_simple_account_credentials(
std::string& action, std::string& project_name, std::string& project_url, std::string& authenticator, std::string& creation_time
) {
bool retval = false;
std::string strCookieServer("boinc.berkeley.edu");
std::string strCookieAction("action");
std::string strCookieProjectName("project_name");
std::string strCookieProjectURL("project_url");
std::string strCookieAuthenticator("authenticator");
std::string strCookieCreationTime("creation_time");
#ifdef _WIN32
if ( detect_cookie_ie(strCookieServer, strCookieAction, action) &&
detect_cookie_ie(strCookieServer, strCookieProjectName, project_name) &&
detect_cookie_ie(strCookieServer, strCookieProjectURL, project_url) &&
detect_cookie_ie(strCookieServer, strCookieCreationTime, creation_time)
){
detect_cookie_ie(strCookieServer, strCookieAuthenticator, authenticator);
goto END;
}
#endif
#ifdef __APPLE__
if ( detect_cookie_safari(strCookieServer, strCookieAction, action) &&
detect_cookie_safari(strCookieServer, strCookieProjectName, project_name) &&
detect_cookie_safari(strCookieServer, strCookieProjectURL, project_url) &&
detect_cookie_safari(strCookieServer, strCookieCreationTime, creation_time)
){
detect_cookie_safari(strCookieServer, strCookieAuthenticator, authenticator);
goto END;
}
#endif
if ( detect_cookie_chrome(strCookieServer, strCookieAction, action) &&
detect_cookie_chrome(strCookieServer, strCookieProjectName, project_name) &&
detect_cookie_chrome(strCookieServer, strCookieProjectURL, project_url) &&
detect_cookie_chrome(strCookieServer, strCookieCreationTime, creation_time)
){
detect_cookie_chrome(strCookieServer, strCookieAuthenticator, authenticator);
goto END;
}
if ( detect_cookie_firefox_3(strCookieServer, strCookieAction, action) &&
detect_cookie_firefox_3(strCookieServer, strCookieProjectName, project_name) &&
detect_cookie_firefox_3(strCookieServer, strCookieProjectURL, project_url) &&
detect_cookie_firefox_3(strCookieServer, strCookieCreationTime, creation_time)
){
detect_cookie_firefox_3(strCookieServer, strCookieAuthenticator, authenticator);
goto END;
}
if ( detect_cookie_firefox_2(strCookieServer, strCookieAction, action) &&
detect_cookie_firefox_2(strCookieServer, strCookieProjectName, project_name) &&
detect_cookie_firefox_2(strCookieServer, strCookieProjectURL, project_url) &&
detect_cookie_firefox_2(strCookieServer, strCookieCreationTime, creation_time)
){
detect_cookie_firefox_2(strCookieServer, strCookieAuthenticator, authenticator);
goto END;
}
END:
if (!action.empty() && !project_name.empty() && !project_url.empty() && !creation_time.empty()) {
retval = true;
}
return retval;
}
//
// walk through the various browsers looking up the
// project cookies until the projects 'Setup' cookie is found.
@ -1335,6 +1262,80 @@ END:
}
//
// walk through the various browsers looking up the
// various cookies that make up the simple account creation scheme.
//
// give preference to the default platform specific browers first before going
// to the platform independant browsers since most people don't switch from
// the default.
//
bool detect_simple_account_credentials(
std::string& project_name, std::string& project_url, std::string& authenticator,
std::string& project_institution, std::string& project_description
) {
bool retval = false;
std::string strCookieServer("http://boinc.berkeley.edu/");
std::string strCookieProjectName("attach_project_name");
std::string strCookieProjectURL("attach_master_url");
std::string strCookieAuthenticator("attach_auth");
std::string strCookieProjectInstitution("attach_project_inst");
std::string strCookieProjectDescription("attach_project_desc");
#ifdef _WIN32
if ( detect_cookie_ie(strCookieServer, strCookieProjectName, project_name) &&
detect_cookie_ie(strCookieServer, strCookieProjectURL, project_url)
){
detect_cookie_ie(strCookieServer, strCookieAuthenticator, authenticator);
detect_cookie_ie(strCookieServer, strCookieProjectInstitution, project_institution);
detect_cookie_ie(strCookieServer, strCookieProjectDescription, project_description);
goto END;
}
#endif
#ifdef __APPLE__
if ( detect_cookie_safari(strCookieServer, strCookieProjectName, project_name) &&
detect_cookie_safari(strCookieServer, strCookieProjectURL, project_url)
){
detect_cookie_safari(strCookieServer, strCookieAuthenticator, authenticator);
detect_cookie_safari(strCookieServer, strCookieProjectInstitution, project_institution);
detect_cookie_safari(strCookieServer, strCookieProjectDescription, project_description);
goto END;
}
#endif
if ( detect_cookie_chrome(strCookieServer, strCookieProjectName, project_name) &&
detect_cookie_chrome(strCookieServer, strCookieProjectURL, project_url)
){
detect_cookie_chrome(strCookieServer, strCookieAuthenticator, authenticator);
detect_cookie_chrome(strCookieServer, strCookieProjectInstitution, project_institution);
detect_cookie_chrome(strCookieServer, strCookieProjectDescription, project_description);
goto END;
}
if ( detect_cookie_firefox_3(strCookieServer, strCookieProjectName, project_name) &&
detect_cookie_firefox_3(strCookieServer, strCookieProjectURL, project_url)
){
detect_cookie_firefox_3(strCookieServer, strCookieAuthenticator, authenticator);
detect_cookie_firefox_3(strCookieServer, strCookieProjectInstitution, project_institution);
detect_cookie_firefox_3(strCookieServer, strCookieProjectDescription, project_description);
goto END;
}
if ( detect_cookie_firefox_2(strCookieServer, strCookieProjectName, project_name) &&
detect_cookie_firefox_2(strCookieServer, strCookieProjectURL, project_url)
){
detect_cookie_firefox_2(strCookieServer, strCookieAuthenticator, authenticator);
detect_cookie_firefox_2(strCookieServer, strCookieProjectInstitution, project_institution);
detect_cookie_firefox_2(strCookieServer, strCookieProjectDescription, project_description);
goto END;
}
END:
if (!project_name.empty() && !project_url.empty()) {
retval = true;
}
return retval;
}
//
// walk through the various browsers looking up the
// account manager cookies until the account manager's 'Login' and 'Password_Hash'

View File

@ -24,12 +24,17 @@
// cookie.
//
bool detect_setup_authenticator(std::string& project_url, std::string& authenticator);
bool detect_simple_account_credentials(
std::string& action, std::string& project_name, std::string& project_url, std::string& authenticator, std::string& creation_time
std::string& project_name, std::string& project_url, std::string& authenticator,
std::string& project_institution, std::string& project_description
);
bool detect_setup_authenticator(std::string& project_url, std::string& authenticator);
bool detect_account_manager_credentials(std::string& project_url, std::string& login, std::string& password_hash, std::string& return_url);
bool detect_account_manager_credentials(
std::string& project_url, std::string& login, std::string& password_hash,
std::string& return_url
);
bool is_authenticator_valid(const std::string authenticator);

View File

@ -66,7 +66,7 @@ function url_to_download() {
}
} else if (strstr($client_info, 'Linux') && strstr($client_info, 'Android')) {
// Check for Android before Linux,
// since Android contains the Linux kernel and the
// since Android contains the Linux kernel and the
// web browser user agent string list Linux too.
return get_download_url('androidarm');
} else if (strstr($client_info, 'Linux')) {