summaryrefslogtreecommitdiffstats
path: root/src/winbind.c
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2014-08-04 12:48:56 -0400
committerSimo Sorce <simo@redhat.com>2014-08-07 12:44:46 -0400
commit78cb0a7bf31554d90eccfe626ba3e2b4c6b2893a (patch)
tree5cfc2d3951652873691453c67db7feba0800b990 /src/winbind.c
parent193ec981cd15fb56283015608842fff1b781656b (diff)
downloadgss-ntlmssp-78cb0a7bf31554d90eccfe626ba3e2b4c6b2893a.tar.gz
gss-ntlmssp-78cb0a7bf31554d90eccfe626ba3e2b4c6b2893a.tar.xz
gss-ntlmssp-78cb0a7bf31554d90eccfe626ba3e2b4c6b2893a.zip
Add call to get names from winbind
Based on David Woodhouse work.
Diffstat (limited to 'src/winbind.c')
-rw-r--r--src/winbind.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/winbind.c b/src/winbind.c
index f36e3ff..3469f81 100644
--- a/src/winbind.c
+++ b/src/winbind.c
@@ -10,6 +10,41 @@
#include <wbclient.h>
+uint32_t winbind_get_names(char **computer, char **domain)
+{
+ struct wbcInterfaceDetails *details = NULL;
+ wbcErr wbc_status;
+ int ret = ENOENT;
+
+ wbc_status = wbcInterfaceDetails(&details);
+ if (!WBC_ERROR_IS_OK(wbc_status)) goto done;
+
+ if (computer) {
+ *computer = strdup(details->netbios_name);
+ if (!*computer) {
+ ret = ENOMEM;
+ goto done;
+ }
+ }
+
+ if (domain) {
+ *domain = strdup(details->netbios_domain);
+ if (!*domain) {
+ ret = ENOMEM;
+ goto done;
+ }
+ }
+
+ ret = 0;
+
+done:
+ if (ret) {
+ if (computer) free(*computer);
+ }
+ wbcFreeMemory(details);
+ return ret;
+}
+
uint32_t winbind_get_creds(struct gssntlm_name *name,
struct gssntlm_cred *cred)
{