Changed so these files get env variables at runtime

svn path=/trunk/boinc/; revision=184
This commit is contained in:
Barry Luong 2002-07-12 00:01:11 +00:00
parent 555af1f808
commit 10fef64db8
3 changed files with 5 additions and 13 deletions

View File

@ -5,22 +5,15 @@ VPATH = @srcdir@
all: cgi
ifndef BOINC_KEY
BOINC_KEY = 0xdadacafe
endif
CFLAGS = -g -Wall @DEFS@ \
-I@top_srcdir@/db \
-I@top_srcdir@/lib \
-I@top_srcdir@/tools \
-DBOINC_DB_NAME=\"$(BOINC_DB_NAME)\" \
-DBOINC_KEY=$(BOINC_KEY) \
-DBOINC_PUBLIC_KEY_PATH=\"$(BOINC_PUBLIC_KEY_PATH)\" \
-I/usr/local/mysql/include \
-I@top_srcdir@/RSAEuro/source \
-DBOINC_KEY_DIR=\"$(BOINC_KEY_DIR)\" \
-DBOINC_KEY=$(BOINC_KEY) \
-DBOINC_UPLOAD_DIR=\"$(BOINC_UPLOAD_DIR)\"
CC = g++ $(CFLAGS)

View File

@ -172,6 +172,7 @@ int main(int argc, char** argv) {
int i, retval;
bool asynch = false;
void* p;
char* barry;
for (i=1; i<argc; i++) {
if (!strcmp(argv[i], "-asynch")) {
@ -191,7 +192,7 @@ int main(int argc, char** argv) {
}
ssp = (SCHED_SHMEM*)p;
ssp->init();
retval = db_open(BOINC_DB_NAME);
retval = db_open(getenv("BOINC_DB_NAME"));
if (retval) {
fprintf(stderr, "feeder: db_open: %d\n", retval);
exit(1);

View File

@ -19,15 +19,13 @@
// <error>bad file size</error>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "parse.h"
#include "crypt.h"
/* #define BOINC_UPLOAD_DIR "/home/david/html/upload" */
/* #define BOINC_PUBLIC_KEY_PATH "/home/david/boinc_keys/upload_public" */
#define MAX_FILES 32
struct FILE_INFO {
@ -156,7 +154,7 @@ int handle_request(FILE* in, R_RSA_PUBLIC_KEY& key) {
return -1;
}
sprintf(path, "%s/%s", BOINC_UPLOAD_DIR, file_info.name);
sprintf(path, "%s/%s", getenv("BOINC_UPLOAD_DIR"), file_info.name);
retval = copy_socket_to_file(in, path, offset, nbytes);
break;
}
@ -168,7 +166,7 @@ int get_key(R_RSA_PUBLIC_KEY& key) {
FILE* f;
int retval;
f = fopen(BOINC_PUBLIC_KEY_PATH, "r");
f = fopen(strcat(getenv("BOINC_KEY_DIR"), "/upload_public"), "r");
if (!f) return -1;
retval = scan_key_hex(f, (KEY*)&key, sizeof(key));
fclose(f);