summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-04-03 13:23:34 +0200
committerGünther Deschner <gd@samba.org>2008-04-03 16:27:18 +0200
commita654ed60898da746b44ecff6eb60fbc962fb88b7 (patch)
tree3efeb7e674fac7d5c91e47e6531c15963bbdd177 /source3
parentb365cd3fc531db124a4aa80693aa7d178b315f28 (diff)
downloadsamba-a654ed60898da746b44ecff6eb60fbc962fb88b7.tar.gz
samba-a654ed60898da746b44ecff6eb60fbc962fb88b7.tar.bz2
samba-a654ed60898da746b44ecff6eb60fbc962fb88b7.zip
Add _pam_winbind_init/free_context.
Guenther (This used to be commit d62676cf886d910334b3d6f7ce0147b75ef53aec)
Diffstat (limited to 'source3')
-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)