diff --git a/client/acct_mgr.cpp b/client/acct_mgr.cpp index 727dfb0ddfd..d708bcf60cf 100644 --- a/client/acct_mgr.cpp +++ b/client/acct_mgr.cpp @@ -53,15 +53,12 @@ static const char *run_mode_name[] = {"", "always", "auto", "never"}; // do an account manager RPC; // if URL is null, detach from current account manager // -int ACCT_MGR_OP::do_rpc( - string _url, string name, string password_hash, bool _via_gui -) { +int ACCT_MGR_OP::do_rpc(ACCT_MGR_INFO& _ami, bool _via_gui) { int retval; unsigned int i; - char url[256], password[256], buf[256]; - FILE *pwdf; + char buf[256]; - strlcpy(url, _url.c_str(), sizeof(url)); + ami = _ami; error_num = ERR_IN_PROGRESS; error_str = ""; @@ -70,7 +67,7 @@ int ACCT_MGR_OP::do_rpc( // if null URL, detach from current AMS // - if (!strlen(url) && strlen(gstate.acct_mgr_info.master_url)) { + if (!strlen(ami.master_url) && strlen(gstate.acct_mgr_info.master_url)) { msg_printf(NULL, MSG_INFO, "Removing account manager info"); gstate.acct_mgr_info.clear(); boinc_delete_file(ACCT_MGR_URL_FILENAME); @@ -84,29 +81,35 @@ int ACCT_MGR_OP::do_rpc( return 0; } - canonicalize_master_url(url, sizeof(url)); - if (!valid_master_url(url)) { + canonicalize_master_url(ami.master_url, sizeof(ami.master_url)); + if (!valid_master_url(ami.master_url)) { error_num = ERR_INVALID_URL; return 0; } - strlcpy(ami.master_url, url, sizeof(ami.master_url)); - strlcpy(ami.project_name, "", sizeof(ami.project_name)); - strlcpy(ami.login_name, name.c_str(), sizeof(ami.login_name)); - strlcpy(ami.password_hash, password_hash.c_str(), sizeof(ami.password_hash)); - FILE* f = boinc_fopen(ACCT_MGR_REQUEST_FILENAME, "w"); if (!f) return ERR_FOPEN; fprintf(f, "\n" "\n" - " %s\n" - " %s\n" + ); + if (strlen(ami.authenticator)) { + fprintf(f, + " %s\n", + ami.authenticator + ); + } else { + fprintf(f, + " %s\n" + " %s\n", + ami.login_name, ami.password_hash + ); + } + fprintf(f, " %s\n" " %s\n" " %d.%d.%d\n" " %s\n", - name.c_str(), password_hash.c_str(), gstate.host_info.host_cpid, gstate.host_info.domain_name, gstate.core_client_version.major, @@ -122,7 +125,7 @@ int ACCT_MGR_OP::do_rpc( ); } - // If the AMS requested it, send GUI RPC port and password hash. + // If the AMS requested it, send GUI RPC port and password. // This is for the "farm" account manager so it // can know where to send GUI RPC requests to // without having to configure each host @@ -134,15 +137,19 @@ int ACCT_MGR_OP::do_rpc( fprintf(f," %d\n", GUI_RPC_PORT); } if (boinc_file_exists(GUI_RPC_PASSWD_FILE)) { - safe_strcpy(password, ""); - pwdf = fopen(GUI_RPC_PASSWD_FILE, "r"); + char gui_rpc_password[256]; + safe_strcpy(gui_rpc_password, ""); + FILE* pwdf = fopen(GUI_RPC_PASSWD_FILE, "r"); if (pwdf) { - if (fgets(password, 256, pwdf)) { - strip_whitespace(password); + if (fgets(gui_rpc_password, 256, pwdf)) { + strip_whitespace(gui_rpc_password); } fclose(pwdf); } - fprintf(f," %s\n", password); + fprintf(f, + " %s\n", + gui_rpc_password + ); } } for (i=0; i\n"); fclose(f); - snprintf(buf, sizeof(buf), "%srpc.php", url); + snprintf(buf, sizeof(buf), "%srpc.php", ami.master_url); retval = gui_http->do_rpc_post( this, buf, ACCT_MGR_REQUEST_FILENAME, ACCT_MGR_REPLY_FILENAME, true ); @@ -236,7 +243,7 @@ int ACCT_MGR_OP::do_rpc( error_num = retval; return retval; } - msg_printf(NULL, MSG_INFO, "Contacting account manager at %s", url); + msg_printf(NULL, MSG_INFO, "Contacting account manager at %s", ami.master_url); return 0; } @@ -376,6 +383,7 @@ int ACCT_MGR_OP::parse(FILE* f) { } if (xp.match_tag("/acct_mgr_reply")) return 0; if (xp.parse_str("name", ami.project_name, 256)) continue; + if (xp.parse_str("authenticator", ami.authenticator, 256)) continue; if (xp.parse_int("error_num", error_num)) continue; if (xp.parse_string("error", error_str)) continue; if (xp.parse_string("error_msg", error_str)) continue; @@ -585,6 +593,7 @@ void ACCT_MGR_OP::handle_reply(int http_op_retval) { safe_strcpy(gstate.acct_mgr_info.master_url, ami.master_url); safe_strcpy(gstate.acct_mgr_info.login_name, ami.login_name); safe_strcpy(gstate.acct_mgr_info.password_hash, ami.password_hash); + safe_strcpy(gstate.acct_mgr_info.authenticator, ami.authenticator); gstate.acct_mgr_info.no_project_notices = ami.no_project_notices; // process projects @@ -824,15 +833,26 @@ int ACCT_MGR_INFO::write_info() { } fprintf(f, "\n" - " %s\n" - " %s\n" + ); + if (strlen(authenticator)) { + fprintf(f, + " %s\n", + authenticator + ); + } else { + fprintf(f, + " %s\n" + " %s\n", + login_name, + password_hash + ); + } + fprintf(f, " %s\n" " %f\n" " \n%s\n" " \n" " %d\n", - login_name, - password_hash, previous_host_cpid, next_rpc_time, opaque, @@ -853,6 +873,7 @@ void ACCT_MGR_INFO::clear() { safe_strcpy(login_name, ""); safe_strcpy(user_name, ""); safe_strcpy(password_hash, ""); + safe_strcpy(authenticator, ""); safe_strcpy(signing_key, ""); safe_strcpy(previous_host_cpid, ""); safe_strcpy(opaque, ""); @@ -889,6 +910,7 @@ int ACCT_MGR_INFO::parse_login_file(FILE* p) { if (xp.match_tag("/acct_mgr_login")) break; else if (xp.parse_str("login", login_name, 256)) continue; else if (xp.parse_str("password_hash", password_hash, 256)) continue; + else if (xp.parse_str("authenticator", authenticator, 256)) continue; else if (xp.parse_str("previous_host_cpid", previous_host_cpid, sizeof(previous_host_cpid))) continue; else if (xp.parse_double("next_rpc_time", next_rpc_time)) continue; else if (xp.match_tag("opaque")) { @@ -1002,9 +1024,7 @@ bool ACCT_MGR_INFO::poll() { // default synch period is 1 day // next_rpc_time = gstate.now + 86400; - gstate.acct_mgr_op.do_rpc( - master_url, login_name, password_hash, false - ); + gstate.acct_mgr_op.do_rpc(*this, false); return true; } return false; diff --git a/client/acct_mgr.h b/client/acct_mgr.h index 7ac771601e3..ba2638e646e 100644 --- a/client/acct_mgr.h +++ b/client/acct_mgr.h @@ -36,10 +36,18 @@ struct ACCT_MGR_INFO : PROJ_AM { // the following used to be std::string but there // were mysterious bugs where setting it to "" didn't work // + + // Account managers originally authenticated with name/password; + // e.g. BAM!, Gridrepublic. + // This has drawbacks, e.g. no way to change password. + // So we added the option of using a random-string authenticator. + // If this is present, use it rather than name/passwd. + // char login_name[256]; // unique name (could be email addr) char user_name[256]; // non-unique name char password_hash[256]; // md5 of password.lowercase(login_name) + char authenticator[256]; char opaque[256]; // opaque data, from the AM, to be included in future AM requests char signing_key[MAX_KEY_LEN]; @@ -70,12 +78,14 @@ struct ACCT_MGR_INFO : PROJ_AM { inline bool using_am() { if (!strlen(master_url)) return false; + if (strlen(authenticator)) return true; if (!strlen(login_name)) return false; if (!strlen(password_hash)) return false; return true; } - inline bool same_am(const char* mu, const char* ln, const char* ph) { + inline bool same_am(const char* mu, const char* ln, const char* ph, const char* auth) { if (strcmp(mu, master_url)) return false; + if (!strcmp(auth, authenticator)) return true; if (strcmp(ln, login_name)) return false; if (strcmp(ph, password_hash)) return false; return true; @@ -155,10 +165,7 @@ struct ACCT_MGR_OP: public GUI_HTTP_OP { bool got_rss_feeds; std::vectorrss_feeds; - int do_rpc( - std::string url, std::string name, std::string password, - bool via_gui - ); + int do_rpc(ACCT_MGR_INFO&, bool via_gui); int parse(FILE*); virtual void handle_reply(int http_op_retval); diff --git a/client/acct_setup.cpp b/client/acct_setup.cpp index 9ce7ff483eb..6b7a90c2a21 100644 --- a/client/acct_setup.cpp +++ b/client/acct_setup.cpp @@ -394,8 +394,7 @@ int LOOKUP_LOGIN_TOKEN_OP::do_rpc( // void LOOKUP_LOGIN_TOKEN_OP::handle_reply(int http_op_retval) { string user_name; - string team_name, weak_auth; // returned by projects - string login_name, passwd_hash; // returned by AMs + string team_name, authenticator; gstate.autologin_in_progress = false; @@ -417,37 +416,27 @@ void LOOKUP_LOGIN_TOKEN_OP::handle_reply(int http_op_retval) { continue; } else if (xp.parse_string("team_name", team_name)) { continue; - } else if (xp.parse_string("weak_auth", weak_auth)) { - continue; - } else if (xp.parse_string("login_name", login_name)) { - continue; - } else if (xp.parse_string("passwd_hash", passwd_hash)) { + } else if (xp.parse_string("authenticator", authenticator)) { continue; } } fclose(f); + if (!user_name.size() || !authenticator.size()) { + msg_printf(NULL, MSG_INFO, "token lookup RPC: missing info"); + boinc_delete_file(ACCOUNT_DATA_FILENAME); + return; + } if (pli->is_account_manager) { - if (!login_name.size() || !passwd_hash.size()) { - msg_printf(NULL, MSG_INFO, "token lookup RPC: missing info"); - boinc_delete_file(ACCOUNT_DATA_FILENAME); - return; - } msg_printf(NULL, MSG_INFO, "Using account manager %s", pli->name.c_str()); strcpy(gstate.acct_mgr_info.master_url, pli->master_url.c_str()); - strcpy(gstate.acct_mgr_info.login_name, login_name.c_str()); strcpy(gstate.acct_mgr_info.user_name, user_name.c_str()); - strcpy(gstate.acct_mgr_info.password_hash, passwd_hash.c_str()); + strcpy(gstate.acct_mgr_info.authenticator, authenticator.c_str()); } else { - if (!user_name.size() || !weak_auth.size()) { - msg_printf(NULL, MSG_INFO, "token lookup RPC: missing info"); - boinc_delete_file(ACCOUNT_DATA_FILENAME); - return; - } msg_printf(NULL, MSG_INFO, "Attaching to project %s", pli->name.c_str()); gstate.add_project( - pli->master_url.c_str(), weak_auth.c_str(), pli->name.c_str(), false + pli->master_url.c_str(), authenticator.c_str(), pli->name.c_str(), false ); PROJECT *p = gstate.lookup_project(pli->master_url.c_str()); if (p) { diff --git a/client/gui_rpc_server_ops.cpp b/client/gui_rpc_server_ops.cpp index d55b8e5c4a6..a950cccf160 100644 --- a/client/gui_rpc_server_ops.cpp +++ b/client/gui_rpc_server_ops.cpp @@ -640,7 +640,9 @@ static void handle_acct_mgr_info(GUI_RPC_CONN& grc) { gstate.acct_mgr_info.project_name ); - if (strlen(gstate.acct_mgr_info.login_name)) { + if (strlen(gstate.acct_mgr_info.login_name) + || strlen(gstate.acct_mgr_info.authenticator) + ) { grc.mfout.printf(" \n"); } @@ -938,7 +940,7 @@ static void handle_project_attach_poll(GUI_RPC_CONN& grc) { // url/name/passwd args are null // static void handle_acct_mgr_rpc(GUI_RPC_CONN& grc) { - string url, name, password; + string url, name, password, authenticator; string password_hash, name_lc; bool use_config_file = false; bool bad_arg = false; @@ -971,6 +973,7 @@ static void handle_acct_mgr_rpc(GUI_RPC_CONN& grc) { url = gstate.acct_mgr_info.master_url; name = gstate.acct_mgr_info.login_name; password_hash = gstate.acct_mgr_info.password_hash; + authenticator = gstate.acct_mgr_info.authenticator; } } else { bad_arg = !url_found || !name_found || !password_found; @@ -990,11 +993,16 @@ static void handle_acct_mgr_rpc(GUI_RPC_CONN& grc) { grc.mfout.printf("bad arg\n"); } else if (gstate.acct_mgr_info.using_am() && !url.empty() - && !gstate.acct_mgr_info.same_am(url.c_str(), name.c_str(), password_hash.c_str()) + && !gstate.acct_mgr_info.same_am(url.c_str(), name.c_str(), password_hash.c_str(), authenticator.c_str()) ){ grc.mfout.printf("attached to a different AM - detach first\n"); } else { - gstate.acct_mgr_op.do_rpc(url, name, password_hash, true); + ACCT_MGR_INFO ami; + safe_strcpy(ami.master_url, url.c_str()); + safe_strcpy(ami.login_name, name.c_str()); + safe_strcpy(ami.password_hash, password_hash.c_str()); + safe_strcpy(ami.authenticator, authenticator.c_str()); + gstate.acct_mgr_op.do_rpc(ami, true); grc.mfout.printf("\n"); } } diff --git a/client/scripts/boinc-client.service.in b/client/scripts/boinc-client.service.in index 4f52467ea0f..f1778f17489 100644 --- a/client/scripts/boinc-client.service.in +++ b/client/scripts/boinc-client.service.in @@ -8,7 +8,7 @@ ProtectHome=true Type=simple Nice=10 User=boinc -WorkingDirectory=~ +WorkingDirectory=/var/lib/boinc ExecStart=@exec_prefix@/bin/boinc ExecStop=@exec_prefix@/bin/boinccmd --quit ExecReload=@exec_prefix@/bin/boinccmd --read_cc_config diff --git a/clientgui/AsyncRPC.cpp b/clientgui/AsyncRPC.cpp index ee946e79d6f..90c303cbf4e 100644 --- a/clientgui/AsyncRPC.cpp +++ b/clientgui/AsyncRPC.cpp @@ -19,6 +19,11 @@ #pragma implementation "AsyncRPC.h" #endif +#ifdef _WIN32 +#include "boinc_win.h" +#endif +#include "config.h" + #if HAVE_XLOCALE_H #include #endif @@ -137,25 +142,16 @@ void *RPCThread::Entry() { wxMutexError mutexErr = wxMUTEX_NO_ERROR; wxCondError condErr = wxCOND_NO_ERROR; -#ifndef NO_PER_THREAD_LOCALE -#ifdef __WXMSW__ - // On Windows, set all locales for this thread on a per-thread basis +#ifdef HAVE__CONFIGTHREADLOCALE _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); setlocale(LC_ALL, "C"); -#else - // We initialize RPC_Thread_Locale to fix a compiler warning - locale_t RPC_Thread_Locale = LC_GLOBAL_LOCALE; -#if defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4) - if (uselocale) // uselocale() is not available in Mac OS 10.3.9 +#elif defined(HAVE_USELOCALE) + locale_t RPC_Thread_Locale = newlocale(LC_ALL_MASK, "C", (locale_t) 0); + uselocale(RPC_Thread_Locale); #endif - { - // On Mac / Unix / Linux, set "C" locale for this thread only - RPC_Thread_Locale = newlocale(LC_ALL_MASK, "C", NULL); - uselocale(RPC_Thread_Locale); - } -#endif // ifndef __WXMSW__ -#endif // ifndef NO_PER_THREAD_LOCALE + + m_pRPC_Thread_Mutex->Lock(); m_pDoc->m_bRPCThreadIsReady = true; while(true) { @@ -167,14 +163,9 @@ void *RPCThread::Entry() { wxASSERT(condErr == wxCOND_NO_ERROR); if (m_pDoc->m_bShutDownRPCThread) { -#if !defined(NO_PER_THREAD_LOCALE) && !defined(__WXMSW__) -#if defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4) - if (uselocale) // uselocale() is not available in Mac OS 10.3.9 -#endif - { +#ifdef HAVE_USELOCALE uselocale(LC_GLOBAL_LOCALE); freelocale(RPC_Thread_Locale); - } #endif m_pRPC_Thread_Mutex->Unlock(); // Just for safety - not really needed // Tell CMainDocument that thread has gracefully ended diff --git a/clientgui/DlgDiagnosticLogFlags.cpp b/clientgui/DlgDiagnosticLogFlags.cpp index 2ec35b52a78..7febcccdb38 100644 --- a/clientgui/DlgDiagnosticLogFlags.cpp +++ b/clientgui/DlgDiagnosticLogFlags.cpp @@ -26,7 +26,6 @@ #include "BOINCBaseFrame.h" #include "Events.h" #include "error_numbers.h" -#include "gui_rpc_client.h" // For SET_LOCALE #include "SkinManager.h" @@ -156,7 +155,6 @@ CDlgDiagnosticLogFlags::~CDlgDiagnosticLogFlags() { void CDlgDiagnosticLogFlags::CreateCheckboxes() { - SET_LOCALE sl; char buf[64000]; MIOFILE mf; bool val; @@ -196,7 +194,6 @@ void CDlgDiagnosticLogFlags::CreateCheckboxes() { } void CDlgDiagnosticLogFlags::SaveFlags() { - SET_LOCALE sl; char buf[64000]; MIOFILE mf; bool val; diff --git a/clientgui/mac/config.h b/clientgui/mac/config.h index fe8ad02429a..030bedcd28f 100644 --- a/clientgui/mac/config.h +++ b/clientgui/mac/config.h @@ -299,6 +299,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 +/* Define to 1 if you have the `uselocale' function. */ +#define HAVE_USELOCALE 1 + /* Define to 1 if you have the header file. */ #define HAVE_UTMP_H 1 diff --git a/clientsetup/win/CAShutdownBOINCManager.cpp b/clientsetup/win/CAShutdownBOINCManager.cpp index 6ea1fd44b64..66e9df45c5e 100644 --- a/clientsetup/win/CAShutdownBOINCManager.cpp +++ b/clientsetup/win/CAShutdownBOINCManager.cpp @@ -83,7 +83,7 @@ UINT CAShutdownBOINCManager::OnExecution() hWndBOINCManagerSystray = FindWindow( _T("wxTaskBarExWindowClass"), _T("BOINCManagerSystray") ); if ( NULL != hWndBOINCManagerSystray ) { - GetWindowText( hWndBOINCManagerSystray, szWindowTitle, (sizeof(szWindowTitle) * sizeof(TCHAR))); + GetWindowText( hWndBOINCManagerSystray, szWindowTitle, (sizeof(szWindowTitle) / sizeof(TCHAR))); LogProgress( szWindowTitle ); lrReturnValue = SendMessage( hWndBOINCManagerSystray, WM_TASKBARSHUTDOWN, NULL, NULL ); diff --git a/configure.ac b/configure.ac index 9d6a18c4210..e7f9ecec9eb 100644 --- a/configure.ac +++ b/configure.ac @@ -592,7 +592,7 @@ else echo "DEBUG: GLUT_CFLAGS = $GLUT_CFLAGS" >&5 echo "DEBUG: GLUT_LIBS = $GLUT_LIBS" >&5 - AC_CHECK_HEADERS([gl.h glu.h glut.h glaux.h GL/gl.h GL/glu.h GL/glut.h GL/glaux.h OpenGL/gl.h OpenGL/glu.h OpenGL/glut.h OpenGL/glaux.h GLUT/glut.h MesaGL/gl.h MesaGL/glu.h MesaGL/glut.h MesaGL/glaux.h libnotify/notify.h gtk/gtk.h locale.h xlocale.h]) + AC_CHECK_HEADERS([gl.h glu.h glut.h glaux.h GL/gl.h GL/glu.h GL/glut.h GL/glaux.h OpenGL/gl.h OpenGL/glu.h OpenGL/glut.h OpenGL/glaux.h GLUT/glut.h MesaGL/gl.h MesaGL/glu.h MesaGL/glut.h MesaGL/glaux.h libnotify/notify.h gtk/gtk.h]) AC_CHECK_LIB([jpeg], [jpeg_start_compress],[have_jpeg=1],[have_jpeg=0]) AC_CHECK_HEADER([jpeglib.h],[have_jpeg=1],[have_jpeg=0]) @@ -638,14 +638,6 @@ AH_TOP([ ]) AH_BOTTOM([ -#if !HAVE_DECL__CONFIGTHREADLOCALE -#define NO_PER_THREAD_LOCALE 1 -#undef HAVE__CONFIGTHREADLOCALE -#else -#undef NO_PER_THREAD_LOCALE -#define HAVE__CONFIGTHREADLOCALE 1 -#endif - #ifndef HAVE_RES_INIT #define res_init() (0) #endif @@ -666,7 +658,7 @@ AC_TYPE_SIGNAL if test "${isWIN32}" = "yes" ; then AC_CHECK_HEADERS(winsock2.h winsock.h windows.h ws2tcpip.h winternl.h crtdbg.h) fi -AC_CHECK_HEADERS(sys/types.h sys/un.h arpa/inet.h dirent.h grp.h fcntl.h inttypes.h stdint.h memory.h netdb.h netinet/in.h netinet/tcp.h netinet/ether.h net/if.h net/if_arp.h signal.h strings.h sys/auxv.h sys/file.h sys/fcntl.h sys/ipc.h sys/ioctl.h sys/msg.h sys/param.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/socket.h sys/stat.h sys/statvfs.h sys/statfs.h sys/systeminfo.h sys/time.h sys/types.h sys/utsname.h sys/vmmeter.h sys/wait.h unistd.h utmp.h errno.h procfs.h ieeefp.h setjmp.h float.h sal.h execinfo.h) +AC_CHECK_HEADERS([sys/types.h sys/un.h arpa/inet.h dirent.h grp.h fcntl.h inttypes.h stdint.h memory.h netdb.h netinet/in.h netinet/tcp.h netinet/ether.h net/if.h net/if_arp.h signal.h strings.h sys/auxv.h sys/file.h sys/fcntl.h sys/ipc.h sys/ioctl.h sys/msg.h sys/param.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/socket.h sys/stat.h sys/statvfs.h sys/statfs.h sys/systeminfo.h sys/time.h sys/types.h sys/utsname.h sys/vmmeter.h sys/wait.h unistd.h utmp.h errno.h procfs.h ieeefp.h setjmp.h float.h sal.h execinfo.h xlocale.h]) save_cxxflags="${CXXFLAGS}" save_cppflags="${CPPFLAGS}" @@ -924,9 +916,9 @@ AC_LANG_POP dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_FUNC_VPRINTF -AC_CHECK_FUNCS(ether_ntoa setpriority sched_setscheduler strlcpy strlcat strcasestr strcasecmp sigaction getutent setutent getisax strdup _strdup strdupa _strdupa daemon stat64 putenv setenv unsetenv res_init strtoull localtime localtime_r gmtime gmtime_r) +AC_CHECK_FUNCS([ether_ntoa setpriority sched_setscheduler strlcpy strlcat strcasestr strcasecmp sigaction getutent setutent getisax strdup _strdup strdupa _strdupa daemon stat64 putenv setenv unsetenv res_init strtoull localtime localtime_r gmtime gmtime_r uselocale _configthreadlocale]) -AC_CHECK_DECLS([_fpreset, fpreset, _configthreadlocale], +AC_CHECK_DECLS([_fpreset, fpreset], [],[],[[ #include #if HAVE_SYS_TYPES_H @@ -973,12 +965,6 @@ AC_CHECK_DECLS([_fpreset, fpreset, _configthreadlocale], #ifdef HAVE_MATH_H #include #endif -#ifdef HAVE_LOCALE_H -#include -#endif -#ifdef HAVE_XLOCALE_H -#include -#endif ]]) dnl Checks for typedefs, structures, and compiler characteristics. diff --git a/html/user/get_project_config.php b/html/user/get_project_config.php index b07ea492ed8..19e6808df06 100644 --- a/html/user/get_project_config.php +++ b/html/user/get_project_config.php @@ -62,6 +62,10 @@ function show_platforms() { ".secure_url_base()." "; +if (parse_config($config, "")) { + echo " \n"; +} + $local_revision = @trim(file_get_contents("../../local.revision")); if ($local_revision) { echo "$local_revision\n"; diff --git a/html/user/login_token_lookup.php b/html/user/login_token_lookup.php index b0c828b2fec..db925470d05 100644 --- a/html/user/login_token_lookup.php +++ b/html/user/login_token_lookup.php @@ -39,12 +39,21 @@ function main() { $uname = htmlentities($user->name); echo "\n"; if (parse_bool($config, "account_manager")) { + // the following for 7.9.2 clients; can be removed later + // echo " $uname\n"; echo " $user->email_addr\n"; echo " $user->passwd_hash\n"; + + // the following for later clients + // + echo " $user->authenticator\n"; } else { - $auth = weak_auth($user); - echo " $auth\n"; + // the following for 7.9.2 clients; remove soon + // + echo " $user->authenticator\n"; + + echo " $user->authenticator\n"; echo " $uname\n"; if ($user->teamid && $team == BoincTeam::lookup_id($user->teamid)) { $tname = htmlentities($team->name); diff --git a/lib/boinc_win.h b/lib/boinc_win.h index 58e516a46f3..0260298cb1f 100644 --- a/lib/boinc_win.h +++ b/lib/boinc_win.h @@ -96,8 +96,6 @@ #define HAVE_DECL__FPRESET 1 #define HAVE_DECL___CPUID 1 #define HAVE_MSVCRT 1 -#undef NO_PER_THREAD_LOCALE -#define HAVE_DECL__CONFIGTHREADLOCALE 1 #define HAVE__CONFIGTHREADLOCALE 1 #define HAVE_DECL___CPUID 1 diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h index c752a80ea4d..3c4fb4dfe21 100644 --- a/lib/gui_rpc_client.h +++ b/lib/gui_rpc_client.h @@ -20,6 +20,11 @@ #ifndef BOINC_GUI_RPC_CLIENT_H #define BOINC_GUI_RPC_CLIENT_H +#ifdef _WIN32 +#include "boinc_win.h" +#endif +#include "config.h" + #if !defined(_WIN32) || defined (__CYGWIN__) #include #include @@ -30,9 +35,10 @@ #include #include #include -#include #endif +#include + #include #include "cc_config.h" @@ -773,73 +779,23 @@ struct RPC { int parse_reply(); }; -// We recommend using the XCode project under OS 10.5 to compile -// the BOINC library, but some projects still use config & make, -// so the following compatibility code avoids compiler errors when -// building libboinc.a using config & make on system OS 10.3.9 or -// with the OS 10.3.9 SDK (but using config & make is not recommended.) -// -#if defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4) && (!defined(BUILDING_MANAGER)) -#define NO_PER_THREAD_LOCALE 1 -#endif - -// uselocal() API should be available on UNIX, Fedora & Ubuntu. -// For any platforms which do not support setting locale on a -// per-thread basis, add code here similar to the following sample: -//#if defined(__UNIVAC__) -//#define NO_PER_THREAD_LOCALE 1 -//#endif -#if defined(__HAIKU__) -#define NO_PER_THREAD_LOCALE 1 -#endif - - -#ifdef NO_PER_THREAD_LOCALE - // Use this code for any platforms which do not support - // setting locale on a per-thread basis (see comment above) - struct SET_LOCALE { - std::string locale; - inline SET_LOCALE() { - locale = setlocale(LC_ALL, NULL); - setlocale(LC_ALL, "C"); - } - inline ~SET_LOCALE() { - setlocale(LC_ALL, locale.c_str()); - } -}; - -#elif defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4) -// uselocale() is not available in OS 10.3.9 so use weak linking -#if HAVE_XLOCALE_H -#include -#endif -extern int freelocale(locale_t) __attribute__((weak_import)); -extern locale_t newlocale(int, __const char *, locale_t) __attribute__((weak_import)); -extern locale_t uselocale(locale_t) __attribute__((weak_import)); +#if defined(HAVE__CONFIGTHREADLOCALE) || defined(HAVE_USELOCALE) +// no-op, the calling thread is already set to use C locale struct SET_LOCALE { - locale_t old_locale, RPC_locale; - std::string locale; - inline SET_LOCALE() { - if (uselocale == NULL) { - locale = setlocale(LC_ALL, NULL); - setlocale(LC_ALL, "C"); - } - } - inline ~SET_LOCALE() { - if (uselocale == NULL) { - setlocale(LC_ALL, locale.c_str()); - } - } + SET_LOCALE() {} + ~SET_LOCALE() {} }; #else - struct SET_LOCALE { - // Don't need to juggle locales if we have per-thread locale - inline SET_LOCALE() { + std::string old_locale; + SET_LOCALE() { + old_locale = setlocale(LC_ALL, NULL); + setlocale(LC_ALL, "C"); } - inline ~SET_LOCALE() { + ~SET_LOCALE() { + setlocale(LC_ALL, old_locale.c_str()); } }; #endif