diff options
author | Lukas Slebodnik <lslebodn@redhat.com> | 2013-03-14 09:44:41 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-04-02 17:01:08 +0200 |
commit | 53b58615fbc13eddcd6e2f28066b67cb5f16b6d3 (patch) | |
tree | e5ca489842778a4e6adba28e085bb75701db89de /src/providers | |
parent | 755aee449c6311518200c2f11c1aae329a19b038 (diff) | |
download | sssd-53b58615fbc13eddcd6e2f28066b67cb5f16b6d3.tar.gz sssd-53b58615fbc13eddcd6e2f28066b67cb5f16b6d3.tar.bz2 sssd-53b58615fbc13eddcd6e2f28066b67cb5f16b6d3.zip |
Reusing create_pam_data() on the other places.
Function create_pam_data() should be only one way how to create new
struct pam_data, because it also initialize destructor to created
object.
Diffstat (limited to 'src/providers')
-rw-r--r-- | src/providers/data_provider.h | 12 | ||||
-rw-r--r-- | src/providers/krb5/krb5_child.c | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/providers/data_provider.h b/src/providers/data_provider.h index 8e475d22..2ce16e85 100644 --- a/src/providers/data_provider.h +++ b/src/providers/data_provider.h @@ -202,6 +202,18 @@ struct pam_data { #define SSS_KRB5_INFO_TGT_LIFETIME (SSS_SERVER_INFO|SSS_KRB5_INFO|0x01) #define SSS_KRB5_INFO_UPN (SSS_SERVER_INFO|SSS_KRB5_INFO|0x02) +/** + * @brief Create new zero initialized struct pam_data. + * + * @param mem_ctx A memory context use to allocate the internal data + * @return A pointer to new struct pam_data + * NULL on error + * + * NOTE: This function should be the only way, how to create new empty + * struct pam_data, because this function automatically initialize sub + * structures and set destructor to created object. + */ +struct pam_data *create_pam_data(TALLOC_CTX *mem_ctx); errno_t copy_pam_data(TALLOC_CTX *mem_ctx, struct pam_data *old_pd, struct pam_data **new_pd); void pam_print_data(int l, struct pam_data *pd); diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c index 65685333..52127b39 100644 --- a/src/providers/krb5/krb5_child.c +++ b/src/providers/krb5/krb5_child.c @@ -1556,7 +1556,7 @@ static errno_t unpack_buffer(uint8_t *buf, size_t size, if (!offline || !kr) return EINVAL; - pd = talloc_zero(kr, struct pam_data); + pd = create_pam_data(kr); if (pd == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_zero failed.\n")); return ENOMEM; |