ads_struct
[metze/samba/wip.git] / source3 / libads / kerberos_util.c
index 7d49c02869f7a86279b0729d6cbe47f2546cd5fd..2bbb837c52b1cdc62159c2596106b4cc1eb65e39 100644 (file)
@@ -33,8 +33,12 @@ int ads_kinit_password(ADS_STRUCT *ads)
        const char *account_name;
        fstring acct_name;
 
+       if (ads->auth._password == NULL || ads->auth._password[0] == '\0') {
+               return KRB5_LIBOS_CANTREADPWD;
+       }
+
        if (ads->auth.flags & ADS_AUTH_USER_CREDS) {
-               account_name = ads->auth.user_name;
+               account_name = ads->auth._user_name;
                goto got_accountname;
        }
 
@@ -50,22 +54,19 @@ int ads_kinit_password(ADS_STRUCT *ads)
                }
                else
                        /* This looks like host/lp_netbios_name()@REA.LM */
-                       account_name = ads->auth.user_name;
+                       account_name = ads->auth._user_name;
        }
 
  got_accountname:
-       if (asprintf(&s, "%s@%s", account_name, ads->auth.realm) == -1) {
+       if (asprintf(&s, "%s@%s", account_name, ads->auth._realm) == -1) {
                return KRB5_CC_NOMEM;
        }
 
-       if (!ads->auth.password) {
-               SAFE_FREE(s);
-               return KRB5_LIBOS_CANTREADPWD;
-       }
-
-       ret = kerberos_kinit_password_ext(s, ads->auth.password, ads->auth.time_offset,
-                       &ads->auth.tgt_expire, NULL, NULL, False, False, ads->auth.renewable,
-                       NULL);
+       ret = kerberos_kinit_password_ext(s, ads->auth._password,
+                                         ads->auth.time_offset,
+                                         &ads->auth.tgt_expire, NULL,
+                                         ads->auth._ccache_name, false, false,
+                                         ads->auth._renewable, NULL);
 
        if (ret) {
                DEBUG(0,("kerberos_kinit_password %s failed: %s\n",