diff --git a/checkin_notes b/checkin_notes index 627707934a..78f1f5a40c 100755 --- a/checkin_notes +++ b/checkin_notes @@ -850,3 +850,11 @@ David July 4, 2002 client/app.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 diff --git a/client/app.C b/client/app.C index 71e7126176..65007a6117 100644 --- a/client/app.C +++ b/client/app.C @@ -25,17 +25,33 @@ #ifdef _WIN32 #include -#else +#include +#endif +#if HAVE_UNISTD_H #include +#endif +#if HAVE_SYS_WAIT_H #include +#endif +#if HAVE_SYS_TIME_H #include +#endif +#if HAVE_SYS_RESOURCE_H #include #endif +#if HAVE_SYS_TYPES_H #include +#endif +#if HAVE_SYS_SIGNAL_H #include +#endif +#if HAVE_FCNTL_H #include +#endif #include +#if HAVE_SIGNAL_H #include +#endif #include #include #include @@ -311,9 +327,18 @@ int ACTIVE_TASK::start(bool first_time) { void ACTIVE_TASK::request_exit(int seconds) { int retval; +#if HAVE_SIGNAL_H +#if HAVE_SYS_TYPES_H retval = kill(pid, SIGTERM); sleep(seconds); 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) { @@ -377,7 +402,9 @@ bool ACTIVE_TASK_SET::poll() { } #endif -#ifdef unix +#if HAVE_SYS_RESOURCE_H +#if HAVE_SYS_WAIT_H +#if HAVE_SYS_TIME_H struct rusage rs; int pid; @@ -402,6 +429,8 @@ bool ACTIVE_TASK_SET::poll() { atp->state = PROCESS_EXIT_UNKNOWN; atp->result->exit_status = -1; } +#endif +#endif #endif // check for the stderr file, copy to result record diff --git a/client/configure.scan b/client/configure.scan index 1ff7f8e093..4ba0090a30 100644 --- a/client/configure.scan +++ b/client/configure.scan @@ -1,22 +1,34 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(http.C) +AC_INIT(error_numbers.h) dnl Checks for programs. +AC_PROG_CC 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. AC_HEADER_DIRENT AC_HEADER_STDC 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. +AC_TYPE_SIZE_T AC_HEADER_TIME dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL 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) diff --git a/client/hostinfo_unix.C b/client/hostinfo_unix.C index 9cf34fcd70..309a3953eb 100644 --- a/client/hostinfo_unix.C +++ b/client/hostinfo_unix.C @@ -221,14 +221,12 @@ int get_host_info(HOST_INFO& host) { #endif #ifdef linux - memset(&host, 0, sizeof(host)); -#endif - get_local_domain_name(host.domain_name); - get_local_ip_addr_str(host.ip_addr); -#ifdef linux + memset(&host, 0, sizeof(host)); parse_cpuinfo(host); parse_meminfo(host); #endif + get_local_domain_name(host.domain_name); + get_local_ip_adr_str(host.ip_addr); #ifdef HAVE_SYS_UTSNAME_H get_osinfo(host); #endif diff --git a/lib/crypt.C b/lib/crypt.C index 5e5af97879..d1a426108f 100644 --- a/lib/crypt.C +++ b/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 n; x.len = 0; + char *retval, buf[3]; while (1) { - n = fscanf(f, "%2x", x.data+x.len); - if (n <= 0) break; + retval = fgets(buf, 2, f); + 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++; } 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 len, i, n; - - fscanf(f, "%d", &key->bits); + char buf[size+1]; + //fscanf(f, "%d", &key->bits); + fgets(buf, size, f); + sscanf(buf, "%2x", &key->bits); len = size - sizeof(key->bits); for (i=0; idata[i] = n; } - fscanf(f, "."); + //fscanf(f, "."); + sscanf(buf, "."); return 0; } @@ -113,7 +121,7 @@ int encrypt_private( } 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) { diff --git a/sched/Makefile.in b/sched/Makefile.in index 54c07907c8..90619eabfc 100644 --- a/sched/Makefile.in +++ b/sched/Makefile.in @@ -61,6 +61,10 @@ FCGI_OBJS = \ ../db/mysql_util.fcgi.o \ ../lib/shmem.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 FCGI_LIBS = -lfcgi -lfcgi++ FCGI_FLAGS = -include /usr/local/include/fcgi_stdio.h -D_USING_FCGI_ @@ -74,6 +78,9 @@ MYSQL_LIBS = \ %.fcgi.o: %.C $(CC) $(FCGI_FLAGS) -c $*.C -o $*.fcgi.o +%.fcgi.o: %.c + $(CC) $(FCGI_FLAGS) -c $*.c -o $*.fcgi.o + .C.o: $(CC) -c -o $*.o $<