1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

Add _pam_winbind_init/free_context.

Guenther
This commit is contained in:
Günther Deschner 2008-04-03 13:23:34 +02:00
parent fe8acb0644
commit d62676cf88

View File

@ -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)