mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=10292
This commit is contained in:
parent
7d144b3d4d
commit
e9ddf9f268
|
@ -5749,3 +5749,15 @@ David 9 June 2006
|
|||
validate_util.C,h
|
||||
validate_util2.C,h (new)
|
||||
validator_placeholder.C
|
||||
|
||||
Charlie 9 June 2006
|
||||
- Changes for sandbox:
|
||||
Renamed global variable boinc_project_gid to g_boinc_project_gid.
|
||||
Change shared memory segment group to g_boinc_project_gid.
|
||||
|
||||
client/
|
||||
app_start.C
|
||||
client_state.C,h
|
||||
client_types.C
|
||||
lib/
|
||||
shmem.C,h
|
||||
|
|
|
@ -489,7 +489,7 @@ int ACTIVE_TASK::start(bool first_time) {
|
|||
//
|
||||
if (!app_client_shm.shm) {
|
||||
retval = create_shmem(
|
||||
shmem_seg_name, sizeof(SHARED_MEM), (void**)&app_client_shm.shm
|
||||
shmem_seg_name, sizeof(SHARED_MEM), g_boinc_project_gid, (void**)&app_client_shm.shm
|
||||
);
|
||||
if (retval) {
|
||||
msg_printf(
|
||||
|
|
|
@ -52,6 +52,8 @@ using std::max;
|
|||
|
||||
CLIENT_STATE gstate;
|
||||
|
||||
gid_t g_boinc_project_gid;
|
||||
|
||||
CLIENT_STATE::CLIENT_STATE() {
|
||||
net_xfers = new NET_XFER_SET;
|
||||
http_ops = new HTTP_OP_SET(net_xfers);
|
||||
|
@ -301,7 +303,7 @@ int CLIENT_STATE::init() {
|
|||
}
|
||||
|
||||
#ifdef SANDBOX
|
||||
retval = lookup_group(BOINC_PROJECT_GROUP_NAME, boinc_project_gid);
|
||||
retval = lookup_group(BOINC_PROJECT_GROUP_NAME, g_boinc_project_gid);
|
||||
if (retval) return retval;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -472,7 +472,7 @@ extern CLIENT_STATE gstate;
|
|||
|
||||
#ifdef SANDBOX
|
||||
#define BOINC_PROJECT_GROUP_NAME "boinc_project"
|
||||
extern gid_t boinc_project_gid;
|
||||
extern gid_t g_boinc_project_gid;
|
||||
#endif
|
||||
|
||||
// return a random double in the range [MIN,min(e^n,MAX))
|
||||
|
|
|
@ -556,7 +556,7 @@ int FILE_INFO::set_permissions() {
|
|||
// in case someone runs BOINC from different user
|
||||
|
||||
#ifdef SANDBOX
|
||||
retval = chown(pathname, -1, boinc_project_gid);
|
||||
retval = chown(pathname, (uid_t)-1, g_boinc_project_gid);
|
||||
if (retval) return retval;
|
||||
if (executable) {
|
||||
retval = chmod(pathname,
|
||||
|
|
22
lib/shmem.C
22
lib/shmem.C
|
@ -159,10 +159,29 @@ int detach_shmem(void* p) {
|
|||
|
||||
#else
|
||||
|
||||
int create_shmem(key_t key, int size, void** pp) {
|
||||
int create_shmem(key_t key, int size, gid_t gid, void** pp) {
|
||||
int id;
|
||||
#ifdef SANDBOX
|
||||
int retval;
|
||||
struct shmid_ds buf;
|
||||
#endif
|
||||
|
||||
id = shmget(key, size, IPC_CREAT|0660);
|
||||
if (id < 0) {
|
||||
#ifdef SANDBOX
|
||||
// Set the shmem segment's group ID
|
||||
retval = shmctl(id, IPC_STAT, &buf);
|
||||
if (retval) {
|
||||
perror("shmget: shmctl STAT");
|
||||
return ERR_SHMGET;
|
||||
}
|
||||
buf.shm_perm.gid = gid;
|
||||
retval = shmctl(id, IPC_SET, &buf);
|
||||
if (retval) {
|
||||
perror("shmget: shmctl IPC_SET");
|
||||
return ERR_SHMGET;
|
||||
}
|
||||
#endif
|
||||
id = shmget(key, size, IPC_CREAT|SHM_R|SHM_W);
|
||||
}
|
||||
if (id < 0) {
|
||||
|
@ -170,7 +189,6 @@ int create_shmem(key_t key, int size, void** pp) {
|
|||
return ERR_SHMGET;
|
||||
}
|
||||
return attach_shmem(key, pp);
|
||||
|
||||
}
|
||||
|
||||
int destroy_shmem(key_t key){
|
||||
|
|
|
@ -47,7 +47,7 @@ int detach_shmem(HANDLE hSharedMem, void* p);
|
|||
|
||||
// create a shared-memory segment of the given size.
|
||||
//
|
||||
extern int create_shmem(key_t, int size, void**);
|
||||
extern int create_shmem(key_t, int size, gid_t gid, void**);
|
||||
|
||||
// Destroy a shared-memory segment.
|
||||
// If there are attachments to it,
|
||||
|
|
Loading…
Reference in New Issue