summaryrefslogtreecommitdiffstats
path: root/src/back-sch.h
Commit message (Collapse)AuthorAgeFilesLines
* schema-compat: add support for timeout-based NSS queries with libsss_nss_idmapAlexander Bokovoy2017-11-031-1/+8
| | | | | | | | | | | | | | | | | | | | | | In case libsss_nss_idmap provides timeout-enabled NSS API, use it. This solves a problem of too long queries to an NSS backend with traditional POSIX NSS API. In case SSSD takes too long to respond to a query, corresponding 389-ds thread running schema-compat plugin would stuck waiting that response. It can lead to an exhaustion of 389-ds threads. A refactored interface to NSS backends is introduced with this commit. A backend API looks like an API an NSS plugin has to implement in glibc but also allows to handle timeout-based requests internally. If backend implements timeout-enabled calls, then backend_nss_set_timeout() function can be used to modify a per-context state. There is no need for a caller to know whether backend supports timeout-enabled calls because either way these calls are synchronous and backend choice is done at compile-time. schema-compat plugin uses 10 seconds as its default timeout. One can change it via 'slapi-nss-timeout' attribute in the plugin config entry.
* back-sch: do not clobber target of the pblock for idviewAlexander Bokovoy2016-08-071-1/+1
| | | | | | | | | | | When extracting idview all we care is the DN of new target. We don't really use the rewritten target as a string anymore, so there is no need to rewrite the string in the pblock. This fixes a bug when running with 389-ds 1.3.5.10+ which is more strict about modification of the values in pblock. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1360245
* Declare int backend_init_extop for reuse in plug-sch.cAlexander Bokovoy2016-06-201-0/+1
|
* slapi-nis: resolve IPA groups with fully qualified suffixAlexander Bokovoy2016-06-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With SSSD 1.14+ there is a logic change to handling of a default domain suffix. SSSD has two different formats to handle: the input and output. The input format is parsed into (name,domain) tuples with the re_expression option and the output is formatted with the full_name_format option. Because of the way SSSD used to store the usernames in sysdb, it was tied to the full_name_format option, just changing the output format changed the way the names are stored internally. SSSD changed the cache to always store names in a unified format (foo@bar) and use the full_name_format only for output, as it should be. This changed a logic of use_fully_qualified_names=True. It now mandates that the /input/ contains both the name and the domain part and then SSSD formats the output using the full_name_format option. The default_domain_suffix is a hack that just appends its value to an unqualified input, making all queries for "foo" into "foo@bar". In new SSSD if configuration contains: default_domain_suffix = win.domain full_name_format = $1 # only name then a request for "foo" will internally turn into "foo@win.domain" but return "foo" on the output. However, queries for IPA's foo will have to be qualified by the admin manually like "foo@ipa.domain" otherwise sssd doesn't know which foo you meant. Support this logic by querying associatedDomain attribute of the restricted bases of the data set. IPA stores this information in the $SUFFIX base dn (dc=example,dc=com) and configures slapi-nis with restricted base set to $SUFFIX (and the plugin config). While associatedDomain attribute is multivalued, the $SUFFIX object always has a single value corresponding to the IPA domain name that is the same as SSSD domain suffix.
* slapi-nis should allow password update on a virtual entryThierry Bordaz2016-06-201-0/+16
| | | | | | | | | | | | | During password modification ext. op (1.3.6.1.4.1.4203.1.11.1), if the target entry is in the compat tree, slapi-nis should remap the entry to the real entry. This needs to be done in a pre-op extop that calls the callback function handling a given OID. The password mod. callback does a reverse mapping of extop USERID and set it in SLAPI_TARGET_SDN. https://fedorahosted.org/freeipa/ticket/5955
* slapi-nis: delay sending responses from compat tree after map searchAlexander Bokovoy2015-11-191-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When slapi-nis plugin responds on a search query, it holds read lock for the internal structure called 'map cache'. The map cache lock can also be taken for write when modification would be required like responding to DELETE, ADD, or MODIFY operations. As result of the lock semantics, write lock owner is blocked until all read lock owners release their locks. This is generally not a problem but when readers sent out LDAP query results, they call into SLAPI function that might take long time to send out the data due to external reasons (network latencies, clients being blocked, etc) and all this time map cache is locked for write operations. When Kerberos KDC issues a TGT, it needs to modify few Kerberos-related attributes in the principal's LDAP entry. These updates are generating MOD operations visible by slapi-nis plugin which triggers re-scan of map cache to potentially replace the affected entries. To perform potential replacement, slapi-nis has to take a write lock and be blocked by outstanding readers. Therefore, it is possible to encounter a situation where an LDAP client uses SASL GSSAPI authentication and existing Kerberos ticket did expire in a course of outstanding search request. According to LDAPv3 protocol specification, an LDAP client must perform re-negotiation before reading any outstanding PDUs. It would ask Kerberos KDC for a new (or renewed) TGT, that would cause MOD updates for the primary tree which is tracked for changes by slapi-nis. These changes would be blocked by a slapi-nis reader as the client cannot finish reading outstanding PDUs yet. To solve this problem, we avoid sending LDAP entries while keeping map cache lock. Instead, we generate a linked list of copies of entries which will be sent out. To allow sharing of entries between multiple parallel queries, we hash the entry and reference the cached entry in the linked list with increased reference count. Once entry is actually sent, its reference count decreased and on reaching zero it is removed from the hash. The entry in the hash table might become outdated. This is detected by comparing both modifyTimestamp and entryUSN values of the entry to be sent and entry in the hash table. If new version of the entry is different, hash table's entry reference is replaced with a new copy. The old entry is not removed because it is still referenced by some outstanding query processing. Thus, the hash table always references the most recent version of an entry but there might be multiple copies in possesion of the linked lists from the separate parallel queries. An entry sharing via hash table can be disabled by setting slapi-entry-cache: 0 in the definition, cn=Schema Compatibility,cn=plugins,cn=config Resolves: rhbz#1273587 https://bugzilla.redhat.com/show_bug.cgi?id=1273587
* schema-compat: use libnss_sss.so.2 explicitly to resolve trusted domain ↵Alexander Bokovoy2015-03-261-0/+5
| | | | | | | | | | | | users via NSS When Schema Compatibility plugin is configured to enumerate users and groups from Active Directory domains trusted by FreeIPA, use nss_sss module directly instead of following nsswitch.conf configuration. The issue with nsswitch.conf configuration is in the fact that for each request all modules in NSS chain are processed while only one of them is responsible for users from trusted Active Directory domains, namely, nss_sss.
* schema-compat: support ID overrides in bind callbackAlexander Bokovoy2014-10-301-0/+4
| | | | | | | | If RDN of the bind DN is overridden within the ID view, rewrite the target to use original value of the uid attribute. If original uid attribute is not available, fail the search and thus the whole bind request by claiming that bind DN does not exist.
* Add support for FreeIPA ID viewsAlexander Bokovoy2014-10-101-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FreeIPA ID views allow to override POSIX attributes for certain users and groups. A support is added to allow using specific ID view when serving compatibility tree. Each user or group entry which has an override in the view is amended with the overridden values from the view before served out to the LDAP client. A view to use is specified as a part of base DN: cn=<view>,cn=views,cn=compat,$SUFFIX where cn=compat,$SUFFIX is the original compatibility tree base DN. Each entry, when served through the view, gets new DN rewritten to specify the view. Additionally, if override in the view changes uid (for users) or cn (for groups) attribute, the entry's RDN is changed accordingly. For groups memberUid attribute is modified as well in case there is an override in the view that changes uid value of that member. FreeIPA ID views support overrides for users of trusted Active Directory domains. In case of a trusted AD domain's user or group is returned via compatibility tree, view overrides are applied in two stages: 1. SSSD applies default view for AD users 2. slapi-nis applies explicitly specified (host-specific) view on top of the entry returned by SSSD Thus, slapi-nis does not need to apply default view for AD users and if there are no host-specific views in use, there is no need to specify a view in the base DN, making overhead of a default view for AD users lower.
* Explicitly track the sources of cached entriesNalin Dahyabhai2013-08-121-0/+4
|
* Renames and fix a memory leakNalin Dahyabhai2013-08-121-6/+6
| | | | | | | | Rename backend_staged_data to backend_staged_search. Fix some formatting. Change how we walk the list of entries retrieved using a staged search so that if the map's been removed since the search was staged, we still free the temporary entry structures.
* Collapse a pair of blank linesNalin Dahyabhai2013-08-121-1/+0
|
* back-sch: move structure definitions to back-sch.h to share with other codeAlexander Bokovoy2013-08-071-0/+95
| | | | NSSWITCH supporting code needs access to the schema-compat structures
* - drop backend-specific header filesNalin Dahyabhai2008-07-011-34/+0
|
* - start adding an sch backendNalin Dahyabhai2008-06-301-0/+34
- start factoring out the backend logic where the sch and nis backends overlap