From c1fbc6b64ecaf51efc4379c4c8a4960de095abf0 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Jun 14 2018 18:01:54 +0000 Subject: krb5 locator: make plugin more robust Although currently libkrb5 sets all parameters of the locator plugin calls to suitable values we should make sure that provided pointers are not NULL before trying to dereference them. Related to https://pagure.io/SSSD/sssd/issue/941 Reviewed-by: Jakub Hrozek --- diff --git a/src/krb5_plugin/sssd_krb5_locator_plugin.c b/src/krb5_plugin/sssd_krb5_locator_plugin.c index 58cac7f..9874fd2 100644 --- a/src/krb5_plugin/sssd_krb5_locator_plugin.c +++ b/src/krb5_plugin/sssd_krb5_locator_plugin.c @@ -439,6 +439,10 @@ krb5_error_code sssd_krb5_locator_lookup(void *private_data, if (private_data == NULL) return KRB5_PLUGIN_NO_HANDLE; ctx = (struct sssd_ctx *) private_data; + if (realm == NULL || cbfunc == NULL || cbdata == NULL) { + return KRB5_PLUGIN_NO_HANDLE; + } + if (ctx->disabled) { PLUGIN_DEBUG(("Plugin disabled, nothing to do.\n")); return KRB5_PLUGIN_NO_HANDLE;