trusted domains cache

Rafal Szczesniak mimir at diament.ists.pwr.wroc.pl
Sun Oct 20 22:50:00 GMT 2002


Now, after spending some time with caching code, it's time
to get back to major task called trusted domains support.
Attached code implements basic trusted domains caching code
planned to be useful especially when samba is a domain member
server.
It will be used in conjunction with one part of auth subsystem
(auth_domain, namely), but it's not implemeted yet. Thus,
trustdom cache fetch function hasn't been tested, although
it does fairly simple task when compared to namecache equivalent.
This code contains trustdom_cache interface and modification
of rescan_trusted_domains() routine for updating the cache using
this interface.


-- 
cheers,
+------------------------------------------------------------+
|Rafal 'Mimir' Szczesniak <mimir at diament.ists.pwr.wroc.pl>   |
|*BSD, GNU/Linux and Samba                                  /
|__________________________________________________________/
-------------- next part --------------
Index: Makefile.in
===================================================================
RCS file: /cvsroot/samba/source/Makefile.in,v
retrieving revision 1.550
diff -u -r1.550 Makefile.in
--- Makefile.in	9 Oct 2002 12:01:24 -0000	1.550
+++ Makefile.in	20 Oct 2002 22:01:33 -0000
@@ -172,7 +172,7 @@
              libsmb/smberr.o libsmb/credentials.o libsmb/pwd_cache.o \
 	     libsmb/clioplock.o libsmb/errormap.o libsmb/clirap2.o \
 	     libsmb/passchange.o libsmb/unexpected.o libsmb/doserr.o \
-	     libsmb/namecache.o $(RPC_PARSE_OBJ1)
+	     libsmb/namecache.o libsmb/trustdom_cache.o $(RPC_PARSE_OBJ1)
 
 LIBMSRPC_OBJ = rpc_client/cli_lsarpc.o rpc_client/cli_samr.o \
 	       rpc_client/cli_netlogon.o rpc_client/cli_srvsvc.o \
Index: nsswitch/winbindd_util.c
===================================================================
RCS file: /cvsroot/samba/source/nsswitch/winbindd_util.c,v
retrieving revision 1.82
diff -u -r1.82 winbindd_util.c
--- nsswitch/winbindd_util.c	15 Oct 2002 23:44:15 -0000	1.82
+++ nsswitch/winbindd_util.c	20 Oct 2002 22:01:52 -0000
@@ -173,7 +173,7 @@
 		int i;
 
 		result = domain->methods->trusted_domains(domain, mem_ctx, &num_domains,
-							  &names, &alt_names, &dom_sids);
+		                                          &names, &alt_names, &dom_sids);
 		if (!NT_STATUS_IS_OK(result)) {
 			continue;
 		}
@@ -182,9 +182,12 @@
 		   the access methods of its parent */
 		for(i = 0; i < num_domains; i++) {
 			DEBUG(10,("Found domain %s\n", names[i]));
-			add_trusted_domain(names[i], 
-					   alt_names?alt_names[i]:NULL, 
-					   domain->methods, &dom_sids[i]);
+			add_trusted_domain(names[i], alt_names?alt_names[i]:NULL,
+			                   domain->methods, &dom_sids[i]);
+			
+			/* store trusted domain in the cache */
+			trustdom_cache_store(names[i], &(dom_sids[i]),
+			                     t + WINBINDD_RESCAN_FREQ);
 		}
 	}
 
@@ -204,8 +207,10 @@
 	/* Add ourselves as the first entry */
 	domain = add_trusted_domain(lp_workgroup(), NULL, &cache_methods, NULL);
 
-	/* Now we *must* get the domain sid for our primary domain. Go into
-	   a holding pattern until that is available */
+	/* 
+	 * Now we *must* get the domain sid for our primary domain. Go into
+	 * a holding pattern until that is available
+	 */
 
 	result = cache_methods.domain_sid(domain, &domain->sid);
 	while (!NT_STATUS_IS_OK(result)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trustdom_cache.c
Type: text/x-csrc
Size: 4709 bytes
Desc: libsmb/trustdom_cache.c
Url : http://lists.samba.org/archive/samba-technical/attachments/20021020/8b1ab15a/trustdom_cache.bin


More information about the samba-technical mailing list