Remove linefeed characters

This commit is contained in:
Jim Norman 2008-03-27 23:11:57 +00:00
parent 54210a90b8
commit aca2b715b1
16 changed files with 927 additions and 927 deletions

@ -20,18 +20,18 @@
* *
***********************************************************************/ ***********************************************************************/
using System; using System;
using System.Collections; using System.Collections;
namespace sscs.cache namespace sscs.cache
{ {
interface IKeychain interface IKeychain
{ {
void AddSecret(Secret mySecret); void AddSecret(Secret mySecret);
void RemoveSecret(String secretID); void RemoveSecret(String secretID);
Secret GetSecret(string secretID); Secret GetSecret(string secretID);
// IEnumerator getAllSecrets(); // IEnumerator getAllSecrets();
} }
} }

@ -20,17 +20,17 @@
* *
***********************************************************************/ ***********************************************************************/
using System; using System;
namespace sscs.cache namespace sscs.cache
{ {
interface ISecret interface ISecret
{ {
//Setter methods //Setter methods
void SetValue(byte[] key); void SetValue(byte[] key);
void SetKey(String newkey); void SetKey(String newkey);
//Get methods //Get methods
byte[] GetValue(String key); byte[] GetValue(String key);
string GetKey(); string GetKey();
} }
} }

@ -113,13 +113,13 @@ class KeyChain : IKeychain
public void RemoveSecret(String secretID) public void RemoveSecret(String secretID)
{ {
// remove all keyvalues first, as to unlink reverse links // remove all keyvalues first, as to unlink reverse links
try try
{ {
Secret secret = GetSecret(secretID); Secret secret = GetSecret(secretID);
secret.RemoveAllKeyValuePairs(this); secret.RemoveAllKeyValuePairs(this);
} }
catch (Exception e) catch (Exception e)
{ {
CSSSLogger.ExpLog(e.ToString()); CSSSLogger.ExpLog(e.ToString());
} }

@ -33,21 +33,21 @@ namespace sscs.cache
public static int VALUE_TYPE_STRING = 0; public static int VALUE_TYPE_STRING = 0;
public static int VALUE_TYPE_BINARY = 1; public static int VALUE_TYPE_BINARY = 1;
private int m_iValueType = VALUE_TYPE_STRING; private int m_iValueType = VALUE_TYPE_STRING;
private bool m_IsPersistent = true; private bool m_IsPersistent = true;
public bool IsPersistent public bool IsPersistent
{ {
get get
{ {
return m_IsPersistent; return m_IsPersistent;
} }
set set
{ {
m_IsPersistent = value; m_IsPersistent = value;
} }
} }
private string m_key; private string m_key;
public string Key public string Key
{ {
@ -152,10 +152,10 @@ namespace sscs.cache
get get
{ {
return m_created; return m_created;
} }
set set
{ {
m_created = value; m_created = value;
} }
} }
@ -165,10 +165,10 @@ namespace sscs.cache
get get
{ {
return m_modified; return m_modified;
} }
set set
{ {
m_modified = value; m_modified = value;
} }
} }
@ -230,11 +230,11 @@ namespace sscs.cache
public int GetValueType() public int GetValueType()
{ {
return m_iValueType; return m_iValueType;
} }
internal void SetValueType(int iValueType) internal void SetValueType(int iValueType)
{ {
m_iValueType = iValueType; m_iValueType = iValueType;
} }
public string ToXML() public string ToXML()

@ -194,11 +194,11 @@ namespace sscs.cache
public string GetKey() public string GetKey()
{ {
return secretID; return secretID;
} }
public void SetKeyValue(string key, string value) public void SetKeyValue(string key, string value)
{ {
SetKeyValue(key, value, true); SetKeyValue(key, value, true);
} }
public void SetKeyValue(string key, string value, bool bUpdateSecretModifiedTime) public void SetKeyValue(string key, string value, bool bUpdateSecretModifiedTime)
@ -213,17 +213,17 @@ namespace sscs.cache
{ {
kv = new KeyValue(key, value); kv = new KeyValue(key, value);
htKeyValues.Add(key, kv); htKeyValues.Add(key, kv);
}
if (bUpdateSecretModifiedTime)
{
this.ModifiedTime = DateTime.Now;
} }
}
if (bUpdateSecretModifiedTime)
public void SetKeyValue(string key, byte[] baValue) {
{ this.ModifiedTime = DateTime.Now;
SetKeyValue(key, baValue, true); }
}
public void SetKeyValue(string key, byte[] baValue)
{
SetKeyValue(key, baValue, true);
} }
public void SetKeyValue(string key, byte[] baValue, bool bUpdateModifiedTime) public void SetKeyValue(string key, byte[] baValue, bool bUpdateModifiedTime)
@ -238,11 +238,11 @@ namespace sscs.cache
{ {
kv = new KeyValue(key, baValue); kv = new KeyValue(key, baValue);
htKeyValues.Add(key, kv); htKeyValues.Add(key, kv);
} }
if (bUpdateModifiedTime) if (bUpdateModifiedTime)
{ {
this.ModifiedTime = DateTime.Now; this.ModifiedTime = DateTime.Now;
} }
} }
@ -261,13 +261,13 @@ namespace sscs.cache
internal void RemoveAllKeyValuePairs(KeyChain kc) internal void RemoveAllKeyValuePairs(KeyChain kc)
{ {
if (htKeyValues != null) if (htKeyValues != null)
{ {
IDictionaryEnumerator enumer = htKeyValues.GetEnumerator(); IDictionaryEnumerator enumer = htKeyValues.GetEnumerator();
while (enumer.MoveNext()) while (enumer.MoveNext())
{ {
String key = (String)enumer.Key; String key = (String)enumer.Key;
RemoveKeyValue(kc, key); RemoveKeyValue(kc, key);
// refresh enumerator // refresh enumerator
enumer = htKeyValues.GetEnumerator(); enumer = htKeyValues.GetEnumerator();
} }
} }

@ -68,8 +68,8 @@ namespace sscs.cache
string m_persistenceDirectory = null; string m_persistenceDirectory = null;
private static string POLICY_DIRECTORY = "/home/.casa"; private static string POLICY_DIRECTORY = "/home/.casa";
private MPFileWatcher mpWatcher = null; private MPFileWatcher mpWatcher = null;
private Secret m_DesktopSecret = new Secret(ConstStrings.MICASA_DESKTOP_PASSWD); private Secret m_DesktopSecret = new Secret(ConstStrings.MICASA_DESKTOP_PASSWD);
private DateTime createTime; private DateTime createTime;
@ -793,7 +793,7 @@ namespace sscs.cache
if (lss != null) if (lss != null)
lss.PersistStoreWithDelay(); lss.PersistStoreWithDelay();
if (slss != null) if (slss != null)
slss.PersistStore(ConstStrings.SSCS_SERVER_KEY_CHAIN_ID); slss.PersistStore(ConstStrings.SSCS_SERVER_KEY_CHAIN_ID);
} }
@ -885,62 +885,62 @@ namespace sscs.cache
{ {
if (mpWatcher != null) if (mpWatcher != null)
mpWatcher.resumeWatcher(); mpWatcher.resumeWatcher();
} }
internal Secret GetDesktopSecret() internal Secret GetDesktopSecret()
{ {
if (common.CSSSUtils.StoreDesktopPasswordInCache()) if (common.CSSSUtils.StoreDesktopPasswordInCache())
{ {
try try
{ {
string keyChainId = ConstStrings.SSCS_SESSION_KEY_CHAIN_ID + "\0"; string keyChainId = ConstStrings.SSCS_SESSION_KEY_CHAIN_ID + "\0";
KeyChain keyChain = GetKeyChain(keyChainId); KeyChain keyChain = GetKeyChain(keyChainId);
Secret secret; Secret secret;
try try
{ {
secret = keyChain.GetSecret(ConstStrings.MICASA_DESKTOP_PASSWD); secret = keyChain.GetSecret(ConstStrings.MICASA_DESKTOP_PASSWD);
return secret; return secret;
} }
catch (SecretNotFoundException e) catch (SecretNotFoundException e)
{ {
CSSSLogger.DbgLog("Desktop password not found in cache, creating one"); CSSSLogger.DbgLog("Desktop password not found in cache, creating one");
secret = new Secret(ConstStrings.MICASA_DESKTOP_PASSWD); secret = new Secret(ConstStrings.MICASA_DESKTOP_PASSWD);
keyChain.AddSecret(secret); keyChain.AddSecret(secret);
return secret; return secret;
} }
catch (Exception e1) catch (Exception e1)
{ {
CSSSLogger.DbgLog(e1.ToString()); CSSSLogger.DbgLog(e1.ToString());
} }
} }
catch (Exception) catch (Exception)
{ {
CSSSLogger.DbgLog("KeyChain does not exist"); CSSSLogger.DbgLog("KeyChain does not exist");
return null; return null;
} }
} }
else else
{ {
return m_DesktopSecret; return m_DesktopSecret;
} }
return null; return null;
} }
internal string GetDesktopPasswd() internal string GetDesktopPasswd()
{ {
try try
{ {
Secret secret = GetDesktopSecret(); Secret secret = GetDesktopSecret();
if (secret != null) if (secret != null)
{ {
string passwd = secret.GetKeyValue(ConstStrings.MICASA_DESKTOP_PASSWD_KEYNAME).GetValue(); string passwd = secret.GetKeyValue(ConstStrings.MICASA_DESKTOP_PASSWD_KEYNAME).GetValue();
return passwd; return passwd;
} }
} }
catch catch
{ {
CSSSLogger.DbgLog("Desktop password not set in Session"); CSSSLogger.DbgLog("Desktop password not set in Session");
} }
return null; return null;
} }

@ -20,82 +20,82 @@
* *
***********************************************************************/ ***********************************************************************/
using System; using System;
using System.IO; using System.IO;
namespace sscs.common namespace sscs.common
{ {
//TBD //TBD
// All user defined exceptions will extend this class in future // All user defined exceptions will extend this class in future
internal class CSSSException : ApplicationException internal class CSSSException : ApplicationException
{ {
internal CSSSException (string message) internal CSSSException (string message)
{ {
} }
} }
internal class CommunicationException : ApplicationException internal class CommunicationException : ApplicationException
{ {
internal CommunicationException (String message) : base (message) internal CommunicationException (String message) : base (message)
{ {
} }
internal CommunicationException (String message, Exception inner) : base(message,inner) internal CommunicationException (String message, Exception inner) : base(message,inner)
{ {
} }
} }
internal class MessageFormatException : Exception internal class MessageFormatException : Exception
{ {
internal MessageFormatException (String message) : base (message) internal MessageFormatException (String message) : base (message)
{ {
} }
internal MessageFormatException (String message, Exception inner) : base(message,inner) internal MessageFormatException (String message, Exception inner) : base(message,inner)
{ {
} }
} }
internal class UserNotInSessionException : Exception internal class UserNotInSessionException : Exception
{ {
internal UserNotInSessionException (String message) : base (message) internal UserNotInSessionException (String message) : base (message)
{ {
CSSSLogger.DbgLog(message); CSSSLogger.DbgLog(message);
} }
internal UserNotInSessionException (UserIdentifier user) internal UserNotInSessionException (UserIdentifier user)
{ {
CSSSLogger.DbgLog("UserIdentifier is not in session table " + user.GetUID()); CSSSLogger.DbgLog("UserIdentifier is not in session table " + user.GetUID());
} }
} }
internal class KeyChainDoesNotExistException : Exception internal class KeyChainDoesNotExistException : Exception
{ {
internal KeyChainDoesNotExistException (String kId) internal KeyChainDoesNotExistException (String kId)
{ {
CSSSLogger.DbgLog("Keychain - " + kId + " not found"); CSSSLogger.DbgLog("Keychain - " + kId + " not found");
} }
} }
internal class SecretNotFoundException : Exception internal class SecretNotFoundException : Exception
{ {
internal SecretNotFoundException (String sId) internal SecretNotFoundException (String sId)
{ {
CSSSLogger.DbgLog("SecretId - " + sId + " not found"); CSSSLogger.DbgLog("SecretId - " + sId + " not found");
} }
} }
internal class CryptoException : ApplicationException internal class CryptoException : ApplicationException
{ {
internal CryptoException(string msg) internal CryptoException(string msg)
{ {
CSSSLogger.DbgLog("Crypto exception : " + msg ); CSSSLogger.DbgLog("Crypto exception : " + msg );
} }
} }
} }

@ -20,225 +20,225 @@
* *
***********************************************************************/ ***********************************************************************/
using System; using System;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
using sscs.common; using sscs.common;
using sscs.constants; using sscs.constants;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
namespace sscs.common namespace sscs.common
{ {
/* /*
* This ia a common logging facility for windows and Linux. * This ia a common logging facility for windows and Linux.
* This also is the common place to log all server logs and debug logs. * This also is the common place to log all server logs and debug logs.
*/ */
class CSSSLogger class CSSSLogger
{ {
//private static CSSSLogger csssLog = null; //private static CSSSLogger csssLog = null;
//private static string WINID = "Microsoft"; //private static string WINID = "Microsoft";
private static string engineLog = null; private static string engineLog = null;
#if DEBUG #if DEBUG
private static string LINUXID = "Unix"; private static string LINUXID = "Unix";
private static string debugLog = null; private static string debugLog = null;
private static Stream debugStream= null; private static Stream debugStream= null;
#endif #endif
private static StreamWriter serverTrace= null; private static StreamWriter serverTrace= null;
private static Mutex dbgmutex = new Mutex(); private static Mutex dbgmutex = new Mutex();
static CSSSLogger() static CSSSLogger()
{ {
#if DEBUG #if DEBUG
if (Environment.OSVersion.ToString().StartsWith(LINUXID)) if (Environment.OSVersion.ToString().StartsWith(LINUXID))
{ {
engineLog = ConstStrings.SSCS_LINUX_ENGINELOG; engineLog = ConstStrings.SSCS_LINUX_ENGINELOG;
debugLog = ConstStrings.SSCS_LINUX_DEBUGLOG; debugLog = ConstStrings.SSCS_LINUX_DEBUGLOG;
} }
else else
{ {
engineLog = ConstStrings.SSCS_WIN_ENGINELOG; engineLog = ConstStrings.SSCS_WIN_ENGINELOG;
debugLog = ConstStrings.SSCS_WIN_DEBUGLOG; debugLog = ConstStrings.SSCS_WIN_DEBUGLOG;
} }
/* There is no set up for Server Trace /* There is no set up for Server Trace
* open and close would be done when needed. * open and close would be done when needed.
*/ */
// Set up for Debug // Set up for Debug
if( File.Exists( debugLog ) ) if( File.Exists( debugLog ) )
{ {
File.Delete( debugLog ); File.Delete( debugLog );
} }
debugStream = File.Create(debugLog); debugStream = File.Create(debugLog);
Debug.Listeners.Add(new TextWriterTraceListener(debugStream)); Debug.Listeners.Add(new TextWriterTraceListener(debugStream));
Debug.AutoFlush = true; Debug.AutoFlush = true;
Debug.Indent(); Debug.Indent();
Debug.WriteLine("Debug Log created"); Debug.WriteLine("Debug Log created");
#endif #endif
} }
public static void log(bool criticality, String message) public static void log(bool criticality, String message)
{ {
if (criticality) // Status message if (criticality) // Status message
WritetoServerLog(message); WritetoServerLog(message);
else else
DbgLog(message); DbgLog(message);
} }
public static void log(bool criticality, System.Exception e) public static void log(bool criticality, System.Exception e)
{ {
if (criticality) // Status message if (criticality) // Status message
WritetoServerLog(e.ToString()); WritetoServerLog(e.ToString());
else else
DbgLog(e.ToString()); DbgLog(e.ToString());
} }
public static void ExecutionTrace(Object obj) public static void ExecutionTrace(Object obj)
{ {
#if DEBUG #if DEBUG
StringBuilder message = null; StringBuilder message = null;
StackTrace st = null; StackTrace st = null;
try try
{ {
message = new StringBuilder(); message = new StringBuilder();
st = new StackTrace(true); st = new StackTrace(true);
} }
catch( OutOfMemoryException e ) catch( OutOfMemoryException e )
{ {
ExpLog(e.ToString()); ExpLog(e.ToString());
throw e; throw e;
} }
Type type = obj.GetType(); Type type = obj.GetType();
StackFrame sf = st.GetFrame(1); StackFrame sf = st.GetFrame(1);
message.Append(" ThreadID: "); message.Append(" ThreadID: ");
message.Append(Thread.CurrentThread.GetHashCode().ToString()); message.Append(Thread.CurrentThread.GetHashCode().ToString());
message.Append(" Executing Path: "); message.Append(" Executing Path: ");
message.Append(type.ToString()); message.Append(type.ToString());
message.Append(":"); message.Append(":");
if (sf != null) if (sf != null)
message.Append(sf.GetMethod().ToString()); message.Append(sf.GetMethod().ToString());
else else
message.Append("Method unknown"); message.Append("Method unknown");
log( ConstStrings.DEBUG,message.ToString() ); log( ConstStrings.DEBUG,message.ToString() );
#endif #endif
} }
public static void ExecutionTrace(Type type) public static void ExecutionTrace(Type type)
{ {
#if DEBUG #if DEBUG
StringBuilder message = null; StringBuilder message = null;
StackTrace st = null; StackTrace st = null;
try try
{ {
message = new StringBuilder(); message = new StringBuilder();
st = new StackTrace(true); st = new StackTrace(true);
} }
catch( OutOfMemoryException e ) catch( OutOfMemoryException e )
{ {
ExpLog(e.ToString()); ExpLog(e.ToString());
throw e; throw e;
} }
StackFrame sf = st.GetFrame(1); StackFrame sf = st.GetFrame(1);
message.Append(" ThreadID: "); message.Append(" ThreadID: ");
message.Append(Thread.CurrentThread.GetHashCode().ToString()); message.Append(Thread.CurrentThread.GetHashCode().ToString());
message.Append(" Executing Path: "); message.Append(" Executing Path: ");
message.Append(type.ToString()); message.Append(type.ToString());
message.Append(":"); message.Append(":");
if (sf != null) if (sf != null)
message.Append(sf.GetMethod().ToString()); message.Append(sf.GetMethod().ToString());
else else
message.Append("Method Unknown"); message.Append("Method Unknown");
log( ConstStrings.DEBUG,message.ToString() ); log( ConstStrings.DEBUG,message.ToString() );
#endif #endif
} }
public static string GetExecutionPath(Object obj) public static string GetExecutionPath(Object obj)
{ {
StringBuilder message = null; StringBuilder message = null;
StackTrace st = null; StackTrace st = null;
try try
{ {
message = new StringBuilder(); message = new StringBuilder();
st = new StackTrace(true); st = new StackTrace(true);
} }
catch( OutOfMemoryException e ) catch( OutOfMemoryException e )
{ {
ExpLog(e.ToString()); ExpLog(e.ToString());
throw e; throw e;
} }
Type type = obj.GetType(); Type type = obj.GetType();
StackFrame sf = st.GetFrame(1); StackFrame sf = st.GetFrame(1);
message.Append(" ThreadID: "); message.Append(" ThreadID: ");
message.Append(Thread.CurrentThread.GetHashCode().ToString()); message.Append(Thread.CurrentThread.GetHashCode().ToString());
message.Append(" Executing Path: "); message.Append(" Executing Path: ");
message.Append(type.ToString()); message.Append(type.ToString());
message.Append("::"); message.Append("::");
if (sf != null) if (sf != null)
message.Append(sf.GetMethod().ToString()); message.Append(sf.GetMethod().ToString());
else else
message.Append("Method unknown"); message.Append("Method unknown");
return message.ToString(); return message.ToString();
} }
public static void logbreak() public static void logbreak()
{ {
dbgmutex.WaitOne(); dbgmutex.WaitOne();
Debug.WriteLine(" ") ; Debug.WriteLine(" ") ;
Debug.WriteLine("----------------------------------------------------") ; Debug.WriteLine("----------------------------------------------------") ;
Debug.WriteLine(" ") ; Debug.WriteLine(" ") ;
dbgmutex.ReleaseMutex(); dbgmutex.ReleaseMutex();
} }
// The log format is Time stamp : Machine name: Product name: Logging information // The log format is Time stamp : Machine name: Product name: Logging information
private static void WritetoServerLog( string message ) private static void WritetoServerLog( string message )
{ {
serverTrace = File.AppendText(engineLog); serverTrace = File.AppendText(engineLog);
serverTrace.Write("{0} {1}", DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString()); serverTrace.Write("{0} {1}", DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString());
serverTrace.Write("CSSS"); serverTrace.Write("CSSS");
serverTrace.Write(message); serverTrace.Write(message);
serverTrace.Flush(); serverTrace.Flush();
serverTrace.Close(); serverTrace.Close();
} }
// The log format is Time stamp :Component name: Error description // The log format is Time stamp :Component name: Error description
public static void DbgLog(string message) public static void DbgLog(string message)
{ {
dbgmutex.WaitOne(); dbgmutex.WaitOne();
Debug.Write(DateTime.Now.ToLongTimeString()); Debug.Write(DateTime.Now.ToLongTimeString());
Debug.Write(" " + DateTime.Now.ToLongDateString()); Debug.Write(" " + DateTime.Now.ToLongDateString());
Debug.Write(":"); Debug.Write(":");
Debug.WriteLine(message); Debug.WriteLine(message);
// Debug.WriteLine(" ") ; // Debug.WriteLine(" ") ;
dbgmutex.ReleaseMutex(); dbgmutex.ReleaseMutex();
} }
public static void ExpLog(string message) public static void ExpLog(string message)
{ {
dbgmutex.WaitOne(); dbgmutex.WaitOne();
Debug.Write(DateTime.Now.ToLongTimeString()); Debug.Write(DateTime.Now.ToLongTimeString());
Debug.Write(" " + DateTime.Now.ToLongDateString()); Debug.Write(" " + DateTime.Now.ToLongDateString());
Debug.Write(": Exception encountered - "); Debug.Write(": Exception encountered - ");
Debug.WriteLine(message); Debug.WriteLine(message);
Debug.WriteLine(" ") ; Debug.WriteLine(" ") ;
StackTrace st = new StackTrace(); StackTrace st = new StackTrace();
Debug.WriteLine(st.ToString()); Debug.WriteLine(st.ToString());
dbgmutex.ReleaseMutex(); dbgmutex.ReleaseMutex();
} }
} }
} }

@ -54,14 +54,14 @@ namespace sscs.constants
internal static int SSCS_SECRET_IS_PERSISTENT = -24; internal static int SSCS_SECRET_IS_PERSISTENT = -24;
internal static int SSCS_SECRET_IS_NOT_PERSISTENT = -25; internal static int SSCS_SECRET_IS_NOT_PERSISTENT = -25;
internal static int SSCS_SECRET_STORE_IS_LOCKED = -26; internal static int SSCS_SECRET_STORE_IS_LOCKED = -26;
} }
class SSFLAGS class SSFLAGS
{ {
// used internally by WriteBinaryKey // used internally by WriteBinaryKey
// these are not published in the NDK // these are not published in the NDK
internal static int FLAG_PERSIST = 0x10000000; internal static int FLAG_PERSIST = 0x10000000;
internal static int FLAG_DO_NOT_PERSIST = 0x20000000; internal static int FLAG_DO_NOT_PERSIST = 0x20000000;
} }
internal class ReqMsgId internal class ReqMsgId
@ -91,8 +91,8 @@ namespace sscs.constants
internal static string SSCS_LOCAL_KEY_CHAIN_ID = "SSCS_LOCAL_KEY_CHAIN_ID"; internal static string SSCS_LOCAL_KEY_CHAIN_ID = "SSCS_LOCAL_KEY_CHAIN_ID";
internal static string SSCS_HIDDEN_LOCAL_KEYCHAIN_ID = "SSCS_HIDDEN_LOCAL_KEYCHAIN_ID"; internal static string SSCS_HIDDEN_LOCAL_KEYCHAIN_ID = "SSCS_HIDDEN_LOCAL_KEYCHAIN_ID";
internal static string SSCS_REMOTE_KEYCHAIN_ID = "SSCS_REMOTE_KEYCHAIN_ID"; internal static string SSCS_REMOTE_KEYCHAIN_ID = "SSCS_REMOTE_KEYCHAIN_ID";
internal static string SSCS_LOCAL_REMOTE_KEYCHAIN_ID = "SSCS_LOCAL_REMOTE_KEYCHAIN_ID"; internal static string SSCS_LOCAL_REMOTE_KEYCHAIN_ID = "SSCS_LOCAL_REMOTE_KEYCHAIN_ID";
internal static string SSCS_CONFLICT_KEYCHAIN = "SSCS_CONFLICT_KEYCHAIN_ID"; internal static string SSCS_CONFLICT_KEYCHAIN = "SSCS_CONFLICT_KEYCHAIN_ID";
//TBD , Need to look at Novell standard for the desktop //TBD , Need to look at Novell standard for the desktop
@ -163,7 +163,7 @@ namespace sscs.constants
internal static string miCASANode = "miCASA"; internal static string miCASANode = "miCASA";
internal static string versionAttr = "version"; internal static string versionAttr = "version";
internal static string keyChainNode = "KeyChain"; internal static string keyChainNode = "KeyChain";
internal static string idAttr = "id"; internal static string idAttr = "id";
internal static string binaryAttr = "binary"; internal static string binaryAttr = "binary";
internal static string secretNode = "Secret"; internal static string secretNode = "Secret";
internal static string valueNode = "Value"; internal static string valueNode = "Value";

@ -82,7 +82,7 @@ namespace sscs.common
msgIdMap.Add(19,"sscs.verbs.IsSecretPersistent"); msgIdMap.Add(19,"sscs.verbs.IsSecretPersistent");
msgIdMap.Add(20,"sscs.verbs.ObjectSerialization"); msgIdMap.Add(20,"sscs.verbs.ObjectSerialization");
msgIdMap.Add(21,"sscs.verbs.WriteBinaryKey"); msgIdMap.Add(21,"sscs.verbs.WriteBinaryKey");
msgIdMap.Add(22,"sscs.verbs.ReadBinaryKey"); msgIdMap.Add(22,"sscs.verbs.ReadBinaryKey");
msgIdMap.Add(23,"sscs.verbs.RemoveKey"); msgIdMap.Add(23,"sscs.verbs.RemoveKey");
msgIdMap.Add(24,"sscs.verbs.MergeCache"); msgIdMap.Add(24,"sscs.verbs.MergeCache");
} }

@ -66,12 +66,12 @@ namespace sscs.common
{ {
return sessionManager; return sessionManager;
} }
} }
internal static SecretStore CreateUserSession(UserIdentifier userId) internal static SecretStore CreateUserSession(UserIdentifier userId)
{ {
return CreateUserSession(userId, null); return CreateUserSession(userId, null);
} }
internal static SecretStore CreateUserSession(UserIdentifier userId, string userHome) internal static SecretStore CreateUserSession(UserIdentifier userId, string userHome)
@ -87,137 +87,137 @@ namespace sscs.common
return ss; return ss;
} }
catch(UserNotInSessionException) catch(UserNotInSessionException)
{ {
#if W32 #if W32
// if running on vista, let's make additional checks for users with elevation privileges // if running on vista, let's make additional checks for users with elevation privileges
// on Vista use the elevated token if there is one. // on Vista use the elevated token if there is one.
System.OperatingSystem os = System.Environment.OSVersion; System.OperatingSystem os = System.Environment.OSVersion;
if (os.Version.Major > 5) if (os.Version.Major > 5)
{ {
WinUserIdentifier vistaAdminUser = (WinUserIdentifier)userId; WinUserIdentifier vistaAdminUser = (WinUserIdentifier)userId;
// if this user an admin eqivalent, it has an elevated token // if this user an admin eqivalent, it has an elevated token
if (vistaAdminUser.HasElevatedToken()) if (vistaAdminUser.HasElevatedToken())
{ {
CSSSLogger.DbgLog("VISTA: Request received from user with Elevated Token"); CSSSLogger.DbgLog("VISTA: Request received from user with Elevated Token");
// CASA's Credential Manager creates a WinUser with just the normal token id // CASA's Credential Manager creates a WinUser with just the normal token id
// ZEN creates a WinUser with the elevated token id // ZEN creates a WinUser with the elevated token id
// Here we determine if we can merge any of these. // Here we determine if we can merge any of these.
WinUserIdentifier credUser = null; WinUserIdentifier credUser = null;
WinUserIdentifier zenUser = null; WinUserIdentifier zenUser = null;
SecretStore credUserSS = null; SecretStore credUserSS = null;
SecretStore zenUserSS = null; SecretStore zenUserSS = null;
// look for match UserIdentifier with just the normal id // look for match UserIdentifier with just the normal id
try try
{ {
credUser = new WinUserIdentifier(vistaAdminUser.GetUIDLow(), vistaAdminUser.GetUIDHigh(), vistaAdminUser.GetSID()); credUser = new WinUserIdentifier(vistaAdminUser.GetUIDLow(), vistaAdminUser.GetUIDHigh(), vistaAdminUser.GetSID());
credUserSS = GetUserSecretStore(credUser); credUserSS = GetUserSecretStore(credUser);
} }
catch (Exception) { } catch (Exception) { }
// ZEN creates a winUser with just the elevated ID // ZEN creates a winUser with just the elevated ID
try try
{ {
zenUser = new WinUserIdentifier(vistaAdminUser.GetElevatedUIDLow(), vistaAdminUser.GetElevatedUIDHigh(), vistaAdminUser.GetSID()); zenUser = new WinUserIdentifier(vistaAdminUser.GetElevatedUIDLow(), vistaAdminUser.GetElevatedUIDHigh(), vistaAdminUser.GetSID());
zenUserSS = GetUserSecretStore(zenUser); zenUserSS = GetUserSecretStore(zenUser);
} }
catch (Exception) { } catch (Exception) { }
// if both exist merge them into the credUser, fix up userIdentify and return resulting store // if both exist merge them into the credUser, fix up userIdentify and return resulting store
if ((credUserSS != null) && (zenUserSS != null)) if ((credUserSS != null) && (zenUserSS != null))
{ {
CSSSLogger.DbgLog("VISTA: Merging zenUser store with credUser store"); CSSSLogger.DbgLog("VISTA: Merging zenUser store with credUser store");
byte[] baSecrets = sscs.lss.LocalStorage.GetSecretsAsXMLStream(zenUserSS, ConstStrings.SSCS_SESSION_KEY_CHAIN_ID).ToArray(); byte[] baSecrets = sscs.lss.LocalStorage.GetSecretsAsXMLStream(zenUserSS, ConstStrings.SSCS_SESSION_KEY_CHAIN_ID).ToArray();
if (baSecrets != null) if (baSecrets != null)
{ {
credUserSS.MergeXMLSecrets(baSecrets); credUserSS.MergeXMLSecrets(baSecrets);
} }
// add elevated ids to cred user object // add elevated ids to cred user object
WinUserIdentifier temp = (WinUserIdentifier)credUserSS.GetUserIdentifier(); WinUserIdentifier temp = (WinUserIdentifier)credUserSS.GetUserIdentifier();
temp.SetElevatedUIDLow(vistaAdminUser.GetElevatedUIDLow()); temp.SetElevatedUIDLow(vistaAdminUser.GetElevatedUIDLow());
temp.SetElevatedUIDHigh(vistaAdminUser.GetElevatedUIDHigh()); temp.SetElevatedUIDHigh(vistaAdminUser.GetElevatedUIDHigh());
// nuke the zen user session // nuke the zen user session
SessionManager.RemoveUserSession(zenUser, true); SessionManager.RemoveUserSession(zenUser, true);
return credUserSS; return credUserSS;
} }
// only the credUser exists, add the elevated UIDs, return creduser store // only the credUser exists, add the elevated UIDs, return creduser store
else if (credUserSS != null) else if (credUserSS != null)
{ {
// fix up credUser with elevated IDs // fix up credUser with elevated IDs
CSSSLogger.DbgLog("VISTA: Fixing credUser up with elevated IDs"); CSSSLogger.DbgLog("VISTA: Fixing credUser up with elevated IDs");
WinUserIdentifier temp = (WinUserIdentifier)credUserSS.GetUserIdentifier(); WinUserIdentifier temp = (WinUserIdentifier)credUserSS.GetUserIdentifier();
temp.SetElevatedUIDLow(vistaAdminUser.GetElevatedUIDLow()); temp.SetElevatedUIDLow(vistaAdminUser.GetElevatedUIDLow());
temp.SetElevatedUIDHigh(vistaAdminUser.GetElevatedUIDHigh()); temp.SetElevatedUIDHigh(vistaAdminUser.GetElevatedUIDHigh());
return credUserSS; return credUserSS;
} }
// only the zenUser exists, fix the UIDs, return zenuser store // only the zenUser exists, fix the UIDs, return zenuser store
else if (zenUserSS != null) else if (zenUserSS != null)
{ {
// fix up zenUser with correct IDs // fix up zenUser with correct IDs
// NOTE:we might need to remove old UserID from session table, and add this one // NOTE:we might need to remove old UserID from session table, and add this one
CSSSLogger.DbgLog("VISTA: Fixing zenUser up with correct IDs"); CSSSLogger.DbgLog("VISTA: Fixing zenUser up with correct IDs");
WinUserIdentifier temp = (WinUserIdentifier)zenUserSS.GetUserIdentifier(); WinUserIdentifier temp = (WinUserIdentifier)zenUserSS.GetUserIdentifier();
// move uids // move uids
temp.SetUIDLow(vistaAdminUser.GetUIDLow()); temp.SetUIDLow(vistaAdminUser.GetUIDLow());
temp.SetUIDHigh(vistaAdminUser.GetUIDHigh()); temp.SetUIDHigh(vistaAdminUser.GetUIDHigh());
// set non elevated // set non elevated
temp.SetElevatedUIDLow(vistaAdminUser.GetElevatedUIDLow()); temp.SetElevatedUIDLow(vistaAdminUser.GetElevatedUIDLow());
temp.SetElevatedUIDHigh(vistaAdminUser.GetElevatedUIDHigh()); temp.SetElevatedUIDHigh(vistaAdminUser.GetElevatedUIDHigh());
return zenUserSS; return zenUserSS;
} }
} }
} }
#endif #endif
// Would create either windows/unix user // Would create either windows/unix user
// depending on the platform. // depending on the platform.
User user; User user;
if (userHome != null) if (userHome != null)
{ {
user = User.CreateUser(userId, userHome); user = User.CreateUser(userId, userHome);
} }
else else
{ {
user = User.CreateUser(userId); user = User.CreateUser(userId);
} }
mutex.WaitOne(); mutex.WaitOne();
try try
{ {
sessionTable.Add(userId, user); sessionTable.Add(userId, user);
} }
catch (Exception e) catch (Exception e)
{ {
CSSSLogger.DbgLog(e.ToString()); CSSSLogger.DbgLog(e.ToString());
} }
mutex.ReleaseMutex(); mutex.ReleaseMutex();
ss = user.GetSecretStore(); ss = user.GetSecretStore();
ss.IncrRefCount(); ss.IncrRefCount();
ss.CreateTime = DateTime.Now; ss.CreateTime = DateTime.Now;
// add session keychain if it does not exist.
if (!ss.CheckIfKeyChainExists(constants.ConstStrings.SSCS_SESSION_KEY_CHAIN_ID + '\0'))
{
ss.AddKeyChain(new KeyChain(constants.ConstStrings.SSCS_SESSION_KEY_CHAIN_ID + '\0'));
}
// add server keychain if it does not exist. // add session keychain if it does not exist.
if (!ss.CheckIfKeyChainExists(constants.ConstStrings.SSCS_SERVER_KEY_CHAIN_ID + '\0')) if (!ss.CheckIfKeyChainExists(constants.ConstStrings.SSCS_SESSION_KEY_CHAIN_ID + '\0'))
{ {
ss.AddKeyChain(new KeyChain(constants.ConstStrings.SSCS_SERVER_KEY_CHAIN_ID + '\0')); ss.AddKeyChain(new KeyChain(constants.ConstStrings.SSCS_SESSION_KEY_CHAIN_ID + '\0'));
}
// add server keychain if it does not exist.
if (!ss.CheckIfKeyChainExists(constants.ConstStrings.SSCS_SERVER_KEY_CHAIN_ID + '\0'))
{
ss.AddKeyChain(new KeyChain(constants.ConstStrings.SSCS_SERVER_KEY_CHAIN_ID + '\0'));
} }
ss.StartPersistenceOfServerSecretsBySystemKey(); ss.StartPersistenceOfServerSecretsBySystemKey();
@ -342,7 +342,7 @@ namespace sscs.common
//Console.WriteLine((((SecretStore)(etor.Value)).secretStoreName + ":" + ((SecretStore)(etor.Value)).refCount); //Console.WriteLine((((SecretStore)(etor.Value)).secretStoreName + ":" + ((SecretStore)(etor.Value)).refCount);
} }
CSSSLogger.DbgLog("List Active Sessions3"); CSSSLogger.DbgLog("List Active Sessions3");
CSSSLogger.DbgLog("Current Session Count: " + sessionTable.Count); CSSSLogger.DbgLog("Current Session Count: " + sessionTable.Count);
mutex.ReleaseMutex(); mutex.ReleaseMutex();
CSSSLogger.DbgLog("List Active Sessions4"); CSSSLogger.DbgLog("List Active Sessions4");

@ -20,39 +20,39 @@
* *
***********************************************************************/ ***********************************************************************/
using System; using System;
namespace sscs.common namespace sscs.common
{ {
internal class UnixUserIdentifier : UserIdentifier internal class UnixUserIdentifier : UserIdentifier
{ {
private int uid; private int uid;
internal UnixUserIdentifier(int uid) internal UnixUserIdentifier(int uid)
{ {
this.uid = uid; this.uid = uid;
} }
public override bool Equals(Object obj) public override bool Equals(Object obj)
{ {
UnixUserIdentifier u = (UnixUserIdentifier)obj; UnixUserIdentifier u = (UnixUserIdentifier)obj;
if (u.uid == uid) if (u.uid == uid)
return true; return true;
else else
return false; return false;
} }
public override int GetHashCode() public override int GetHashCode()
{ {
return uid.GetHashCode(); return uid.GetHashCode();
} }
public void PrintIdentifier() public void PrintIdentifier()
{ {
// Console.WriteLine("UnixUserIdentifier : uid is {0}",uid); // Console.WriteLine("UnixUserIdentifier : uid is {0}",uid);
} }
public int GetUID() public int GetUID()
{ {
return uid; return uid;
} }
} }
} }

@ -20,66 +20,66 @@
* *
***********************************************************************/ ***********************************************************************/
using System; using System;
using System.IO; using System.IO;
using sscs.cache; using sscs.cache;
namespace sscs.common namespace sscs.common
{ {
abstract class User abstract class User
{ {
protected UserIdentifier userId; protected UserIdentifier userId;
public UserIdentifier UserIdentifier public UserIdentifier UserIdentifier
{ {
get get
{ {
return userId; return userId;
} }
} }
protected SecretStore secretStore; protected SecretStore secretStore;
//protected string home; //protected string home;
/* Change the protection level after getting the latest requirements */ /* Change the protection level after getting the latest requirements */
protected string userName = null; protected string userName = null;
abstract internal void SetUserName(string userName); abstract internal void SetUserName(string userName);
abstract internal string GetUserName(); abstract internal string GetUserName();
abstract internal string GetUserHomeDir(); abstract internal string GetUserHomeDir();
internal SecretStore GetSecretStore() internal SecretStore GetSecretStore()
{ {
return secretStore; return secretStore;
} }
internal static User CreateUser(UserIdentifier userId, string userHome) internal static User CreateUser(UserIdentifier userId, string userHome)
{ {
User user = null; User user = null;
#if LINUX #if LINUX
user = new UnixUser(userId); user = new UnixUser(userId);
#endif #endif
#if W32 #if W32
user = new WinUser(userId, userHome); user = new WinUser(userId, userHome);
#endif #endif
return user; return user;
} }
internal static User CreateUser(UserIdentifier userId) internal static User CreateUser(UserIdentifier userId)
{ {
User user = null; User user = null;
#if LINUX #if LINUX
user = new UnixUser(userId); user = new UnixUser(userId);
#endif #endif
#if W32 #if W32
user = new WinUser(userId); user = new WinUser(userId);
#endif #endif
return user; return user;
} }
} }
} }

@ -21,15 +21,15 @@
***********************************************************************/ ***********************************************************************/
using System; using System;
using System.IO; using System.IO;
namespace sscs.common namespace sscs.common
{ {
public interface UserIdentifier public interface UserIdentifier
{ {
void PrintIdentifier(); void PrintIdentifier();
int GetUID(); int GetUID();
} }
} }

@ -20,108 +20,108 @@
* *
***********************************************************************/ ***********************************************************************/
using System; using System;
using System.Collections; using System.Collections;
using System.IO; using System.IO;
using Microsoft.Win32; using Microsoft.Win32;
using sscs.cache; using sscs.cache;
using sscs.common; using sscs.common;
using sscs.constants; using sscs.constants;
namespace sscs.common namespace sscs.common
{ {
internal class WinUser : User internal class WinUser : User
{ {
private string m_sUserHome = null; private string m_sUserHome = null;
internal WinUser() internal WinUser()
{ {
} }
internal WinUser(UserIdentifier winUserId, string userHome) internal WinUser(UserIdentifier winUserId, string userHome)
{ {
userId = winUserId; userId = winUserId;
secretStore = new SecretStore(this); secretStore = new SecretStore(this);
m_sUserHome = userHome; m_sUserHome = userHome;
} }
internal WinUser(UserIdentifier winUserId) internal WinUser(UserIdentifier winUserId)
{ {
userId = winUserId; userId = winUserId;
secretStore = new SecretStore(this); secretStore = new SecretStore(this);
} }
override internal void SetUserName(string username) override internal void SetUserName(string username)
{ {
userName = username; userName = username;
} }
override internal string GetUserName() override internal string GetUserName()
{ {
return userName; return userName;
} }
/* A method to find the user's home dir on windows needs to be added. /* A method to find the user's home dir on windows needs to be added.
*/ */
override internal string GetUserHomeDir() override internal string GetUserHomeDir()
{ {
CSSSLogger.DbgLog("WinUser:GetUserHomeDir - Entered"); CSSSLogger.DbgLog("WinUser:GetUserHomeDir - Entered");
if (m_sUserHome == null || m_sUserHome.Length < 1) if (m_sUserHome == null || m_sUserHome.Length < 1)
{ {
CSSSLogger.DbgLog("WinUser:GetUserHomeDir is empty"); CSSSLogger.DbgLog("WinUser:GetUserHomeDir is empty");
//Console.WriteLine("read registry"); //Console.WriteLine("read registry");
// get the users home drive and homepath from the registry // get the users home drive and homepath from the registry
// //
string sSIDString = ((WinUserIdentifier)userId).GetSID(); string sSIDString = ((WinUserIdentifier)userId).GetSID();
// look up Profile path // look up Profile path
// [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-21-1757981266-436374069-725345543-1006] // [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-21-1757981266-436374069-725345543-1006]
CSSSLogger.DbgLog("Reading Reg: SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\" + sSIDString); CSSSLogger.DbgLog("Reading Reg: SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\" + sSIDString);
string sProfile = ReadRegKey(Registry.LocalMachine, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\" + sSIDString, "ProfileImagePath"); string sProfile = ReadRegKey(Registry.LocalMachine, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\" + sSIDString, "ProfileImagePath");
if (sProfile == null) if (sProfile == null)
CSSSLogger.DbgLog("WinUser:GetUserHomeDir get Profile return null"); CSSSLogger.DbgLog("WinUser:GetUserHomeDir get Profile return null");
else else
m_sUserHome = sProfile; m_sUserHome = sProfile;
//string sHomeDrive = ReadRegKey(Registry.Users, sSIDString+"\\Volatile Environment", "HOMEDRIVE"); //string sHomeDrive = ReadRegKey(Registry.Users, sSIDString+"\\Volatile Environment", "HOMEDRIVE");
//string sHomeDir = ReadRegKey(Registry.Users, sSIDString+"\\Volatile Environment", "HOMEPATH"); //string sHomeDir = ReadRegKey(Registry.Users, sSIDString+"\\Volatile Environment", "HOMEPATH");
//m_sUserHome = sHomeDrive+sHomeDir; //m_sUserHome = sHomeDrive+sHomeDir;
//Console.WriteLine("Homedir: "+ m_sUserHome); //Console.WriteLine("Homedir: "+ m_sUserHome);
} }
CSSSLogger.DbgLog("WinUser:GetUserHomeDir - Exited: "+m_sUserHome); CSSSLogger.DbgLog("WinUser:GetUserHomeDir - Exited: "+m_sUserHome);
return m_sUserHome; return m_sUserHome;
} }
private string ReadRegKey(RegistryKey rk, string sSubKey, string KeyName) private string ReadRegKey(RegistryKey rk, string sSubKey, string KeyName)
{ {
// Opening the registry key // Opening the registry key
// RegistryKey rk = Registry.Users; // RegistryKey rk = Registry.Users;
// Open a subKey as read-only // Open a subKey as read-only
RegistryKey sk1 = rk.OpenSubKey(sSubKey); RegistryKey sk1 = rk.OpenSubKey(sSubKey);
// If the RegistrySubKey doesn't exist -> (null) // If the RegistrySubKey doesn't exist -> (null)
if ( sk1 == null ) if ( sk1 == null )
{ {
return null; return null;
} }
else else
{ {
try try
{ {
// If the RegistryKey exists I get its value // If the RegistryKey exists I get its value
// or null is returned. // or null is returned.
return (string)sk1.GetValue(KeyName.ToUpper()); return (string)sk1.GetValue(KeyName.ToUpper());
} }
catch (Exception) catch (Exception)
{ {
//ShowErrorMessage(e, "Reading registry " + KeyName.ToUpper()); //ShowErrorMessage(e, "Reading registry " + KeyName.ToUpper());
return null; return null;
} }
} }
} }
} }
} }

@ -20,141 +20,141 @@
* *
***********************************************************************/ ***********************************************************************/
using System; using System;
namespace sscs.common namespace sscs.common
{ {
internal class WinUserIdentifier : UserIdentifier internal class WinUserIdentifier : UserIdentifier
{ {
private int m_uidLow; private int m_uidLow;
private int m_uidHigh; private int m_uidHigh;
private int m_elevatedUidLow = 0; private int m_elevatedUidLow = 0;
private int m_elevatedUidHigh = 0; private int m_elevatedUidHigh = 0;
private string m_sSID = ""; private string m_sSID = "";
internal WinUserIdentifier(int uidLowPart, int uidHighPart, string sSID, int elevatedUidLow, int elevatedUidHigh) internal WinUserIdentifier(int uidLowPart, int uidHighPart, string sSID, int elevatedUidLow, int elevatedUidHigh)
{ {
this.m_uidLow = uidLowPart; this.m_uidLow = uidLowPart;
this.m_uidHigh = uidHighPart; this.m_uidHigh = uidHighPart;
this.m_sSID = sSID; this.m_sSID = sSID;
if (elevatedUidLow != 0) if (elevatedUidLow != 0)
this.m_elevatedUidLow = elevatedUidLow; this.m_elevatedUidLow = elevatedUidLow;
if (elevatedUidHigh != 0) if (elevatedUidHigh != 0)
this.m_elevatedUidHigh = elevatedUidHigh; this.m_elevatedUidHigh = elevatedUidHigh;
} }
internal WinUserIdentifier(int uidLowPart, int uidHighPart, string sSID) internal WinUserIdentifier(int uidLowPart, int uidHighPart, string sSID)
{ {
this.m_uidLow = uidLowPart; this.m_uidLow = uidLowPart;
this.m_uidHigh = uidHighPart; this.m_uidHigh = uidHighPart;
this.m_sSID = sSID; this.m_sSID = sSID;
} }
internal WinUserIdentifier(int uidLowPart, int uidHighPart) internal WinUserIdentifier(int uidLowPart, int uidHighPart)
{ {
this.m_uidLow = uidLowPart; this.m_uidLow = uidLowPart;
this.m_uidHigh = uidHighPart; this.m_uidHigh = uidHighPart;
} }
internal string GetSID() internal string GetSID()
{ {
return m_sSID; return m_sSID;
} }
public override bool Equals(Object obj) public override bool Equals(Object obj)
{ {
WinUserIdentifier temp = (WinUserIdentifier)obj; WinUserIdentifier temp = (WinUserIdentifier)obj;
if ((temp.m_uidLow == m_uidLow) && if ((temp.m_uidLow == m_uidLow) &&
(temp.m_uidHigh == m_uidHigh) && (temp.m_uidHigh == m_uidHigh) &&
(temp.m_elevatedUidLow == m_elevatedUidLow) && (temp.m_elevatedUidLow == m_elevatedUidLow) &&
(temp.m_elevatedUidHigh == m_elevatedUidHigh)) (temp.m_elevatedUidHigh == m_elevatedUidHigh))
{ {
// we have a match, set the SID if we can // we have a match, set the SID if we can
if ((this.m_sSID.Length < 1) && (temp.GetSID().Length > 0)) if ((this.m_sSID.Length < 1) && (temp.GetSID().Length > 0))
{ {
CSSSLogger.DbgLog("******** WinUserIdentifier: Updating the SID *********"); CSSSLogger.DbgLog("******** WinUserIdentifier: Updating the SID *********");
this.m_sSID = temp.GetSID(); this.m_sSID = temp.GetSID();
} }
return true; return true;
} }
else else
{ {
return false; return false;
} }
} }
public override int GetHashCode() public override int GetHashCode()
{ {
return m_uidLow.GetHashCode(); return m_uidLow.GetHashCode();
} }
public void PrintIdentifier() public void PrintIdentifier()
{ {
CSSSLogger.DbgLog(" High: " + this.m_uidHigh); CSSSLogger.DbgLog(" High: " + this.m_uidHigh);
CSSSLogger.DbgLog(" LOW: " + this.m_uidLow); CSSSLogger.DbgLog(" LOW: " + this.m_uidLow);
CSSSLogger.DbgLog(" eHigh: " + this.m_elevatedUidHigh); CSSSLogger.DbgLog(" eHigh: " + this.m_elevatedUidHigh);
CSSSLogger.DbgLog(" eLOW: " + this.m_elevatedUidLow); CSSSLogger.DbgLog(" eLOW: " + this.m_elevatedUidLow);
CSSSLogger.DbgLog(" SID: " + this.m_sSID); CSSSLogger.DbgLog(" SID: " + this.m_sSID);
} }
public int GetUID() public int GetUID()
{ {
return -1; return -1;
} }
internal int GetUIDLow() internal int GetUIDLow()
{ {
return this.m_uidLow; return this.m_uidLow;
} }
internal int GetUIDHigh() internal int GetUIDHigh()
{ {
return this.m_uidHigh; return this.m_uidHigh;
} }
internal int GetElevatedUIDLow() internal int GetElevatedUIDLow()
{ {
return this.m_elevatedUidLow; return this.m_elevatedUidLow;
} }
internal int GetElevatedUIDHigh() internal int GetElevatedUIDHigh()
{ {
return this.m_elevatedUidHigh; return this.m_elevatedUidHigh;
} }
// setters // setters
internal void SetUIDLow(int uidLow) internal void SetUIDLow(int uidLow)
{ {
this.m_uidLow = uidLow; this.m_uidLow = uidLow;
} }
internal void SetUIDHigh(int uidHigh) internal void SetUIDHigh(int uidHigh)
{ {
this.m_uidHigh = uidHigh; this.m_uidHigh = uidHigh;
} }
internal void SetElevatedUIDLow(int elevatedUidLow) internal void SetElevatedUIDLow(int elevatedUidLow)
{ {
this.m_elevatedUidLow = elevatedUidLow; this.m_elevatedUidLow = elevatedUidLow;
} }
internal void SetElevatedUIDHigh(int elevatedUidHigh) internal void SetElevatedUIDHigh(int elevatedUidHigh)
{ {
this.m_elevatedUidHigh = elevatedUidHigh; this.m_elevatedUidHigh = elevatedUidHigh;
} }
internal bool HasElevatedToken() internal bool HasElevatedToken()
{ {
if (m_elevatedUidHigh + m_elevatedUidLow > 0) if (m_elevatedUidHigh + m_elevatedUidLow > 0)
return true; return true;
else else
return false; return false;
} }
} }
} }