summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-11-12 00:51:46 +0100
committerGünther Deschner <gd@samba.org>2009-11-12 10:22:39 +0100
commitb4e40958b7f7406dc6cdd1bef4fa3f824b9cbe3a (patch)
tree241ef08c033d00cb3b78ae298bf94f95a65313fa /source3/libsmb
parentbbe4a9cf0fb09a0a2348149e4fb43e3c74ed3abf (diff)
downloadsamba-b4e40958b7f7406dc6cdd1bef4fa3f824b9cbe3a.tar.gz
s3-kerberos: add smb_krb5_principal_get_realm().
Guenther
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clikrb5.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source3/libsmb/clikrb5.c b/source3/libsmb/clikrb5.c
index d5a910bfbda..e86c6c4531a 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,