summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-03-12 10:36:14 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-03-12 10:36:14 +0000
commita6c6800746a77fd041151b42c4aad9d170efb931 (patch)
treede5558b18c272a6228ad910264f9f74520383007
parent52fbbf051b926cea44b9458289ea155d36a8bb7c (diff)
downloadsamba-a6c6800746a77fd041151b42c4aad9d170efb931.tar.gz
samba-a6c6800746a77fd041151b42c4aad9d170efb931.tar.bz2
samba-a6c6800746a77fd041151b42c4aad9d170efb931.zip
Patch from Ken Cross <kcross@nssolutions.com> to take a username in the form
of user@realm for kerberos logins. Andrew Bartlett (This used to be commit ce013dc13e9e77b5cb9b2d5a4b76d54f91614e6c)
-rw-r--r--source3/utils/net_ads.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 8cd3bac802..ea31a92575 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -124,6 +124,7 @@ static ADS_STRUCT *ads_startup(void)
ADS_STATUS status;
BOOL need_password = False;
BOOL second_time = False;
+ char *realm;
ads = ads_init(NULL, NULL, opt_host);
@@ -150,6 +151,16 @@ retry:
ads->auth.user_name = strdup(opt_user_name);
+ /*
+ * If the username is of the form "name@realm",
+ * extract the realm and convert to upper case.
+ */
+ if (realm = strchr(ads->auth.user_name, '@')) {
+ *realm++ = '\0';
+ ads->auth.realm = strdup(realm);
+ strupper(ads->auth.realm);
+ }
+
status = ads_connect(ads);
if (!ADS_ERR_OK(status)) {
if (!need_password && !second_time) {