diff options
author | Günther Deschner <gd@samba.org> | 2009-11-12 00:51:46 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-11-12 10:22:39 +0100 |
commit | b4e40958b7f7406dc6cdd1bef4fa3f824b9cbe3a (patch) | |
tree | 241ef08c033d00cb3b78ae298bf94f95a65313fa /source3 | |
parent | bbe4a9cf0fb09a0a2348149e4fb43e3c74ed3abf (diff) | |
download | samba-b4e40958b7f7406dc6cdd1bef4fa3f824b9cbe3a.tar.gz samba-b4e40958b7f7406dc6cdd1bef4fa3f824b9cbe3a.tar.bz2 samba-b4e40958b7f7406dc6cdd1bef4fa3f824b9cbe3a.zip |
s3-kerberos: add smb_krb5_principal_get_realm().
Guenther
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/includes.h | 2 | ||||
-rw-r--r-- | source3/libsmb/clikrb5.c | 25 |
2 files changed, 27 insertions, 0 deletions
diff --git a/source3/include/includes.h b/source3/include/includes.h index 8bd27b99e3..cbf30d6158 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -1086,6 +1086,8 @@ krb5_error_code smb_krb5_get_creds(const char *server_s, const char *cc, const char *impersonate_princ_s, krb5_creds **creds_p); +char *smb_krb5_principal_get_realm(krb5_context context, + krb5_principal principal); #endif /* HAVE_KRB5 */ diff --git a/source3/libsmb/clikrb5.c b/source3/libsmb/clikrb5.c index d5a910bfbd..e86c6c4531 100644 --- a/source3/libsmb/clikrb5.c +++ b/source3/libsmb/clikrb5.c @@ -2234,6 +2234,31 @@ krb5_error_code smb_krb5_get_creds(const char *server_s, return ret; } +/* + * smb_krb5_principal_get_realm + * + * @brief Get realm of a principal + * + * @param[in] context The krb5_context + * @param[in] principal The principal + * @return pointer to the realm + * + */ + +char *smb_krb5_principal_get_realm(krb5_context context, + krb5_principal principal) +{ +#ifdef HAVE_KRB5_PRINCIPAL_GET_REALM /* Heimdal */ + return krb5_principal_get_realm(context, principal); +#elif defined(krb5_princ_realm) /* MIT */ + krb5_data *realm; + realm = krb5_princ_realm(context, principal); + return (char *)realm->data; +#else + return NULL; +#endif +} + #else /* HAVE_KRB5 */ /* this saves a few linking headaches */ int cli_krb5_get_ticket(const char *principal, time_t time_offset, |