*** empty log message ***

svn path=/trunk/boinc/; revision=10589
This commit is contained in:
Charlie Fenton 2006-07-06 11:04:46 +00:00
parent ac5b5f6d6f
commit 74ae3b868b
9 changed files with 158 additions and 3 deletions

View File

@ -7272,3 +7272,30 @@ David 5 July 2006
client/
cs_benchmark.C
Charlie 6 July 2006
- Mac sandbox: boinc_delete_file(), clean_out_dir(), boinc_rmdir ()
all call remove_project_owned_file_or_dir() which uses switcher
helper application to remove subdirectories created & owned by
projects.
- Add License (GPL) to source files where missing.
client/
check_security.C
file_names.C,h
setprojectgrp.C
switcher.C
lib/
filesys.C
mac_installer/
release_boinc.sh
release_GridRepublic.sh
Charlie 6 July 2006
Mac: integrate task tray icon changes, fix compile errors.
clientgui/
BOINCGUIApp.cpp
BOINCTaskBar.cpp
mac/
MacSysMenu.cpp,h

View File

@ -439,6 +439,10 @@ static int CheckNestedDirectories(char * basepath, int depth) {
}
if (isDirectory) {
if (depth > 1)
if ((sbuf.st_uid != boinc_master_uid) && (sbuf.st_gid != boinc_master_gid))
continue; // We can't check subdirectories owned by boinc_project
retval = CheckNestedDirectories(full_path, depth + 1);
if (retval)
break;

View File

@ -283,4 +283,15 @@ int set_to_project_group(const char* path) {
#endif
}
int remove_project_owned_file_or_dir(const char* path) {
#ifdef SANDBOX
char cmd[1024];
sprintf(cmd, "%s/%s /bin/rm rm -fR \"%s\"", SWITCHER_DIR, SWITCHER_FILE_NAME, path);
return system(cmd);
#else
return ERR_UNLINK;
#endif
}
const char *BOINC_RCSID_7d362a6a52 = "$Id$";

View File

@ -49,6 +49,8 @@ extern void get_sched_request_filename(PROJECT&, char*);
extern void get_sched_reply_filename(PROJECT&, char*);
extern void get_master_filename(PROJECT&, char*);
extern int set_to_project_group(const char* path);
extern int remove_project_owned_file_or_dir(const char* path);
#define PROJECTS_DIR "projects"
#define SLOTS_DIR "slots"

View File

@ -1,3 +1,22 @@
// Berkeley Open Infrastructure for Network Computing
// http://boinc.berkeley.edu
// Copyright (C) 2005 University of California
//
// This is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation;
// either version 2.1 of the License, or (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// To view the GNU Lesser General Public License visit
// http://www.gnu.org/copyleft/lesser.html
// or write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// setprojectgrp.C
//
// When run as

View File

@ -1,3 +1,22 @@
// Berkeley Open Infrastructure for Network Computing
// http://boinc.berkeley.edu
// Copyright (C) 2005 University of California
//
// This is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation;
// either version 2.1 of the License, or (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// To view the GNU Lesser General Public License visit
// http://www.gnu.org/copyleft/lesser.html
// or write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// switcher.C
//
// When run as
@ -7,10 +26,16 @@
#include <unistd.h>
#include <stdio.h>
#include <cerrno>
#include <sys/param.h> // for MAXPATHLEN
int main(int argc, char** argv) {
#if 0 // For debugging
#if 0 // For debugging only
char current_dir[MAXPATHLEN];
getcwd( current_dir, sizeof(current_dir));
fprintf(stderr, "current directory = %s\n", current_dir);
for (int i=0; i<argc; i++) {
fprintf(stderr, "switcher arg %d: %s\n", i, argv[i]);
}

View File

@ -63,6 +63,9 @@ typedef BOOL (CALLBACK* FreeFn)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULAR
#include "util.h"
#include "error_numbers.h"
#include "filesys.h"
#ifdef SANDBOX
#include "file_names.h"
#endif
#ifdef _USING_FCGI_
#include "fcgi_stdio.h"
@ -255,6 +258,14 @@ int boinc_delete_file(const char* path) {
}
#else
retval = unlink(path);
#ifdef SANDBOX
if (retval)
// We may not have permission to read subdirectories created by projects
if (errno == EACCES) {
return remove_project_owned_file_or_dir(path);
}
#endif
return retval;
#endif
if (retval) {
safe_strcpy(boinc_failed_file, path);
@ -302,7 +313,14 @@ int clean_out_dir(const char* dirpath) {
DIRREF dirp;
dirp = dir_open(dirpath);
if (!dirp) return 0; // if dir doesn't exist, it's empty
if (!dirp)
#ifdef SANDBOX
// We may not have permission to read subdirectories created by projects
if (errno == EACCES) {
return remove_project_owned_file_or_dir(dirpath);
} else
#endif
return 0; // if dir doesn't exist, it's empty
while (1) {
strcpy(filename, "");
retval = dir_scan(filename, dirp, sizeof(filename));
@ -468,7 +486,16 @@ int boinc_rmdir(const char* name) {
#ifdef _WIN32
return !RemoveDirectory(name);
#else
return rmdir(name);
int retval;
retval = rmdir(name);
#ifdef SANDBOX
if (retval)
// We may not have permission to read subdirectories created by projects
if (errno == EACCES) {
return remove_project_owned_file_or_dir(name);
}
#endif
return retval;
#endif
}

View File

@ -1,5 +1,24 @@
#!/bin/csh
## Berkeley Open Infrastructure for Network Computing
## http://boinc.berkeley.edu
## Copyright (C) 2005 University of California
##
## This is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation;
## either version 2.1 of the License, or (at your option) any later version.
##
## This software is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
## See the GNU Lesser General Public License for more details.
##
## To view the GNU Lesser General Public License visit
## http://www.gnu.org/copyleft/lesser.html
## or write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##
# Release Script for Macintosh GridRepublic Desktop 4/17/06 by Charlie Fenton
##
@ -94,6 +113,7 @@ mkdir -p "${PR_PATH}/Library/Application Support/ BOINC Data/locale"
mkdir -p "${PR_PATH}/Library/Application Support/BOINC Data/switcher"
cp -fpR "$BUILDPATH/switcher" "${PR_PATH}/Library/Application Support/BOINC Data/switcher/"
cp -fpR "$BUILDPATH/setprojectgrp" "${PR_PATH}/Library/Application Support/BOINC Data/switcher/"
cp -fpR "$BUILDPATH/BOINCManager.app" "${PR_PATH}/Applications/"

View File

@ -1,5 +1,24 @@
#!/bin/csh
## Berkeley Open Infrastructure for Network Computing
## http://boinc.berkeley.edu
## Copyright (C) 2005 University of California
##
## This is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation;
## either version 2.1 of the License, or (at your option) any later version.
##
## This software is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
## See the GNU Lesser General Public License for more details.
##
## To view the GNU Lesser General Public License visit
## http://www.gnu.org/copyleft/lesser.html
## or write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##
# Release Script for Macintosh BOINC Manager 2/16/06 by Charlie Fenton
##
@ -71,6 +90,7 @@ mkdir -p ../BOINC_Installer/Pkg_Root/Library/Application\ Support/BOINC\ Data/lo
mkdir -p ../BOINC_Installer/Pkg_Root/Library/Application\ Support/BOINC\ Data/switcher
cp -fpR $BUILDPATH/switcher ../BOINC_Installer/Pkg_Root/Library/Application\ Support/BOINC\ Data/switcher/
cp -fpR $BUILDPATH/setprojectgrp ../BOINC_Installer/Pkg_Root/Library/Application\ Support/BOINC\ Data/switcher/
cp -fpR $BUILDPATH/BOINCManager.app ../BOINC_Installer/Pkg_Root/Applications/