diff --git a/html/ops/db_ops.inc b/html/ops/db_ops.inc
index 6b35bf0e79..bafde7a308 100644
--- a/html/ops/db_ops.inc
+++ b/html/ops/db_ops.inc
@@ -26,8 +26,7 @@ function lookup_user_auth($auth) {
}
}
-function join_query_string($s1, $s2)
-{
+function join_query_string($s1, $s2) {
if ($s1) {
if ($s2) {
return "$s1&s2";
@@ -120,8 +119,7 @@ class SqlQueryString {
}
}
-function build_sql_query()
-{
+function build_sql_query() {
$q = new SqlQueryString();
$q->addeq('id');
@@ -151,8 +149,7 @@ function link_results($n, $mq, $query) {
}
}
-function show_result_summary()
-{
+function show_result_summary() {
$server_state = array();
$outcome = array();
$client_state = array();
@@ -175,6 +172,11 @@ function show_result_summary()
echo "
Query: $main_query
\n";
$result = mysql_query($main_query);
$ntotal =0; // TODO: how to count $result?
+
+ $nvalid = 0; // for SUCCESS results
+ $ninvalid = 0;
+ $nfile_deleted = 0;
+
while ($res = mysql_fetch_object($result)) {
$server_state[$res->server_state] += 1;
$ntotal += 1;
@@ -183,6 +185,17 @@ function show_result_summary()
if ($res->outcome == 3) {
$client_state[$res->client_state] += 1;
}
+ if ($res->outcome == 1) {
+ if ($res->validate_state == 1) {
+ $nvalid += 1;
+ }
+ if ($res->validate_state == 2) {
+ $ninvalid += 1;
+ }
+ if ($res->file_delete_state >= 1) {
+ $nfile_deleted +=1;
+ }
+ }
}
}
mysql_free_result($result);
@@ -192,6 +205,7 @@ function show_result_summary()
echo "
" . link_results("$ntotal results", $urlquery, '') . " | ";
echo "" . link_results("'Over' results", $urlquery, "server_state=5") . " | ";
echo "" . link_results("'Client error' results", $urlquery, "outcome=3") . " | ";
+ echo "Success results | ";
echo "";
echo "";
echo "Outcome | # results | \n";
for ($ro=0; $ro<6; $ro++) {
c_row2($outcome[$ro]?outcome_color($ro):'white', outcome_string($ro),
- link_results($outcome[$ro], $urlquery, "outcome=$ro"));
+ link_results($outcome[$ro], $urlquery, "outcome=$ro")
+ );
}
echo "
| ";
@@ -214,10 +229,17 @@ function show_result_summary()
echo "
Client state | # results |
\n";
for ($cs=1; $cs<6; $cs++) {
row2(client_state_string($cs),
- link_results($client_state[$cs], $urlquery, "client_state=$cs"));
+ link_results($client_state[$cs], $urlquery, "client_state=$cs")
+ );
}
- print "";
- print "";
+ echo "";
+ echo "";
+ start_table();
+ row2("Valid", link_results($nvalid, $urlquery, "validate_state=1"));
+ row2("Invalid", link_results($ninvalid, $urlquery, "validate_state=2"));
+ row2("Files deleted", link_results($ninvalid, $urlquery, "file_delete_state= 1 or file_delete_state=2"));
+ end_table();
+ echo "";
}
diff --git a/lib/crypt.C b/lib/crypt.C
index a1adf1e9da..d65153a2f4 100644
--- a/lib/crypt.C
+++ b/lib/crypt.C
@@ -102,7 +102,7 @@ int scan_hex_data(FILE* f, DATA_BLOCK& x) {
// same, but read from buffer
//
-int sscan_hex_data(char* p, DATA_BLOCK& x) {
+static int sscan_hex_data(char* p, DATA_BLOCK& x) {
int m, n, nleft=x.len;
x.len = 0;
@@ -113,7 +113,7 @@ int sscan_hex_data(char* p, DATA_BLOCK& x) {
nleft--;
if (nleft<0) {
fprintf(stderr, "sscan_hex_data: buffer overflow\n");
- exit(1);
+ return ERR_BAD_HEX_FORMAT;
}
p += 2;
if (*p == '\n') p++;
@@ -291,7 +291,8 @@ int verify_file2(
}
signature.data = signature_buf;
signature.len = sizeof(signature_buf);
- sscan_hex_data(signature_text, signature);
+ retval = sscan_hex_data(signature_text, signature);
+ if (retval) return retval;
return verify_file(path, key, signature, answer);
}
@@ -311,7 +312,8 @@ int verify_string(
n = strlen(md5_buf);
signature.data = signature_buf;
signature.len = sizeof(signature_buf);
- sscan_hex_data(signature_text, signature);
+ retval = sscan_hex_data(signature_text, signature);
+ if (retval) return retval;
clear_signature.data = (unsigned char*)clear_buf;
clear_signature.len = 256;
retval = decrypt_public(key, signature, clear_signature);
diff --git a/lib/error_numbers.h b/lib/error_numbers.h
index 966cb0a187..d3754f71d2 100755
--- a/lib/error_numbers.h
+++ b/lib/error_numbers.h
@@ -67,3 +67,5 @@
#define ERR_GETRUSAGE -132
// getrusage failed
#define ERR_BENCHMARK_FAILED -133
+#define ERR_BAD_HEX_FORMAT -134
+ // hex-format key data is bad
diff --git a/tools/add.C b/tools/add.C
index b3d375f557..68b153079e 100644
--- a/tools/add.C
+++ b/tools/add.C
@@ -80,7 +80,7 @@ char* user_friendly_name=0;
char* exec_dir=0, *exec_files[10], *signature_files[10];
char *email_addr=0, *user_name=0, *authenticator=0;
char *global_prefs_file=0, *download_dir, *download_url;
-char* code_sign_keyfile=0;
+char code_sign_keyfile[256];
char *message=0, *message_priority=0;
void add_project() {
@@ -357,10 +357,10 @@ int main(int argc, char** argv) {
if (retval) {
printf("no config file found\n");
} else {
- strcpy(db_name, config.db_name);
- strcpy(db_passwd, config.db_passwd);
- strcpy(download_url, config.download_url);
- strcpy(download_dir, config.download_dir);
+ db_name = config.db_name;
+ db_passwd = config.db_passwd;
+ download_url = config.download_url;
+ download_dir = config.download_dir;
sprintf(code_sign_keyfile, "%s/code_sign_private", config.key_dir);
}
@@ -423,7 +423,7 @@ int main(int argc, char** argv) {
} else if (!strcmp(argv[i], "-message_priority")) {
message_priority = argv[++i];
} else if (!strcmp(argv[i], "-code_sign_keyfile")) {
- code_sign_keyfile = argv[++i];
+ strcpy(code_sign_keyfile, argv[++i]);
}
}
retval = boinc_db_open(db_name, db_passwd);
diff --git a/tools/add.py b/tools/add.py
index f1d445b975..3bfd77c305 100755
--- a/tools/add.py
+++ b/tools/add.py
@@ -53,10 +53,13 @@ add.py result (TODO) '''
import sys, os, getopt, md5, time
sys.path.append('../py/')
-import database, db_mid
+sys.path.append('../sched')
+import database, db_mid, boinc_config
from util import *
-database._connectp('quarl_test_upper_case','','')
+config = boinc_config.BoincConfig('../../projects/client_test/config.xml').read()
+
+database._connectp('boinc_client_test','','')
CREATE_TIME = ['?create_time', int(time.time())]
|