summaryrefslogtreecommitdiffstats
path: root/src/winbind.c
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2014-08-08 08:54:57 -0400
committerSimo Sorce <simo@redhat.com>2014-08-08 10:11:05 -0400
commitd52868a17b098378762692429d52b4d19380b4c1 (patch)
tree13847cbd47fc3628a5e163c8f8e5bc67f01ed08a /src/winbind.c
parent500b252270f2e99ccd9a0888556fe64567edd2d9 (diff)
downloadgss-ntlmssp-d52868a17b098378762692429d52b4d19380b4c1.tar.gz
gss-ntlmssp-d52868a17b098378762692429d52b4d19380b4c1.tar.xz
gss-ntlmssp-d52868a17b098378762692429d52b4d19380b4c1.zip
Set the domain name only when available.
If we cannot source the domain name do not try to fake it up, just leave it empty and omit it from the negotiation.
Diffstat (limited to 'src/winbind.c')
-rw-r--r--src/winbind.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/winbind.c b/src/winbind.c
index b2f82d0..d731fd8 100644
--- a/src/winbind.c
+++ b/src/winbind.c
@@ -19,7 +19,9 @@ uint32_t winbind_get_names(char **computer, char **domain)
wbc_status = wbcInterfaceDetails(&details);
if (!WBC_ERROR_IS_OK(wbc_status)) goto done;
- if (computer) {
+ if (computer &&
+ details->netbios_name &&
+ (details->netbios_name[0] != 0)) {
*computer = strdup(details->netbios_name);
if (!*computer) {
ret = ENOMEM;
@@ -27,7 +29,9 @@ uint32_t winbind_get_names(char **computer, char **domain)
}
}
- if (domain) {
+ if (domain &&
+ details->netbios_domain &&
+ (details->netbios_domain[0] != 0)) {
*domain = strdup(details->netbios_domain);
if (!*domain) {
ret = ENOMEM;
@@ -39,7 +43,7 @@ uint32_t winbind_get_names(char **computer, char **domain)
done:
if (ret) {
- if (computer) free(*computer);
+ if (computer) safefree(*computer);
}
wbcFreeMemory(details);
return ret;