diff options
author | Gerald Carter <jerry@samba.org> | 2002-06-17 18:36:36 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2002-06-17 18:36:36 +0000 |
commit | 1e6e5b299c235b513095a76a4cd9fffc41e8fc9c (patch) | |
tree | 9f741529073ad411cc7328334e26d3e35b1d33f1 /source/nsswitch | |
parent | a11c5d7ad07d259d764aede4745d13f8163a8212 (diff) | |
download | samba-1e6e5b299c235b513095a76a4cd9fffc41e8fc9c.tar.gz samba-1e6e5b299c235b513095a76a4cd9fffc41e8fc9c.tar.xz samba-1e6e5b299c235b513095a76a4cd9fffc41e8fc9c.zip |
beginning to sync up for 2.2.5 release....
Diffstat (limited to 'source/nsswitch')
-rw-r--r-- | source/nsswitch/hp_nss_common.h | 4 | ||||
-rw-r--r-- | source/nsswitch/nss.h | 2 | ||||
-rw-r--r-- | source/nsswitch/wb_common.c | 4 | ||||
-rw-r--r-- | source/nsswitch/wbinfo.c | 27 | ||||
-rw-r--r-- | source/nsswitch/winbind_nss.c | 31 | ||||
-rw-r--r-- | source/nsswitch/winbind_nss_config.h | 10 | ||||
-rw-r--r-- | source/nsswitch/winbindd.c | 32 | ||||
-rw-r--r-- | source/nsswitch/winbindd_cache.c | 34 | ||||
-rw-r--r-- | source/nsswitch/winbindd_misc.c | 5 | ||||
-rw-r--r-- | source/nsswitch/winbindd_pam.c | 3 | ||||
-rw-r--r-- | source/nsswitch/winbindd_rpc.c | 19 | ||||
-rw-r--r-- | source/nsswitch/winbindd_util.c | 2 | ||||
-rw-r--r-- | source/nsswitch/winbindd_wins.c | 8 | ||||
-rw-r--r-- | source/nsswitch/wins.c | 25 |
14 files changed, 153 insertions, 53 deletions
diff --git a/source/nsswitch/hp_nss_common.h b/source/nsswitch/hp_nss_common.h index 5f39e9abb05..5bd5374182e 100644 --- a/source/nsswitch/hp_nss_common.h +++ b/source/nsswitch/hp_nss_common.h @@ -23,8 +23,12 @@ Boston, MA 02111-1307, USA. */ +#ifdef HAVE_SYNCH_H #include <synch.h> +#endif +#ifdef HAVE_PTHREAD_H #include <pthread.h> +#endif typedef enum { NSS_SUCCESS, diff --git a/source/nsswitch/nss.h b/source/nsswitch/nss.h index e021b013b50..d83a5e237ed 100644 --- a/source/nsswitch/nss.h +++ b/source/nsswitch/nss.h @@ -72,7 +72,7 @@ typedef enum #define NSD_MEM_VOLATILE 1 #define NSD_MEM_DYNAMIC 2 -#elif defined(HPUX) +#elif defined(HPUX) && defined(HAVE_NSSWITCH_H) /* HP-UX 11 */ #include "nsswitch/hp_nss_common.h" diff --git a/source/nsswitch/wb_common.c b/source/nsswitch/wb_common.c index 6a2143f8f0f..928b70d8b1b 100644 --- a/source/nsswitch/wb_common.c +++ b/source/nsswitch/wb_common.c @@ -168,7 +168,7 @@ int winbind_open_pipe_sock(void) return winbindd_fd; } -/* Write data to winbindd socket with timeout */ +/* Write data to winbindd socket */ int write_sock(void *buffer, int count) { @@ -234,7 +234,7 @@ int write_sock(void *buffer, int count) return nwritten; } -/* Read data from winbindd socket with timeout */ +/* Read data from winbindd socket */ static int read_sock(void *buffer, int count) { diff --git a/source/nsswitch/wbinfo.c b/source/nsswitch/wbinfo.c index 9803d6505f4..3b44c40ba26 100644 --- a/source/nsswitch/wbinfo.c +++ b/source/nsswitch/wbinfo.c @@ -3,7 +3,7 @@ Winbind status program. - Copyright (C) Tim Potter 2000 + Copyright (C) Tim Potter 2000-2002 Copyright (C) Andrew Bartlett 2002 This program is free software; you can redistribute it and/or modify @@ -257,11 +257,11 @@ static BOOL wbinfo_check_secret(void) if (result) { - if (response.data.num_entries == 0) + if (response.data.auth.nt_status == 0) printf("Secret is good\n"); else printf("Secret is bad\n0x%08x\n", - response.data.num_entries); + response.data.auth.nt_status); return True; } @@ -458,6 +458,8 @@ static BOOL wbinfo_auth(char *username) return result == NSS_STATUS_SUCCESS; } +#ifdef WITH_WINBIND_AUTH_CRAP + /* Authenticate a user with a challenge/response */ static BOOL wbinfo_auth_crap(char *username) @@ -512,6 +514,8 @@ static BOOL wbinfo_auth_crap(char *username) return result == NSS_STATUS_SUCCESS; } +#endif /* WITH_WINBIND_AUTH_CRAP */ + /* Print domain users */ static BOOL print_domain_users(void) @@ -593,8 +597,10 @@ static BOOL wbinfo_set_auth_user(char *username) /* Store in secrets.tdb */ - if (!secrets_store(SECRETS_AUTH_USER, username, - strlen(username) + 1) || + secrets_init(); + + if (!secrets_store(SECRETS_AUTH_USER, user, + strlen(user) + 1) || !secrets_store(SECRETS_AUTH_DOMAIN, domain, strlen(domain) + 1) || !secrets_store(SECRETS_AUTH_PASSWORD, password, @@ -625,7 +631,7 @@ static BOOL wbinfo_ping(void) static void usage(void) { printf("Usage: wbinfo -ug | -n name | -sSY sid | -UG uid/gid | -tm " - "| -a user%%password\n"); + "| -[aA] user%%password\n"); printf("\t-u\t\t\tlists all domain users\n"); printf("\t-g\t\t\tlists all domain groups\n"); printf("\t-n name\t\t\tconverts name to sid\n"); @@ -640,6 +646,7 @@ static void usage(void) printf("\t-m\t\t\tlist trusted domains\n"); printf("\t-r user\t\t\tget user groups\n"); printf("\t-a user%%password\tauthenticate user\n"); + printf("\t-A user%%password\tstore user and password used by winbindd (root only)\n"); printf("\t-p 'ping' winbindd to see if it is alive\n"); printf("\t--sequence\t\tshow sequence numbers of all domains\n"); } @@ -648,7 +655,7 @@ static void usage(void) enum { OPT_SET_AUTH_USER = 1000, - OPT_SEQUENCE, + OPT_SEQUENCE }; int main(int argc, char **argv) @@ -683,7 +690,7 @@ int main(int argc, char **argv) { "sequence", 0, POPT_ARG_NONE, 0, OPT_SEQUENCE }, { "user-groups", 'r', POPT_ARG_STRING, &string_arg, 'r' }, { "authenticate", 'a', POPT_ARG_STRING, &string_arg, 'a' }, - { "set-auth-user", 0, POPT_ARG_STRING, &string_arg, OPT_SET_AUTH_USER }, + { "set-auth-user", 'A', POPT_ARG_STRING, &string_arg, OPT_SET_AUTH_USER }, { "ping", 'p', POPT_ARG_NONE, 0, 'p' }, { 0, 0, 0, 0 } }; @@ -838,13 +845,13 @@ int main(int argc, char **argv) "plaintext password\n", string_arg); got_error = True; } - +#ifdef WITH_WINBIND_AUTH_CRAP if (!wbinfo_auth_crap(string_arg)) { printf("Could not authenticate user %s with " "challenge/response\n", string_arg); got_error = True; } - +#endif if (got_error) goto done; break; diff --git a/source/nsswitch/winbind_nss.c b/source/nsswitch/winbind_nss.c index 0a49f5ec968..c087c6c7ad9 100644 --- a/source/nsswitch/winbind_nss.c +++ b/source/nsswitch/winbind_nss.c @@ -659,6 +659,17 @@ static NSS_STATUS fill_pwent(struct passwd *result, strcpy(result->pw_shell, pw->pw_shell); + /* The struct passwd for Solaris has some extra fields which must + be initialised or nscd crashes. */ + +#if HAVE_PASSWD_PW_COMMENT + result->pw_comment = ""; +#endif + +#if HAVE_PASSWD_PW_AGE + result->pw_age = ""; +#endif + return NSS_STATUS_SUCCESS; } @@ -856,7 +867,7 @@ _nss_winbind_getpwent_r(struct passwd *result, char *buffer, } ret = fill_pwent(result, &pw_cache[ndx_pw_cache], - &buffer, &buflen); + &buffer, (int *)&buflen); /* Out of memory - try again */ @@ -906,7 +917,7 @@ _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result, char *buffer, if (ret == NSS_STATUS_SUCCESS) { ret = fill_pwent(result, &response.data.pw, - &buffer, &buflen); + &buffer, (int *)&buflen); if (ret == NSS_STATUS_TRYAGAIN) { keep_response = True; @@ -919,7 +930,7 @@ _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result, char *buffer, /* We've been called again */ - ret = fill_pwent(result, &response.data.pw, &buffer, &buflen); + ret = fill_pwent(result, &response.data.pw, &buffer, (int *)&buflen); if (ret == NSS_STATUS_TRYAGAIN) { keep_response = True; @@ -968,7 +979,7 @@ _nss_winbind_getpwnam_r(const char *name, struct passwd *result, char *buffer, if (ret == NSS_STATUS_SUCCESS) { ret = fill_pwent(result, &response.data.pw, &buffer, - &buflen); + (int *)&buflen); if (ret == NSS_STATUS_TRYAGAIN) { keep_response = True; @@ -981,7 +992,7 @@ _nss_winbind_getpwnam_r(const char *name, struct passwd *result, char *buffer, /* We've been called again */ - ret = fill_pwent(result, &response.data.pw, &buffer, &buflen); + ret = fill_pwent(result, &response.data.pw, &buffer, (int *)&buflen); if (ret == NSS_STATUS_TRYAGAIN) { keep_response = True; @@ -1105,7 +1116,7 @@ _nss_winbind_getgrent_r(struct group *result, ret = fill_grent(result, &gr_cache[ndx_gr_cache], ((char *)getgrent_response.extra_data)+mem_ofs, - &buffer, &buflen); + &buffer, (int *)&buflen); /* Out of memory - try again */ @@ -1165,7 +1176,7 @@ _nss_winbind_getgrnam_r(const char *name, if (ret == NSS_STATUS_SUCCESS) { ret = fill_grent(result, &response.data.gr, response.extra_data, - &buffer, &buflen); + &buffer, (int *)&buflen); if (ret == NSS_STATUS_TRYAGAIN) { keep_response = True; @@ -1179,7 +1190,7 @@ _nss_winbind_getgrnam_r(const char *name, /* We've been called again */ ret = fill_grent(result, &response.data.gr, - response.extra_data, &buffer, &buflen); + response.extra_data, &buffer, (int *)&buflen); if (ret == NSS_STATUS_TRYAGAIN) { keep_response = True; @@ -1228,7 +1239,7 @@ _nss_winbind_getgrgid_r(gid_t gid, ret = fill_grent(result, &response.data.gr, response.extra_data, - &buffer, &buflen); + &buffer, (int *)&buflen); if (ret == NSS_STATUS_TRYAGAIN) { keep_response = True; @@ -1242,7 +1253,7 @@ _nss_winbind_getgrgid_r(gid_t gid, /* We've been called again */ ret = fill_grent(result, &response.data.gr, - response.extra_data, &buffer, &buflen); + response.extra_data, &buffer, (int *)&buflen); if (ret == NSS_STATUS_TRYAGAIN) { keep_response = True; diff --git a/source/nsswitch/winbind_nss_config.h b/source/nsswitch/winbind_nss_config.h index 0de63878be5..00cd5c12e47 100644 --- a/source/nsswitch/winbind_nss_config.h +++ b/source/nsswitch/winbind_nss_config.h @@ -38,6 +38,10 @@ #include <unistd.h> #endif +#ifdef HAVE_SYS_SELECT_H +#include <sys/select.h> +#endif + #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif @@ -129,11 +133,15 @@ typedef int BOOL; #endif /* zero a structure */ +#ifndef ZERO_STRUCT #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x)) +#endif /* zero a structure given a pointer to the structure */ +#ifndef ZERO_STRUCTP #define ZERO_STRUCTP(x) { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } - +#endif + /* Some systems (SCO) treat UNIX domain sockets as FIFOs */ #ifndef S_IFSOCK diff --git a/source/nsswitch/winbindd.c b/source/nsswitch/winbindd.c index 666472eddbe..65361b571c4 100644 --- a/source/nsswitch/winbindd.c +++ b/source/nsswitch/winbindd.c @@ -50,14 +50,21 @@ static BOOL reload_services_file(BOOL test) snprintf(logfile, sizeof(logfile), "%s/log.winbindd", LOGFILEBASE); lp_set_logfile(logfile); - reopen_logs(); + if (!reopen_logs()) { + fprintf(stderr, "Could not open logfile: %s\n", logfile); + fprintf(stderr, "Continuing in the hope that that is OK\n"); + } ret = lp_load(servicesf,False,False,True); snprintf(logfile, sizeof(logfile), "%s/log.winbindd", LOGFILEBASE); lp_set_logfile(logfile); - reopen_logs(); + if (!reopen_logs()) { + fprintf(stderr, "Could not open logfile: %s\n", logfile); + fprintf(stderr, "Continuing in the hope that that is OK\n"); + } + load_interfaces(); return(ret); @@ -228,7 +235,9 @@ static struct dispatch_table dispatch_table[] = { /* PAM auth functions */ { WINBINDD_PAM_AUTH, winbindd_pam_auth, "PAM_AUTH" }, +#ifdef WITH_WINBIND_AUTH_CRAP { WINBINDD_PAM_AUTH_CRAP, winbindd_pam_auth_crap, "AUTH_CRAP" }, +#endif { WINBINDD_PAM_CHAUTHTOK, winbindd_pam_chauthtok, "CHAUTHTOK" }, /* Enumeration functions */ @@ -750,7 +759,10 @@ int main(int argc, char **argv) lp_set_logfile(logfile); setup_logging("winbindd", interactive); - reopen_logs(); + if (!reopen_logs()) { + fprintf(stderr, "Could not open logfile: %s\n", logfile); + fprintf(stderr, "Continuing in the hope that that is OK\n"); + } DEBUG(1, ("winbindd version %s started.\n", VERSION ) ); DEBUGADD( 1, ( "Copyright The Samba Team 2000-2001\n" ) ); @@ -760,8 +772,6 @@ int main(int argc, char **argv) exit(1); } - pidfile_create("winbindd"); - codepage_initialise(lp_client_code_page()); /* Setup names. */ @@ -777,8 +787,11 @@ int main(int argc, char **argv) fstrcpy(global_myworkgroup, lp_workgroup()); - if (!interactive) + if (!interactive) { become_daemon(); + pidfile_create("winbindd"); + } + #if HAVE_SETPGID /* @@ -791,7 +804,12 @@ int main(int argc, char **argv) load_interfaces(); - secrets_init(); + if (!secrets_init()) { + + DEBUG(0,("Could not initialize domain trust account secrets. Giving up\n")); + return 1; + + } /* Get list of domains we look up requests for. This includes the domain which we are a member of as well as any trusted diff --git a/source/nsswitch/winbindd_cache.c b/source/nsswitch/winbindd_cache.c index 3a76ba97fae..4978ced334d 100644 --- a/source/nsswitch/winbindd_cache.c +++ b/source/nsswitch/winbindd_cache.c @@ -275,7 +275,7 @@ static struct cache_entry *wcache_fetch(struct winbind_cache *cache, } centry = smb_xmalloc(sizeof(*centry)); - centry->data = data.dptr; + centry->data = (uchar *)data.dptr; centry->len = data.dsize; centry->ofs = 0; @@ -389,7 +389,7 @@ static void centry_end(struct cache_entry *centry, const char *format, ...) key.dptr = kstr; key.dsize = strlen(kstr); - data.dptr = centry->data; + data.dptr = (char *)centry->data; data.dsize = centry->ofs; tdb_store(wcache->tdb, key, data, TDB_REPLACE); @@ -410,15 +410,18 @@ static void wcache_save_name_to_sid(struct winbindd_domain *domain, NTSTATUS sta { struct cache_entry *centry; uint32 len; + fstring uname; centry = centry_start(domain, status); if (!centry) return; len = sid_size(sid); centry_expand(centry, len); centry_put_uint32(centry, type); - sid_linearize(centry->data + centry->ofs, len, sid); + sid_linearize((char *)centry->data + centry->ofs, len, sid); centry->ofs += len; - centry_end(centry, "NS/%s/%s", domain->name, name); + fstrcpy(uname, name); + strupper(uname); + centry_end(centry, "NS/%s/%s", domain->name, uname); centry_free(centry); } @@ -448,7 +451,7 @@ static void wcache_save_user(struct winbindd_domain *domain, NTSTATUS status, WI centry_put_string(centry, info->full_name); centry_put_uint32(centry, info->user_rid); centry_put_uint32(centry, info->group_rid); - centry_end(centry, "U/%s/%x", domain->name, info->user_rid); + centry_end(centry, "U/%s/%d", domain->name, info->user_rid); centry_free(centry); } @@ -597,13 +600,16 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain, struct winbind_cache *cache = get_cache(domain); struct cache_entry *centry = NULL; NTSTATUS status; + fstring uname; if (!cache->tdb) goto do_query; - centry = wcache_fetch(cache, domain, "NS/%s/%s", domain->name, name); + fstrcpy(uname, name); + strupper(uname); + centry = wcache_fetch(cache, domain, "NS/%s/%s", domain->name, uname); if (!centry) goto do_query; *type = centry_uint32(centry); - sid_parse(centry->data + centry->ofs, centry->len - centry->ofs, sid); + sid_parse((char *)centry->data + centry->ofs, centry->len - centry->ofs, sid); status = centry->status; centry_free(centry); @@ -620,6 +626,9 @@ do_query: /* and save it */ wcache_save_name_to_sid(domain, status, name, sid, *type); + /* We can't save the sid to name mapping as we don't know the + correct case of the name without looking it up */ + return status; } @@ -661,6 +670,7 @@ do_query: /* and save it */ refresh_sequence_number(domain, True); wcache_save_sid_to_name(domain, status, sid, *name, *type, rid); + wcache_save_name_to_sid(domain, status, *name, sid, *type); return status; } @@ -678,7 +688,7 @@ static NTSTATUS query_user(struct winbindd_domain *domain, if (!cache->tdb) goto do_query; - centry = wcache_fetch(cache, domain, "U/%s/%x", domain->name, user_rid); + centry = wcache_fetch(cache, domain, "U/%s/%d", domain->name, user_rid); if (!centry) goto do_query; info->acct_name = centry_string(centry, mem_ctx); @@ -719,7 +729,7 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain, if (!cache->tdb) goto do_query; - centry = wcache_fetch(cache, domain, "UG/%s/%x", domain->name, user_rid); + centry = wcache_fetch(cache, domain, "UG/%s/%d", domain->name, user_rid); if (!centry) goto do_query; *num_groups = centry_uint32(centry); @@ -754,7 +764,7 @@ do_query: for (i=0; i<(*num_groups); i++) { centry_put_uint32(centry, (*user_gids)[i]); } - centry_end(centry, "UG/%s/%x", domain->name, user_rid); + centry_end(centry, "UG/%s/%d", domain->name, user_rid); centry_free(centry); skip_save: @@ -775,7 +785,7 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain, if (!cache->tdb) goto do_query; - centry = wcache_fetch(cache, domain, "GM/%s/%x", domain->name, group_rid); + centry = wcache_fetch(cache, domain, "GM/%s/%d", domain->name, group_rid); if (!centry) goto do_query; *num_names = centry_uint32(centry); @@ -824,7 +834,7 @@ do_query: centry_put_string(centry, (*names)[i]); centry_put_uint32(centry, (*name_types)[i]); } - centry_end(centry, "GM/%s/%x", domain->name, group_rid); + centry_end(centry, "GM/%s/%d", domain->name, group_rid); centry_free(centry); skip_save: diff --git a/source/nsswitch/winbindd_misc.c b/source/nsswitch/winbindd_misc.c index 5678bdaa5af..c71776f7096 100644 --- a/source/nsswitch/winbindd_misc.c +++ b/source/nsswitch/winbindd_misc.c @@ -88,7 +88,10 @@ enum winbindd_result winbindd_check_machine_acct(struct winbindd_cli_state *stat "good" : "bad")); done: - state->response.data.num_entries = NT_STATUS_V(result); + state->response.data.auth.nt_status = NT_STATUS_V(result); + fstrcpy(state->response.data.auth.nt_status_string, get_nt_error_msg(result)); + fstrcpy(state->response.data.auth.error_string, get_nt_error_msg(result)); + /*state->response.data.auth.pam_error = nt_status_to_pam(result);*/ return WINBINDD_OK; } diff --git a/source/nsswitch/winbindd_pam.c b/source/nsswitch/winbindd_pam.c index 5adbf98789f..45aebe385d2 100644 --- a/source/nsswitch/winbindd_pam.c +++ b/source/nsswitch/winbindd_pam.c @@ -126,6 +126,7 @@ done: return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR; } +#ifdef WITH_WINBIND_AUTH_CRAP /* Challenge Response Authentication Protocol */ enum winbindd_result winbindd_pam_auth_crap(struct winbindd_cli_state *state) @@ -217,6 +218,8 @@ done: return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR; } +#endif /* WITH_WINBIND_AUTH_CRAP */ + /* Change a user password */ enum winbindd_result winbindd_pam_chauthtok(struct winbindd_cli_state *state) diff --git a/source/nsswitch/winbindd_rpc.c b/source/nsswitch/winbindd_rpc.c index 684ce5ac288..edf445a0ec9 100644 --- a/source/nsswitch/winbindd_rpc.c +++ b/source/nsswitch/winbindd_rpc.c @@ -23,6 +23,24 @@ #include "winbindd.h" +/******************************************************************* + Duplicate a UNISTR2 string into a UNIX codepage null terminated char* + using a talloc context +********************************************************************/ + +static char *unistr2_tdup(TALLOC_CTX *ctx, const UNISTR2 *str) +{ + char *s; + int maxlen = (str->uni_str_len+1)*4; + if (!str->buffer) + return NULL; + s = (char *)talloc(ctx, maxlen); /* convervative */ + if (!s) + return NULL; + unistr2_to_unix(s, str, maxlen); + return s; +} + /* Query display info for a domain. This returns enough information plus a bit extra to give an overview of domain users for the User Manager application. */ @@ -92,6 +110,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain, } for (j=0;j<count;i++, j++) { + /* unistr2_tdup converts to UNIX charset. */ (*info)[i].acct_name = unistr2_tdup(mem_ctx, &info1.str[j].uni_acct_name); (*info)[i].full_name = unistr2_tdup(mem_ctx, &info1.str[j].uni_full_name); (*info)[i].user_rid = info1.sam[j].rid_user; diff --git a/source/nsswitch/winbindd_util.c b/source/nsswitch/winbindd_util.c index 06804b3b43f..90bc3479ea4 100644 --- a/source/nsswitch/winbindd_util.c +++ b/source/nsswitch/winbindd_util.c @@ -151,7 +151,7 @@ BOOL init_domain_list(void) DEBUG(1, ("getting trusted domain list\n")); - result = cache_methods.trusted_domains(domain, mem_ctx, &num_domains, + result = cache_methods.trusted_domains(domain, mem_ctx, (uint *)&num_domains, &names, &dom_sids); /* Add each domain to the trusted domain list */ diff --git a/source/nsswitch/winbindd_wins.c b/source/nsswitch/winbindd_wins.c index af624170eb4..79f88ed6c2c 100644 --- a/source/nsswitch/winbindd_wins.c +++ b/source/nsswitch/winbindd_wins.c @@ -85,7 +85,7 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count) int fd; struct in_addr *ret = NULL; struct in_addr p; - int j; + int j, flags; *count = 0; @@ -95,13 +95,13 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count) p = wins_srv_ip(); if( !is_zero_ip(p) ) { - ret = name_query(fd,name,0x20,False,True, p, count); + ret = name_query(fd,name,0x20,False,True, p, count, &flags); goto out; } if (lp_wins_support()) { /* we are our own WINS server */ - ret = name_query(fd,name,0x20,False,True, *interpret_addr2("127.0.0.1"), count); + ret = name_query(fd,name,0x20,False,True, *interpret_addr2("127.0.0.1"), count, &flags); goto out; } @@ -110,7 +110,7 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count) j >= 0; j--) { struct in_addr *bcast = iface_n_bcast(j); - ret = name_query(fd,name,0x20,True,True,*bcast,count); + ret = name_query(fd,name,0x20,True,True,*bcast,count, &flags); if (ret) break; } diff --git a/source/nsswitch/wins.c b/source/nsswitch/wins.c index c88bd379100..d74b006bb92 100644 --- a/source/nsswitch/wins.c +++ b/source/nsswitch/wins.c @@ -118,7 +118,7 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count) int fd; struct in_addr *ret = NULL; struct in_addr p; - int j; + int j, flags; if (!initialised) { nss_wins_init(); @@ -132,13 +132,13 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count) p = wins_srv_ip(); if( !is_zero_ip(p) ) { - ret = name_query(fd,name,0x20,False,True, p, count); + ret = name_query(fd,name,0x20,False,True, p, count, &flags); goto out; } if (lp_wins_support()) { /* we are our own WINS server */ - ret = name_query(fd,name,0x20,False,True, *interpret_addr2("127.0.0.1"), count); + ret = name_query(fd,name,0x20,False,True, *interpret_addr2("127.0.0.1"), count, &flags); goto out; } @@ -147,7 +147,7 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count) j >= 0; j--) { struct in_addr *bcast = iface_n_bcast(j); - ret = name_query(fd,name,0x20,True,True,*bcast,count); + ret = name_query(fd,name,0x20,True,True,*bcast,count, &flags); if (ret) break; } @@ -319,4 +319,21 @@ _nss_wins_gethostbyname_r(const char *name, struct hostent *he, return NSS_STATUS_SUCCESS; } + +NSS_STATUS +_nss_wins_gethostbyname2_r(const char *name, int af, struct hostent *he, + char *buffer, size_t buflen, int *errnop, + int *h_errnop) +{ + if(af!=AF_INET) { + *h_errnop = NO_DATA; + *errnop = EAFNOSUPPORT; + return NSS_STATUS_UNAVAIL; + } + + return _nss_wins_gethostbyname_r(name,he,buffer,buflen,errnop,h_errnop); +} + + + #endif |