summaryrefslogtreecommitdiff
path: root/source3/libads/kerberos.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libads/kerberos.c')
-rw-r--r--source3/libads/kerberos.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
index 9a486237c9..1ba5d978e8 100644
--- a/source3/libads/kerberos.c
+++ b/source3/libads/kerberos.c
@@ -110,8 +110,16 @@ int ads_kinit_password(ADS_STRUCT *ads)
char *s;
int ret;
- asprintf(&s, "%s@%s", ads->auth.user_name, ads->auth.realm);
- ret = kerberos_kinit_password(s, ads->auth.password);
+ if (!ads->user_name) {
+ /* by default use the machine account */
+ extern pstring global_myname;
+ fstring myname;
+ fstrcpy(myname, global_myname);
+ strlower(myname);
+ asprintf(&ads->user_name, "HOST/%s", global_myname);
+ }
+ asprintf(&s, "%s@%s", ads->user_name, ads->realm);
+ ret = kerberos_kinit_password(s, ads->password);
if (ret) {
DEBUG(0,("kerberos_kinit_password %s failed: %s\n",