CC-3573: Use posix_geteuid instead of "whoami" to detect who is running PHP script
-done
This commit is contained in:
parent
61c5c839dd
commit
c66f0c783f
12 changed files with 12 additions and 12 deletions
|
@ -2,7 +2,7 @@
|
|||
#-e Causes bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
|
||||
if [ `whoami` != 'root' ]; then
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Please run as root user."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
#Check if root user
|
||||
if [ `whoami` != 'root' ]; then
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Please run as root user."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -33,7 +33,7 @@ class AirtimeInstall
|
|||
public static function ExitIfNotRoot()
|
||||
{
|
||||
// Need to check that we are superuser before running this.
|
||||
if(exec("whoami") != "root"){
|
||||
if(posix_geteuid() != 0){
|
||||
echo "Must be root user.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#-e Causes bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
|
||||
if [ `whoami` != 'root' ]; then
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Please run as root user."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#-e Causes bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
|
||||
if [ `whoami` != 'root' ]; then
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Please run as root user."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#-e Causes bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
|
||||
if [ `whoami` != 'root' ]; then
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Please run as root user."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#-e Causes bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
|
||||
if [ `whoami` != 'root' ]; then
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Please run as root user."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -11,7 +11,7 @@ require_once(__DIR__.'/airtime-constants.php');
|
|||
require_once(dirname(__FILE__).'/AirtimeIni.php');
|
||||
require_once(dirname(__FILE__).'/AirtimeInstall.php');
|
||||
|
||||
if(exec("whoami") != "root"){
|
||||
if(posix_geteuid() != 0){
|
||||
echo "Must be root user.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class AirtimeCheck {
|
|||
public static function ExitIfNotRoot()
|
||||
{
|
||||
// Need to check that we are superuser before running this.
|
||||
$user = exec("whoami");
|
||||
$user = posix_getlogin();
|
||||
if($user != "root" && $user != "www-data"){
|
||||
echo "Must be root user.\n";
|
||||
exit(1);
|
||||
|
|
|
@ -18,7 +18,7 @@ logging.disable(50)
|
|||
# add ch to logger
|
||||
logger.addHandler(ch)
|
||||
|
||||
if (commands.getoutput("whoami") != 'root'):
|
||||
if (posix_geteuid() != 0):
|
||||
print 'Must be a root user.'
|
||||
sys.exit()
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ array_filter($log_files, "file_exists");
|
|||
function exitIfNotRoot()
|
||||
{
|
||||
// Need to check that we are superuser before running this.
|
||||
if(exec("whoami") != "root"){
|
||||
if(posix_geteuid() != 0){
|
||||
echo "Must be root user.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
|||
function exitIfNotRoot()
|
||||
{
|
||||
// Need to check that we are superuser before running this.
|
||||
if(exec("whoami") != "root"){
|
||||
if(posix_geteuid() != 0){
|
||||
echo "Must be root user.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue