summaryrefslogtreecommitdiffstats
path: root/src/util/sss_krb5.c
Commit message (Collapse)AuthorAgeFilesLines
* krb5 utils: add sss_krb5_realm_has_proxy()Sumit Bose2015-08-051-0/+57
| | | | | Reviewed-by: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* Add missing new lines to debug messagesLukas Slebodnik2015-03-171-5/+5
| | | | Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* krb5: add wrapper for krb5_kt_have_content()Sumit Bose2014-12-071-0/+40
| | | | | | | | | krb5_kt_have_content() was introduced in MIT Kerberos 1.11. For older platforms this patch adds sss_krb5_kt_have_content() as a wrapper. Resolves https://fedorahosted.org/sssd/ticket/2518 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* krb5: Check return value of sss_krb5_princ_realmLukas Slebodnik2014-11-281-0/+12
| | | | | | | | | | sss_krb5_princ_realm set output parameter realm to NULL and len to 0 in case of failure. Clang static analysers reported warning "Null pointer passed as an argument to a 'nonnull' parameter" in function match_principal. It was possible, that realm_name with value NULL could be used in strncmp. Reviewed-by: Pavel Reichl <preichl@redhat.com>
* krb5: Check return value of krb5_principal_get_realmLukas Slebodnik2014-11-281-2/+9
| | | | | | | Function krb5_principal_get_realm can return NULL an it would case segfault in function strlen. Reviewed-by: Pavel Reichl <preichl@redhat.com>
* LDAP: Move sss_krb5_verify_keytab_ex to ldap_childJakub Hrozek2014-11-051-76/+0
| | | | | | | | The function was called from one place only, so it makes no sense to keep it in a shared module. Moreover, the function should only be called from code that runs as root. Reviewed-by: Michal Židek <mzidek@redhat.com>
* krb5: make get_primary() a public callStephen Gallagher2014-09-291-3/+7
| | | | | | | This patch changes get_primary() into sss_krb5_get_primary() so it can be used by the AD provider to get the sAMAccountName from the hostname. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* KRB5: Print a verbose error message on failure reading the keytabJakub Hrozek2014-04-231-0/+6
| | | | | | | | | | | | krb5_kt_resolve() returns 0 when a non-existent keytab is read, which means there was no FATAL-level DEBUG message printed to the user in case the keytab was missing completely and users had to enable more verbose debugging to diagnose failure to start up. This patch adds both the verbose DEBUG message as well as a syslog message. Reviewed-by: Michal Židek <mzidek@redhat.com>
* Update DEBUG* invocations to use new levelsNikolai Kondrashov2014-02-121-27/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a script to update DEBUG* macro invocations, which use literal numbers for levels, to use bitmask macros instead: grep -rl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e 'use strict; use File::Slurp; my @map=qw" SSSDBG_FATAL_FAILURE SSSDBG_CRIT_FAILURE SSSDBG_OP_FAILURE SSSDBG_MINOR_FAILURE SSSDBG_CONF_SETTINGS SSSDBG_FUNC_DATA SSSDBG_TRACE_FUNC SSSDBG_TRACE_LIBS SSSDBG_TRACE_INTERNAL SSSDBG_TRACE_ALL "; my $text=read_file(\*STDIN); my $repl; $text=~s/ ^ ( .* \b (DEBUG|DEBUG_PAM_DATA|DEBUG_GR_MEM) \s* \(\s* )( [0-9] )( \s*, ) ( \s* ) ( .* ) $ / $repl = $1.$map[$3].$4.$5.$6, length($repl) <= 80 ? $repl : $1.$map[$3].$4."\n".(" " x length($1)).$6 /xmge; print $text; ' < "$f.orig" > "$f" rm "$f.orig" done Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Make DEBUG macro invocations variadicNikolai Kondrashov2014-02-121-55/+55
| | | | | | | | | | | | | | | | | | | | | | | | Use a script to update DEBUG macro invocations to use it as a variadic macro, supplying format string and its arguments directly, instead of wrapping them in parens. This script was used to update the code: grep -rwl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e \ 'use strict; use File::Slurp; my $text=read_file(\*STDIN); $text=~s#(\bDEBUG\s*\([^(]+)\((.*?)\)\s*\)\s*;#$1$2);#gs; print $text;' < "$f.orig" > "$f" rm "$f.orig" done Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Fix a trivial typoJakub Hrozek2013-12-091-1/+1
|
* krb5: Remove unused helper functionsSimo Sorce2013-09-091-80/+0
| | | | | | | these functions are not needed anymore. Related: https://fedorahosted.org/sssd/ticket/2061
* krb5: Remove unused functionSimo Sorce2013-09-091-30/+0
| | | | | Related: https://fedorahosted.org/sssd/ticket/2061
* krb5: Make check_for_valid_tgt() staticSimo Sorce2013-09-091-72/+0
| | | | | | | check_for_valid_tgt() is used exclusively in krb5_uitls.c so move it there. Resolves: https://fedorahosted.org/sssd/ticket/2061
* KRB5: Add support for KEYRING cache typeStephen Gallagher2013-08-271-0/+14
| | | | https://fedorahosted.org/sssd/ticket/2036
* KRB5: Add low-level debugging to sss_get_ccache_name_for_principalStephen Gallagher2013-08-271-0/+6
|
* Fix memory leak insss_krb5_get_error_messageLukas Slebodnik2013-08-221-0/+1
| | | | warning reported by cppcheck
* KRB5: Add new #define for collection cache typesStephen Gallagher2013-08-221-8/+8
| | | | | | Kerberos now supports multiple types of collection caches, not just DIR: caches. We should add a macro for generic collection behavior and use that where appropriate.
* Add mising argument required by format stringLukas Slebodnik2013-07-191-1/+1
|
* Use conditional build for retrieving ccache.Lukas Slebodnik2013-07-151-0/+52
| | | | | | | | Some krb5 functions needn't be available for retrieving ccache with principal. Therefore ifdef is used to solve this situation with older version of libkrb5. There were two functions with similar functionality in krb5_child and krb5_utils. They were merged to one universal function, which was moved to file src/util/sss_krb5.c
* AD: Write out domain-realm mappingsJakub Hrozek2013-06-271-22/+0
| | | | | This patch reuses the code from IPA provider to make sure that domain-realm mappings are written even for AD sub domains.
* Fix wrong detection of krb5 ccnameLukas Slebodnik2013-06-261-1/+4
| | | | | DIR:/run/user/1000/krb5cc is valid ccname, but function sss_krb5_cc_file_path returned NULL in this case.
* subdomains: touch krb5.conf when creating new domain-realm mappingsPavel Březina2013-06-161-0/+22
| | | | https://fedorahosted.org/sssd/ticket/1815
* Allow usage of enterprise principalsSumit Bose2013-04-221-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | Enterprise principals are currently most useful for the AD provider and hence enabled here by default while for the other Kerberos based authentication providers they are disabled by default. If additional UPN suffixes are configured for the AD domain the user principal stored in the AD LDAP server might not contain the real Kerberos realm of the AD domain but one of the additional suffixes which might be completely randomly chooses, e.g. are not related to any existing DNS domain. This make it hard for a client to figure out the right KDC to send requests to. To get around this enterprise principals (see http://tools.ietf.org/html/rfc6806 for details) were introduced. Basically a default realm is added to the principal so that the Kerberos client libraries at least know where to send the request to. It is not in the responsibility of the KDC to either handle the request itself, return a client referral if he thinks a different KDC can handle the request or return and error. This feature is also use to allow authentication in AD environments with cross forest trusts. Fixes https://fedorahosted.org/sssd/ticket/1842
* krb5: include backwards compatible declaration of krb5_trace_infoJakub Hrozek2013-02-111-1/+7
| | | | | | | krb5-1.10 used to include "struct krb5_trace_info", now krb5-1.11 includes a "krb5_trace_info" typedefed from "struct _krb5_trace_info". Do the same in the SSSD to allow compiling with both 1.10 and 1.11.
* Search for SHORTNAME$@REALM instead of fqdn$@REALM by defaultJakub Hrozek2013-01-071-3/+35
| | | | | | | | The search was intended for the AD provider mostly, but keytabs coming from AD via samba don't contain fqdn$@REALM but rather uppercased SHORTNAME$@REALM https://fedorahosted.org/sssd/ticket/1740
* select_principal_from_keytab() do wildcard lookups after specific onesSumit Bose2012-12-181-3/+3
| | | | | | | | | | Currently the wildcard lookup '*$' is done before the one for host/our.hostname@REALM. This means we would ignore a more specific match in favour of an unspecific match with a principal which is only used in a AD environment. I think this is wrong an wildcards should only be used is all specific lookups fail.
* select_principal_from_keytab() look for plain input as wellSumit Bose2012-12-181-2/+6
| | | | | | | Currently in select_principal_from_keytab() all kind of different versions of the host principal are looked up in the keytab except for the plain name the ldap_sasl_authid option. With this patch the plain name is looked up first.
* Only build extract_and_send_pac on platforms that support itJakub Hrozek2012-11-121-0/+111
|
* Add replacement for krb5_find_authdata()Sumit Bose2012-10-261-0/+14
| | | | | | | | | krb5_find_authdata() is only available in MIT Kerberos 1.10 or higher. To allow sssd to be compiled on platform with lower version of MIT Kerberos a replacement call is added. Please note that on those platform the replacement call will only return an error. If the krb5_find_authdata functionality is really needed on those platform it must be implemented by a different patch.
* Only call krb5_set_trace_callback on platforms that support itJakub Hrozek2012-10-121-1/+16
|
* Collect krb5 trace on high debug levelsJakub Hrozek2012-10-121-0/+12
| | | | | | | If the debug level contains SSSDBG_TRACE_ALL, then the logs would also include tracing information from libkrb5. https://fedorahosted.org/sssd/ticket/1539
* remove left over principal selectionPavel Březina2012-10-021-102/+0
| | | | | | | | | | | | | | | https://fedorahosted.org/sssd/ticket/1303 Domain start up was taking too long when there are many principals in a kerberos keytab. We were looking up in the keytab two times. The first time we try to select a proper principal and remember it. The second call happens almost right after the first one and it is just a check if the principal exists in the keytab, without any output information other than success/failure. It is probably a left over from https://fedorahosted.org/sssd/ticket/781. This patch removes the second call.
* Check for errors from krb5_unparse_nameStephen Gallagher2012-07-091-1/+8
| | | | Coverity #12781
* Revert commit 4c157ecedd52602f75574605ef48d0c48e9bfbe8Stef Walter2012-07-061-143/+0
| | | | | | | | * This broke corner cases when used with default_tkt_types = des-cbc-crc and DES enabled on an AD domain. * This is fixed in kerberos instead, in a more correct way and in a way which we cannot replicate.
* KRB5: Auto-detect DIR cache support in configureStephen Gallagher2012-06-151-2/+10
| | | | | | We can't support the DIR cache features in systems with kerberos libraries older than 1.10. Make sure we don't build it on those systems.
* Add support for storing credential caches in the DIR: back endJakub Hrozek2012-06-141-19/+2
| | | | https://fedorahosted.org/sssd/ticket/974
* Residual util functionsJakub Hrozek2012-06-141-0/+86
| | | | | | Kerberos credential caches can be specified by TYPE:RESIDUAL. This patch adds a couple of utilities to support parsing if ccache locations, checking types etc.
* KRB5: Avoid NULL-dereference with empty keytabStephen Gallagher2012-05-221-7/+13
| | | | https://fedorahosted.org/sssd/ticket/1330
* Limit krb5_get_init_creds_keytab() to etypes in keytabStef Walter2012-05-071-0/+137
| | | | | | | | | * Load the enctypes for the keys in the keytab and pass them to krb5_get_init_creds_keytab(). * This fixes the problem where the server offers a enctype that krb5 supports, but we don't have a key for in the keytab. https://bugzilla.redhat.com/show_bug.cgi?id=811375
* Remove erroneous failure message in find_principal_in_keytabStef Walter2012-05-071-1/+1
| | | | | * When it's actually a failure, then the callers will print a message. Fine tune this.
* Clean up log messages about keytab_nameStephen Gallagher2012-04-051-11/+19
| | | | | | | | | There were many places where we were printing (null) to the logs because a NULL keytab name tells libkrb5 to use its configured default instead of a particular path. This patch should clean up all uses of this to print "default" in the logs. https://fedorahosted.org/sssd/ticket/1288
* Fix off-by-one error in principal selectionJakub Hrozek2012-03-291-3/+3
| | | | https://fedorahosted.org/sssd/ticket/1269
* Always initialize the returned data in sss_krb5_princ_realm()Sumit Bose2012-03-261-0/+3
|
* Raise the debug level of two very noisy statementsStephen Gallagher2012-01-171-2/+3
|
* Add compatibility layer for Heimdal Kerberos implementationStephen Gallagher2011-12-221-12/+58
|
* Add wrapper for krb5_get_init_creds_opt_set_canonicalizeJan Zeleny2011-11-021-0/+10
|
* Fixed unitialized pointer in select_principal_from_keytabJan Zeleny2011-05-161-1/+1
| | | | https://fedorahosted.org/sssd/ticket/857
* Fixed unitialized return value in match_principalJan Zeleny2011-05-161-2/+1
| | | | https://fedorahosted.org/sssd/ticket/858
* Added some kerberos functions for building on RHEL5Jan Zeleny2011-05-051-5/+178
|