added winbind_exclude_domain() so smbd can tell the winbind client
authorAndrew Tridgell <tridge@samba.org>
Tue, 10 Jul 2001 02:28:17 +0000 (02:28 +0000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 10 Jul 2001 02:28:17 +0000 (02:28 +0000)
code not to do lookups for a particular domain. This allows winbind to
operate on a Samba PDC

source/nsswitch/wb_common.c
source/smbd/server.c

index ed0075a358bd9d8be04c1ed7be882474fb969cc4..0ec29aa2d783b22e9ac272bc4d26b220ceeae58a 100644 (file)
 /* Global variables.  These are effectively the client state information */
 
 static int established_socket = -1;           /* fd for winbindd socket */
 /* 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 */
 
 
 /* Initialise a request structure */
 
@@ -321,6 +332,12 @@ NSS_STATUS winbindd_request(int req_type,
                return NSS_STATUS_NOTFOUND;
        }
 
                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;
        if (!response) {
                ZERO_STRUCT(lresponse);
                response = &lresponse;
index f753d615edba0807b134fd9d637c9a5c743e21c2..7947b9cbc05798212d30d9a096fe8d776a8db6ea 100644 (file)
@@ -693,6 +693,11 @@ static void usage(char *pname)
                return(-1);     
 
        init_structs();
                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)) {
        
 #ifdef WITH_PROFILE
        if (!profile_setup(False)) {