summaryrefslogtreecommitdiffstats
path: root/src/responder
Commit message (Collapse)AuthorAgeFilesLines
* cache_req: delete old codePavel Březina2016-10-202-1886/+0
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* cache_req: switch to new codePavel Březina2016-10-207-7/+7
| | | | | | | This patch switch the old switch-based cache req code to the new plugin-based. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* cache_req: move from switch to plugins, add pluginsPavel Březina2016-10-2015-0/+2019
| | | | | | This patch adds all existing functionality into plugins. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* cache_req: move from switch to plugins; add logicPavel Březina2016-10-205-0/+1295
| | | | | | | | | | | | | | | cache_req grown quite big from the original code and it turned out that using switch statements to branch code for different cases makes the code quite hard to read and further extend and any modification to the logic itself is difficult. This patch changes the switch statements to plugins with small functions and separates logic into multiple modules. This gives us better control over the code and improves readability and maintainability while keeping code duplication to minimum. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Petr Cech <pcech@redhat.com>
* nss: allow UPNs in SSS_NSS_GETSIDBYNAME and SSS_NSS_GETORIGBYNAMESumit Bose2016-10-101-10/+66
| | | | | | | | | | | | | | When adding support for UPNs, email addresses and aliases the SSS_NSS_GETSIDBYNAME and SSS_NSS_GETORIGBYNAME request were forgotten. This patch adds the missing support because it might be irritating if getpwnam() can resolve the name but the other requests fail. The same logic as for the plain user lookup is used, this add some code duplication which is expected to be removed when the nss responder will be switched to use the new cache_req code. Resolves https://fedorahosted.org/sssd/ticket/3194 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* SECRETS: Add a configurable limit of secrets that can be storedFabiano Fidêncio2016-10-055-0/+65
| | | | | | | Related: https://fedorahosted.org/sssd/ticket/3169 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* SECRETS: Use HTTP error code 504 when a proxy server cannot be reachedJakub Hrozek2016-10-043-1/+6
| | | | | | | | | | | Previously, a generic 500 error code was returned. This patch adds a new error message on a failure to contact the proxy server and returns 504, "Gateway timeout" instead. Resolves: https://fedorahosted.org/sssd/ticket/3212 Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
* SECRETS: Fix a typo in function nameJakub Hrozek2016-10-041-7/+7
| | | | | | s/filed/field/ Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
* SECRETS: Use a better data type for retJakub Hrozek2016-10-041-2/+2
| | | | | | | Normally we use errno_t for return codes and size_t for counting objects. Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
* SECRETS: Add DEBUG messages to the sssd-secrets providerJakub Hrozek2016-10-044-59/+441
| | | | | | | | | | Previously, it was not possible to follow the flow of the secrets responder or find out what went wrong on error. This patch adds DEBUG messages so that most failure cases have their own message. At the same time, running sssd-secrets with debug_level <= 3 does not emit any messages at all. Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
* SECRETS: Add a configurable depth limit for nested containersFabiano Fidêncio2016-10-034-0/+41
| | | | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/3168 Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* SECRETS: Use a tmp_context on local_db_check_containers()Fabiano Fidêncio2016-10-031-7/+23
| | | | | | | | | Otherwise the struct ldb_dn will be hanging on the mem_ctx till it gets freed. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* SECRETS: Make functions from local.c staticFabiano Fidêncio2016-10-031-43/+43
| | | | | | | | There's no reason for those functions to be exposed. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* IFP: expose user and group unique IDs through DBusThomas Equeter2016-09-228-0/+60
| | | | | | | | This adds a uniqueID property on User and Group InfoPipe objects. It has a useful value on AD- and IPA-backed domains. For Active Directory, this is the GUID. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* Remove double semicolon at the end of lineLukas Slebodnik2016-09-211-1/+1
| | | | Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* NSS: Fix offline resolution of netgroupsJakub Hrozek2016-09-211-0/+9
| | | | | | | | | | | If talking to the Data Provider failed, we never re-tried looking into the cache. We should consult the cache on DP failures and return cached results, if possible. Resolves: https://fedorahosted.org/sssd/ticket/3123 Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* AUTOFS: Fix offline resolution of autofs mapsJakub Hrozek2016-09-211-4/+12
| | | | | | | | | | | If talking to the Data Provider failed, we never re-tried looking into the cache. We should consult the cache on DP failures and return cached results, if possible. Resolves: https://fedorahosted.org/sssd/ticket/3080 Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* SECRETS: Don't remove a container when it has childrenFabiano Fidêncio2016-09-161-2/+31
| | | | | | | | | | | | | | | | | | Let's return and log an error in case the container to be removed has children. The approach taken introduced at least one new search in every delete operation. As far as I understand searching in the BASE scope is quite cheap and that's the reason I decided to just do the search in the ONELEVEL scope when the requested to be deleted dn is for sure a container. Resolves: https://fedorahosted.org/sssd/ticket/3167 Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* p11: return a fully-qualified nameSumit Bose2016-09-161-11/+9
| | | | | | Related to https://fedorahosted.org/sssd/ticket/3165 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* p11: only set PKCS11_LOGIN_TOKEN_NAME if gdm-smartcard is usedSumit Bose2016-09-161-13/+20
| | | | | | Resolves https://fedorahosted.org/sssd/ticket/3165 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* SECRETS: Search by the right type when checking containersFabiano Fidêncio2016-09-131-1/+2
| | | | | | | | | | | | | | | We've been searching for the wrong type ("simple") in local_db_check_containers(), which always gives us a NULL result. Let's introduce the new LOCAL_CONTAINER_FILTER and do the search for the right type ("container") from now on. Resolves: https://fedorahosted.org/sssd/ticket/3137 Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* SECRETS: Make reading the config options more uniformJakub Hrozek2016-08-301-1/+1
| | | | | | | | One of confdb_get_ calls in sec_get_config() used a variable referenced from rctx, the other used a hardcoded string. Use one of them on both places instead. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* SECRETS: Make internal function staticJakub Hrozek2016-08-301-1/+2
| | | | Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* SECRETS: Return ENOENT when_deleting a non-existent secretFabiano Fidêncio2016-08-261-7/+2
| | | | | | | | | | | | For this, just make use of the sysdb_error_to_errno() function. Resolves: https://fedorahosted.org/sssd/ticket/3125 Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* SECRETS: Use sss_atomic_read/write for better readabilityJakub Hrozek2016-08-171-3/+3
| | | | | | | | | sss_atomic_read_s and sss_atomic_write_s are macro-wrappers around sss_atomic_io_s but it's easier to follow the code with the read/write vairants used directly. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Fabiano Fidêncio <fabiano@fidencio.org>
* NSS: Remove unused functionsPavel Březina2016-08-163-125/+0
| | | | | | | When removing the old data provider I noticed that those functions are not used at all. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* DP: Remove old data provider interfacePavel Březina2016-08-1617-114/+249
| | | | | | | | | Reverse data provider interface is moved to a better location in NSS responder. All responders now can have an sbus interface defined per data provider connection. The unused old data provider interface is removed. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* sssctl: print active server and server listPavel Březina2016-08-166-1/+131
| | | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/3069 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: add utility function to simplify message and reply handlingPavel Březina2016-08-161-73/+12
| | | | | | | | | | | This patch adds the ability to hook DBusMessage to a talloc context to remove the need of calling dbus_message_unref(). It also provides an automatical way to detect error in a reply so the caller does not need to parse it manually and the whole code around DBusError can be avoided. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* sbus: add sbus_request_reply_error()Pavel Březina2016-08-161-8/+4
| | | | | | | | | | | | | This simplifies error handling in sbus requests since we avoid creating DBusError and checking for NULL manually. It removes few lines of code. This patch does not replace all calls to sbus_request_fail_and_finish since sometimes it is desirable to create the error manualy. But it replaces it in most recent places. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* rdp: add ability to forward reply to the client requestPavel Březina2016-08-163-138/+220
| | | | | | | | | In cases where the InfoPipe servers just as a middle-man between the DataProvider and a client we can simply forward the reply reducing amount of coded needed in the InfoPipe. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* NSS: Use correct name for invalidating memory cacheLukas Slebodnik2016-08-102-15/+18
| | | | | | | | | | | | | After refactoring of sysdb, we get and internal fully qualified name from backend in org.freedesktop.sssd.dataprovider_rev.initgrCheck Previously we got short name and we created fq name in nss_update_initgr_memcache. Memory cache still need to use short names if it was specified. This patch uses right name in different places. Reviewed-by: Petr Cech <pcech@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* NSS: Do not check local users with disabled local_negative_timeoutLukas Slebodnik2016-08-091-18/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sssd_nss can set different negative timeout for local users and groups. However, checking whether user/group is local is quite expensive operation. We can avoid such operations if local_negative_timeout is not set. This fix improve performance(40%) of lookup non-existing entries in offline mode and with disabled local_negative_timeout. sh$ cat pok.sh for i in {1..10000}; do getent passwd -s sss temp$i getent group -s sss temp$i done #without patch sh $time /bin/bash pok.sh real 0m41.534s user 0m3.580s sys 0m14.202s #with patch sh $time /bin/bash pok.sh real 0m26.686s user 0m3.292s sys 0m13.165s Resolves: https://fedorahosted.org/sssd/ticket/3122 Reviewed-by: Petr Cech <pcech@redhat.com>
* PAM: Do not act on ldb_message in case of a failureJakub Hrozek2016-08-081-15/+18
| | | | Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* RESPONDERS: Pass errno to strerror() when SELINUX_getpeercon() failsFabiano Fidêncio2016-08-041-0/+1
| | | | | | | | | | | Currently ret, which is -1, is passed to strerror() instead of errno. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Related: https://fedorahosted.org/sssd/ticket/3094 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* RESPONDERS: Show a bit more info in case of SELINUX_getpeercon() failureFabiano Fidêncio2016-08-041-0/+2
| | | | | | | | | | | | Be explicit that it may happen when SELinux is disabled and also suggest to enable SELinux. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Related: https://fedorahosted.org/sssd/ticket/3094 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* RESPONDERS: Decrease debug level for failures in SELINUX_getpeercon()Fabiano Fidêncio2016-08-041-2/+2
| | | | | | | | | | | | As this is not FATAL and may happen when SELinux is disabled, let's just decrease the debug level to MINOR_FAILURE Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Related: https://fedorahosted.org/sssd/ticket/3094 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* PAM: Fix domain for UPN based lookupsSumit Bose2016-07-291-0/+17
| | | | | | | Since sysdb_search_user_by_upn() searches the whole cache we have to set the domain so that it matches the result. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* NSS: use different neg cache name for UPN searchesSumit Bose2016-07-291-2/+10
| | | | | | | | | | If Kerberos principals or email address have the same domain suffix as the domain itself the first user lookup by name might have already added the name to the negative cache and the second lookup by UPN/email will skip the domain because of the neg cache entry. To avoid this a special name with a '@' prefix is used here. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* PAM: continue with UPN/email search if name was not foundSumit Bose2016-07-291-0/+39
| | | | | | | | Currently we only search for UPNs if the domain part of the name was not know, with Kerberos aliases and email addresses we have to do this even if the domain name is a know domain. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* NSS: continue with UPN/email search if name was not foundSumit Bose2016-07-291-6/+6
| | | | | | | | Currently we only search for UPNs if the domain part of the name was not know, with Kerberos aliases and email addresses we have to do this even if the domain name is a know domain. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* NSS: add user email to fill_orig()Sumit Bose2016-07-291-0/+2
| | | | | | | The IPA server must send the email address of a user to the clients to allow login by email. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* views: properly override group member namesSumit Bose2016-07-291-1/+6
| | | | | | Resolves https://fedorahosted.org/sssd/ticket/2948 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* Amend debug messages after failure of unlinkLukas Slebodnik2016-07-252-1/+3
| | | | | | | | Some messages did not have errno or name of problematic file. There was also improper use of negative value. The function strerror was called with -1 instead of errno Reviewed-by: Petr Čech <pcech@redhat.com>
* SECRETS: Log message for failures with removing fileLukas Slebodnik2016-07-221-1/+7
| | | | | | | Type: Unchecked return value Reported by coverity Reviewed-by: Petr Čech <pcech@redhat.com>
* SSH-CERT: always initialize cert_verify_optsSumit Bose2016-07-071-8/+6
| | | | | | | | | Currently cert_verify_opts is only initialized when there is an option in the config file. This might cause issues later when the struct is accessed. Since parse_cert_verify_opts() can already handle an empty option the additional check is not needed at all. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* Fix packet size calculation in sss_packet_newNikolai Kondrashov2016-07-071-1/+1
| | | | | | | | Use division instead of modulo while rounding the created packet size up to a multiple of SSSSRV_PACKET_MEM_SIZE in sss_packet_new. This fixes potentially packet buffer overflows with certain body sizes. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* fix some 'might be used uninitialized' warningsSumit Bose2016-07-071-0/+2
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* SUDO: Add more low-level tracing messagesJakub Hrozek2016-07-071-3/+10
| | | | | | | Just adds more debugging messages that are handy in seeing what gets passed between sudo responder and client. Reviewed-by: Sumit Bose <sbose@redhat.com>
* sudo: solve problems with fully qualified namesPavel Březina2016-07-071-42/+227
| | | | | | | | | | | | | | | | | | | | | | | | | | | sudo expects the same name in sudo rule as login name. Therefore if fully qualified name is used or even enforced by setting use_fully_qualified_names to true or by forcing default domain with default_domain_suffix sssd is able to correctly return the rules but sudo can't match the user with contect of sudoUser attribute since it is not qualified. This patch changes the rules on the fly to avoid using names at all. We do this in two steps: 1. We fetch all rules that match current user name, id or groups and replace sudoUser attribute with sudoUser: #uid. 2. We fetch complementry rules that contain netgroups since it is expected we don't have infromation about existing netgroups in cache, sudo still needs to evaluate it for us if needed. This patch also remove test for sysdb_get_sudo_filter since it wasn't sufficient anyway and I did not rewrite it since I don't thing it is a good thing to have filter tests that depends on exact filter order. Resolves: https://fedorahosted.org/sssd/ticket/2919 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>