- client: fix bug that broke file signing with X.509 certificates.

From matszpk.  Fixes #1168.


svn path=/trunk/boinc/; revision=26071
This commit is contained in:
David Anderson 2012-09-02 20:05:20 +00:00
parent 0f8cb89499
commit b412b9d172
5 changed files with 26 additions and 16 deletions

View File

@ -5841,3 +5841,13 @@ David 30 Aug 2012
sched_send.cpp
tools/
tt_boinc
David 2 Sept 2012
- client: fix bug that broke file signing with X.509 certificates.
From matszpk. Fixes #1168.
lib/
filesys.cpp,h
crypt.cpp
client/
cs_files.cpp

View File

@ -90,12 +90,12 @@ int CLIENT_STATE::make_project_dirs() {
// Is app signed by one of the Application Certifiers?
//
bool FILE_INFO::verify_file_certs() {
char file[256];
char file[MAXPATHLEN];
bool retval = false;
if (!is_dir(CERTIFICATE_DIRECTORY)) return false;
DIRREF dir = dir_open(CERTIFICATE_DIRECTORY);
while (dir_scan(file, dir, sizeof(file))) {
while (!dir_scan(file, dir, sizeof(file))) {
if (cert_verify_file(cert_sigs, file, CERTIFICATE_DIRECTORY)) {
msg_printf(project, MSG_INFO,
"Signature verified using certificate %s", file
@ -156,7 +156,7 @@ bool FILE_INFO::verify_file_certs() {
int FILE_INFO::verify_file(
bool verify_contents, bool show_errors, bool allow_async
) {
char cksum[64], pathname[256];
char cksum[64], pathname[MAXPATHLEN];
bool verified;
int retval;
double size, local_nbytes;

View File

@ -602,8 +602,8 @@ char *check_validity(
DIRREF dir = dir_open(certPath);
char file[256];
while (dir_scan(file, dir, sizeof(file))) {
char file[MAXPATHLEN];
while (!dir_scan(file, dir, sizeof(file))) {
char fpath[MAXPATHLEN];
snprintf(fpath, sizeof(fpath), "%s/%s", certPath, file);
// TODO : replace '128'

View File

@ -82,7 +82,7 @@ typedef BOOL (CALLBACK* FreeFn)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARG
using std::string;
char boinc_failed_file[256];
char boinc_failed_file[MAXPATHLEN];
// routines for enumerating the entries in a directory
@ -206,7 +206,7 @@ void dir_close(DIRREF dirp) {
}
bool is_dir_empty(const char *p) {
char file[256];
char file[MAXPATHLEN];
DIRREF dir = dir_open(p);
if (!dir) return true;
@ -360,7 +360,7 @@ int boinc_truncate(const char* path, double size) {
// remove everything from specified directory
//
int clean_out_dir(const char* dirpath) {
char filename[256], path[MAXPATHLEN];
char filename[MAXPATHLEN], path[MAXPATHLEN];
int retval;
DIRREF dirp;
@ -732,13 +732,13 @@ int FILE_LOCK::unlock(const char* filename) {
void boinc_getcwd(char* path) {
#ifdef _WIN32
getcwd(path, 256);
getcwd(path, MAXPATHLEN);
#else
char* p
#ifdef __GNUC__
__attribute__ ((unused))
#endif
= getcwd(path, 256);
= getcwd(path, MAXPATHLEN);
#endif
}
@ -754,8 +754,8 @@ void relative_to_absolute(const char* relname, char* path) {
//
#ifdef _WIN32
int get_filesystem_info(double &total_space, double &free_space, char*) {
char buf[256];
boinc_getcwd(buf);
char cwd[MAXPATHLEN];
boinc_getcwd(cwd);
FreeFn pGetDiskFreeSpaceEx;
pGetDiskFreeSpaceEx = (FreeFn)GetProcAddress(
GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA"
@ -765,7 +765,7 @@ int get_filesystem_info(double &total_space, double &free_space, char*) {
ULARGE_INTEGER TotalNumberOfBytes;
ULARGE_INTEGER FreeBytesAvailable;
pGetDiskFreeSpaceEx(
buf, &FreeBytesAvailable, &TotalNumberOfBytes,
cwd, &FreeBytesAvailable, &TotalNumberOfBytes,
&TotalNumberOfFreeBytes
);
signed __int64 uMB;
@ -779,7 +779,7 @@ int get_filesystem_info(double &total_space, double &free_space, char*) {
DWORD dwFreeClusters;
DWORD dwTotalClusters;
GetDiskFreeSpaceA(
buf, &dwSectPerClust, &dwBytesPerSect, &dwFreeClusters,
cwd, &dwSectPerClust, &dwBytesPerSect, &dwFreeClusters,
&dwTotalClusters
);
free_space = (double)dwFreeClusters * dwSectPerClust * dwBytesPerSect;

View File

@ -55,7 +55,7 @@ extern "C" {
extern void boinc_getcwd(char*);
extern void relative_to_absolute(const char* relname, char* path);
extern int boinc_make_dirs(const char*, const char*);
extern char boinc_failed_file[256];
extern char boinc_failed_file[MAXPATHLEN];
extern int is_file(const char* path);
extern int is_dir(const char* path);
extern int is_dir_follow_symlinks(const char* path);
@ -82,7 +82,7 @@ extern int get_filesystem_info(double& total, double& free, char* path=const_cas
//
#if defined(_WIN32) && !defined(__CYGWIN32__)
typedef struct _DIR_DESC {
char path[256];
char path[MAXPATHLEN];
bool first;
void* handle;
} DIR_DESC;