< Wallet::ACL::Krb5::Regex API | Russ Allbery > Software > wallet | Wallet::ACL::LDAP::Attribute::Root API > |
(Wallet ACL verifier for LDAP attribute compares)
my $verifier = Wallet::ACL::LDAP::Attribute->new; my $status = $verifier->check ($principal, "$attr=$value"); if (not defined $status) { die "Something failed: ", $verifier->error, "\n"; } elsif ($status) { print "Access granted\n"; } else { print "Access denied\n"; }
Wallet::ACL::LDAP::Attribute checks whether the LDAP record for the entry
corresponding to a principal contains an attribute with a particular
value. It is used to verify ACL lines of type ldap-attr
. The value of
such an ACL is an attribute followed by an equal sign and a value, and the
ACL grants access to a given principal if and only if the LDAP entry for
that principal has that attribute set to that value.
To use this object, several configuration parameters must be set. See Wallet::Config for details on those configuration parameters and information about how to set wallet configuration.
Creates a new ACL verifier. Opens and binds the connection to the LDAP server.
Returns true if PRINCIPAL is granted access according to ACL, false if not, and undef on an error (see DIAGNOSTICS below). ACL must be an attribute name and a value, separated by an equal sign (with no whitespace). PRINCIPAL will be granted access if its LDAP entry contains that attribute with that value.
Returns the error if check() returned undef.
The new() method may fail with one of the following exceptions:
Attempting to connect or bind to the LDAP server failed.
The required configuration parameters were not set. See Wallet::Config(3) for the required configuration parameters and how to set them.
Verifying an LDAP attribute ACL may fail with the following errors (returned by the error() method):
The LDAP compare to check for the required attribute failed. The attribute may have been misspelled, or there may be LDAP directory permission issues. This error indicates that PRINCIPAL's entry was located in LDAP, but the check failed during the compare to verify the attribute value.
Searching for PRINCIPAL (possibly after ldap_map_principal() mapping) failed. This is often due to LDAP directory permissions issues. This indicates a failure during the mapping of PRINCIPAL to an LDAP DN.
The ACL parameter to check() was malformed. Usually this means that
either the attribute or the value were empty or the required =
sign
separating them was missing.
There was an ldap_map_principal() function defined in the wallet configuration, but calling it for the PRINCIPAL argument failed.
The PRINCIPAL parameter to check() was undefined or the empty string.
Wallet::ACL(3), Wallet::ACL::Base(3), Wallet::Config(3), wallet-backend(8)
This module is part of the wallet system. The current version is available from <https://www.eyrie.org/~eagle/software/wallet/>.
Russ Allbery <eagle@eyrie.org>
< Wallet::ACL::Krb5::Regex API | Russ Allbery > Software > wallet | Wallet::ACL::LDAP::Attribute::Root API > |