core client download

svn path=/trunk/boinc/; revision=592
This commit is contained in:
David Anderson 2002-11-09 20:26:50 +00:00
parent f0a6ae5078
commit f8c2293da0
18 changed files with 183 additions and 103 deletions

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -42,3 +42,7 @@ ScriptAlias /boinc-cgi/ "/users/barry/cgi/"
Allow from all
</Directory>
</pre>
You should also set the default MIME type as follows:
<pre>
DefaultType application/octet-stream
</pre>

View File

@ -76,6 +76,11 @@ ScriptAlias /david_cgi/ "/users/david/boinc_cgi/"
</pre>
You should also set the default MIME type as follows:
<pre>
DefaultType application/octet-stream
</pre>
<h3>Environment variabless</h3>
Define the following environment variables:

View File

@ -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("<db_name>");
mysql_select_db($db_name);
fclose($fp);
return $db_name;
}
function lookup_user_auth($auth) {

View File

@ -23,13 +23,7 @@ define("BODY_COLOR", " bgcolor=ffffff ");
define("NOLOGIN", "Not logged in. Click <a href=login.php>here</a> to login.\n");
define("BADPASS", "The password you entered is incorrect. Click the <b>Back</b> button on your browser to re-enter your password or try again later.");
define("DIFFPASS", "You've typed two different passwords. Click the <b>Back</b> 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("<br><a href=login.php>Log in as someone else.</a>\n");
$project = get_project_name();
printf("<br><a href=this_user.php>My %s</a>\n", $project);
} else {
echo NOLOGIN;
}
@ -53,8 +45,7 @@ function show_login($user) {
function page_head($title) {
echo "<head><title>$title</title><body " . BG_COLOR . ">\n";
$project = get_project_name();
echo TABLE . "<tr " . TITLE_COLOR . "><td>" . TITLE_FONT . "<font size=6><b><a href=index.php>".$project.":</a> $title</b></font></td></tr></table>\n";
echo TABLE . "<tr " . TITLE_COLOR . "><td>" . TITLE_FONT . "<font size=6><b><a href=index.php>".PROJECT.":</a> $title</b></font></td></tr></table>\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 "</body></html>";
}
// 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;
}
?>

View File

@ -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("<db_name>");
mysql_select_db($db_name);
fclose($fp);
return $db_name;
}
function lookup_user_auth($auth) {

View File

@ -1,29 +1,34 @@
<?php
require_once("db.inc");
require_once("util.inc");
function platform_downloads($platform, $core_app) {
$result = mysql_query("select * from app_version where platformid=$platform->id and appid=$core_app->id");
if (!$result) return;
$download_url = parse_config("<download_url>");
echo "<tr><td><b>$platform->name</b></td></tr>\n";
while ($app_version = mysql_fetch_object($result)) {
$filename = parse_element($app_version->xml_doc, "<name>");
if (!$filename) { echo "CAN'T FIND FILENAMEn $app_version->xml_doc\n";}
$version = sprintf(
"<a href=dl_%s_%s.php>BOINC core client,<b> version %s.</b></a>",
"<a href=$download_url/$filename>BOINC core client,<b> version %s.</b></a>",
$platform->name, $app_version->version_num,
$app_version->version_num
);
echo "<tr><td>&#160;&#160;&#160;&#160;&#160;&#160;$version</td></tr>\n";
echo "<tr><td>$version</td></tr>\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);

View File

@ -6,11 +6,11 @@
$user = get_user_from_cookie();
printf(
"<head>\n"
."<title>".PROJECT." Distributed Computing Project</title>\n"
."<title>".PROJECT."</title>\n"
."</head>\n"
."<body text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000>\n"
."<table width=780>\n"
."<tr><td><h1 align=center>".PROJECT." Distributed Computing Project</h1></td></tr>\n"
."<tr><td><h1 align=center>".PROJECT."</h1></td></tr>\n"
);
if ($user) {
echo "<tr><td><h3>Welcome $user->name</h3>\n";

View File

@ -2,8 +2,7 @@
function print_login_form() {
page_head("Log in");
echo(
"<form method=post action=login_action.php>\n"
echo "<form method=post action=login_action.php>\n"
.TABLE2."\n
<tr><td colspan=2><b>Enter the email address and password of your account to login:</b></td></tr>\n
<tr><td><br></td></tr>\n
@ -21,9 +20,9 @@ function print_login_form() {
</tr>\n
</table>\n
</form>\n
<br>\n
.TABLE2."\n
<tr><td>If you don't have an account, please <a href=create_account.php>create a new one</a></td</tr>\n
<br>\n"
.TABLE2."\n
<tr><td>If you don't have an account, please <a href=create_account.php>create a new one</a></td</tr>\n
</table>\n";
page_tail();
}

View File

@ -87,7 +87,7 @@
if ($result) {
setcookie("auth", $authenticator);
page_head("Creating Account");
echo( TABLE2."\n
echo TABLE2."\n
<tr><td>
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
<tr><td>Couldn't create account.
Please try again later.</td></tr>\n
</table>\n";

View File

@ -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;
}
?>

View File

@ -52,7 +52,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
@ -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, "<file_info>")) {
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;
}

View File

@ -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
);
}
}
}

View File

@ -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; $i<sizeof($this->app_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, "<db_name>$this->db_name</db_name>\n");
fputs($f, "<db_passwd>$this->db_name</db_passwd>\n");
fputs($f, "<download_url>$this->download_url</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) {

View File

@ -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";

View File

@ -65,14 +65,14 @@ int add_signatures(char* xml, R_RSA_PRIVATE_KEY& key) {
int retval, len;
while (1) {
q1 = strstr(p, "<file_info>");
q1 = strstr(p, "<file_info>\n");
if (!q1) break;
q2 = strstr(q1, "</file_info>");
if (!q2) {
fprintf(stderr, "add_signatures: malformed XML: %s\n", xml);
return ERR_XML_PARSE;
}
q1 += strlen("<file_info>");
q1 += strlen("<file_info>\n");
len = q2 - q1;
memcpy(buf, q1, len);
buf[len] = 0;