From d472ee3a690fb6db03fd4536e4093a18fc37ddbb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2001 02:28:17 +0000 Subject: [PATCH] added winbind_exclude_domain() so smbd can tell the winbind client code not to do lookups for a particular domain. This allows winbind to operate on a Samba PDC --- source/nsswitch/wb_common.c | 17 +++++++++++++++++ source/smbd/server.c | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/source/nsswitch/wb_common.c b/source/nsswitch/wb_common.c index ed0075a358b..0ec29aa2d78 100644 --- a/source/nsswitch/wb_common.c +++ b/source/nsswitch/wb_common.c @@ -29,6 +29,17 @@ /* Global variables. These are effectively the client state information */ static int established_socket = -1; /* fd for winbindd socket */ +static char *excluded_domain; + +/* + smbd needs to be able to exclude lookups for its own domain +*/ +void winbind_exclude_domain(const char *domain) +{ + if (excluded_domain) free(excluded_domain); + excluded_domain = strdup(domain); +} + /* Initialise a request structure */ @@ -321,6 +332,12 @@ NSS_STATUS winbindd_request(int req_type, return NSS_STATUS_NOTFOUND; } + /* smbd may have excluded this domain */ + if (excluded_domain && + strcasecmp(excluded_domain, request->domain) == 0) { + return NSS_STATUS_NOTFOUND; + } + if (!response) { ZERO_STRUCT(lresponse); response = &lresponse; diff --git a/source/smbd/server.c b/source/smbd/server.c index f753d615edb..7947b9cbc05 100644 --- a/source/smbd/server.c +++ b/source/smbd/server.c @@ -693,6 +693,11 @@ static void usage(char *pname) return(-1); init_structs(); + + /* don't call winbind for our domain if we are the DC */ + if (lp_domain_logons()) { + winbind_exclude_domain(lp_workgroup()); + } #ifdef WITH_PROFILE if (!profile_setup(False)) { -- 2.47.3