- scheduler: if client request uses a weak authenticator,

don't modify user preferences or CPID.
- client: fix bug that shows ATI version incorrectly
- database: host.posts has been repurposed as a salt (or seqno)
    for a new type of weak authenticator that won't depend on password
- web code:
    modify forum_preferences.posts instead of host.posts.
    (actually, the former isn't used either, we just do a select count(*);
    should fix this at some point).

svn path=/trunk/boinc/; revision=18865
This commit is contained in:
David Anderson 2009-08-18 20:44:12 +00:00
parent fb8540f6b5
commit 12d4b978be
10 changed files with 84 additions and 22 deletions

View File

@ -6971,3 +6971,30 @@ David 17 Aug 2009
lib/
gui_rpc_client.h
gui_rpc_client_ops.cpp
David 18 Aug 2009
- scheduler: if client request uses a weak authenticator,
don't modify user preferences or CPID.
- client: fix bug that shows ATI version incorrectly
- database: host.posts has been repurposed as a salt (or seqno)
for a new type of weak authenticator that won't depend on password
- web code:
modify forum_preferences.posts instead of host.posts.
(actually, the former isn't used either, we just do a select count(*);
should fix this at some point).
client/
cpu_sched.cpp
db/
boinc_db.h
schema.sql
html/
inc/
forum.inc
ops/
forum_repair.php
lib/
coproc.pp
sched/
handle_request.cpp
sched_types.h

View File

@ -740,8 +740,8 @@ static inline bool in_ordered_scheduled_results(ACTIVE_TASK* atp) {
static inline bool more_important(RESULT* r0, RESULT* r1) {
// favor jobs in danger of deadline miss
//
bool miss0 = r0->rr_sim_misses_deadline;
bool miss1 = r1->rr_sim_misses_deadline;
bool miss0 = r0->edf_scheduled;
bool miss1 = r1->edf_scheduled;
if (miss0 && !miss1) return true;
if (!miss0 && miss1) return false;
@ -790,7 +790,7 @@ static void print_job_list(vector<RESULT*>& jobs, bool details) {
msg_printf(rp->project, MSG_INFO,
"[cpu_sched_debug] %d: %s (MD: %s; UTS: %s)",
i, rp->name,
rp->rr_sim_misses_deadline?"yes":"no",
rp->edf_scheduled?"yes":"no",
rp->unfinished_time_slice?"yes":"no"
);
}
@ -923,15 +923,40 @@ bool CLIENT_STATE::enforce_schedule() {
// Loop through the jobs we want to schedule.
//
ncpus_used = 0;
bool running_edf_scheduled_job = false;
for (i=0; i<runnable_jobs.size(); i++) {
RESULT* rp = runnable_jobs[i];
if (!rp->uses_coprocs() && (ncpus_used >= ncpus)) {
if (log_flags.cpu_sched_debug) {
msg_printf(rp->project, MSG_INFO,
"[cpu_sched_debug] all CPUs used, skipping %s", rp->name
);
// decide if we're already using too many CPUs to run this job
//
if (!rp->uses_coprocs()) {
if (running_edf_scheduled_job) {
// if we're running an EDF job,
// don't use more than 150% of #CPUs.
//
double x = ncpus_used + rp->avp->avg_ncpus;
if (x > 1.5001*ncpus) {
if (log_flags.cpu_sched_debug) {
msg_printf(rp->project, MSG_INFO,
"[cpu_sched_debug] have EDF job, %s would oversaturate CPUs, skipping",
rp->name
);
}
continue;
}
} else {
// Otherwise saturate CPUs.
//
if (ncpus_used >= ncpus) {
if (log_flags.cpu_sched_debug) {
msg_printf(rp->project, MSG_INFO,
"[cpu_sched_debug] all CPUs used, skipping %s",
rp->name
);
}
continue;
}
}
continue;
}
atp = lookup_active_task_by_result(rp);
@ -949,6 +974,8 @@ bool CLIENT_STATE::enforce_schedule() {
}
}
if (rp->edf_scheduled) running_edf_scheduled_job = true;
if (log_flags.cpu_sched_debug) {
msg_printf(rp->project, MSG_INFO,
"[cpu_sched_debug] scheduling %s", rp->name

View File

@ -155,8 +155,7 @@ struct USER {
bool show_hosts;
int posts; // number of messages posted (redundant)
// deprecated as of 9/2004 - forum_preferences.posts is used instead
// may be used as a temp var
// WARNING: it's a shortint (16 bits) in the DB
// now used as salt for weak auth
// The following are specific to SETI@home;
// they record info about the user's involvement in a prior project

View File

@ -85,7 +85,7 @@ create table user (
send_email smallint not null,
show_hosts smallint not null,
posts smallint not null,
-- deprecated
-- reused: salt for weak auth
seti_id integer not null,
seti_nresults integer not null,
seti_last_result_time integer not null,

View File

@ -1,6 +1,10 @@
<?
$project_news = array(
array("August 18, 2009",
"Check out <a href=http://www.smh.com.au/technology/new-heroes-with-a-hard-drive-20090815-elsd.html>an article in The Sydney Morning Herald</a>
about volunteer computing in Australia."
),
array("August 3, 2009",
"Intel (in partnership with GridRepublic and BOINC) announces
<a href=http://apps.facebook.com/processors/new.php>Progress Thru Processors</a>,

View File

@ -792,7 +792,7 @@ function create_post($content, $parent_id, $user, $forum, $thread, $signature) {
notify_subscriber($thread, $user2);
}
}
$user->update("posts=posts+1");
$user->prefs->update("posts=posts+1");
$thread->update("replies=replies+1, timestamp=$now");
$forum->update("posts=posts+1, timestamp=$now");
}

View File

@ -43,10 +43,11 @@ function update_thread_timestamps() {
function update_user_posts() {
$users = BoincUser::enum();
foreach ($users as $user) {
BoincForumPrefs::lookup($user);
$num = BoincPost::count("user=$user->id");
if ($num != $user->posts) {
if ($num != $user->prefs->posts) {
echo "user $user->id: $user->posts $num\n";
$user->update("posts=$num");
$user->prefs->update("posts=$num");
}
}
}

View File

@ -618,7 +618,7 @@ void COPROC_ATI::get(COPROCS& coprocs, vector<string>& strings) {
(*__calInit)();
(*__calDeviceGetCount)(&numDevices);
(*__calGetVersion)(&cal_major,&cal_minor,&cal_imp);
(*__calGetVersion)(&cal_major, &cal_minor, &cal_imp);
if (!numDevices) {
strings.push_back("No usable CAL devices found");
@ -644,6 +644,7 @@ void COPROC_ATI::get(COPROCS& coprocs, vector<string>& strings) {
}
cc.attribs = attribs;
strcpy(cc.name, gpu_name.c_str());
sprintf(cc.version, "%d.%d.%d", cal_major, cal_minor, cal_imp);
cc.device_num = i;
gpus.push_back(cc);
}
@ -666,7 +667,6 @@ void COPROC_ATI::get(COPROCS& coprocs, vector<string>& strings) {
COPROC_ATI* ccp = new COPROC_ATI;
*ccp = best;
sprintf(ccp->version, "%d.%d.%d", cal_major, cal_minor, cal_imp);
strcpy(ccp->type, "ATI");
ccp->count = numDevices;
coprocs.coprocs.push_back(ccp);

View File

@ -270,25 +270,25 @@ int authenticate_user() {
// look up user based on the ID in host record,
// and see if the authenticator matches (regular or weak)
//
g_request->using_weak_auth = false;
sprintf(buf, "where id=%d", host.userid);
retval = user.lookup(buf);
if (!retval && !strcmp(user.authenticator, g_request->authenticator)) {
// req auth matches user auth - go on
} else {
bool weak_auth = false;
if (!retval) {
// user for host.userid exists - check weak auth
//
get_weak_auth(user, buf);
if (!strcmp(buf, g_request->authenticator)) {
weak_auth = true;
g_request->using_weak_auth = true;
log_messages.printf(MSG_DEBUG,
"[HOST#%d] accepting weak authenticator\n",
host.id
);
}
}
if (!weak_auth) {
if (!g_request->using_weak_auth) {
// weak auth failed - look up user based on authenticator
//
strlcpy(
@ -478,7 +478,7 @@ got_host:
// if new user CPID, update user record
//
if (strlen(g_request->cross_project_id)) {
if (!g_request->using_weak_auth && strlen(g_request->cross_project_id)) {
if (strcmp(g_request->cross_project_id, g_reply->user.cross_project_id)) {
user.id = g_reply->user.id;
escape_string(g_request->cross_project_id, sizeof(g_request->cross_project_id));
@ -743,7 +743,7 @@ int handle_global_prefs() {
// decide whether to update DB
//
if (have_master_prefs) {
if (!g_request->using_weak_auth && have_master_prefs) {
bool update_user_record = false;
if (have_db_prefs) {
if (master_mod_time > db_mod_time && same_account) {

View File

@ -395,6 +395,10 @@ struct SCHEDULER_REQUEST {
bool client_cap_plan_class;
int sandbox; // -1 = don't know
bool using_weak_auth;
// Request uses weak authenticator.
// Don't modify user prefs or CPID
SCHEDULER_REQUEST();
~SCHEDULER_REQUEST();
const char* parse(FILE*);