summaryrefslogtreecommitdiffstats
path: root/source/smbd/negprot.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2001-11-29 06:21:56 +0000
committerAndrew Bartlett <abartlet@samba.org>2001-11-29 06:21:56 +0000
commit8f9ce717819235d98a1463f20ac659cb4b4ebbd2 (patch)
tree9ba716911849e7637bc321a65b6594e6c0516ae9 /source/smbd/negprot.c
parent4215048f7b20a8f9e5877bdbb2f54841b2f7fa64 (diff)
downloadsamba-8f9ce717819235d98a1463f20ac659cb4b4ebbd2.tar.gz
samba-8f9ce717819235d98a1463f20ac659cb4b4ebbd2.tar.xz
samba-8f9ce717819235d98a1463f20ac659cb4b4ebbd2.zip
Make better use of the ads_init() function to get the kerberos relam etc.
This allows us to use automagically obtained values in future, and the value from krb5.conf now. Also fix mem leaks etc. Andrew Bartlett
Diffstat (limited to 'source/smbd/negprot.c')
-rw-r--r--source/smbd/negprot.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/source/smbd/negprot.c b/source/smbd/negprot.c
index 9a03e1ba961..78d4da3a757 100644
--- a/source/smbd/negprot.c
+++ b/source/smbd/negprot.c
@@ -184,15 +184,19 @@ static int negprot_spnego(char *p)
return 16;
}
#endif
-
- /* win2000 uses host$@REALM, which we will probably use eventually,
- but for now this works */
- asprintf(&principal, "HOST/%s@%s", guid, lp_realm());
- blob = spnego_gen_negTokenInit(guid,
- lp_security()==SEC_ADS ? OIDs_krb5 : OIDs_plain,
- principal);
- free(principal);
-
+ {
+ ADS_STRUCT *ads;
+ ads = ads_init(NULL, NULL, NULL);
+
+ /* win2000 uses host$@REALM, which we will probably use eventually,
+ but for now this works */
+ asprintf(&principal, "HOST/%s@%s", guid, ads->realm);
+ blob = spnego_gen_negTokenInit(guid,
+ lp_security()==SEC_ADS ? OIDs_krb5 : OIDs_plain,
+ principal);
+ free(principal);
+ ads_destroy(&ads);
+ }
memcpy(p, blob.data, blob.length);
len = blob.length;
data_blob_free(&blob);