Skip to content

Commit 8814b55

Browse files
committed
Check that file owner is root in UnixPlatform::check_permissions().
1 parent f71480c commit 8814b55

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

backend/src/osx_platform.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ bool OSXPlatform::run_privileged()
3636
OSStatus err;
3737
AuthorizationFlags flags;
3838

39+
// FIXME: Throw exception if process is setuid but owner is not root! Right now this fails badly!
40+
3941
const char *path = this->path().c_str();
4042

4143
flags = kAuthorizationFlagExtendRights | kAuthorizationFlagInteractionAllowed;
@@ -103,4 +105,4 @@ vector<InterfaceInfo> OSXPlatform::interfaces()
103105
CFRelease(prefs);
104106

105107
return result;
106-
}
108+
}

backend/src/unix_platform.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ class UnixPlatform : public AbstractPlatform
5858
m_path = string(path);
5959
}
6060

61-
bool is_root()
62-
{
61+
bool is_root() {
6362
return geteuid() == 0;
6463
}
6564

@@ -71,7 +70,7 @@ class UnixPlatform : public AbstractPlatform
7170
if (err == -1)
7271
throw runtime_error("stat() failed");
7372

74-
return (file_stat.st_mode == MODE);
73+
return (file_stat.st_uid == 0 && file_stat.st_mode == MODE);
7574
}
7675

7776
void fix_permissions() {

xpi/modules/FiresheepSession.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ FiresheepSession.prototype = {
4646
// FIXME: This should really use chmod(2) directly.
4747
Utils.runCommand('chmod', [ 'a+x', this._core.backendPath ]);
4848

49-
// Tell backend to repair owner/setuid. Wil return succesfully if everything is already OK.
49+
// Tell backend to repair owner/setuid. Will return succesfully if everything is already OK.
5050
this._process = Cc["@codebutler.com/mozpopen/process;1"].createInstance(Ci.IMozPopenProcess);
5151
this._process.Init(this._core.backendPath, [ '--fix-permissions' ], 1);
5252
this._process.Start();

0 commit comments

Comments
 (0)