diff options
author | Sumit Bose <sbose@redhat.com> | 2009-10-13 13:53:32 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-11-05 14:55:19 -0500 |
commit | ff85dca17f68cc002adf753d71a9b7183ead1c1b (patch) | |
tree | fb989de859f3884b6e5faf79446e1d09e2f560b5 /server/providers/krb5 | |
parent | 73df935dab319ce413a8927bbae0a991008b5d07 (diff) | |
download | sssd-ff85dca17f68cc002adf753d71a9b7183ead1c1b.tar.gz sssd-ff85dca17f68cc002adf753d71a9b7183ead1c1b.tar.bz2 sssd-ff85dca17f68cc002adf753d71a9b7183ead1c1b.zip |
add replacements for missing Kerberos calls
Diffstat (limited to 'server/providers/krb5')
-rw-r--r-- | server/providers/krb5/krb5_auth.h | 1 | ||||
-rw-r--r-- | server/providers/krb5/krb5_child.c | 40 | ||||
-rw-r--r-- | server/providers/krb5/krb5_common.h | 6 |
3 files changed, 9 insertions, 38 deletions
diff --git a/server/providers/krb5/krb5_auth.h b/server/providers/krb5/krb5_auth.h index 95647e31..84eafec8 100644 --- a/server/providers/krb5/krb5_auth.h +++ b/server/providers/krb5/krb5_auth.h @@ -26,6 +26,7 @@ #ifndef __KRB5_AUTH_H__ #define __KRB5_AUTH_H__ +#include "util/sss_krb5.h" #include "providers/dp_backend.h" #include "providers/krb5/krb5_common.h" diff --git a/server/providers/krb5/krb5_child.c b/server/providers/krb5/krb5_child.c index e67ff889..319775a2 100644 --- a/server/providers/krb5/krb5_child.c +++ b/server/providers/krb5/krb5_child.c @@ -90,19 +90,13 @@ struct krb5_req { char *ccname; }; -#ifdef HAVE_KRB5_GET_ERROR_MESSAGE static krb5_context krb5_error_ctx; static const char *__krb5_error_msg; #define KRB5_DEBUG(level, krb5_error) do { \ - __krb5_error_msg = krb5_get_error_message(krb5_error_ctx, krb5_error); \ + __krb5_error_msg = sss_krb5_get_error_message(krb5_error_ctx, krb5_error); \ DEBUG(level, ("%d: [%d][%s]\n", __LINE__, krb5_error, __krb5_error_msg)); \ - krb5_free_error_message(krb5_error_ctx, __krb5_error_msg); \ + sss_krb5_free_error_message(krb5_error_ctx, __krb5_error_msg); \ } while(0); -#else -#define KRB5_DEBUG(level, krb5_error) do { \ - DEBUG(level, ("%d: kerberos error [%d]\n", __LINE__, krb5_error)); \ -} while(0); -#endif struct response { size_t max_size; @@ -181,20 +175,14 @@ static struct response *prepare_response_message(struct krb5_req *kr, ret = pack_response_packet(resp, PAM_SUCCESS, PAM_ENV_ITEM, msg); talloc_zfree(msg); } else { -#ifdef HAVE_KRB5_GET_ERROR_MESSAGE - krb5_msg = krb5_get_error_message(krb5_error_ctx, kerr); + krb5_msg = sss_krb5_get_error_message(krb5_error_ctx, kerr); if (krb5_msg == NULL) { - DEBUG(1, ("krb5_get_error_message failed.\n")); + DEBUG(1, ("sss_krb5_get_error_message failed.\n")); return NULL; } ret = pack_response_packet(resp, pam_status, PAM_USER_INFO, krb5_msg); - krb5_free_error_message(krb5_error_ctx, krb5_msg); -#else - msg = talloc_asprintf(kr, "Kerberos error [%d]", kerr); - ret = pack_response_packet(resp, pam_status, PAM_USER_INFO, msg); - talloc_zfree(msg); -#endif + sss_krb5_free_error_message(krb5_error_ctx, krb5_msg); } if (ret != EOK) { @@ -536,11 +524,7 @@ static int krb5_cleanup(void *ptr) if (kr == NULL) return EOK; if (kr->options != NULL) { -#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC - krb5_get_init_creds_opt_free(kr->ctx, kr->options); -#else - free(kr->options); -#endif + sss_krb5_get_init_creds_opt_free(kr->ctx, kr->options); } if (kr->creds != NULL) { @@ -639,21 +623,11 @@ static int krb5_setup(struct pam_data *pd, const char *user_princ_str, goto failed; } -#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC - kerr = krb5_get_init_creds_opt_alloc(kr->ctx, &kr->options); + kerr = sss_krb5_get_init_creds_opt_alloc(kr->ctx, &kr->options); if (kerr != 0) { KRB5_DEBUG(1, kerr); goto failed; } -#else - kr->options = calloc(1, sizeof(krb5_get_init_creds_opt)); - if (kr->options == NULL) { - DEBUG(1, ("calloc failed.\n")); - kerr = ENOMEM; - goto failed; - } - krb5_get_init_creds_opt_init(&kr->options); -#endif /* TODO: set options, e.g. * krb5_get_init_creds_opt_set_tkt_life diff --git a/server/providers/krb5/krb5_common.h b/server/providers/krb5/krb5_common.h index 5d784a55..60f6a82f 100644 --- a/server/providers/krb5/krb5_common.h +++ b/server/providers/krb5/krb5_common.h @@ -28,14 +28,10 @@ #include "config.h" #include <stdbool.h> -#ifdef HAVE_KRB5_KRB5_H -#include <krb5/krb5.h> -#else -#include <krb5.h> -#endif #include "providers/dp_backend.h" #include "util/util.h" +#include "util/sss_krb5.h" #define SSSD_KRB5_KDC "SSSD_KRB5_KDC" #define SSSD_KRB5_REALM "SSSD_KRB5_REALM" |