unsigned < 0 test ?

Jeremy Allison jra at samba.org
Tue Sep 25 13:49:02 GMT 2001


On Tue, Sep 25, 2001 at 10:36:14PM +0200, andreas moroder wrote:
> Hello,
> 
> in smbd/sec_ctx.c  there are the following lines
> 
> BOOL initialise_groups(char *user, uid_t uid, gid_t gid)
> {
> 	struct sec_ctx *prev_ctx_p;
> 	BOOL result = True;
> 
> 	if (non_root_mode()) {
> 		return True;
> 	}
> 
> 	become_root();
> 
> 	/* Call initgroups() to get user groups */
> 
> 	if (winbind_initgroups(user,gid) == -1) {
> 		DEBUG(0,("Unable to initgroups. Error was %s\n", strerror(errno) ));
> 		if (getuid() == 0) {
> 			if (gid < 0 || gid > 32767 || uid < 0 || uid > 32767) {
> 				DEBUG(0,("This is probably a problem with the account %s\n", user));
> 			}
> 		}
> 		result = False;
> 		goto done;
> 	}
> 
> I hope I am not wrong, but gid and uid are unsigned variables ( on linux ) . 
> If this is true the <0 condition is allways false and not necessary.
> Are there systems around where the type uid_t is signed ?

Yes I think so. Very old ones but they're out there.....

Jeremy.




More information about the samba-technical mailing list