diff --git a/Makefile.in b/Makefile.in index 1996105dd6..e3c3fb8e48 100644 --- a/Makefile.in +++ b/Makefile.in @@ -5,18 +5,13 @@ topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ -INSTALL_DIR = /usr/local/boinc - -MINOR_VERSION = 02 -MAJOR_VERSION = 0 - # # The ../$(srcdir)/client/configure # only works when the original configure is relative path # it doesn't work when it is an absolute path # This needs to be fixed # -all: messages +all: cd RSAEuro/source; ${MAKE}; cd ../..; \ cd db; ${MAKE}; cd ..; \ cd lib; ${MAKE}; cd ..; \ @@ -26,10 +21,6 @@ all: messages cd sched; ${MAKE}; cd ..; \ cd tools; ${MAKE}; cd ..; -messages: - @echo $(ENV_MESSAGES) - $(EXIT_IF_NEEDED) - clean: rm -f boinc.tar.gz config.cache; \ cd RSAEuro/source/; ${MAKE} clean; cd ../../; \ @@ -41,25 +32,6 @@ clean: cd sched; ${MAKE} clean; cd ..; \ cd tools; ${MAKE} clean; cd ..; -install: all - -mkdir -p $(INSTALL_DIR); - cd sched; ${MAKE} install; - cd lib; ${MAKE} install; - cd api; ${MAKE} install; - cd apps; ${MAKE} install; - cd client; ${MAKE} install; - cd tools; ${MAKE} install; - $(CP) -r test /usr/local/boinc; - -uninstall: - cd sched; ${MAKE} uninstall; - cd lib; ${MAKE} uninstall; - cd api; ${MAKE} uninstall; - cd apps; ${MAKE} uninstall; - cd client; ${MAKE} uninstall; - cd tools; ${MAKE} uninstall; - $(RM) -r $(INSTALL_DIR)/tools; - ARCHIVE_TARGETS = \ client/*.C client/*.h client/configure \ client/install-sh client/*.in client/*.sub client/*.guess \ @@ -86,10 +58,10 @@ ARCHIVE_TARGETS = \ *.in *.sub *.guess tar: - tar cf boinc_$(MAJOR_VERSION).$(MINOR_VERSION).tar $(ARCHIVE_TARGETS) ; gzip boinc_$(MAJOR_VERSION).$(MINOR_VERSION).tar + tar cf boinc_$(BOINC_MAJOR_VERSION).$(BOINC_MINOR_VERSION).tar $(ARCHIVE_TARGETS) ; gzip boinc_$(BOINC_MAJOR_VERSION).$(BOINC_MINOR_VERSION).tar zip: - zip -q boinc_$(MAJOR_VERSION).$(MINOR_VERSION).zip $(ARCHIVE_TARGETS) + zip -q boinc_$(BOINC_MAJOR_VERSION).$(BOINC_MINOR_VERSION).zip $(ARCHIVE_TARGETS) client_tar: clean cd client; ./configure; ${MAKE} tar; diff --git a/checkin_notes b/checkin_notes index 589bac4b7c..0cbac426a3 100755 --- a/checkin_notes +++ b/checkin_notes @@ -2318,3 +2318,41 @@ David Nov 7 2002 backend_lib.Ch create_work.C process_result_template.C + +David Nov 9 2002 + - fixed bug that caused file upload authentication failure + - The user web site now correctly provides download of the core client, + as long as you add a core client app version in your test script + (see test_uc.php for an example) + - version numbers now come from env vars BOINC_MAJOR_VERSION + and BOINC_MINOR_VERSION. You must set these in your .cshrc + - Web server config file must have + DefaultType application/octet-stream + so that core client is saved as file, not displayed + - replaced "db_name" file in html_user, html_ops directories with + "config.xml", which contains download URL as well as DB name/passwd + - got rid of "install" target in main Makefile + + Makefile.in + client/ + Makefile.in + doc/ + data_server_setup.html + single_host_server.html + html_ops/ + util.inc + html_user/ + db.inc + download.php + index.php + login.inc + login_action.php + util.inc + sched/ + file_upload_handler.C + handle_request.C + test/ + test.inc + test_uc.php + tools/ + process_result_template.C diff --git a/client/Makefile.in b/client/Makefile.in index 9bc6f7e7ef..076b87f56a 100644 --- a/client/Makefile.in +++ b/client/Makefile.in @@ -5,8 +5,6 @@ VPATH = @srcdir@ INSTALL_DIR = /usr/local/boinc -MINOR_VERSION = 02 -MAJOR_VERSION = 0 VERSION = 2 CFLAGS = -g -Wall @DEFS@ \ @@ -23,7 +21,7 @@ CC = @CC@ $(CFLAGS) CLIBS = @LIBS@ -CLIENT_PROG = boinc_$(MAJOR_VERSION).$(MINOR_VERSION)_@host@ +CLIENT_PROG = boinc_$(BOINC_MAJOR_VERSION).$(BOINC_MINOR_VERSION)_@host@ PROGS = $(CLIENT_PROG) test_net_xfer test_http test_file_xfer all: $(PROGS) @@ -112,11 +110,11 @@ test_file_xfer: test_file_xfer.o $(TEST_FX_OBJS) tar: cd $(topsrcdir)/..; \ - tar cf boinc_client_$(MAJOR_VERSION).$(MINOR_VERSION).tar $(ARCHIVE_TARGETS); \ - gzip boinc_client_$(MAJOR_VERSION).$(MINOR_VERSION).tar; + tar cf boinc_client_$(BOINC_MAJOR_VERSION).$(BOINC_MINOR_VERSION).tar $(ARCHIVE_TARGETS); \ + gzip boinc_client_$(BOINC_MAJOR_VERSION).$(BOINC_MINOR_VERSION).tar; zip: - cd $(topsrcdir)/..; zip -q boinc_client_$(MAJOR_VERSION).$(MINOR_VERSION).zip $(ARCHIVE_TARGETS) + cd $(topsrcdir)/..; zip -q boinc_client_$(BOINC_MAJOR_VERSION).$(BOINC_MINOR_VERSION).zip $(ARCHIVE_TARGETS) clean: rm -f *.o $(PROGS) core dependencies config.cache diff --git a/doc/data_server_setup.html b/doc/data_server_setup.html index 48042d1573..5687fa5419 100644 --- a/doc/data_server_setup.html +++ b/doc/data_server_setup.html @@ -42,3 +42,7 @@ ScriptAlias /boinc-cgi/ "/users/barry/cgi/" Allow from all </Directory> +You should also set the default MIME type as follows: +
+DefaultType application/octet-stream
+
diff --git a/doc/single_host_server.html b/doc/single_host_server.html index 559103d362..9b122b4f58 100644 --- a/doc/single_host_server.html +++ b/doc/single_host_server.html @@ -76,6 +76,11 @@ ScriptAlias /david_cgi/ "/users/david/boinc_cgi/" +You should also set the default MIME type as follows: +
+DefaultType application/octet-stream
+
+

Environment variabless

Define the following environment variables: diff --git a/html/ops/db.inc b/html/ops/db.inc index 0185eff4aa..dd3d7eef71 100644 --- a/html/ops/db.inc +++ b/html/ops/db.inc @@ -5,12 +5,8 @@ function db_init() { if (!$retval) { exit(); } - $fp = fopen("db_name", "r"); - $db_name = fgets($fp, 1024); - $db_name = rtrim($db_name); + $db_name = parse_config(""); mysql_select_db($db_name); - fclose($fp); - return $db_name; } function lookup_user_auth($auth) { diff --git a/html/ops/util.inc b/html/ops/util.inc index 2e05a78239..378614e766 100644 --- a/html/ops/util.inc +++ b/html/ops/util.inc @@ -23,13 +23,7 @@ define("BODY_COLOR", " bgcolor=ffffff "); define("NOLOGIN", "Not logged in. Click here to login.\n"); define("BADPASS", "The password you entered is incorrect. Click the Back button on your browser to re-enter your password or try again later."); define("DIFFPASS", "You've typed two different passwords. Click the Back button on your browser to edit your information, making sure you type the same password in both password fields."); - -function get_project_name() { - $fp = fopen(db_name, "r"); - $db_name = fgets($fp, 1024); - $db_name = rtrim($db_name); - return $db_name; -} +define("PROJECT", "Sample project"); function get_user_from_cookie() { $auth = ""; @@ -44,8 +38,6 @@ function show_login($user) { if ($user) { printf("Logged in as %s.\n", $user->name); printf("
Log in as someone else.\n"); - $project = get_project_name(); - printf("
My %s\n", $project); } else { echo NOLOGIN; } @@ -53,8 +45,7 @@ function show_login($user) { function page_head($title) { echo "$title\n"; - $project = get_project_name(); - echo TABLE . "" . TITLE_FONT . "".$project.": $title\n"; + echo TABLE . "" . TITLE_FONT . "".PROJECT.": $title\n"; } function page_tail() { @@ -141,7 +132,7 @@ function random_string() { } function print_country_select() { - PassThru("/disks/milkyway/a/users/anderson/boinc/tools/country_select"); + PassThru("country_select"); } function print_page_header($title) { @@ -159,4 +150,34 @@ function print_page_end() { echo ""; } +// look for an element in some XML text +// +function parse_element($xml, $tag) { + $element = null; + $x = strstr($xml, $tag); + if ($x) { + $y = substr($x, strlen($tag)); + $n = strpos($y, "<"); + if ($n) { + $element = substr($y, 0, $n); + } + } + return $element; +} + +// look for a particular element in the config.xml file +// +function parse_config($tag) { + $element = null; + $fp = fopen("config.xml", "r"); + while (1) { + $buf = fgets($fp, 1024); + if ($buf == null) break; + $element = parse_element($buf, $tag); + if ($element) break; + } + fclose($fp); + return $element; +} + ?> diff --git a/html/user/db.inc b/html/user/db.inc index 90148e5259..ab5ecda9b6 100644 --- a/html/user/db.inc +++ b/html/user/db.inc @@ -3,17 +3,16 @@ // database-related functions. // Presentation code (HTML) shouldn't be here +// TODO: add support for host, user, password + function db_init() { $retval = mysql_pconnect(); if (!$retval) { exit(); } - $fp = fopen("db_name", "r"); - $db_name = fgets($fp, 1024); - $db_name = rtrim($db_name); + + $db_name = parse_config(""); mysql_select_db($db_name); - fclose($fp); - return $db_name; } function lookup_user_auth($auth) { diff --git a/html/user/download.php b/html/user/download.php index ee4548bebb..7a7032977d 100644 --- a/html/user/download.php +++ b/html/user/download.php @@ -1,29 +1,34 @@ id and appid=$core_app->id"); if (!$result) return; + + $download_url = parse_config(""); echo "$platform->name\n"; while ($app_version = mysql_fetch_object($result)) { + $filename = parse_element($app_version->xml_doc, ""); + if (!$filename) { echo "CAN'T FIND FILENAMEn $app_version->xml_doc\n";} $version = sprintf( - "BOINC core client, version %s.", + "BOINC core client, version %s.", $platform->name, $app_version->version_num, $app_version->version_num ); - echo "      $version\n"; + echo "$version\n"; //$app_version->md5_cksum"; } mysql_free_result($result); } - require_once("db.inc"); - require_once("util.inc"); db_init(); page_head("Download the BOINC client"); - $result = mysql_query("select * from app where name='core_client'"); + $result = mysql_query("select * from app where name='core client'"); $core_app = mysql_fetch_object($result); mysql_free_result($result); diff --git a/html/user/index.php b/html/user/index.php index c733e50928..3c4b8e1a8c 100644 --- a/html/user/index.php +++ b/html/user/index.php @@ -6,11 +6,11 @@ $user = get_user_from_cookie(); printf( "\n" - ."".PROJECT." Distributed Computing Project\n" + ."".PROJECT."\n" ."\n" ."\n" ."\n" - ."\n" + ."\n" ); if ($user) { echo "\n \n @@ -21,9 +20,9 @@ function print_login_form() { \n

".PROJECT." Distributed Computing Project

".PROJECT."

Welcome $user->name

\n"; diff --git a/html/user/login.inc b/html/user/login.inc index 98da11a16e..2398aa9cdb 100644 --- a/html/user/login.inc +++ b/html/user/login.inc @@ -2,8 +2,7 @@ function print_login_form() { page_head("Log in"); - echo( - "
\n" + echo "\n" .TABLE2."\n
Enter the email address and password of your account to login:

\n \n -
\n - .TABLE2."\n - If you don't have an account, please create a new one\n +
\n" + .TABLE2."\n + If you don't have an account, please create a new one\n \n"; page_tail(); } diff --git a/html/user/login_action.php b/html/user/login_action.php index 7aa8da1973..3f65b4dddd 100644 --- a/html/user/login_action.php +++ b/html/user/login_action.php @@ -87,7 +87,7 @@ if ($result) { setcookie("auth", $authenticator); page_head("Creating Account"); - echo( TABLE2."\n + echo TABLE2."\n Your account has been created successfully. In order to run the client you will need a BOINC key. @@ -102,7 +102,7 @@ mail($email_addr, "BOINC key", "Your BOINC key is " . $authenticator); } else { page_head("Creating Account"); - echo(TABLE2."\n + echo TABLE2."\n Couldn't create account. Please try again later.\n \n"; diff --git a/html/user/util.inc b/html/user/util.inc index 82f8416a41..2366255687 100644 --- a/html/user/util.inc +++ b/html/user/util.inc @@ -94,7 +94,38 @@ function random_string() { } function print_country_select() { - PassThru("/disks/milkyway/a/users/anderson/boinc_cvs/boinc/tools/country_select"); + $x = posix_getcwd(); + PassThru("$x/country_select"); +} + +// look for an element in some XML text +// +function parse_element($xml, $tag) { + $element = null; + $x = strstr($xml, $tag); + if ($x) { + $y = substr($x, strlen($tag)); + $n = strpos($y, "<"); + if ($n) { + $element = substr($y, 0, $n); + } + } + return $element; +} + +// look for a particular element in the config.xml file +// +function parse_config($tag) { + $element = null; + $fp = fopen("config.xml", "r"); + while (1) { + $buf = fgets($fp, 1024); + if ($buf == null) break; + $element = parse_element($buf, $tag); + if ($element) break; + } + fclose($fp); + return $element; } ?> diff --git a/sched/file_upload_handler.C b/sched/file_upload_handler.C index c26589faa3..11c3d15451 100644 --- a/sched/file_upload_handler.C +++ b/sched/file_upload_handler.C @@ -52,7 +52,6 @@ #include #include #include -#include #include #include #include @@ -76,7 +75,7 @@ struct FILE_INFO { int FILE_INFO::parse(FILE* in) { char buf[256]; int retval; - assert(in!=NULL); + memset(this, 0, sizeof(FILE_INFO)); signed_xml = strdup(""); while (fgets(buf, 256, in)) { @@ -115,14 +114,9 @@ int copy_socket_to_file(FILE* in, char* path, double offset, double nbytes) { FILE* out; int retval, n, m; double bytes_left; - assert(in!=NULL); - assert(path!=NULL); - assert(offset>=0); - assert(nbytes>=0); - // printf("path is %s",path); + out = fopen(path, "ab"); if (!out) { - print_status(-1, "can't open file"); return -1; } @@ -171,7 +165,7 @@ int handle_request(FILE* in, R_RSA_PUBLIC_KEY& key) { FILE_INFO file_info; int retval; bool is_valid; - assert(in!=NULL); + while (fgets(buf, 256, in)) { if (match_tag(buf, "")) { retval = file_info.parse(in); @@ -187,7 +181,12 @@ int handle_request(FILE* in, R_RSA_PUBLIC_KEY& key) { ); if (retval || !is_valid) { print_status(-1, "invalid XML signature"); - // return -1; + fprintf(stderr, + "signed xml:\n%s" + "signature:\n%s", + file_info.signed_xml, file_info.xml_signature + ); + return -1; } continue; } diff --git a/sched/handle_request.C b/sched/handle_request.C index dd1d979739..285bdba353 100644 --- a/sched/handle_request.C +++ b/sched/handle_request.C @@ -360,7 +360,9 @@ int handle_results( if (retval) { fprintf(stderr, "Can't update WU\n"); } - fprintf(stderr, "updated WU %d\n", wu.id); + fprintf(stderr, + "BOINC scheduler: set need_validate for WU %d\n", wu.id + ); } } } diff --git a/test/test.inc b/test/test.inc index df128bca13..8f18bfef95 100644 --- a/test/test.inc +++ b/test/test.inc @@ -54,7 +54,7 @@ function db_query($query) { function run_tool($cmd) { $tool_dir = get_env_var("BOINC_SRC_DIR")."/tools/"; $cmd = $tool_dir.$cmd; - //echo $cmd; + echo "$cmd\n"; PassThru($cmd); } @@ -196,7 +196,14 @@ class Project { for ($i=0; $iapp_versions); $i++) { $app_version = $this->app_versions[$i]; $app = $app_version->app; - run_tool("add app_version -db_name $this->db_name -app_name $app->name -platform_name $app_version->platform_name -version $app_version->version -download_dir $this->project_dir/download -download_url $this->download_url -code_sign_keyfile $this->key_dir/code_sign_private -exec_dir $source_dir/apps -exec_files $app_version->exec_name"); + if ($app->name == "core client") { + $dir = "$source_dir/client"; + $exec_name = sprintf("boinc_%d.%02d_%s", get_env_var("BOINC_MAJOR_VERSION"), get_env_var("BOINC_MINOR_VERSION"), $app_version->platform_name); + } else { + $dir = "$source_dir/apps"; + $exec_name = $app_version->exec_name; + } + run_tool("add app_version -db_name $this->db_name -app_name '$app->name' -platform_name $app_version->platform_name -version $app_version->version -download_dir $this->project_dir/download -download_url $this->download_url -code_sign_keyfile $this->key_dir/code_sign_private -exec_dir $dir -exec_files $exec_name"); } // copy the server programs to the project /cgi dir, @@ -224,16 +231,17 @@ class Project { // copy the user and administrative PHP files to the project dir, // PassThru("cp -f $source_dir/html_user/* $this->project_dir/html_user"); + PassThru("cp -f $source_dir/tools/country_select $this->project_dir/html_user"); PassThru("cp -f $source_dir/html_ops/* $this->project_dir/html_ops"); - // put a file with the database name in each directory + // put a file with the database name and other info in each directory // - $f = fopen("$this->project_dir/html_user/db_name", "w"); - fputs($f, "$this->db_name\n"); - fclose($f); - $f = fopen("$this->project_dir/html_ops/db_name", "w"); - fputs($f, "$this->db_name\n"); + $f = fopen("$this->project_dir/html_user/config.xml", "w"); + fputs($f, "$this->db_name\n"); + fputs($f, "$this->db_name\n"); + fputs($f, "$this->download_url\n"); fclose($f); + PassThru("cp $this->project_dir/html_user/config.xml $this->project_dir/html_ops"); // edit "index.html" in the user directory to have // the right scheduler URL @@ -286,20 +294,16 @@ class Project { $result = mysql_query("select * from result"); while ($x = mysql_fetch_object($result)) { $n++; - if ($result->state != null) { - if ($result->state != $x->state) { - echo "ERROR: result $x->id: unexpected state $x->state\n"; - } + if ($result->state != null && $result->state != $x->state) { + echo "ERROR: result $x->id: unexpected state $x->state\n"; } if ($result->stderr_out != null) { if (substr($result->stderr_out, $x->stderr_out)==0) { echo "ERROR: result $x->id: unexpected stderr_out $x->stderr_out\n"; } } - if ($result->exit_status != null) { - if ($result->exit_status != $x->exit_status) { - echo "ERROR: result $x->id: unexpected exit_status $x->exit_status\n"; - } + if ($result->exit_state != null && $result->exit_status != $x->exit_status) { + echo "ERROR: result $x->id: unexpected exit_status $x->exit_status\n"; } } if ($n != $ntarget) { diff --git a/test/test_uc.php b/test/test_uc.php index 0357ade844..fc8e879d18 100644 --- a/test/test_uc.php +++ b/test/test_uc.php @@ -14,6 +14,13 @@ $project->add_user($user); $project->add_app($app); $project->add_app_version($app_version); + + // the following is optional + $app = new App("core client"); + $app_version = new App_Version($app); + $project->add_app($app); + $project->add_app_version($app_version); + $project->install(); // must install projects before adding to hosts $host->log_flags = "log_flags.xml"; diff --git a/tools/process_result_template.C b/tools/process_result_template.C index 9e7479893c..dabeb65286 100644 --- a/tools/process_result_template.C +++ b/tools/process_result_template.C @@ -65,14 +65,14 @@ int add_signatures(char* xml, R_RSA_PRIVATE_KEY& key) { int retval, len; while (1) { - q1 = strstr(p, ""); + q1 = strstr(p, "\n"); if (!q1) break; q2 = strstr(q1, ""); if (!q2) { fprintf(stderr, "add_signatures: malformed XML: %s\n", xml); return ERR_XML_PARSE; } - q1 += strlen(""); + q1 += strlen("\n"); len = q2 - q1; memcpy(buf, q1, len); buf[len] = 0;