Logical Operators

The Privilege Management for Unix and Linux Security Policy Scripting Language supports a standard set of logical operators.

Operator Action
&&

AND

In Privilege Management for Unix and Linux versions 3.2 and earlier, logical expressions containing the && operator are evaluated before determining the result.

Beginning with Privilege Management for Unix and Linux version 3.5, logical expressions containing the && operator stop evaluation when a false value is found.

||

OR

In Privilege Management for Unix and Linux versions 3.2 and earlier, logical expressions containing the || operator are evaluated before determining the result.

Beginning with Privilege Management for Unix and Linux version 3.5, logical expressions containing the || operators stop evaluation when a true value is found.

! NOT

AND Operator

The AND operator ( && ) considers the relationship between two values. Both values must be true for a true result to be returned. If both values are true, an integer value of 1 (true) is returned. Otherwise, an integer value of 0 (false) is returned.

In Privilege Management for Unix and Linux 3.2 and earlier, all parts of logical expressions containing && operators are evaluated before determining the result.

Beginning with Privilege Management for Unix and Linux 3.5, logical expressions containing && operators are evaluated from left to right until their truth can be determined (like in the C language).

if (UserOkay && Bkup) accept;

If both UserOkay and Bkup are non-zero, the current task request is accepted.

OR Operator

The OR operator ( || ) considers the relationship between two values. At minimum, one of the two values must be true for a true result to be returned. If either the first or second value is true, an integer value of 1 (true) is returned. Otherwise, an integer value of 0 (false) is returned.

In Privilege Management for Unix and Linux 3.2 and earlier, all parts of logical expressions that contain || operators are evaluated before determining the result.

Beginning with Privilege Management for Unix and Linux 3.5, logical expressions that contain || operators are evaluated from left to right until their truth can be determined (like in the C language).

if (UserOkay || Bkup) accept;

If either UserOkay or Bkup are non-zero, the current task request is accepted.

NOT Operator

The NOT operator ( ! ) takes the inverse of a value. If a value is false, an integer value of 1 (true) is returned. Otherwise, an integer value of 0 (false) is returned.

if (!UserOkay) reject;

If UserOkay is equal to 0, the current task request is rejected.