mirror of https://github.com/BOINC/boinc.git
Implemented executable MD5 user confirmation
svn path=/trunk/boinc/; revision=1501
This commit is contained in:
parent
6d384113f7
commit
a368b7aa49
|
@ -44,23 +44,6 @@ FILE_XFER::~FILE_XFER() {
|
|||
int FILE_XFER::init_download(FILE_INFO& file_info) {
|
||||
double f_size;
|
||||
|
||||
/*
|
||||
if (file_info.executable) {
|
||||
char msg[256];
|
||||
int n;
|
||||
|
||||
n = sprintf(msg, "BOINC is about to download the executable file \"%s\" for project \"%s\".\n\n", file_info.name, file_info.project->project_name);
|
||||
n += sprintf(msg+n, "MD5: %s\n", file_info.md5_cksum);
|
||||
n += sprintf(msg+n, "URL: %s\n", file_info.get_url());
|
||||
n += sprintf(msg+n, "Would you like to accept this file?");
|
||||
|
||||
if (AfxMessageBox(msg, MB_ICONQUESTION|MB_YESNO|MB_APPLMODAL|MB_DEFBUTTON2, 0) == IDNO) {
|
||||
file_info.status = -1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
is_upload = false;
|
||||
fip = &file_info;
|
||||
get_pathname(fip, pathname);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "error_numbers.h"
|
||||
#include "file_names.h"
|
||||
#include "log_flags.h"
|
||||
#include "md5_file.h"
|
||||
#include "parse.h"
|
||||
#include "util.h"
|
||||
|
||||
|
@ -149,6 +150,35 @@ bool PERS_FILE_XFER::poll(time_t now) {
|
|||
last_time = dtime();
|
||||
|
||||
if (fxp->file_xfer_done) {
|
||||
if (gstate.global_prefs.confirm_executable && fip->executable && !is_upload) {
|
||||
char msg[256];
|
||||
int n;
|
||||
|
||||
get_pathname(fip, pathname);
|
||||
md5_file(pathname, fip->md5_cksum, fip->nbytes);
|
||||
|
||||
n = sprintf(msg, "BOINC has downloaded the executable file \"%s\" for project \"%s\".\n\n", fip->name, fip->project->project_name);
|
||||
n += sprintf(msg+n, "MD5: %s\n", fip->md5_cksum);
|
||||
n += sprintf(msg+n, "URL: %s\n", fip->get_url());
|
||||
n += sprintf(msg+n, "\nWould you like to accept this file?");
|
||||
|
||||
if (AfxMessageBox(msg, MB_ICONQUESTION|MB_YESNO|MB_APPLMODAL|MB_DEFBUTTON2, 0) == IDNO) {
|
||||
if (log_flags.file_xfer)
|
||||
msg_printf(fip->project, MSG_INFO, "User rejected \"%s\" of project \"%s\"", fip->name, fip->project->project_name);
|
||||
if (log_flags.file_xfer_debug)
|
||||
msg_printf(fip->project, MSG_INFO, "file transfer status %d", fxp->file_xfer_retval);
|
||||
|
||||
fip->delete_file();
|
||||
|
||||
handle_xfer_failure();
|
||||
|
||||
gstate.file_xfers->remove(fxp);
|
||||
delete fxp;
|
||||
fxp = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (log_flags.file_xfer) {
|
||||
msg_printf(fip->project, MSG_INFO, "Finished %s of %s",
|
||||
is_upload?"upload":"download", fip->name);
|
||||
|
@ -222,13 +252,11 @@ void PERS_FILE_XFER::giveup() {
|
|||
void PERS_FILE_XFER::handle_xfer_failure() {
|
||||
time_t now = time(0);
|
||||
|
||||
/*
|
||||
// for handling user-declined download of executable files
|
||||
if (fxp == NULL) {
|
||||
giveup();
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
// If it was a bad range request, delete the file and start over
|
||||
//
|
||||
|
|
|
@ -54,6 +54,7 @@ void GLOBAL_PREFS::init() {
|
|||
max_bytes_sec_down = 1e9;
|
||||
max_memory_mbytes = 128;
|
||||
cpu_affinity = -1;
|
||||
confirm_executable = true;
|
||||
};
|
||||
|
||||
GLOBAL_PREFS::GLOBAL_PREFS() {
|
||||
|
@ -149,6 +150,9 @@ int GLOBAL_PREFS::parse(FILE* in, char* host_venue) {
|
|||
continue;
|
||||
} else if (parse_int(buf, "<cpu_affinity>", cpu_affinity)) {
|
||||
continue;
|
||||
} else if (match_tag(buf, "<confirm_executable/>")) {
|
||||
confirm_executable = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
|
|
|
@ -54,6 +54,7 @@ struct GLOBAL_PREFS {
|
|||
double max_bytes_sec_down;
|
||||
int max_memory_mbytes;
|
||||
int cpu_affinity;
|
||||
bool confirm_executable;
|
||||
|
||||
GLOBAL_PREFS();
|
||||
void init();
|
||||
|
|
2124
win_build/boinc.opt
2124
win_build/boinc.opt
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue