[jcifs] Re: Problems with implementing LsarLookupSids()

Michael B Allen mba2000 at ioplex.com
Mon Dec 20 04:21:17 GMT 2004


On Sun, 19 Dec 2004 23:30:57 +0100
Ralf Hartmann <ralf.hartmann at xsystem.de> wrote:

> Hello Mike,
> 
> i have created an improved SID class. I is more like a Java class and 
> can be used with Hastables. I have merged it with your improvements.

Hey Ralf,

Actually for equals() I think you should do the following so that it fails
properly with an object of unknown type and will work correctly with an
rpc.sid_t (as opposed to only other SIDs). I also chopped the 'this.'
prefixes.

public boolean equals(Object o) {

	if (o instanceof rpc.sid_t) {
		rpc.sid_t sid = (rpc.sid_t)o;

		if (revision != sid.revision ||
					sub_authority_count != sid.sub_authority_count)
			return false;

		int i;
		for (i = 0; i < this.sub_authority_count; i++)
			if (sub_authority[i] != sid.sub_authority[i])
				return false;

		for (i = 0;  i < 6; i++)
			if (identifier_authority[i] != sid.identifier_authority[i])
				return false;

		return true;
	}

	return false;
}

-- 
Greedo shoots first? Not in my Star Wars.


More information about the jcifs mailing list