check for uid/gid or username/groupname correctly in config-xml files, fixes #1642

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2016-08-01 08:47:45 +02:00
parent f1b7d731bd
commit aa76ae4ddc
6 changed files with 12 additions and 11 deletions

View File

@@ -71,7 +71,7 @@ class ConfigDaemon {
* @var string * @var string
*/ */
public $title; public $title;
/** /**
* Whether this is the default daemon of the service-category * Whether this is the default daemon of the service-category
* @var boolean * @var boolean
@@ -321,7 +321,7 @@ class ConfigDaemon {
if (array_key_exists('chown', $attributes)) { if (array_key_exists('chown', $attributes)) {
$return[] = array('type' => 'command', 'content' => 'chown ' . $attributes['chown'] . ' "' . $this->_parseContent($attributes['name']) . '"', 'execute' => "post"); $return[] = array('type' => 'command', 'content' => 'chown ' . $attributes['chown'] . ' "' . $this->_parseContent($attributes['name']) . '"', 'execute' => "post");
} }
// If we have more than 1 element, we want to group this stuff for easier processing later // If we have more than 1 element, we want to group this stuff for easier processing later
if (count($return) > 1) { if (count($return) > 1) {
$return = array('type' => 'file', 'subcommands' => $return, 'name' => $this->_parseContent($attributes['name'])); $return = array('type' => 'file', 'subcommands' => $return, 'name' => $this->_parseContent($attributes['name']));
@@ -399,10 +399,11 @@ class ConfigDaemon {
case "false": if ($order == true) { $return = -1; }; break; case "false": if ($order == true) { $return = -1; }; break;
case "true": if ($order == false) { $return = -1; }; break; case "true": if ($order == false) { $return = -1; }; break;
case "notempty": if ($order == "") { $return = -1; }; break; case "notempty": if ($order == "") { $return = -1; }; break;
case "userexists": if (posix_getpwnam($order) === false) { $return = -1; }; break; case "userexists": if (posix_getpwuid($order) === false) { $return = -1; }; break;
case "groupexists": if (posix_getgrnam($order) === false) { $return = -1; }; break; case "groupexists": if (posix_getgrgid($order) === false) { $return = -1; }; break;
case "usernotexists": if (is_array(posix_getpwnam($order))) { $return = -1; }; break; case "usernotexists": if (is_array(posix_getpwuid($order))) { $return = -1; }; break;
case "groupnotexists": if (is_array(posix_getgrnam($order))) { $return = -1; }; break; case "groupnotexists": if (is_array(posix_getgrgid($order))) { $return = -1; }; break;
case "usernamenotexists": if (is_array(posix_getpwnam($order))) { $return = -1; }; break;
case "equals": $return = (isset($attributes['value']) && $attributes['value'] == $order ? 0 : -1); break; case "equals": $return = (isset($attributes['value']) && $attributes['value'] == $order ? 0 : -1); break;
} }
return $return; return $return;

View File

@@ -3875,7 +3875,7 @@ aliases: files
<commands index="3"> <commands index="3">
<visibility mode="true">{{settings.phpfpm.enabled_ownvhost}} <visibility mode="true">{{settings.phpfpm.enabled_ownvhost}}
</visibility> </visibility>
<visibility mode="usernotexists">{{settings.phpfpm.vhost_httpuser}} <visibility mode="usernamenotexists">{{settings.phpfpm.vhost_httpuser}}
</visibility> </visibility>
<command><![CDATA[groupadd -f {{settings.phpfpm.vhost_httpgroup}}]]></command> <command><![CDATA[groupadd -f {{settings.phpfpm.vhost_httpgroup}}]]></command>
<command><![CDATA[useradd -s /bin/false -g {{settings.phpfpm.vhost_httpgroup}} {{settings.phpfpm.vhost_httpuser}}]]></command> <command><![CDATA[useradd -s /bin/false -g {{settings.phpfpm.vhost_httpgroup}} {{settings.phpfpm.vhost_httpuser}}]]></command>

View File

@@ -4696,7 +4696,7 @@ aliases: files
<commands index="3"> <commands index="3">
<visibility mode="true">{{settings.phpfpm.enabled_ownvhost}} <visibility mode="true">{{settings.phpfpm.enabled_ownvhost}}
</visibility> </visibility>
<visibility mode="usernotexists">{{settings.phpfpm.vhost_httpuser}} <visibility mode="usernamenotexists">{{settings.phpfpm.vhost_httpuser}}
</visibility> </visibility>
<command><![CDATA[groupadd -f {{settings.phpfpm.vhost_httpgroup}}]]></command> <command><![CDATA[groupadd -f {{settings.phpfpm.vhost_httpgroup}}]]></command>
<command><![CDATA[useradd -s /bin/false -g {{settings.phpfpm.vhost_httpgroup}} {{settings.phpfpm.vhost_httpuser}}]]></command> <command><![CDATA[useradd -s /bin/false -g {{settings.phpfpm.vhost_httpgroup}} {{settings.phpfpm.vhost_httpuser}}]]></command>

View File

@@ -1695,7 +1695,7 @@ aliases: files
<commands index="3"> <commands index="3">
<visibility mode="true">{{settings.phpfpm.enabled_ownvhost}} <visibility mode="true">{{settings.phpfpm.enabled_ownvhost}}
</visibility> </visibility>
<visibility mode="usernotexists">{{settings.phpfpm.vhost_httpuser}} <visibility mode="usernamenotexists">{{settings.phpfpm.vhost_httpuser}}
</visibility> </visibility>
<command><![CDATA[groupadd -f {{settings.phpfpm.vhost_httpgroup}}]]></command> <command><![CDATA[groupadd -f {{settings.phpfpm.vhost_httpgroup}}]]></command>
<command><![CDATA[useradd -s /bin/false -g {{settings.phpfpm.vhost_httpgroup}} {{settings.phpfpm.vhost_httpuser}}]]></command> <command><![CDATA[useradd -s /bin/false -g {{settings.phpfpm.vhost_httpgroup}} {{settings.phpfpm.vhost_httpuser}}]]></command>

View File

@@ -1703,7 +1703,7 @@ aliases: files
<commands index="3"> <commands index="3">
<visibility mode="true">{{settings.phpfpm.enabled_ownvhost}} <visibility mode="true">{{settings.phpfpm.enabled_ownvhost}}
</visibility> </visibility>
<visibility mode="usernotexists">{{settings.phpfpm.vhost_httpuser}} <visibility mode="usernamenotexists">{{settings.phpfpm.vhost_httpuser}}
</visibility> </visibility>
<command><![CDATA[groupadd -f {{settings.phpfpm.vhost_httpgroup}}]]></command> <command><![CDATA[groupadd -f {{settings.phpfpm.vhost_httpgroup}}]]></command>
<command><![CDATA[useradd -s /bin/false -g {{settings.phpfpm.vhost_httpgroup}} {{settings.phpfpm.vhost_httpuser}}]]></command> <command><![CDATA[useradd -s /bin/false -g {{settings.phpfpm.vhost_httpgroup}} {{settings.phpfpm.vhost_httpuser}}]]></command>

View File

@@ -5504,7 +5504,7 @@ aliases: files
<commands index="3"> <commands index="3">
<visibility mode="true">{{settings.phpfpm.enabled_ownvhost}} <visibility mode="true">{{settings.phpfpm.enabled_ownvhost}}
</visibility> </visibility>
<visibility mode="usernotexists">{{settings.phpfpm.vhost_httpuser}} <visibility mode="usernamenotexists">{{settings.phpfpm.vhost_httpuser}}
</visibility> </visibility>
<command><![CDATA[groupadd -f {{settings.phpfpm.vhost_httpgroup}}]]></command> <command><![CDATA[groupadd -f {{settings.phpfpm.vhost_httpgroup}}]]></command>
<command><![CDATA[useradd -s /bin/false -g {{settings.phpfpm.vhost_httpgroup}} {{settings.phpfpm.vhost_httpuser}}]]></command> <command><![CDATA[useradd -s /bin/false -g {{settings.phpfpm.vhost_httpgroup}} {{settings.phpfpm.vhost_httpuser}}]]></command>