Skip to content

Commit

Permalink
lib/krb5_wrap: add smb_krb5_principal_get_type().
Browse files Browse the repository at this point in the history
Guenther

Signed-off-by: Günther Deschner <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
  • Loading branch information
gd authored and abartlet committed Aug 8, 2014
1 parent abc2d81 commit 0e25549
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
20 changes: 20 additions & 0 deletions lib/krb5_wrap/krb5_samba.c
Original file line number Diff line number Diff line change
Expand Up @@ -2572,6 +2572,26 @@ krb5_boolean smb_krb5_get_allowed_weak_crypto(krb5_context context)
#error UNKNOWN_KRB5_CONFIG_ROUTINES
#endif

/**
* @brief Return the type of a krb5_principal
*
* @param context The krb5_context
* @param principal The const krb5_principal
*
* @return integer type of the principal
*/
int smb_krb5_principal_get_type(krb5_context context,
krb5_const_principal principal)
{
#ifdef HAVE_KRB5_PRINCIPAL_GET_TYPE /* Heimdal */
return krb5_principal_get_type(context, principal);
#elif defined(krb5_princ_type) /* MIT */
return krb5_princ_type(context, principal);
#else
#error UNKNOWN_PRINC_GET_TYPE_FUNCTION
#endif
}

#else /* HAVE_KRB5 */
/* this saves a few linking headaches */
int cli_krb5_get_ticket(TALLOC_CTX *mem_ctx,
Expand Down
3 changes: 3 additions & 0 deletions lib/krb5_wrap/krb5_samba.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ krb5_error_code krb5_copy_data_contents(krb5_data *p,
const void *data,
size_t len);

int smb_krb5_principal_get_type(krb5_context context,
krb5_const_principal principal);

#endif /* HAVE_KRB5 */

int cli_krb5_get_ticket(TALLOC_CTX *mem_ctx,
Expand Down
1 change: 1 addition & 0 deletions source4/heimdal_build/wscript_configure
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ conf.define('HAVE_FLAGS_IN_KRB5_CREDS', 1)
conf.define('HAVE_KRB5_CONFIG_GET_BOOL_DEFAULT', 1)
conf.define('HAVE_KRB5_DATA_COPY', 1)
conf.define('HAVE_KRB5_PRINCIPAL_SET_REALM', 1)
conf.define('HAVE_KRB5_PRINCIPAL_GET_TYPE', 1)

heimdal_includedirs = []
heimdal_libdirs = []
Expand Down
2 changes: 1 addition & 1 deletion wscript_configure_system_mitkrb5
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ conf.CHECK_FUNCS('''
krb5_free_checksum_contents krb5_c_make_checksum krb5_create_checksum
krb5_config_get_bool_default krb5_get_profile
krb5_data_copy
krb5_keyblock_init krb5_principal_set_realm
krb5_keyblock_init krb5_principal_set_realm krb5_principal_get_type
''',
lib='krb5 k5crypto')
conf.CHECK_DECLS('''krb5_get_credentials_for_user
Expand Down

0 comments on commit 0e25549

Please sign in to comment.