summaryrefslogtreecommitdiff
path: root/source4/auth/ntlmssp
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-05-03 12:16:16 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-05-03 07:37:07 +0200
commit2742ec0e34c06ded2885aa2607f1c1729a57b034 (patch)
treec10f1501c68c54ffc61c1f3545f7d272187b0aa2 /source4/auth/ntlmssp
parent39081a20c5b570430e28866e34ae965c60ee2039 (diff)
downloadsamba-2742ec0e34c06ded2885aa2607f1c1729a57b034.tar.gz
samba-2742ec0e34c06ded2885aa2607f1c1729a57b034.tar.bz2
samba-2742ec0e34c06ded2885aa2607f1c1729a57b034.zip
Remove strlower_m() and strupper_m() from source4 and common code.
This function is problematic because a string may expand in size when changed into upper or lower case. This will then push characters off the end of the string in the s3 implementation, or panic in the former s4 implementation. Andrew Bartlett
Diffstat (limited to 'source4/auth/ntlmssp')
-rw-r--r--source4/auth/ntlmssp/ntlmssp_server.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/source4/auth/ntlmssp/ntlmssp_server.c b/source4/auth/ntlmssp/ntlmssp_server.c
index 9db3b560c1..cdae37262e 100644
--- a/source4/auth/ntlmssp/ntlmssp_server.c
+++ b/source4/auth/ntlmssp/ntlmssp_server.c
@@ -308,26 +308,26 @@ NTSTATUS gensec_ntlmssp_server_start(struct gensec_security *gensec_security)
ntlmssp_state->server.netbios_domain = lpcfg_workgroup(gensec_security->settings->lp_ctx);
{
- char dnsdomname[MAXHOSTNAMELEN], dnsname[MAXHOSTNAMELEN];
-
- /* Find out the DNS domain name */
- dnsdomname[0] = '\0';
- safe_strcpy(dnsdomname, lpcfg_dnsdomain(gensec_security->settings->lp_ctx), sizeof(dnsdomname) - 1);
+ char *dnsdomain = lpcfg_dnsdomain(gensec_security->settings->lp_ctx);
+ char *dnsname, *lower_netbiosname;
+ lower_netbiosname = strlower_talloc(ntlmssp_state, ntlmssp_state->server.netbios_name);
/* Find out the DNS host name */
- safe_strcpy(dnsname, ntlmssp_state->server.netbios_name, sizeof(dnsname) - 1);
- if (dnsdomname[0] != '\0') {
- safe_strcat(dnsname, ".", sizeof(dnsname) - 1);
- safe_strcat(dnsname, dnsdomname, sizeof(dnsname) - 1);
+ if (dnsdomain && dnsdomain[0] != '\0') {
+ dnsname = talloc_asprintf(ntlmssp_state, "%s.%s",
+ lower_netbiosname,
+ dnsdomain);
+ talloc_free(lower_netbiosname);
+ ntlmssp_state->server.dns_name = dnsname;
+ } else {
+ ntlmssp_state->server.dns_name = lower_netbiosname;
}
- strlower_m(dnsname);
- ntlmssp_state->server.dns_name = talloc_strdup(ntlmssp_state,
- dnsname);
NT_STATUS_HAVE_NO_MEMORY(ntlmssp_state->server.dns_name);
- ntlmssp_state->server.dns_domain = talloc_strdup(ntlmssp_state,
- dnsdomname);
+ ntlmssp_state->server.dns_domain
+ = talloc_strdup(ntlmssp_state,
+ lpcfg_dnsdomain(gensec_security->settings->lp_ctx));
NT_STATUS_HAVE_NO_MEMORY(ntlmssp_state->server.dns_domain);
}