Patch from Ken Cross <kcross@nssolutions.com> to take a username in the form
authorAndrew Bartlett <abartlet@samba.org>
Wed, 12 Mar 2003 10:36:14 +0000 (10:36 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 12 Mar 2003 10:36:14 +0000 (10:36 +0000)
of user@realm for kerberos logins.

Andrew Bartlett

source/utils/net_ads.c

index 8cd3bac8024d8c9d6af2cfe200cd9932e851e786..ea31a925754aa322d8ac6a5af770160946615cf5 100644 (file)
@@ -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) {