*** empty log message ***

svn path=/trunk/boinc/; revision=3513
This commit is contained in:
David Anderson 2004-06-09 00:12:22 +00:00
parent f54b9c5a36
commit 68039a57e2
12 changed files with 109 additions and 36 deletions

View File

@ -13087,3 +13087,37 @@ Karl 2004-06-08
upper-case.C
lib/
app_ipc.C
David 6 June 2004
- in strcpy2(), use strlcpy instead of strncpy
strncpy() always copies the full N bytes,
which is inefficient when there are long (64KB) fields
that are short or empty.
strlcpy() does what we want - it only copies significant bytes,
but doesn't go off the end of the destination buffer.
I also commented out the version of strlcpy in std_fixes.h -
this has the same performance problem.
- fixed "show team email addresses" function to not show auths
- temporarily turned off user search by name and team search by name;
we don't have indices on these fields
- file upload handler: show bad-certificate message even
if we're not enforcing it.
- scheduler: fix insufficient-speed message
- validator: print log messages if can't lookup/update anything
db/
db_base.h
html/
inc/
util.inc
user/
forum_text_search*
team_email_list.php
team_lookup.php
user_search_action.php
lib/
std_fixes.h
sched/
file_upload_handler.C
sched_send.C
validate.C

View File

@ -74,8 +74,7 @@ public:
if (!z) { \
x[0]=0; \
} else { \
strncpy(x, z, sizeof(x)); \
x[sizeof(x)-1] = 0; \
strlcpy(x, z, sizeof(x)); \
} \
}

View File

@ -344,12 +344,12 @@ function munge_email_addr($email, $string) {
// if email_addr is of the form @X_Y, split out the X and return true.
// otherwise return false
//
function split_munged_email_addr($addr, $string, &$email) {
function split_munged_email_addr($addr, $auth, &$email) {
if (substr($addr, 0, 1) != "@") return false;
$x = strrchr($addr, "_");
if (!$x) return false;
$y = substr($x, 1);
if ($y != $string) return false;
if ($auth && $y != $auth) return false;
$email = substr($addr, 1, strlen($addr)-strlen($x)-1);
return true;
}

View File

@ -47,7 +47,7 @@ if ($n==$count) {
$s = urlencode($search_string);
$offset += $count;
echo "
<a href=text_search_action.php?bodies=1&search_string=$s&offset=$offset>Next $count</a>
<a href=forum_text_search_action.php?bodies=1&search_string=$s&offset=$offset>Next $count</a>
";
}

View File

@ -23,7 +23,7 @@ echo "
<tr><td align=right>
Search messages:
</td><td>
<form action=text_search_action.php>
<form action=forum_text_search_action.php>
<input name=search_string>
<input type=submit name=bodies value=Search>
</form>

View File

@ -23,8 +23,8 @@ require_once("../inc/team.inc");
row2_plain("<b>Name</b>", "<b>Email address</b>");
$result = mysql_query("select * from user where teamid=$team->id");
while ($user = mysql_fetch_object($result)) {
if (!split_munged_email_addr($addr, $auth, $email)) {
$email = $user->email_addr
if (!split_munged_email_addr($user->email_addr, null, $email)) {
$email = $user->email_addr;
}
row2_plain($user->name, $email);
}

View File

@ -12,6 +12,10 @@
$length = count($words);
$name_lc = strtolower($team_name);
echo "Team lookup disabled";
page_tail();
exit();
$query = sprintf(
"select * from team where name_lc like '%s'",
"%$name_lc%"

View File

@ -16,6 +16,10 @@ $count = 10;
page_head("Search results");
echo "Name search is disabled"
page_tail();
exit();
echo "<h2>User names containing '$search_string'</h2>\n";
$q = "select * from user where name like '%$search_string%' limit $offset,$count";
$result = mysql_query($q);

View File

@ -16,17 +16,6 @@
//
// Contributor(s):
//
// Revision History:
//
// $Log$
// Revision 1.5 2004/01/22 02:01:09 korpela
// Added strlcat().
// Modified match tag to work with tags of the form "<tag>" and "tag"
//
// Revision 1.4 2003/12/11 17:55:07 korpela
// Added definition of strlcpy() for machines without it.
//
//
#ifndef _STD_FIXES_H_
#define _STD_FIXES_H_
@ -40,6 +29,7 @@
#include <string.h>
#endif
#if 0
extern "C" {
size_t strlcpy(char *dst, const char *src, size_t len);
}
@ -53,6 +43,7 @@ inline size_t strlcpy(char *dst, const char *src, size_t len) {
namespace std {
using ::strlcpy;
}
#endif
#endif
@ -64,6 +55,7 @@ namespace std {
#include <string.h>
#endif
#if 0
extern "C" {
size_t strlcat(char *dst, const char *src, size_t len);
}
@ -77,6 +69,7 @@ inline size_t strlcat(char *dst, const char *src, size_t len) {
namespace std {
using ::strlcat;
}
#endif
#endif

View File

@ -209,22 +209,22 @@ int handle_file_upload(FILE* in, R_RSA_PUBLIC_KEY& key) {
if (retval) {
return return_error(ERR_PERMANENT, "FILE_INFO::parse");
}
if (!config.ignore_upload_certificates) {
retval = verify_string(
file_info.signed_xml, file_info.xml_signature, key, is_valid
retval = verify_string(
file_info.signed_xml, file_info.xml_signature, key, is_valid
);
if (retval || !is_valid) {
log_messages.printf(SCHED_MSG_LOG::CRITICAL,
"verify_string() [%s] [%s] retval %d, is_valid = %d\n",
file_info.signed_xml, file_info.xml_signature,
retval, is_valid
);
if (retval || !is_valid) {
log_messages.printf(SCHED_MSG_LOG::CRITICAL,
"verify_string() [%s] [%s] retval %d, is_valid = %d\n",
file_info.signed_xml, file_info.xml_signature,
retval, is_valid
);
if (!config.ignore_upload_certificates) {
log_messages.printf(SCHED_MSG_LOG::NORMAL, file_info.signed_xml, "signed xml: ");
log_messages.printf(SCHED_MSG_LOG::NORMAL, file_info.xml_signature, "signature: ");
return return_error(ERR_PERMANENT, "invalid signature");
continue;
}
}
continue;
}
else if (parse_double(buf, "<offset>", offset)) continue;
else if (parse_double(buf, "<nbytes>", nbytes)) continue;

View File

@ -696,7 +696,7 @@ int send_work(
" (there was work but your computer doesn't have enough memory)"
);
}
if (wreq.insufficient_mem) {
if (wreq.insufficient_speed) {
strcat(reply.message,
" (there was work but your computer would not finish it before it is due"
);

View File

@ -70,27 +70,66 @@ int grant_credit(DB_RESULT& result, double credit) {
int retval;
retval = host.lookup_id(result.hostid);
if (retval) return retval;
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[RESULT#%d] lookup of host %d failed %d\n",
result.id, result.hostid, retval
);
return retval;
}
retval = user.lookup_id(host.userid);
if (retval) return retval;
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[RESULT#%d] lookup of user %d failed %d\n",
result.id, host.userid, retval
);
return retval;
}
user.total_credit += credit;
update_average(result.sent_time, credit, CREDIT_HALF_LIFE, user.expavg_credit, user.expavg_time);
retval = user.update();
if (retval) return retval;
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[RESULT#%d] update of user %d failed %d\n",
result.id, host.userid, retval
);
}
host.total_credit += credit;
update_average(result.sent_time, credit, CREDIT_HALF_LIFE, host.expavg_credit, host.expavg_time);
retval = host.update();
if (retval) return retval;
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[RESULT#%d] update of host %d failed %d\n",
result.id, result.hostid, retval
);
}
if (user.teamid) {
retval = team.lookup_id(user.teamid);
if (retval) return retval;
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[RESULT#%d] lookup of team %d failed %d\n",
result.id, user.teamid, retval
);
return retval;
}
team.total_credit += credit;
update_average(result.sent_time, credit, CREDIT_HALF_LIFE, team.expavg_credit, team.expavg_time);
retval = team.update();
if (retval) return retval;
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[RESULT#%d] update of team %d failed %d\n",
result.id, team.id, retval
);
}
}
return 0;