diff --git a/checkin_notes b/checkin_notes index 1a31df90f9..dd408333cd 100755 --- a/checkin_notes +++ b/checkin_notes @@ -6228,6 +6228,7 @@ Charlie 17 June 2006 check_security.C switcher.C clientgui/ + BOINCGUIApp.cpp mac/ SetupSecurity.cpp mac_build/ diff --git a/client/check_security.C b/client/check_security.C index 4d5bd821c6..94a19b00ea 100644 --- a/client/check_security.C +++ b/client/check_security.C @@ -32,8 +32,8 @@ #include "SetupSecurity.h" -#define real_boinc_master_name "boinc_master" -#define real_boinc_project_name "boinc_project" +#define REAL_BOINC_MASTER_NAME "boinc_master" +#define REAL_BOINC_PROJECT_NAME "boinc_project" static char boinc_master_user_name[64]; static char boinc_master_group_name[64]; @@ -75,13 +75,13 @@ int check_security() { strlcpy(boinc_master_group_name, grp->gr_name, sizeof(boinc_master_group_name)); #else // if (! _DEBUG) - strlcpy(boinc_master_user_name, real_boinc_master_name, sizeof(boinc_master_user_name)); + strlcpy(boinc_master_user_name, REAL_BOINC_MASTER_NAME, sizeof(boinc_master_user_name)); pw = getpwnam(boinc_master_user_name); if (pw == NULL) return ERR_USER_REJECTED; // User boinc_master does not exist boinc_master_uid = pw->pw_uid; - strlcpy(boinc_master_group_name, real_boinc_master_name, sizeof(boinc_master_group_name)); + strlcpy(boinc_master_group_name, REAL_BOINC_MASTER_NAME, sizeof(boinc_master_group_name)); grp = getgrnam(boinc_master_group_name); if (grp == NULL) return ERR_GETGRNAM; // Group boinc_master does not exist @@ -95,13 +95,13 @@ int check_security() { boinc_project_uid = boinc_master_uid; boinc_project_gid = boinc_master_gid; #else - strlcpy(boinc_project_user_name, real_boinc_project_name, sizeof(boinc_project_user_name)); + strlcpy(boinc_project_user_name, REAL_BOINC_PROJECT_NAME, sizeof(boinc_project_user_name)); pw = getpwnam(boinc_project_user_name); if (pw == NULL) return ERR_USER_REJECTED; // User boinc_project does not exist boinc_project_uid = pw->pw_uid; - strlcpy(boinc_project_group_name, real_boinc_project_name, sizeof(boinc_project_group_name)); + strlcpy(boinc_project_group_name, REAL_BOINC_PROJECT_NAME, sizeof(boinc_project_group_name)); grp = getgrnam(boinc_project_group_name); if (grp == NULL) return ERR_GETGRNAM; // Group boinc_project does not exist diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index bf050b199e..57ecf3da11 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -343,6 +343,7 @@ bool CBOINCGUIApp::OnInit() { // GDB can't attach to applications which are running as a diferent user // or group, so fix up data with current user and group during debugging if (check_security()) { + CreateBOINCUsersAndGroups(); SetBOINCDataOwnersGroupsAndPermissions(); SetBOINCAppOwnersGroupsAndPermissions(NULL); } diff --git a/clientgui/mac/SetupSecurity.cpp b/clientgui/mac/SetupSecurity.cpp index ba5419e591..dbbd76e155 100644 --- a/clientgui/mac/SetupSecurity.cpp +++ b/clientgui/mac/SetupSecurity.cpp @@ -47,8 +47,8 @@ static AuthorizationRef gOurAuthRef = NULL; #define DELAY_TICKS_R 10 -#define real_boinc_master_name "boinc_master" -#define real_boinc_project_name "boinc_project" +#define REAL_BOINC_MASTER_NAME "boinc_master" +#define REAL_BOINC_PROJECT_NAME "boinc_project" #ifdef _DEBUG // GDB can't attach to applications which are running as a diferent user or group so @@ -59,10 +59,10 @@ static char boinc_master_group_name[64]; static char boinc_project_user_name[64]; static char boinc_project_group_name[64]; #else -#define boinc_master_user_name real_boinc_master_name -#define boinc_master_group_name real_boinc_master_name -#define boinc_project_user_name real_boinc_project_name -#define boinc_project_group_name real_boinc_project_name +#define boinc_master_user_name REAL_BOINC_MASTER_NAME +#define boinc_master_group_name REAL_BOINC_MASTER_NAME +#define boinc_project_user_name REAL_BOINC_PROJECT_NAME +#define boinc_project_group_name REAL_BOINC_PROJECT_NAME #endif #define MIN_ID 25 /* Minimum user ID / Group ID to create */ @@ -76,11 +76,11 @@ int CreateBOINCUsersAndGroups() { char buf1[80]; OSStatus err = noErr; - err = CreateUserAndGroup(real_boinc_master_name, real_boinc_master_name); + err = CreateUserAndGroup(REAL_BOINC_MASTER_NAME, REAL_BOINC_MASTER_NAME); if (err != noErr) return err; - err = CreateUserAndGroup(real_boinc_project_name, real_boinc_project_name); + err = CreateUserAndGroup(REAL_BOINC_PROJECT_NAME, REAL_BOINC_PROJECT_NAME); if (err != noErr) return err; @@ -227,7 +227,7 @@ int SetBOINCDataOwnersGroupsAndPermissions() { // Does BOINC Data directory exist? result = FSPathMakeRef((StringPtr)fullpath, &ref, &isDirectory); if ((result != noErr) || (! isDirectory)) - return noErr; // BOINC Data Directory does not exist + return err; // BOINC Data Directory does not exist // Set owner and group of BOINC Data directory's contents sprintf(buf1, "%s:%s", boinc_master_user_name, boinc_master_group_name); @@ -600,8 +600,8 @@ static OSStatus SetFakeMasterNames() { strlcpy(boinc_project_group_name, grp->gr_name, sizeof(boinc_project_group_name)); #else // For better debugging of SANDBOX permissions logic - strlcpy(boinc_project_user_name, real_boinc_project_name, sizeof(boinc_project_user_name)); - strlcpy(boinc_project_group_name, real_boinc_project_name, sizeof(boinc_project_group_name)); + strlcpy(boinc_project_user_name, REAL_BOINC_PROJECT_NAME, sizeof(boinc_project_user_name)); + strlcpy(boinc_project_group_name, REAL_BOINC_PROJECT_NAME, sizeof(boinc_project_group_name)); #endif return noErr;