From 9acfb09f7969a69f58bd45c856b01700541853ca Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Thu, 14 Mar 2013 09:10:39 +0100 Subject: Making the authtok structure really opaque. Definition of structure sss_auth_token was removed from header file authtok.h and there left only declaration of this structure. Therefore only way how to use this structure is to use accessory function from same header file. To creating new empty authotok can only be used newly created function sss_authtok_new(). TALLOC context was removed from copy and setter functions, because pointer to stuct sss_auth_token is used as a memory context. All declaration of struct sss_auth_token variables was replaced with pointer to this structure and related changes was made in source code. Function copy_pam_data can copy from argument src which was dynamically allocated with function create_pam_data() or zero initialized struct pam_data allocated on stack. https://fedorahosted.org/sssd/ticket/1830 --- src/providers/krb5/krb5_delayed_online_authentication.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/providers/krb5/krb5_delayed_online_authentication.c') diff --git a/src/providers/krb5/krb5_delayed_online_authentication.c b/src/providers/krb5/krb5_delayed_online_authentication.c index f95fa634..87e0f3c6 100644 --- a/src/providers/krb5/krb5_delayed_online_authentication.c +++ b/src/providers/krb5/krb5_delayed_online_authentication.c @@ -84,7 +84,7 @@ static void authenticate_user(struct tevent_context *ev, return; } - ret = sss_authtok_set_password(pd, &pd->authtok, password, keysize); + ret = sss_authtok_set_password(pd->authtok, password, keysize); safezero(password, keysize); free(password); if (ret) { @@ -246,7 +246,7 @@ errno_t add_user_to_delayed_online_authentication(struct krb5_ctx *krb5_ctx, return EINVAL; } - if (sss_authtok_get_type(&pd->authtok) != SSS_AUTHTOK_TYPE_PASSWORD) { + if (sss_authtok_get_type(pd->authtok) != SSS_AUTHTOK_TYPE_PASSWORD) { DEBUG(1, ("Invalid authtok for user [%s].\n", pd->user)); return EINVAL; } @@ -262,10 +262,10 @@ errno_t add_user_to_delayed_online_authentication(struct krb5_ctx *krb5_ctx, const char *password; size_t len; - ret = sss_authtok_get_password(&new_pd->authtok, &password, &len); + ret = sss_authtok_get_password(new_pd->authtok, &password, &len); if (ret) { DEBUG(1, ("Failed to get password [%d][%s].\n", ret, strerror(ret))); - sss_authtok_set_empty(&new_pd->authtok); + sss_authtok_set_empty(new_pd->authtok); talloc_free(new_pd); return ret; } @@ -275,13 +275,13 @@ errno_t add_user_to_delayed_online_authentication(struct krb5_ctx *krb5_ctx, if (new_pd->key_serial == -1) { ret = errno; DEBUG(1, ("add_key failed [%d][%s].\n", ret, strerror(ret))); - sss_authtok_set_empty(&new_pd->authtok); + sss_authtok_set_empty(new_pd->authtok); talloc_free(new_pd); return ret; } DEBUG(9, ("Saved authtok of user [%s] with serial [%ld].\n", new_pd->user, new_pd->key_serial)); - sss_authtok_set_empty(&new_pd->authtok); + sss_authtok_set_empty(new_pd->authtok); #endif key.type = HASH_KEY_ULONG; -- cgit