Subject: Re: calendar vs. NIS
To: <>
From: David Laight <david@l8s.co.uk>
List: tech-userlevel
Date: 11/05/2002 10:12:35
> 
> I managed to put together a quick fix to stop the reminder service
> from spamming me. The problem is that MAX_UID is far to large
> (2.147.483.647?) for any "simple" data structure.
> 
> So I assume that no UID is larger than 32767. What is the right way to
> handle this?

Not making that assumption!
I'd use a static array of pointers to malloc()ed buffers and set bits.
Say 16k pointers each to 32k data, 2^14 * 2^15 * 2^3 = 2^32.
Ok provided the UIDs are in dense blocks... (or you need 512Mbytes).
Alternatively some kind of sorted data.
Actually this code doesn't scale very well at all if there are
many thousand users!

>  			(void)setegid(pw->pw_gid);
>  			(void)seteuid(pw->pw_uid);
>  			if (!chdir(pw->pw_dir))
>  				cal();

The above code must have a security problem somewhere!
(I guess it is necessary because uid 0 doesn't have 'root'
privs on NFS - sort of makes a mockery of disallowing that!)

	David

-- 
David Laight: david@l8s.co.uk