*** empty log message ***

svn path=/trunk/boinc/; revision=10815
This commit is contained in:
Charlie Fenton 2006-08-02 00:43:27 +00:00
parent ad99a0638f
commit d4eb510bc8
7 changed files with 1262 additions and 12 deletions

View File

@ -8294,3 +8294,22 @@ Walt 1 Aug 2006
api/
x_opengl.C
Charlie 1 Aug 2006
- Mac sandbox: added Dev_noSandbox and Deploy_noSandbox build styles
to XCode project for testing ability to build without -DSANDBOX.
- Mac sandbox: check_security() uses PersistentFGets() for better
reliability, deletes newline from path if present.
- Fix compile errors in non-SANDBOX builds.
client/
client_state.C
clientGUI/
mac/
mac_saver_module.cpp
lib/
util.C
mac_installer/
PostInstall.cpp
mac_build/
boinc.xcodeproj/
project.pbxproj

View File

@ -27,6 +27,7 @@
#include <grp.h>
#include <sys/param.h> // for MAXPATHLEN
#include <dirent.h>
#include <cerrno>
#include "util.h"
#include "error_numbers.h"
#include "file_names.h"
@ -34,6 +35,7 @@
static int CheckNestedDirectories(char * basepath, int depth, int use_sandbox);
#if (! defined(__WXMAC__) && ! defined(_MAC_INSTALLER))
static char * PersistentFGets(char *buf, size_t buflen, FILE *f);
static void GetPathToThisProcess(char* outbuf, size_t maxLen);
#endif
@ -488,6 +490,26 @@ static int CheckNestedDirectories(char * basepath, int depth, int use_sandbox) {
#if (! defined(__WXMAC__) && ! defined(_MAC_INSTALLER))
static char * PersistentFGets(char *buf, size_t buflen, FILE *f) {
char *p = buf;
size_t len = buflen;
size_t datalen = 0;
*buf = '\0';
while (datalen < (buflen - 1)) {
fgets(p, len, f);
if (feof(f)) break;
if (ferror(f) && (errno != EINTR)) break;
if (strchr(buf, '\n')) break;
datalen = strlen(buf);
p = buf + datalen;
len -= datalen;
}
return (buf[0] ? buf : NULL);
}
static void GetPathToThisProcess(char* outbuf, size_t maxLen) {
FILE *f;
char buf[256], *p, *q;
@ -500,9 +522,14 @@ static void GetPathToThisProcess(char* outbuf, size_t maxLen) {
if (f == NULL)
return;
fgets (outbuf, maxLen, f); // Discard header line
fgets (outbuf, maxLen, f);
PersistentFGets (outbuf, maxLen, f); // Discard header line
PersistentFGets (outbuf, maxLen, f);
pclose(f);
// Remove trailing newline if present
p = strchr(outbuf, '\n');
if (p)
*p = '\0';
// Strip off any arguments
p = strstr(outbuf, " -");

View File

@ -313,7 +313,7 @@ int CLIENT_STATE::init() {
}
}
#ifndef _WIN32
#if (defined(SANDBOX) && ! defined(_WIN32))
if (g_use_sandbox) {
#ifdef _DEBUG
boinc_project_gid = getegid();

View File

@ -147,8 +147,6 @@ const char * BOINCUnrecoverableErrorMsg = "Sorry, an unrecoverable error occurr
const char * BOINCTestmodeMg = "This BOINC screensaver does not support Test mode";
//const char * BOINCExitedSaverMode = "BOINC is no longer in screensaver mode.";
int g_use_sandbox = 0;
// Returns desired Animation Frequency (per second) or 0 for no change
int initBOINCSaver(Boolean ispreview) {

View File

@ -68,7 +68,7 @@ using std::string;
// and gstate.m_use_sandbox in the Client, but it is used by some source files
// (filesys.C, check_security.C) that are linked with both Manager and Client
// so the most practical solution is to use a global.
int g_use_sandbox;
int g_use_sandbox = 0;
// Use this instead of strncpy().

File diff suppressed because it is too large Load Diff

View File

@ -78,10 +78,11 @@ int main(int argc, char *argv[])
FSRef fileRef;
OSStatus err, err_fsref;
char *p;
#ifdef SANDBOX
uid_t savedeuid, b_m_uid;
passwd *pw;
int finalInstallAction;
#ifndef SANDBOX
#else
char *q;
group *grp;
char s[256];
@ -486,15 +487,15 @@ OSErr UpdateAllVisibleUsers(long brandID)
{
DIR *dirp;
dirent *dp;
char *p;
group *grp;
passwd *pw;
uid_t saved_uid;
short i;
Boolean deleteLoginItem;
#ifdef SANDBOX
char *p;
group *grp;
short i;
OSErr err = noErr;
#ifdef SANDBOX
grp = getgrnam("admin");
if (grp == NULL) { // Should never happen
puts("getgrnam(\"admin\") failed\n");