summaryrefslogtreecommitdiff
path: root/source3
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
parentbbe4a9cf0fb09a0a2348149e4fb43e3c74ed3abf (diff)
downloadsamba-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.h2
-rw-r--r--source3/libsmb/clikrb5.c25
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,