summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-11-12 00:51:46 +0100
committerKarolin Seeger <kseeger@samba.org>2010-01-13 14:01:00 +0100
commit31fd5b4df941ab43067f8251c05a93153e866365 (patch)
treeb9ef4e8891e6918492c5f717309127f4b4ad2c31 /source
parentff544dc50d132eebb5e7e7d58285a7bd297decae (diff)
downloadsamba-31fd5b4df941ab43067f8251c05a93153e866365.tar.gz
samba-31fd5b4df941ab43067f8251c05a93153e866365.tar.xz
samba-31fd5b4df941ab43067f8251c05a93153e866365.zip
s3-kerberos: add smb_krb5_principal_get_realm().
Guenther (cherry picked from commit bddafc6de8e37e014d7f074b6107dda6f76ebdc5)
Diffstat (limited to 'source')
-rw-r--r--source/include/includes.h3
-rw-r--r--source/libsmb/clikrb5.c25
2 files changed, 27 insertions, 1 deletions
diff --git a/source/include/includes.h b/source/include/includes.h
index baf22e8db6e..b97f78f31be 100644
--- a/source/include/includes.h
+++ b/source/include/includes.h
@@ -1268,7 +1268,8 @@ int smb_krb5_kt_add_entry_ext(krb5_context context,
krb5_data password,
bool no_salt,
bool keep_old_entries);
-
+char *smb_krb5_principal_get_realm(krb5_context context,
+ krb5_principal principal);
#endif /* HAVE_KRB5 */
diff --git a/source/libsmb/clikrb5.c b/source/libsmb/clikrb5.c
index 3f995de8990..231938790b9 100644
--- a/source/libsmb/clikrb5.c
+++ b/source/libsmb/clikrb5.c
@@ -1935,6 +1935,31 @@ krb5_error_code krb5_auth_con_set_req_cksumtype(
}
#endif
+/*
+ * 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,