*** empty log message ***

svn path=/trunk/boinc/; revision=12163
This commit is contained in:
Charlie Fenton 2007-02-27 09:52:01 +00:00
parent 81d8fdc3f1
commit 8e3a02cbb5
5 changed files with 67 additions and 16 deletions

View File

@ -2060,3 +2060,23 @@ Charlie 26 Feb 2007
clientgui/
mac/
SetupSecurity.cpp
Charlie 27 Feb 2007
Mac: Add an optional argument to HOST_INFO::users_idle() to allow
returning the actual idle time. This change is __APPLE__ only.
Mac: Fix serious bugs in Mac_SA_Insecure.sh and Mac_SA_Secure.sh
scripts when run under OS 10.3.x. They sometimes created bad
users and groups with IDs that were duplicates of other users
and groups. They ran correctly under OS 10.4.x.
Users who ran an older version of either script under OS 10.3.x
should first run the current version of Mac_SA_Insecure.sh to
delete the bad entries and then run Mac_SA_Secure.sh to create
new good entries.
client/
hostinf_unix.C
lib/
hostinfo.h
mac_build/
Mac_SA_Insecure.sh
Mac_SA_Secure.sh

View File

@ -814,7 +814,16 @@ static double GetOSXIdleTime(void) {
// return (double)NXIdleTime(gEventHandle); // Very old and very slow API
}
#endif // ! __i386__
#endif // __APPLE__
bool HOST_INFO::users_idle(bool check_all_logins, double idle_time_to_run, double *actual_idle_time) {
double idleTime = GetOSXIdleTime();
if (actual_idle_time)
*actual_idle_time = idleTime;
return (idleTime > (60 * idle_time_to_run));
}
#else // ! __APPLE__
bool HOST_INFO::users_idle(bool check_all_logins, double idle_time_to_run) {
#ifdef HAVE__DEV_TTY1
@ -834,12 +843,10 @@ bool HOST_INFO::users_idle(bool check_all_logins, double idle_time_to_run) {
#ifdef HAVE__DEV_TTY1
&& (check_all_logins || all_tty_idle(idle_time, device_tty, '1', 7))
#endif
#ifdef __APPLE__
&& (GetOSXIdleTime() > (60 * idle_time_to_run))
#endif // __APPLE__
;
}
#endif // ! __APPLE__
const char *BOINC_RCSID_2cf92d205b = "$Id$";

View File

@ -69,7 +69,11 @@ public:
void print();
bool host_is_running_on_batteries();
#ifdef __APPLE__
bool users_idle(bool check_all_logins, double idle_time_to_run, double *actual_idle_time=NULL);
#else
bool users_idle(bool check_all_logins, double idle_time_to_run);
#endif
int get_host_info();
int get_local_network_info();
void clear_host_info();

View File

@ -25,33 +25,43 @@
# - Set file/dir ownership to the specified user and group
# - Remove BOINC groups and users
#
# If you ran an older version of either script under OS 10.3.x, you should
# first run the current version of Mac_SA_Insecure.sh to delete the bad
# entries and then run Mac_SA_Secure.sh to create new good entries.
#
#
# Execute this as root in the BOINC directory:
# cd {path_to_boinc_directory}
# sudo sh {path}/Mac_SA_Insecure.sh user group
#
# IMPORTANT NOTE: earlier versions of the Mac_SA_Insecure.sh and
# Mac_SA_Secure.sh scripts had serious problems when run under OS 10.3.x.
# They sometimes created bad users and groups with IDs that were duplicates
# of other users and groups. They ran correctly under OS 10.4.x
#
# After running this script, the boinc client must be run with
# the --insecure option.
# NOTE: running BOINC with security disabled is not recommended.
#
# Last updated 9/21/06
# Last updated 2/27/07
function remove_boinc_users() {
name=$(dscl . search /users RecordName boinc_master | cut -f1 -)
name=$(dscl . search /users RecordName boinc_master | cut -f1 -s)
if [ "$name" = "boinc_master" ] ; then
sudo dscl . -delete /users/boinc_master
fi
name=$(dscl . search /groups RecordName boinc_master | cut -f1 -)
name=$(dscl . search /groups RecordName boinc_master | cut -f1 -s)
if [ "$name" = "boinc_master" ] ; then
sudo dscl . -delete /groups/boinc_master
fi
name=$(dscl . search /users RecordName boinc_project | cut -f1 -)
name=$(dscl . search /users RecordName boinc_project | cut -f1 -s)
if [ "$name" = "boinc_project" ] ; then
sudo dscl . -delete /users/boinc_project
fi
name=$(dscl . search /groups RecordName boinc_project | cut -f1 -)
name=$(dscl . search /groups RecordName boinc_project | cut -f1 -s)
if [ "$name" = "boinc_project" ] ; then
sudo dscl . -delete /groups/boinc_project
fi

View File

@ -28,6 +28,16 @@
#
# Create groups and users, set file/dir ownership and protection
#
# IMPORTANT NOTE: earlier versions of the Mac_SA_Insecure.sh and
# Mac_SA_Secure.sh scripts had serious problems when run under OS 10.3.x.
# They sometimes created bad users and groups with IDs that were duplicates
# of other users and groups. They ran correctly under OS 10.4.x
#
# If you ran an older version of either script under OS 10.3.x, you should
# first run the current version of Mac_SA_Insecure.sh to delete the bad
# entries and then run Mac_SA_Secure.sh to create new good entries.
#
#
# Execute this as root in the BOINC directory:
# cd {path_to_boinc_directory}
# sudo sh {path}/Mac_SA_Secure.sh
@ -54,18 +64,18 @@
# sudo dscl . -delete /groups/boinc_master users mary
#
# Last updated 9/21/06
# Last updated 2/27/07
function make_boinc_user() {
# Check whether group already exists
name=$(dscl . search /groups RecordName $1 | cut -f1 -)
name=$(dscl . search /groups RecordName $1 | cut -f1 -s)
if [ "$name" = "$1" ] ; then
gid=$(dscl . read /groups/$1 PrimaryGroupID | cut -d" " -f2 -)
gid=$(dscl . read /groups/$1 PrimaryGroupID | cut -d" " -f2 -s)
else
# Find an unused group ID
gid="25"
while true; do
name=$(dscl . search /groups PrimaryGroupID $gid | cut -f1 -)
name=$(dscl . search /groups PrimaryGroupID $gid | cut -f1 -s)
if [ -z "$name" ] ; then
break
fi
@ -76,17 +86,17 @@ function make_boinc_user() {
fi
# Check whether user already exists
name=$(dscl . search /users RecordName $1 | cut -f1 -)
name=$(dscl . search /users RecordName $1 | cut -f1 -s)
if [ -z "$name" ] ; then
# Is uid=gid available?
uid=$gid
name=$(dscl . search /users UniqueID $uid | cut -f1 -)
name=$(dscl . search /users UniqueID $uid | cut -f1 -s)
if [ -n "$name" ] ; then
# uid=gid already in use, so find an unused user ID
uid="25"
while true; do
name=$(dscl . search /groups UniqueID $uid | cut -f1 -)
name=$(dscl . search /groups UniqueID $uid | cut -f1 -s)
if [ -z "$name" ] ; then
break
fi