From 214bb0f11937843a268a897ab0337184ab36c2bc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 8 Nov 2007 17:58:55 -0800 Subject: Fix case where we have no dns domain name. Return a talloc of "". Jeremy. (This used to be commit ab8934844a8ae08657769ce1787c32f14a7eb745) --- source3/lib/util.c | 2 ++ source3/printing/nt_printing.c | 2 +- source3/rpc_server/srv_lsa_nt.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source3/lib/util.c b/source3/lib/util.c index 6e92a60238..287d2090ff 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1227,6 +1227,8 @@ char *get_mydnsdomname(TALLOC_CTX *ctx) if (p) { p++; my_domname = talloc_strdup(ctx, p); + } else { + my_domname = talloc_strdup(ctx, ""); } return my_domname; diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 57e7d37c6e..e729c3b46d 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -2953,7 +2953,7 @@ static bool map_nt_printer_info2_to_dsspooler(NT_PRINTER_INFO_LEVEL_2 *info2) join the domain */ dnssuffix = get_mydnsdomname(talloc_tos()); - if (!dnssuffix) { + if (dnssuffix && *dnssuffix) { fstr_sprintf( longname, "%s.%s", global_myname(), dnssuffix ); } else { fstrcpy( longname, global_myname() ); diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c index 5c2e1b6f01..20655082a5 100644 --- a/source3/rpc_server/srv_lsa_nt.c +++ b/source3/rpc_server/srv_lsa_nt.c @@ -1928,7 +1928,7 @@ NTSTATUS _lsa_query_info2(pipes_struct *p, LSA_Q_QUERY_INFO2 *q_u, LSA_R_QUERY_I /* This should be a 'netbios domain -> DNS domain' mapping */ dnsdomname = get_mydnsdomname(p->mem_ctx); - if (!dnsdomname) { + if (!dnsdomname || !*dnsdomname) { return NT_STATUS_CANT_ACCESS_DOMAIN_INFO; } strlower_m(dnsdomname); -- cgit