mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=2889
This commit is contained in:
parent
7587404e1f
commit
7519dc516c
|
@ -9238,9 +9238,11 @@ Karl 2004-01-15
|
|||
base64.h
|
||||
|
||||
Karl 2004-01-15
|
||||
- renamed user_name to db_user
|
||||
|
||||
- applied changes by Daniel Sumers Myers <dmyers@umiacs.umd.edu>
|
||||
- setup script creates log_<host>
|
||||
- add support for <db_user> field in config.XML
|
||||
- add support for <db_user> field in config.XML in C, python, php
|
||||
- missing default project.inc.sample fields
|
||||
|
||||
db/
|
||||
|
|
|
@ -12,10 +12,10 @@ DB_CONN::DB_CONN() {
|
|||
mysql = 0;
|
||||
}
|
||||
|
||||
int DB_CONN::open(char* db_name, char* db_host, char* dbpassword) {
|
||||
int DB_CONN::open(char* db_name, char* db_host, char* db_user, char* dbpassword) {
|
||||
mysql = mysql_init(0);
|
||||
if (!mysql) return ERR_DB_CANT_INIT;
|
||||
mysql = mysql_real_connect(mysql, db_host, 0, dbpassword, db_name, 0, 0, 0);
|
||||
mysql = mysql_real_connect(mysql, db_host, db_user, dbpassword, db_name, 0, 0, 0);
|
||||
if (mysql == 0) return ERR_DB_CANT_CONNECT;
|
||||
return 0;
|
||||
}
|
||||
|
|
16
db/db_base.h
16
db/db_base.h
|
@ -2,18 +2,18 @@
|
|||
// Version 1.0 (the "License"); you may not use this file except in
|
||||
// compliance with the License. You may obtain a copy of the License at
|
||||
// http://boinc.berkeley.edu/license_1.0.txt
|
||||
//
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS"
|
||||
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing rights and limitations
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
//
|
||||
|
||||
|
@ -32,7 +32,7 @@ struct CURSOR {
|
|||
class DB_CONN {
|
||||
public:
|
||||
DB_CONN();
|
||||
int open(char* name, char* host, char* passwd);
|
||||
int open(char* name, char* host, char* user, char* passwd);
|
||||
int do_query(char*);
|
||||
void close();
|
||||
int insert_id();
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
<?php
|
||||
|
||||
function db_init() {
|
||||
$retval = mysql_connect();
|
||||
$user = parse_config("<db_user>");
|
||||
$pass = parse_config("<db_passwd>");
|
||||
$retval = mysql_connect("localhost", $user, $pass);
|
||||
if (!$retval) {
|
||||
echo "Unable to connect to database - please try again later";
|
||||
echo mysql_error();
|
||||
exit();
|
||||
}
|
||||
$db_name = parse_config("<db_name>");
|
||||
if(!mysql_select_db($db_name)) {
|
||||
echo "Unable to select database '$db_name' - please try again later";
|
||||
echo mysql_error();
|
||||
exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,14 +10,18 @@ function db_init($pathMod='') {
|
|||
echo "Project is shut down for maintenance - please try again later\n";
|
||||
exit();
|
||||
}
|
||||
$retval = mysql_pconnect();
|
||||
$user = parse_config("<db_user>", $pathMod);
|
||||
$pass = parse_config("<db_passwd>", $pathMod);
|
||||
$retval = mysql_pconnect("localhost", $user, $pass);
|
||||
if (!$retval) {
|
||||
echo "Unable to connect to database - please try again later";
|
||||
echo mysql_error();
|
||||
exit();
|
||||
}
|
||||
$db_name = parse_config("<db_name>", $pathMod);
|
||||
if(!mysql_select_db($db_name)) {
|
||||
echo "Unable to select database - please try again later";
|
||||
echo mysql_error();
|
||||
exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ define('IMAGE_PATH', 'images/user_profile/');
|
|||
define('PROFILE_PATH', 'user_profile/');
|
||||
define('LANGUAGE_FILE', 'languages.txt');
|
||||
define('STYLESHEET', 'white.css');
|
||||
define('COPYRIGHT_HOLDER', 'Test Group');
|
||||
|
||||
function project_intro() {
|
||||
echo"
|
||||
|
|
|
@ -33,7 +33,8 @@ libboinc_a_SOURCES = \
|
|||
xml_util.h \
|
||||
shmem.h \
|
||||
synch.h \
|
||||
util.h
|
||||
util.h \
|
||||
base64.h
|
||||
|
||||
# libboinc_graphics_a_SOURCES = \
|
||||
# ../api/graphics_api.C \
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2003 Regents of the University of California
|
||||
|
||||
#include "parse.h"
|
||||
#include "base64.h"
|
||||
|
||||
// Table of characters coding the 64 values.
|
||||
static char base64_value_to_char[64] =
|
||||
|
|
30
lib/base64.h
30
lib/base64.h
|
@ -1,3 +1,31 @@
|
|||
// The contents of this file are subject to the BOINC Public License
|
||||
// Version 1.0 (the "License"); you may not use this file except in
|
||||
// compliance with the License. You may obtain a copy of the License at
|
||||
// http://boinc.berkeley.edu/license_1.0.txt
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS"
|
||||
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing rights and limitations
|
||||
// under the License.
|
||||
//
|
||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||
//
|
||||
// The Initial Developer of the Original Code is the SETI@home project.
|
||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||
// University of California at Berkeley. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
//
|
||||
|
||||
#ifndef h_BASE64
|
||||
#define h_BASE64
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
using std::string;
|
||||
|
||||
class InvalidBase64Exception
|
||||
{
|
||||
};
|
||||
|
@ -9,3 +37,5 @@ inline string r_base64_decode (string const& from) throw(InvalidBase64Exception)
|
|||
return r_base64_decode(from.c_str(), from.length());
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -326,12 +326,19 @@ class Project:
|
|||
def keydir(self, *dirs):
|
||||
return apply(os.path.join,(self.config.config.key_dir,)+dirs)
|
||||
|
||||
def logdir(self, *dirs):
|
||||
return apply(os.path.join,("log_"+socket.getfqdn(),)+dirs)
|
||||
|
||||
def create_keys(self):
|
||||
if not os.path.exists(self.keydir()):
|
||||
os.mkdir(self.keydir())
|
||||
_gen_key(self.keydir('upload'))
|
||||
_gen_key(self.keydir('code_sign'))
|
||||
|
||||
def create_logdir(self):
|
||||
print "logdir = ", self.logdir();
|
||||
os.mkdir(self.logdir());
|
||||
|
||||
def query_create_keys(self):
|
||||
return query_yesno("Keys don't exist in %s; generate them?"%self.keydir())
|
||||
|
||||
|
@ -351,12 +358,12 @@ class Project:
|
|||
# TODO: that is a security risk; don't do this in the future - write
|
||||
# req/reply files somewhere else
|
||||
map(lambda dir: os.mkdir(self.dir(dir)),
|
||||
[ '', 'cgi-bin', 'bin', 'upload', 'download', 'apps', 'log',
|
||||
[ '', 'cgi-bin', 'bin', 'upload', 'download', 'apps', self.logdir(),
|
||||
'html_ops', 'html_user', 'html_user/project_specific',
|
||||
'html_user/class', 'html_user/include'
|
||||
])
|
||||
map(lambda dir: os.chmod(self.dir(dir), 0777),
|
||||
[ 'cgi-bin', 'upload', 'log' ])
|
||||
[ 'cgi-bin', 'upload', self.logdir() ])
|
||||
|
||||
if not self.keys_exist():
|
||||
if self.query_create_keys():
|
||||
|
@ -366,6 +373,9 @@ class Project:
|
|||
# copy the user and administrative PHP files to the project dir,
|
||||
verbose_echo(1, "Setting up server files: copying files")
|
||||
|
||||
# Create the project log directory
|
||||
# self.create_logdir()
|
||||
|
||||
install_boinc_files(self.dir())
|
||||
|
||||
install_glob(srcdir('html_user/*.txt'), self.dir('html_user/'))
|
||||
|
|
|
@ -116,7 +116,7 @@ int main(int argc, char** argv) {
|
|||
// write_pid_file(PIDFILE);
|
||||
log_messages.printf(SchedMessages::NORMAL, "Starting\n");
|
||||
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL, "Can't open DB\n");
|
||||
exit(1);
|
||||
|
|
|
@ -597,7 +597,7 @@ int main(int argc, char** argv) {
|
|||
log_messages.printf(SchedMessages::NORMAL, "Can't parse config file\n");
|
||||
exit(1);
|
||||
}
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::NORMAL, "Can't open DB\n");
|
||||
exit(1);
|
||||
|
|
|
@ -383,7 +383,7 @@ int main(int argc, char** argv) {
|
|||
atexit(cleanup_shmem);
|
||||
install_stop_signal_handler();
|
||||
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL, "boinc_db.open: %d; %s\n", retval, boinc_db.error_string());
|
||||
exit(1);
|
||||
|
|
|
@ -168,7 +168,7 @@ int main(int argc, char** argv) {
|
|||
// write_pid_file(PIDFILE);
|
||||
log_messages.printf(SchedMessages::NORMAL, "Starting\n");
|
||||
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL, "can't open DB\n");
|
||||
exit(1);
|
||||
|
|
|
@ -131,7 +131,7 @@ int main() {
|
|||
}
|
||||
}
|
||||
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL, "can't open database\n");
|
||||
project_stopped = true;
|
||||
|
|
|
@ -133,7 +133,7 @@ void make_work() {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL, "can't open db\n");
|
||||
exit(1);
|
||||
|
|
|
@ -47,6 +47,7 @@ int SCHED_CONFIG::parse(istream& f) {
|
|||
|
||||
memset(this, 0, sizeof(SCHED_CONFIG));
|
||||
parse_str(buf.c_str(), "<db_name>", db_name, sizeof(db_name));
|
||||
parse_str(buf.c_str(), "<db_user>", db_user, sizeof(db_user));
|
||||
parse_str(buf.c_str(), "<db_passwd>", db_passwd, sizeof(db_passwd));
|
||||
parse_str(buf.c_str(), "<db_host>", db_host, sizeof(db_host));
|
||||
parse_int(buf.c_str(), "<shmem_key>", shmem_key);
|
||||
|
@ -55,7 +56,6 @@ int SCHED_CONFIG::parse(istream& f) {
|
|||
parse_str(buf.c_str(), "<download_dir>", download_dir, sizeof(download_dir));
|
||||
parse_str(buf.c_str(), "<upload_url>", upload_url, sizeof(upload_url));
|
||||
parse_str(buf.c_str(), "<upload_dir>", upload_dir, sizeof(upload_dir));
|
||||
parse_str(buf.c_str(), "<user_name>", user_name, sizeof(user_name));
|
||||
if (match_tag(buf.c_str(), "<one_result_per_user_per_wu/>")) {
|
||||
one_result_per_user_per_wu = true;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ using std::istream;
|
|||
class SCHED_CONFIG {
|
||||
public:
|
||||
char db_name[256];
|
||||
char db_user[256];
|
||||
char db_passwd[256];
|
||||
char db_host[256];
|
||||
int shmem_key;
|
||||
|
@ -36,7 +37,6 @@ public:
|
|||
char download_dir[256];
|
||||
char upload_url[256];
|
||||
char upload_dir[256];
|
||||
char user_name[256];
|
||||
bool one_result_per_user_per_wu;
|
||||
int min_sendwork_interval;
|
||||
|
||||
|
|
|
@ -356,7 +356,7 @@ bool do_pass() {
|
|||
void main_loop(bool one_pass) {
|
||||
int retval;
|
||||
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL, "boinc_db.open: %d\n", retval);
|
||||
exit(1);
|
||||
|
|
|
@ -172,7 +172,7 @@ int main(int argc, char** argv) {
|
|||
log_messages.printf(SchedMessages::CRITICAL, "Can't parse config file\n");
|
||||
exit(1);
|
||||
}
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL, "Can't open DB\n");
|
||||
exit(1);
|
||||
|
|
|
@ -336,7 +336,7 @@ int main_loop(bool one_pass) {
|
|||
bool did_something;
|
||||
char buf[256];
|
||||
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd);
|
||||
if (retval) {
|
||||
log_messages.printf(SchedMessages::CRITICAL, "boinc_db.open: %d\n", retval);
|
||||
exit(1);
|
||||
|
|
|
@ -88,7 +88,7 @@ int main(int argc, char** argv) {
|
|||
retval = config.parse_file();
|
||||
if (retval) exit(1);
|
||||
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd);
|
||||
if (retval) {
|
||||
printf("boinc_db.open: %d\n", retval);
|
||||
exit(1);
|
||||
|
|
|
@ -175,7 +175,7 @@ int main(int argc, char** argv) {
|
|||
#undef CHKARG
|
||||
#undef CHKARG_STR
|
||||
|
||||
if (boinc_db.open(db_name, "", db_passwd)) {
|
||||
if (boinc_db.open(db_name, "", "", db_passwd)) {
|
||||
fprintf(stderr, "create_work: error opening database.\n" );
|
||||
exit(0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue