CASA/c_micasad/common/WinUserIdentifier.cs
2006-01-18 23:34:21 +00:00

86 lines
2.3 KiB
C#

/***********************************************************************
*
* Copyright (C) 2005-2006 Novell, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* To contact Novell about this file by physical or electronic mail,
* you may find current contact information at www.novell.com.
*
***********************************************************************/
using System;
namespace sscs.common
{
internal class WinUserIdentifier : UserIdentifier
{
private int uidLow;
private int uidHigh;
private string m_sSID = "";
internal WinUserIdentifier(int uidLowPart, int uidHighPart, string sSID)
{
this.uidLow = uidLowPart;
this.uidHigh = uidHighPart;
this.m_sSID = sSID;
}
internal WinUserIdentifier(int uidLowPart, int uidHighPart)
{
this.uidLow = uidLowPart;
this.uidHigh = uidHighPart;
}
internal string GetSID()
{
return m_sSID;
}
public override bool Equals(Object obj)
{
WinUserIdentifier u = (WinUserIdentifier)obj;
if ((u.uidLow == uidLow) && (u.uidHigh == uidHigh))
{
// we have a match, set the SID if we can
if ((this.m_sSID.Length < 1) && (u.GetSID().Length>0))
{
CSSSLogger.DbgLog("******** WinUserIdentifier: Updating the SID *********");
this.m_sSID = u.GetSID();
}
return true;
}
else
return false;
}
public override int GetHashCode()
{
return uidLow.GetHashCode();
}
public void PrintIdentifier()
{
// Console.WriteLine("WinUserIdentifier : uid is {0}",uid);
}
public int GetUID()
{
return -1;
}
}
}