Commit 37eb51ec authored by anarcat's avatar anarcat Committed by anarcat

don't use get_current_user() to figure out the aegir user, but rely on the running uid instead

parent 68c205c0
......@@ -42,7 +42,7 @@ function drush_provision_hostmaster_install($site = NULL) {
// files
'remote_host' => php_uname('n'),
'aegir_root' => $aegir_root,
'script_user' => drush_get_option('script_user', get_current_user()),
'script_user' => drush_get_option('script_user', provision_current_user()),
// apache
'http_service_type' => 'apache',
'web_group' => drush_get_option('web_group', _provision_default_web_group()),
......
......@@ -317,7 +317,7 @@ class provisionServer extends provisionEnvironment {
$this->setProperty('remote_host', 'localhost');
if ($this->name == '@server_master') {
$this->setProperty('aegir_root', getenv('HOME'));
$this->setProperty('script_user', get_current_user());
$this->setProperty('script_user', provision_current_user());
}
else {
$this->aegir_root = d('@server_master')->aegir_root;
......
......@@ -229,13 +229,13 @@ class provisionFileSystem extends provisionChainedState {
$func = ($recursive) ? array($this, '_chgrp_recursive') : 'chgrp';
if ($group = provision_posix_groupname($gid)) {
if (provision_user_in_group(get_current_user(), $gid)) {
if (provision_user_in_group(provision_current_user(), $gid)) {
if (!call_user_func($func, $path, $group)) {
$this->tokens['@reason'] = dt("chgrp to @group failed on @path", array('@group' => $group, '@path' => $path));
}
}
else {
$this->tokens['@reason'] = dt("@user is not in @group group", array("@user" => get_current_user(), "@group" => $group));
$this->tokens['@reason'] = dt("@user is not in @group group", array("@user" => provision_current_user(), "@group" => $group));
}
}
elseif (!@call_user_func($func, $path, $gid)) { # try to change the group anyways
......@@ -394,7 +394,7 @@ class provisionFileSystem extends provisionChainedState {
}
if ($exists) {
$this->chown($path, get_current_user())
$this->chown($path, provision_current_user())
->succeed($name . ' ownership of @path has been changed to @uid.')
->fail($name . ' ownership of @path could not be changed to @uid.', 'DRUSH_PERM_ERROR');
......
......@@ -170,6 +170,23 @@ function provision_shell_exec() {
return drush_shell_exec($command);
}
/**
* Find the username of the current running procses
*
* This will return the username of the current running user (as seen
* from posix_geteuid()) and should be used instead of
* get_current_user() (which looks at the file owner instead).
*
* @see get_current_user()
* @see posix_geteuid()
*
* @return
* String. The username.
*/
function provision_current_user() {
return provision_posix_username(posix_geteuid());
}
/**
* Check whether a user is a member of a group.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment