const char *ccache_name);
bool cli_credentials_ccache_reinit(struct cli_credentials *cred,
struct loadparm_context *lp_ctx);
+bool cli_credentials_ccache_destroy(struct cli_credentials *cred);
NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *cred,
struct loadparm_context *lp_ctx,
const char *serviceprincipal);
return ok;
}
+/**
+ * @brief Destroy a Kerberos credential cache.
+ *
+ * This function destroys any existing contents of a cache and closes it.
+ *
+ * @param[in] cred The cli_credentials structure.
+ *
+ * @return true on success, false otherwise.
+ */
+_PUBLIC_ bool cli_credentials_ccache_destroy(struct cli_credentials *cred)
+{
+ struct ccache_container *ccc = cred->krb5_ccache;
+ krb5_error_code code;
+
+ code = krb5_cc_destroy(ccc->smb_krb5_context->krb5_context,
+ ccc->ccache);
+ if (code != 0) {
+ return false;
+ }
+ ccc->ccache = NULL;
+
+ TALLOC_FREE(cred->krb5_ccache);
+ cred->krb5_ccache_obtained = CRED_UNINITIALISED;
+
+ return true;
+}
+
/**
* @brief Reinitialize the Kerberos credential cache
*