diff -Nru samba-3.4.17.orig/source3/include/proto.h samba-3.4.17/source3/include/proto.h --- samba-3.4.17.orig/source3/include/proto.h 2012-04-28 19:01:42.000000000 +0200 +++ samba-3.4.17/source3/include/proto.h 2014-01-22 11:18:57.750108619 +0100 @@ -1431,6 +1431,8 @@ const char *socket_name, mode_t dir_perms); const char *get_mydnsfullname(void); +struct TALLOC_CTX; +const char *get_mydnsfullname_talloc(struct TALLOC_CTX *ctx); bool is_myname_or_ipaddr(const char *s); /* The following definitions come from lib/util_str.c */ diff -Nru samba-3.4.17.orig/source3/lib/util.c samba-3.4.17/source3/lib/util.c --- samba-3.4.17.orig/source3/lib/util.c 2012-04-28 19:01:42.000000000 +0200 +++ samba-3.4.17/source3/lib/util.c 2014-01-22 11:31:44.577395455 +0100 @@ -1190,7 +1190,7 @@ const char *domname; char *p; - domname = get_mydnsfullname(); + domname = get_mydnsfullname_talloc(ctx); if (!domname) { return NULL; } diff -Nru samba-3.4.17.orig/source3/lib/util_sock.c samba-3.4.17/source3/lib/util_sock.c --- samba-3.4.17.orig/source3/lib/util_sock.c 2012-04-28 19:01:42.000000000 +0200 +++ samba-3.4.17/source3/lib/util_sock.c 2014-01-22 11:14:55.242442841 +0100 @@ -1830,6 +1830,12 @@ const char *get_mydnsfullname(void) { + return get_mydnsfullname_talloc(talloc_tos()); +} + + +const char *get_mydnsfullname_talloc(struct TALLOC_CTX *ctx) +{ struct addrinfo *res = NULL; char my_hostname[HOST_NAME_MAX]; bool ret; @@ -1886,7 +1892,7 @@ if (!memcache_lookup(NULL, SINGLETON_CACHE, data_blob_string_const_null("get_mydnsfullname"), &tmp)) { - tmp = data_blob_talloc(talloc_tos(), res->ai_canonname, + tmp = data_blob_talloc(ctx, res->ai_canonname, strlen(res->ai_canonname) + 1); } diff -Nru samba-3.4.17.orig/source3/libsmb/ntlmssp.c samba-3.4.17/source3/libsmb/ntlmssp.c --- samba-3.4.17.orig/source3/libsmb/ntlmssp.c 2012-04-28 19:01:42.000000000 +0200 +++ samba-3.4.17/source3/libsmb/ntlmssp.c 2014-01-22 11:10:53.023841427 +0100 @@ -573,7 +573,7 @@ } strlower_m(dnsdomname); - dnsname = get_mydnsfullname(); + dnsname = get_mydnsfullname_talloc(ntlmssp_state); if (!dnsname) { dnsname = ""; } diff -Nru samba-3.4.17.orig/source3/utils/ntlm_auth.c samba-3.4.17/source3/utils/ntlm_auth.c --- samba-3.4.17.orig/source3/utils/ntlm_auth.c 2012-04-28 19:01:42.000000000 +0200 +++ samba-3.4.17/source3/utils/ntlm_auth.c 2014-01-22 10:46:04.270661062 +0100 @@ -546,7 +546,7 @@ } if (memcmp(user_sess_key, zeros, 16) != 0) { - *user_session_key = data_blob(user_sess_key, 16); + *user_session_key = data_blob_talloc(ntlmssp_state, user_sess_key, 16); } ntlmssp_state->auth_context = talloc_strdup(ntlmssp_state, unix_name);