mirror of https://github.com/BOINC/boinc.git
Mac MGR: Launch the graphics application using switcher to fix a potential security risk
svn path=/trunk/boinc/; revision=13598
This commit is contained in:
parent
61ce18e6ca
commit
7fd15f2b5f
|
@ -8535,3 +8535,13 @@ Rytis 17 Sep 2007
|
||||||
|
|
||||||
html/inc/
|
html/inc/
|
||||||
result.inc
|
result.inc
|
||||||
|
|
||||||
|
Charlie 18 Sept 2007
|
||||||
|
- Mac MGR: Launch the graphics application using switcher to fix
|
||||||
|
a potential security risk; I found another solution to the
|
||||||
|
"RegisterProcess failed (error = -50)" so no longer need to
|
||||||
|
use the UNIX system() api to launch the graphics application.
|
||||||
|
|
||||||
|
clientgui/
|
||||||
|
ViewWork.cpp
|
||||||
|
ViewWorkGrid.cpp
|
||||||
|
|
|
@ -233,15 +233,43 @@ void CViewWork::OnWorkShowGraphics( wxCommandEvent& WXUNUSED(event) ) {
|
||||||
if (wxYES == iAnswer) {
|
if (wxYES == iAnswer) {
|
||||||
RESULT* result = pDoc->result(m_pListPane->GetFirstSelected());
|
RESULT* result = pDoc->result(m_pListPane->GetFirstSelected());
|
||||||
if (!result->graphics_exec_path.empty()) {
|
if (!result->graphics_exec_path.empty()) {
|
||||||
#ifdef __WXMAC__
|
|
||||||
// Launching the graphics application using fork() and execv()
|
|
||||||
// results in it getting "RegisterProcess failed (error = -50)"
|
|
||||||
// so we launch it via a shell using the system() api.
|
|
||||||
char cmd[1024];
|
|
||||||
sprintf(cmd, "cd \"%s\"; \"%s\" --graphics &", result->slot_path.c_str(), result->graphics_exec_path.c_str());
|
|
||||||
system(cmd);
|
|
||||||
#else
|
|
||||||
// V6 Graphics
|
// V6 Graphics
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
HANDLE id;
|
||||||
|
#else
|
||||||
|
int id;
|
||||||
|
#endif
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
// For unknown reasons, the graphics application exits with
|
||||||
|
// "RegisterProcess failed (error = -50)" unless we pass its
|
||||||
|
// full path twice in the argument list to execv.
|
||||||
|
char* argv[5];
|
||||||
|
argv[0] = "switcher";
|
||||||
|
argv[1] = (char *)result->graphics_exec_path.c_str();
|
||||||
|
argv[2] = (char *)result->graphics_exec_path.c_str();
|
||||||
|
argv[3] = "--graphics";
|
||||||
|
argv[4] = 0;
|
||||||
|
|
||||||
|
if (g_use_sandbox) {
|
||||||
|
run_program(
|
||||||
|
result->slot_path.c_str(),
|
||||||
|
"../../switcher/switcher",
|
||||||
|
4,
|
||||||
|
argv,
|
||||||
|
0,
|
||||||
|
id
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
run_program(
|
||||||
|
result->slot_path.c_str(),
|
||||||
|
result->graphics_exec_path.c_str(),
|
||||||
|
3,
|
||||||
|
&argv[1],
|
||||||
|
0,
|
||||||
|
id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#else
|
||||||
char* argv[2];
|
char* argv[2];
|
||||||
argv[0] = "--graphics";
|
argv[0] = "--graphics";
|
||||||
argv[1] = 0;
|
argv[1] = 0;
|
||||||
|
|
|
@ -222,6 +222,7 @@ void CViewWorkGrid::OnWorkSuspend( wxCommandEvent& WXUNUSED(event) ) {
|
||||||
wxLogTrace(wxT("Function Start/End"), wxT("CViewWorkGrid::OnWorkSuspend - Function End"));
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewWorkGrid::OnWorkSuspend - Function End"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CViewWorkGrid::OnWorkShowGraphics( wxCommandEvent& WXUNUSED(event) ) {
|
void CViewWorkGrid::OnWorkShowGraphics( wxCommandEvent& WXUNUSED(event) ) {
|
||||||
wxLogTrace(wxT("Function Start/End"), wxT("CViewWorkGrid::OnWorkShowGraphics - Function Begin"));
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewWorkGrid::OnWorkShowGraphics - Function Begin"));
|
||||||
|
|
||||||
|
@ -260,23 +261,46 @@ void CViewWorkGrid::OnWorkShowGraphics( wxCommandEvent& WXUNUSED(event) ) {
|
||||||
wxString searchName = m_pGridPane->GetCellValue(m_pGridPane->GetFirstSelectedRow(),COLUMN_NAME).Trim(false);
|
wxString searchName = m_pGridPane->GetCellValue(m_pGridPane->GetFirstSelectedRow(),COLUMN_NAME).Trim(false);
|
||||||
RESULT* result = pDoc->result(searchName);
|
RESULT* result = pDoc->result(searchName);
|
||||||
if (!result->graphics_exec_path.empty()) {
|
if (!result->graphics_exec_path.empty()) {
|
||||||
#ifdef __WXMAC__
|
|
||||||
// Launching the graphics application using fork() and execv()
|
|
||||||
// results in it getting "RegisterProcess failed (error = -50)"
|
|
||||||
// so we launch it via a shell using the system() api.
|
|
||||||
char cmd[1024];
|
|
||||||
sprintf(cmd, "cd \"%s\"; \"%s\" --graphics &", result->slot_path.c_str(), result->graphics_exec_path.c_str());
|
|
||||||
system(cmd);
|
|
||||||
#else
|
|
||||||
// V6 Graphics
|
// V6 Graphics
|
||||||
char* argv[2];
|
|
||||||
argv[0] = "--graphics";
|
|
||||||
argv[1] = 0;
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
HANDLE id;
|
HANDLE id;
|
||||||
#else
|
#else
|
||||||
int id;
|
int id;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
// For unknown reasons, the graphics application exits with
|
||||||
|
// "RegisterProcess failed (error = -50)" unless we pass its
|
||||||
|
// full path twice in the argument list to execv.
|
||||||
|
char* argv[5];
|
||||||
|
argv[0] = "switcher";
|
||||||
|
argv[1] = (char *)result->graphics_exec_path.c_str();
|
||||||
|
argv[2] = (char *)result->graphics_exec_path.c_str();
|
||||||
|
argv[3] = "--graphics";
|
||||||
|
argv[4] = 0;
|
||||||
|
|
||||||
|
if (g_use_sandbox) {
|
||||||
|
run_program(
|
||||||
|
result->slot_path.c_str(),
|
||||||
|
"../../switcher/switcher",
|
||||||
|
4,
|
||||||
|
argv,
|
||||||
|
0,
|
||||||
|
id
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
run_program(
|
||||||
|
result->slot_path.c_str(),
|
||||||
|
result->graphics_exec_path.c_str(),
|
||||||
|
3,
|
||||||
|
&argv[1],
|
||||||
|
0,
|
||||||
|
id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
char* argv[2];
|
||||||
|
argv[0] = "--graphics";
|
||||||
|
argv[1] = 0;
|
||||||
run_program(
|
run_program(
|
||||||
result->slot_path.c_str(),
|
result->slot_path.c_str(),
|
||||||
result->graphics_exec_path.c_str(),
|
result->graphics_exec_path.c_str(),
|
||||||
|
|
Loading…
Reference in New Issue