From 12cfa317b8cdee94d0c4a6daf30dec56cd8d8fe2 Mon Sep 17 00:00:00 2001
From: Simo Sorce <simo@redhat.com>
Date: Tue, 6 Jan 2015 14:24:58 -0500
Subject: [PATCH] Names with a . in the domain are enteprise names
This allows people to put in an email address as the source name and
have i treated automatically as an enterprise name as well.
Although technically NetBIOS names can have dots it is unlikely and the
user@domain form is generally undestood to be used with UPNs and email
like addresses which use the DNS Domain Name.
The fallback case for NetBIOS domain names with a dot is to configure the
client to use the DOMAIN\user name form instead.
---
src/gss_names.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/gss_names.c b/src/gss_names.c
index e76a3e8cc11a82ff9398216565833e9489d2987d..1a35ed29dc2e2fa536c93730fdd3b3132705286e 100644
--- a/src/gss_names.c
+++ b/src/gss_names.c
@@ -96,11 +96,18 @@ static uint32_t get_enterprise_name(uint32_t *minor_status,
buf[len] = '\0';
e = strstr(buf, "\\@");
+ if (e) {
+ /* remove escape */
+ memmove(e, e + 1, len - (e - buf));
+ } else {
+ /* check if domain part contains dot */
+ e = strchr(buf, '@');
+ if (e) {
+ e = strchr(e, '.');
+ }
+ }
if (!e) return GSSERRS(0, GSS_S_UNAVAILABLE);
- /* remove escape */
- memmove(e, e + 1, len - (e - buf));
-
*username = strdup(buf);
if (NULL == *username) {
set_GSSERR(ENOMEM);
--
2.1.0