Skip to content

Commit

Permalink
(mvc/acl) validate before use of system tag
Browse files Browse the repository at this point in the history
  • Loading branch information
AdSchellevis committed Nov 4, 2015
1 parent 48995d1 commit 249c74c
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/opnsense/mvc/app/models/OPNsense/Core/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,24 @@ private function init()

// gather user / group data from config.xml
$config = Config::getInstance()->object() ;
foreach ($config->system->children() as $key => $node) {
if ($key == 'user') {
$this->legacyUsers[$node->name->__toString()] = array() ;
$this->legacyUsers[$node->name->__toString()]['uid'] = $node->uid->__toString();
$this->legacyUsers[$node->name->__toString()]['groups'] = array();
$this->legacyUsers[$node->name->__toString()]['priv'] = array();
foreach ($node->priv as $priv) {
if (substr($priv, 0, 5) == 'page-') {
if (array_key_exists($priv->__toString(), $pageMap)) {
$this->legacyUsers[$node->name->__toString()]['priv'][] =
$pageMap[$priv->__toString()];
if ($config->system != null) {
foreach ($config->system->children() as $key => $node) {
if ($key == 'user') {
$this->legacyUsers[$node->name->__toString()] = array() ;
$this->legacyUsers[$node->name->__toString()]['uid'] = $node->uid->__toString();
$this->legacyUsers[$node->name->__toString()]['groups'] = array();
$this->legacyUsers[$node->name->__toString()]['priv'] = array();
foreach ($node->priv as $priv) {
if (substr($priv, 0, 5) == 'page-') {
if (array_key_exists($priv->__toString(), $pageMap)) {
$this->legacyUsers[$node->name->__toString()]['priv'][] =
$pageMap[$priv->__toString()];
}
}
}
} elseif ($key == 'group') {
$groupmap[$node->name->__toString()] = $node ;
}
} elseif ($key == 'group') {
$groupmap[$node->name->__toString()] = $node ;
}
}

Expand Down

8 comments on commit 249c74c

@fichtner
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue has recently been reported here: https://forum.opnsense.org/index.php?topic=1685.0

We wait for feedback now to see if this has been properly resolved. :)

@AdSchellevis
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the config has no system section, there definitely is something wrong with the config.xml... The additional check is harmless, but I do think the user should have more issues when he experiences this one (no users, etc).

@fichtner
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That did not seem to be the case. He was just not able to configure the OPT1 device. But maybe I missed the correct line?!

@fichtner
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it was the exact line. Let's see what he reports back. The timing in bug / fix seems to align in this case.

@AdSchellevis
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange. Your right, let's wait for feedback.

@bringha1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am the originator of the post mentioned above ...
Before I Update to 15.7.19: Is it sufficient to patch the file only for testing ?

@fichtner
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bringha1 let me answer on the forum in a few minutes

@bringha1
Copy link

@bringha1 bringha1 commented on 249c74c Nov 15, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.