summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/nsswitch/pam_winbind.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/source3/nsswitch/pam_winbind.c b/source3/nsswitch/pam_winbind.c
index 688462c5e5..7c3c2b1666 100644
--- a/source3/nsswitch/pam_winbind.c
+++ b/source3/nsswitch/pam_winbind.c
@@ -346,6 +346,45 @@ config_from_pam:
return ctrl;
};
+static void _pam_winbind_free_context(struct pwb_context *ctx)
+{
+ if (ctx->dict) {
+ iniparser_freedict(ctx->dict);
+ }
+
+ SAFE_FREE(ctx);
+}
+
+static int _pam_winbind_init_context(const pam_handle_t *pamh,
+ int flags,
+ int argc,
+ const char **argv,
+ struct pwb_context **ctx_p)
+{
+ struct pwb_context *r = NULL;
+
+ r = (struct pwb_context *)malloc(sizeof(struct pwb_context));
+ if (!r) {
+ return PAM_BUF_ERR;
+ }
+
+ ZERO_STRUCTP(r);
+
+ r->pamh = pamh;
+ r->flags = flags;
+ r->argc = argc;
+ r->argv = argv;
+ r->ctrl = _pam_parse(pamh, flags, argc, argv, &r->dict);
+ if (r->ctrl == -1) {
+ _pam_winbind_free_context(r);
+ return PAM_SYSTEM_ERR;
+ }
+
+ *ctx_p = r;
+
+ return PAM_SUCCESS;
+}
+
static void _pam_winbind_cleanup_func(pam_handle_t *pamh,
void *data,
int error_status)