diff --git a/checkin_notes b/checkin_notes index 302cff5314..c6ffa8f788 100755 --- a/checkin_notes +++ b/checkin_notes @@ -8965,3 +8965,15 @@ Rom 6 July 2005 Rom 6 July 2005 (boinc_public) - Tag for 4.70 release, all platforms boinc_core_release_4_70 + +Charlie 7 July 2005 + Mac installer: Installer used to set owner of all installed files + and directories to 501 (BOINCManager, Core Client, Screen Saver + and BOINC Data.) Changed this to set ownership to current user if + current user is member of group admin, otherwise use first member + of group admin other than root. Update installer version number + to 4.70. + + mac-installer/ + PostInstall.cpp + BOINC.pmproj diff --git a/mac_installer/BOINC.pmproj b/mac_installer/BOINC.pmproj index 59494c714c..c0a8fd11e0 100644 Binary files a/mac_installer/BOINC.pmproj and b/mac_installer/BOINC.pmproj differ diff --git a/mac_installer/PostInstall.cpp b/mac_installer/PostInstall.cpp index c6249cd7e1..e1c474f07f 100755 --- a/mac_installer/PostInstall.cpp +++ b/mac_installer/PostInstall.cpp @@ -22,6 +22,7 @@ #define CREATE_LOG 1 /* for debugging */ #include +#include #include // getlogin #include // getpwname, getpwuid, getuid @@ -48,6 +49,8 @@ int main(int argc, char *argv[]) long response; ProcessSerialNumber ourProcess, installerPSN; short itemHit; + group *grp; + char s[256]; int NumberOfLoginItems, Counter, i; pid_t installerPID = 0; FSRef fileRef; @@ -55,8 +58,6 @@ int main(int argc, char *argv[]) Initialize(); - Success = false; - ::GetCurrentProcess (&ourProcess); QuitBOINCManager('BNC!'); // Quit any old instance of BOINC @@ -85,11 +86,55 @@ int main(int argc, char *argv[]) ExitToShell(); } + Success = false; + + // The BOINC Manager and Core Client have the set-user-ID-on-execution + // flag set, so their ownership is important and must match the + // ownership of the BOINC Data directory. + + // Find an appropriate admin user to set as owner of installed files + // First, try the user currently logged in + q = getlogin(); + + grp = getgrnam("admin"); + i = 0; + while ((p = grp->gr_mem[i]) != NULL) { // Step through all users in group admin + if (strcmp(p, q) == 0) { + Success = true; // Logged in user is a member of group admin + break; + } + ++i; + } + + // If currently logged in user is not admin, use first non-root admin user + if (!Success) { + i = 0; + while ((p = grp->gr_mem[i]) != NULL) { // Step through all users in group admin + if (strcmp(p, "root") != 0) + break; + ++i; + } + } + + // Set owner of BOINCManager and contents, including core client + sprintf(s, "chown -Rf %s /Applications/BOINCManager.app", p); + system (s); + + // Set owner of BOINC Screen Saver + sprintf(s, "chown -Rf %s /Library/Screen\\ Savers/BOINCSaver.saver", p); + system (s); + + // Set owner of BOINC Data + sprintf(s, "chown -Rf %s /Library/Application\\ Support/BOINC\\ Data", p); + system (s); + // Installer is running as root. We must setuid back to the logged in user // in order to add a startup item to the user's login preferences SetUIDBackToUser (); + Success = false; + NumberOfLoginItems = GetCountOfLoginItems(kCurrentUser); // Search existing login items in reverse order, deleting any duplicates of ours