diff --git a/checkin_notes b/checkin_notes index 73bb6a76c8..ac233c6fb4 100644 --- a/checkin_notes +++ b/checkin_notes @@ -691,3 +691,12 @@ Charlie Jan 17 2008 SetupSecurity.cpp doc/ sandbox.php + +David Jan 18 2008 + - scheduler: if get request w/o host ID, + use most recently created host with same domain name, + IP addr, OS name, and CPU model, if one exists. + (from Kevin Reed) + + sched/ + handle_request.C diff --git a/doc/boinc_news.php b/doc/boinc_news.php index ccd7f3d990..db1333e9c2 100644 --- a/doc/boinc_news.php +++ b/doc/boinc_news.php @@ -1,6 +1,11 @@ Planetary Society: + From SETI@home to Hominid Fossils: Citizen Cyberscience Reshapes Research Landscape." +), + array("Jan 14, 2008", "The cross-project statistics site All Project Stats.com diff --git a/sched/handle_request.C b/sched/handle_request.C index 21bdc0cb04..2be13dc094 100644 --- a/sched/handle_request.C +++ b/sched/handle_request.C @@ -58,6 +58,33 @@ using namespace std; #include "fcgi_stdio.h" #endif +// find the user's most recently-created host with given various characteristics +// +static bool find_host_by_other(DB_USER& user, HOST req_host, DB_HOST& host) { + char buf[2048]; + char dn[512], ip[512], os[512], pm[512]; + + // Only check if the fields are populated + if (strlen(req_host.domain_name) && strlen(req_host.last_ip_addr) && strlen(req_host.os_name) && strlen(req_host.p_model)) { + strcpy(dn, req_host.domain_name); + escape_string(dn, 512); + strcpy(ip, req_host.last_ip_addr); + escape_string(ip, 512); + strcpy(os, req_host.os_name); + escape_string(os, 512); + strcpy(pm, req_host.p_model); + escape_string(pm, 512); + + sprintf(buf, + "where userid=%d and id>%d and domain_name='%s' and last_ip_addr = '%s' and os_name = '%s' and p_model = '%s' and m_nbytes = %lf order by id desc", user.id, req_host.id, dn, ip, os, pm, req_host.m_nbytes + ); + if (!host.enumerate(buf)) { + host.end_enumerate(); + return true; + } + } + return false; +} static void get_weak_auth(USER& user, char* buf) { char buf2[256], out[256]; sprintf(buf2, "%s%s", user.authenticator, user.passwd_hash); @@ -179,29 +206,6 @@ static void mark_results_over(DB_HOST& host) { } } -// find the user's most recently-created host with given -// various characteristics -// -static bool find_host_by_other(DB_USER& user, HOST req_host, DB_HOST& host) { - char buf[256]; - - sprintf(buf, - "where userid=%d and id>%d and domain_name='%s' and last_ip_addr = '%s' and p_model = '%s' and m_nbytes = %lf order by id desc", - user.id, req_host.id, req_host.domain_name, req_host.last_ip_addr, - req_host.p_model, req_host.m_nbytes - ); - if (!host.enumerate(buf)) { - host.end_enumerate(); - log_messages.printf( - SCHED_MSG_LOG::MSG_CRITICAL, - "[HOST#%d] [USER#%d] Found similar existing host for this user.\n", - host.id, host.userid - ); - return true; - } - return false; -} - // Based on the info in the request message, // look up the host and its user, and make sure the authenticator matches. // Some special cases: @@ -401,12 +405,15 @@ make_new_host: // If found, use the existing host record, // and mark in-progress results as over. // -#if 0 if (find_host_by_other(user, sreq.host, host)) { + log_messages.printf( + SCHED_MSG_LOG::MSG_NORMAL, + "[HOST#%d] [USER#%d] Found similar existing host for this user - assigned.\n", + host.id, host.userid + ); mark_results_over(host); goto got_host; } -#endif // either of the above cases, // or host ID didn't match user ID,