mirror of https://github.com/BOINC/boinc.git
fixed fast cgi crypto
svn path=/trunk/boinc/; revision=164
This commit is contained in:
parent
373a32295d
commit
df08cb7704
|
@ -850,3 +850,11 @@ David July 4, 2002
|
||||||
|
|
||||||
client/app.C
|
client/app.C
|
||||||
sched/file_upload_handler.C
|
sched/file_upload_handler.C
|
||||||
|
|
||||||
|
Michael Gary July 5, 2002
|
||||||
|
- fixed fast cgi crypto
|
||||||
|
use fgets and sscanf instead of fscanf, which
|
||||||
|
is not implemented in fcgi_stdio.h
|
||||||
|
|
||||||
|
sched/Makefile.in
|
||||||
|
lib/crypt.C
|
||||||
|
|
33
client/app.C
33
client/app.C
|
@ -25,17 +25,33 @@
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#else
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
#if HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_TIME_H
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_RESOURCE_H
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if HAVE_SYS_TYPES_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_SIGNAL_H
|
||||||
#include <sys/signal.h>
|
#include <sys/signal.h>
|
||||||
|
#endif
|
||||||
|
#if HAVE_FCNTL_H
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#endif
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#if HAVE_SIGNAL_H
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -311,9 +327,18 @@ int ACTIVE_TASK::start(bool first_time) {
|
||||||
|
|
||||||
void ACTIVE_TASK::request_exit(int seconds) {
|
void ACTIVE_TASK::request_exit(int seconds) {
|
||||||
int retval;
|
int retval;
|
||||||
|
#if HAVE_SIGNAL_H
|
||||||
|
#if HAVE_SYS_TYPES_H
|
||||||
retval = kill(pid, SIGTERM);
|
retval = kill(pid, SIGTERM);
|
||||||
sleep(seconds);
|
sleep(seconds);
|
||||||
if(retval) kill(pid, SIGKILL);
|
if(retval) kill(pid, SIGKILL);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifdef _WIN32
|
||||||
|
//retval = ExitProcess();
|
||||||
|
sleep(seconds);
|
||||||
|
//if(retval) TerminateProcess();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int ACTIVE_TASK_SET::insert(ACTIVE_TASK* atp) {
|
int ACTIVE_TASK_SET::insert(ACTIVE_TASK* atp) {
|
||||||
|
@ -377,7 +402,9 @@ bool ACTIVE_TASK_SET::poll() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef unix
|
#if HAVE_SYS_RESOURCE_H
|
||||||
|
#if HAVE_SYS_WAIT_H
|
||||||
|
#if HAVE_SYS_TIME_H
|
||||||
struct rusage rs;
|
struct rusage rs;
|
||||||
int pid;
|
int pid;
|
||||||
|
|
||||||
|
@ -402,6 +429,8 @@ bool ACTIVE_TASK_SET::poll() {
|
||||||
atp->state = PROCESS_EXIT_UNKNOWN;
|
atp->state = PROCESS_EXIT_UNKNOWN;
|
||||||
atp->result->exit_status = -1;
|
atp->result->exit_status = -1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check for the stderr file, copy to result record
|
// check for the stderr file, copy to result record
|
||||||
|
|
|
@ -1,22 +1,34 @@
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
AC_INIT(http.C)
|
AC_INIT(error_numbers.h)
|
||||||
|
|
||||||
dnl Checks for programs.
|
dnl Checks for programs.
|
||||||
|
AC_PROG_CC
|
||||||
|
|
||||||
dnl Checks for libraries.
|
dnl Checks for libraries.
|
||||||
|
dnl Replace `main' with a function in -lgen:
|
||||||
|
AC_CHECK_LIB(gen, main)
|
||||||
|
dnl Replace `main' with a function in -lm:
|
||||||
|
AC_CHECK_LIB(m, main)
|
||||||
|
dnl Replace `main' with a function in -lnsl:
|
||||||
|
AC_CHECK_LIB(nsl, main)
|
||||||
|
dnl Replace `main' with a function in -lsocket:
|
||||||
|
AC_CHECK_LIB(socket, main)
|
||||||
|
dnl Replace `main' with a function in -lstdc:
|
||||||
|
AC_CHECK_LIB(stdc, main)
|
||||||
|
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_DIRENT
|
AC_HEADER_DIRENT
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_HEADER_SYS_WAIT
|
AC_HEADER_SYS_WAIT
|
||||||
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h)
|
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h)
|
||||||
|
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||||
|
AC_TYPE_SIZE_T
|
||||||
AC_HEADER_TIME
|
AC_HEADER_TIME
|
||||||
|
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
AC_PROG_GCC_TRADITIONAL
|
AC_PROG_GCC_TRADITIONAL
|
||||||
AC_FUNC_WAIT3
|
AC_FUNC_WAIT3
|
||||||
AC_CHECK_FUNCS(gethostname gettimeofday mkdir select socket strstr uname)
|
AC_CHECK_FUNCS(gethostname gettimeofday mkdir select socket strdup strstr uname)
|
||||||
|
|
||||||
AC_OUTPUT(Makefile makefile)
|
AC_OUTPUT(Makefile)
|
||||||
|
|
|
@ -221,14 +221,12 @@ int get_host_info(HOST_INFO& host) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef linux
|
#ifdef linux
|
||||||
memset(&host, 0, sizeof(host));
|
memset(&host, 0, sizeof(host));
|
||||||
#endif
|
|
||||||
get_local_domain_name(host.domain_name);
|
|
||||||
get_local_ip_addr_str(host.ip_addr);
|
|
||||||
#ifdef linux
|
|
||||||
parse_cpuinfo(host);
|
parse_cpuinfo(host);
|
||||||
parse_meminfo(host);
|
parse_meminfo(host);
|
||||||
#endif
|
#endif
|
||||||
|
get_local_domain_name(host.domain_name);
|
||||||
|
get_local_ip_adr_str(host.ip_addr);
|
||||||
#ifdef HAVE_SYS_UTSNAME_H
|
#ifdef HAVE_SYS_UTSNAME_H
|
||||||
get_osinfo(host);
|
get_osinfo(host);
|
||||||
#endif
|
#endif
|
||||||
|
|
22
lib/crypt.C
22
lib/crypt.C
|
@ -42,9 +42,13 @@ int sprint_hex_data(char* p, DATA_BLOCK& x) {
|
||||||
int scan_hex_data(FILE* f, DATA_BLOCK& x) {
|
int scan_hex_data(FILE* f, DATA_BLOCK& x) {
|
||||||
int n;
|
int n;
|
||||||
x.len = 0;
|
x.len = 0;
|
||||||
|
char *retval, buf[3];
|
||||||
while (1) {
|
while (1) {
|
||||||
n = fscanf(f, "%2x", x.data+x.len);
|
retval = fgets(buf, 2, f);
|
||||||
if (n <= 0) break;
|
if(retval == NULL) break;
|
||||||
|
sscanf(buf, "%2x", x.data+x.len);
|
||||||
|
//n = fscanf(f, "%2x", x.data+x.len);
|
||||||
|
//if (n <= 0) break;
|
||||||
x.len++;
|
x.len++;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -80,14 +84,18 @@ int print_key_hex(FILE* f, KEY* key, int size) {
|
||||||
|
|
||||||
int scan_key_hex(FILE* f, KEY* key, int size) {
|
int scan_key_hex(FILE* f, KEY* key, int size) {
|
||||||
int len, i, n;
|
int len, i, n;
|
||||||
|
char buf[size+1];
|
||||||
fscanf(f, "%d", &key->bits);
|
//fscanf(f, "%d", &key->bits);
|
||||||
|
fgets(buf, size, f);
|
||||||
|
sscanf(buf, "%2x", &key->bits);
|
||||||
len = size - sizeof(key->bits);
|
len = size - sizeof(key->bits);
|
||||||
for (i=0; i<len; i++) {
|
for (i=0; i<len; i++) {
|
||||||
fscanf(f, "%2x", &n);
|
//fscanf(f, "%2x", &n);
|
||||||
|
sscanf(buf, "%2x", &n);
|
||||||
key->data[i] = n;
|
key->data[i] = n;
|
||||||
}
|
}
|
||||||
fscanf(f, ".");
|
//fscanf(f, ".");
|
||||||
|
sscanf(buf, ".");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +121,7 @@ int encrypt_private(
|
||||||
}
|
}
|
||||||
|
|
||||||
int decrypt_public(R_RSA_PUBLIC_KEY& key, DATA_BLOCK& in, DATA_BLOCK& out) {
|
int decrypt_public(R_RSA_PUBLIC_KEY& key, DATA_BLOCK& in, DATA_BLOCK& out) {
|
||||||
RSAPublicDecrypt(out.data, &out.len, in.data, in.len, &key);
|
return RSAPublicDecrypt(out.data, &out.len, in.data, in.len, &key);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sign_file(char* path, R_RSA_PRIVATE_KEY& key, DATA_BLOCK& signature) {
|
int sign_file(char* path, R_RSA_PRIVATE_KEY& key, DATA_BLOCK& signature) {
|
||||||
|
|
|
@ -61,6 +61,10 @@ FCGI_OBJS = \
|
||||||
../db/mysql_util.fcgi.o \
|
../db/mysql_util.fcgi.o \
|
||||||
../lib/shmem.fcgi.o \
|
../lib/shmem.fcgi.o \
|
||||||
../lib/parse.fcgi.o \
|
../lib/parse.fcgi.o \
|
||||||
|
../lib/crypt.fcgi.o \
|
||||||
|
../lib/md5.o \
|
||||||
|
../lib/md5_file.o \
|
||||||
|
../RSAEuro/source/rsaeuro.a \
|
||||||
../tools/process_result_template.fcgi.o
|
../tools/process_result_template.fcgi.o
|
||||||
FCGI_LIBS = -lfcgi -lfcgi++
|
FCGI_LIBS = -lfcgi -lfcgi++
|
||||||
FCGI_FLAGS = -include /usr/local/include/fcgi_stdio.h -D_USING_FCGI_
|
FCGI_FLAGS = -include /usr/local/include/fcgi_stdio.h -D_USING_FCGI_
|
||||||
|
@ -74,6 +78,9 @@ MYSQL_LIBS = \
|
||||||
%.fcgi.o: %.C
|
%.fcgi.o: %.C
|
||||||
$(CC) $(FCGI_FLAGS) -c $*.C -o $*.fcgi.o
|
$(CC) $(FCGI_FLAGS) -c $*.C -o $*.fcgi.o
|
||||||
|
|
||||||
|
%.fcgi.o: %.c
|
||||||
|
$(CC) $(FCGI_FLAGS) -c $*.c -o $*.fcgi.o
|
||||||
|
|
||||||
.C.o:
|
.C.o:
|
||||||
$(CC) -c -o $*.o $<
|
$(CC) -c -o $*.o $<
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue