From 69cfcebef48289a58a111595d314da9cf20f82e5 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 6 Feb 2008 19:32:51 +0000 Subject: [PATCH] - file upload handler: the FCGI version wasn't handling signatures, because the code to read keys in FCGI was commented out (and was in fact wrong). I fixed it and uncommented it. - make_project and upgrade: copy lib/crypt_prog to project/bin/ svn path=/trunk/boinc/; revision=14693 --- checkin_notes | 15 +++++++++++++++ lib/crypt.C | 11 ++++------- lib/crypt_prog.C | 2 +- py/Boinc/setup_project.py | 2 ++ tools/sign_executable.C | 9 +++++---- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/checkin_notes b/checkin_notes index 7f73efd209..7ed4092ae7 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1235,3 +1235,18 @@ Rom Feb 6 2008 clientgui/ BOINCTaskBar.cpp + +David Feb 6 2008 + - file upload handler: the FCGI version wasn't handling signatures, + because the code to read keys in FCGI was commented out + (and was in fact wrong). + I fixed it and uncommented it. + - make_project and upgrade: copy lib/crypt_prog to project/bin/ + + lib/ + crypt.C + crypt_prog.C + py/Boinc/ + setup_project.py + tools/ + sign_executable.C diff --git a/lib/crypt.C b/lib/crypt.C index de27d7c116..11f114733d 100644 --- a/lib/crypt.C +++ b/lib/crypt.C @@ -152,7 +152,6 @@ int scan_key_hex(FILE* f, KEY* key, int size) { int num_bits; #if _USING_FCGI_ -#if 0 char *p, buf[256]; int j = 0, b; fgets(buf, 256, f); @@ -161,18 +160,16 @@ int scan_key_hex(FILE* f, KEY* key, int size) { len = size - sizeof(key->bits); while (1) { p = fgets(buf, 256, f); - if (!p) return ERR_GETS; - n = strlen(p)/2; + if (!p) break; + n = (strlen(p)-1)/2; if (n == 0) break; for (i=0; i= len) return ERR_SCANF; + if (j == len) break; key->data[j++] = b; } } - fgets(buf, size, f); - sscanf(buf, "."); -#endif + if (j != len) return ERR_NULL; #else fscanf(f, "%d", &num_bits); key->bits = num_bits; diff --git a/lib/crypt_prog.C b/lib/crypt_prog.C index e0d618a4b3..343c7bc860 100644 --- a/lib/crypt_prog.C +++ b/lib/crypt_prog.C @@ -152,7 +152,7 @@ int main(int argc, char** argv) { if (!fpub) die("fopen"); retval = scan_key_hex(fpub, (KEY*)&public_key, sizeof(public_key)); if (retval) die("read_public_key"); - strcpy((char*)buf2, "foobar"); + strcpy((char*)buf2, "encryption test successful"); in.data = buf2; in.len = strlen((char*)in.data); out.data = buf; diff --git a/py/Boinc/setup_project.py b/py/Boinc/setup_project.py index 9d2f3ba52c..031eef4f7d 100644 --- a/py/Boinc/setup_project.py +++ b/py/Boinc/setup_project.py @@ -370,6 +370,8 @@ def install_boinc_files(dest_dir, web_only): [ 'create_work', 'xadd', 'dbcheck_files_exist', 'run_in_ops', 'update_versions', 'parse_config', 'grep_logs', 'db_query', 'watch_tcp', 'sign_executable', 'dir_hier_move', 'dir_hier_path' ]) + map(lambda (s): install(srcdir('lib',s), dir('bin',s)), + [ 'crypt_prog' ]) map(lambda (s): install(srcdir('sched',s), dir('',s)), [ 'db_dump_spec.xml' ]) diff --git a/tools/sign_executable.C b/tools/sign_executable.C index 09740ad033..251e1659fb 100644 --- a/tools/sign_executable.C +++ b/tools/sign_executable.C @@ -17,7 +17,7 @@ // or write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -// syntax: sign_executable +// syntax: sign_executable data_file private_key_file #include "config.h" #include "crypt.h" @@ -41,9 +41,10 @@ int sign_executable(char* path, char* code_sign_keyfile, char* signature_text) { int main(int argc, char** argv) { if (argc != 3) { - fprintf(stderr, "syntax: sign_executable \n" - "\n" - "Outputs to stdout.\n"); + fprintf(stderr, "syntax: sign_executable data_file private_key_file\n" + "\n" + "Writes signature to stdout.\n" + ); return 1; }