
#import "DomainLogin.h"
#import <netinfo/ni.h>

@implementation DomainLogin
- init:(const char *)user passwd:(const char *)passwd
{
		userName = NXCopyStringBufferFromZone(user, [self zone]);
		password = NXCopyStringBufferFromZone(passwd, [self zone]);
		return self;
}

- free
{
		NXZoneFree([self zone], userName);
		NXZoneFree([self zone], password);
		return self;
}

- (BOOL)authenticate:(void *)handle
{
int	status;

		status = ni_setuser(handle, userName);
		if (status == NI_OK)
			status = ni_setpassword(handle, password);
		if (status == NI_OK)
			return YES;
		else
			return NO;
}
@end
