From 9ac29cad40c43b31dd29e003766f576220b27b25 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Fri, 14 May 2010 12:16:59 +0200 Subject: [PATCH 7/9] Krb5 locator plugin returns KRB5_PLUGIN_NO_HANDLE To allow a fallback to the setting in krb5.conf the locator plugin returns KRB5_PLUGIN_NO_HANDLE in nearly all error conditions. Only if the call back fails the error code of the callback is returned. --- src/krb5_plugin/sssd_krb5_locator_plugin.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/krb5_plugin/sssd_krb5_locator_plugin.c b/src/krb5_plugin/sssd_krb5_locator_plugin.c index 153145b..dfc9c19 100644 --- a/src/krb5_plugin/sssd_krb5_locator_plugin.c +++ b/src/krb5_plugin/sssd_krb5_locator_plugin.c @@ -223,7 +223,7 @@ krb5_error_code sssd_krb5_locator_init(krb5_context context, const char *dummy; ctx = calloc(1,sizeof(struct sssd_ctx)); - if (ctx == NULL) return ENOMEM; + if (ctx == NULL) return KRB5_PLUGIN_NO_HANDLE; dummy = getenv(SSSD_KRB5_LOCATOR_DEBUG); if (dummy == NULL) { @@ -280,7 +280,7 @@ krb5_error_code sssd_krb5_locator_lookup(void *private_data, ctx->sssd_realm = strdup(realm); if (ctx->sssd_realm == NULL) { PLUGIN_DEBUG(("strdup failed.\n")); - return ENOMEM; + return KRB5_PLUGIN_NO_HANDLE; } ret = get_krb5info(realm, ctx, locate_service_kdc); @@ -326,7 +326,7 @@ krb5_error_code sssd_krb5_locator_lookup(void *private_data, case locate_service_krb524: return KRB5_PLUGIN_NO_HANDLE; default: - return EINVAL; + return KRB5_PLUGIN_NO_HANDLE; } switch (family) { @@ -343,7 +343,7 @@ krb5_error_code sssd_krb5_locator_lookup(void *private_data, case SOCK_DGRAM: break; default: - return EINVAL; + return KRB5_PLUGIN_NO_HANDLE; } if (strcmp(realm, ctx->sssd_realm) != 0) @@ -353,7 +353,7 @@ krb5_error_code sssd_krb5_locator_lookup(void *private_data, ret = snprintf(port_str, PORT_STR_SIZE-1, "%u", port); if (ret < 0 || ret >= (PORT_STR_SIZE-1)) { PLUGIN_DEBUG(("snprintf failed.\n")); - return EFAULT; + return KRB5_PLUGIN_NO_HANDLE; } memset(&ai_hints, 0, sizeof(struct addrinfo)); @@ -368,7 +368,7 @@ krb5_error_code sssd_krb5_locator_lookup(void *private_data, PLUGIN_DEBUG(("getaddrinfo failed [%d][%s].\n", errno, strerror(errno))); } - return EFAULT; + return KRB5_PLUGIN_NO_HANDLE; } PLUGIN_DEBUG(("addr[%s:%s] family[%d] socktype[%d]\n", addr, port_str, -- 1.6.6.1