Infinite loops again

Gerald Carter cartegw at Eng.Auburn.EDU
Mon Jan 18 13:59:26 GMT 1999


Matt Chapman wrote:
> 
> What happens is that getgrpunixpwent calls 
> lookupsmbgrpgid, which eventually calls gidtoname, which 
> uses getgrpgid. On some OSs getgrpgid resets the group
> file pointer.

I'm glad you brought that that up, Matt.

Luke,  I spent several days last week digging through the 
files in passdb/* and groupdb/*.  If you use the 
private/smbpasswd backend, there are some serious ineffiencies 
with regards to lookups.

The way I understand the code, Samba does a lookup on name, rid, 
uid, gid, etc... and expects the function to return a fully
filled sam_passwd struct.  The way this is implemented for
private/smbpasswd is obviously an iterative search.
The problem is that for each iterative search, it  builds 
the sam_passwd struct which is very expensive and then
compares to see if it is the one we want.

A better way would be to pass down the item we are search for
in a union

struct search_item {
	union {
		rid,
		uid,
		name
	}	item;
	int	type;
}

and then in the get...ent() function, get the smbpasswd entry,
compare the item and if it is the one we want, **then** build 
the sam_passwd struct.

The problem we had at our site was that we have about 7,500
entries in the passwd table served via NIS+ and about 1,400
entries in private/smbpasswd. Upon login the name service cache
daemon (nscd) grabbed about %50 of the CPU.

By copying the passwd and group maps locally to the server
and changing the code to check before building the sam_passwd
struct, I have a workable solution.

The reason, I am bringing this up is that it would requiring
changing the passdb_ops and groupdb_ops struct in smb.h.
Specifically changin the get...ent() function dclarations to 
accept another argument.

Comments?

jerry
________________________________________________________________________
                            Gerald ( Jerry ) Carter	
Engineering Network Services                           Auburn University 
jerry at eng.auburn.edu             http://www.eng.auburn.edu/users/cartegw

       "...a hundred billion castaways looking for a home."
                                  - Sting "Message in a Bottle" ( 1979 )




More information about the samba-technical mailing list