major source structure and module name changes
This commit is contained in:
98
micasad/lib/common/LinkedKeyInfo.cs
Normal file
98
micasad/lib/common/LinkedKeyInfo.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
/***********************************************************************
|
||||
*
|
||||
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 Lesser 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, Novell, Inc.
|
||||
*
|
||||
* To contact Novell about this file by physical or electronic mail,
|
||||
* you may find current contact information at www.novell.com.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Novell.CASA.MiCasa.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for LinkInfo.
|
||||
/// </summary>
|
||||
///
|
||||
[Serializable]
|
||||
public class LinkedKeyInfo
|
||||
{
|
||||
//private string m_sDestStoreID = null;
|
||||
//private string m_sDestKeychainID = null;
|
||||
private string m_sDestSecretID = null;
|
||||
private string m_sDestKeyID = null;
|
||||
|
||||
public LinkedKeyInfo(string sDestSecretID, string sDestKey)
|
||||
{
|
||||
if (sDestSecretID != null)
|
||||
{
|
||||
if (sDestSecretID.StartsWith("SS_CredSet"))
|
||||
sDestSecretID = "SS_CredSet:" + Utils.EscapeReservedChars(sDestSecretID.Substring(11)) + '\0';
|
||||
else
|
||||
sDestSecretID = "SS_CredSet:" + Utils.EscapeReservedChars(sDestSecretID) + '\0';
|
||||
}
|
||||
|
||||
m_sDestSecretID = sDestSecretID;
|
||||
m_sDestKeyID = sDestKey;
|
||||
}
|
||||
|
||||
public LinkedKeyInfo(string sDestSecretID, string sDestKey, bool bAlreadyEscaped)
|
||||
{
|
||||
if (!bAlreadyEscaped)
|
||||
{
|
||||
if (sDestSecretID != null)
|
||||
{
|
||||
if (sDestSecretID.StartsWith("SS_CredSet"))
|
||||
sDestSecretID = "SS_CredSet:" + Utils.EscapeReservedChars(sDestSecretID.Substring(11)) + '\0';
|
||||
else
|
||||
sDestSecretID = "SS_CredSet:" + Utils.EscapeReservedChars(sDestSecretID) + '\0';
|
||||
}
|
||||
}
|
||||
|
||||
m_sDestSecretID = sDestSecretID;
|
||||
m_sDestKeyID = sDestKey;
|
||||
}
|
||||
|
||||
public string GetLinkID()
|
||||
{
|
||||
return m_sDestSecretID + ":" + m_sDestKeyID;
|
||||
}
|
||||
|
||||
public string GetLinkedSecretID()
|
||||
{
|
||||
return m_sDestSecretID;
|
||||
}
|
||||
|
||||
public string GetLinkedSecretID(bool bUnescape)
|
||||
{
|
||||
if (bUnescape)
|
||||
{
|
||||
if (m_sDestSecretID.StartsWith("SS_CredSet"))
|
||||
return ("SS_CredSet:" + Utils.UnescapeString(m_sDestSecretID.Substring(11)));
|
||||
else
|
||||
return Utils.UnescapeString(m_sDestSecretID);
|
||||
}
|
||||
return m_sDestSecretID;
|
||||
|
||||
}
|
||||
|
||||
public string GetLinkedKeyID()
|
||||
{
|
||||
return m_sDestKeyID;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
micasad/lib/common/Makefile.am
Normal file
36
micasad/lib/common/Makefile.am
Normal file
@@ -0,0 +1,36 @@
|
||||
#######################################################################
|
||||
#
|
||||
# Copyright (C) 2006 Novell, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program 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
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
||||
CFILES =
|
||||
|
||||
EXTRA_DIST = $(CSFILES)
|
||||
|
||||
.PHONY: package package-clean package-install package-uninstall
|
||||
package package-clean package-install package-uninstall:
|
||||
$(MAKE) -C $(TARGET_OS) $@
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile.in
|
||||
|
||||
52
micasad/lib/common/MiCASAStore.cs
Normal file
52
micasad/lib/common/MiCASAStore.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
/***********************************************************************
|
||||
*
|
||||
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 Lesser 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, Novell, Inc.
|
||||
*
|
||||
* To contact Novell about this file by physical or electronic mail,
|
||||
* you may find current contact information at www.novell.com.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System;
|
||||
using Novell.CASA.MiCasa.Common;
|
||||
using Novell.CASA.MiCasa.Communication;
|
||||
|
||||
namespace Novell.CASA.MiCasa.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for MiCASAStore.
|
||||
/// </summary>
|
||||
public class MiCASAStore
|
||||
{
|
||||
public MiCASAStore()
|
||||
{
|
||||
//
|
||||
// TODO: Add constructor logic here
|
||||
//
|
||||
}
|
||||
|
||||
public static bool IsLocked()
|
||||
{
|
||||
Object o = MiCasaRequestReply.Send(MiCasaRequestReply.VERB_GET_STORE_STATUS);
|
||||
|
||||
if ((o != null) && ((System.Int32)o == 2))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
46
micasad/lib/common/Ping.cs
Normal file
46
micasad/lib/common/Ping.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
/***********************************************************************
|
||||
*
|
||||
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 Lesser 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, Novell, Inc.
|
||||
*
|
||||
* To contact Novell about this file by physical or electronic mail,
|
||||
* you may find current contact information at www.novell.com.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
namespace Novell.CASA.MiCasa.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Ping.
|
||||
/// </summary>
|
||||
///
|
||||
[Serializable]
|
||||
public class Ping
|
||||
{
|
||||
public Ping()
|
||||
{
|
||||
//
|
||||
// TODO: Add constructor logic here
|
||||
//
|
||||
}
|
||||
|
||||
public string clientmessage;
|
||||
public string servermessage;
|
||||
|
||||
}
|
||||
}
|
||||
44
micasad/lib/common/ResetMasterPassword.cs
Normal file
44
micasad/lib/common/ResetMasterPassword.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
/***********************************************************************
|
||||
*
|
||||
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 Lesser 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, Novell, Inc.
|
||||
*
|
||||
* To contact Novell about this file by physical or electronic mail,
|
||||
* you may find current contact information at www.novell.com.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Novell.CASA.MiCasa.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for ResetMasterPassword.
|
||||
/// </summary>
|
||||
///
|
||||
[Serializable]
|
||||
public class ResetMasterPassword
|
||||
{
|
||||
public string m_currentPassword;
|
||||
public string m_newPassword;
|
||||
public int rcode = 0;
|
||||
|
||||
public ResetMasterPassword(string currentPassword, string newPassword)
|
||||
{
|
||||
m_currentPassword = currentPassword;
|
||||
m_newPassword = newPassword;
|
||||
}
|
||||
}
|
||||
}
|
||||
83
micasad/lib/common/Utils.cs
Normal file
83
micasad/lib/common/Utils.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
/***********************************************************************
|
||||
*
|
||||
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 Lesser 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, Novell, Inc.
|
||||
*
|
||||
* To contact Novell about this file by physical or electronic mail,
|
||||
* you may find current contact information at www.novell.com.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
// using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Novell.CASA.MiCasa.Common
|
||||
{
|
||||
class Utils
|
||||
{
|
||||
public static string EscapeReservedChars(string origString)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < origString.Length; i++)
|
||||
{
|
||||
switch (origString[i])
|
||||
{
|
||||
case ':':
|
||||
{
|
||||
sb.Append("\\");
|
||||
break;
|
||||
}
|
||||
case '\\':
|
||||
{
|
||||
sb.Append("\\");
|
||||
break;
|
||||
}
|
||||
case '=':
|
||||
{
|
||||
sb.Append("\\");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
sb.Append(origString[i]);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static string UnescapeString(string sOrig)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < sOrig.Length; i++)
|
||||
{
|
||||
if (sOrig[i].Equals('\\'))
|
||||
{
|
||||
if (i + 1 < sOrig.Length)
|
||||
{
|
||||
if (sOrig[i + 1].Equals(':')
|
||||
|| sOrig[i + 1].Equals('\\')
|
||||
|| sOrig[i + 1].Equals('='))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sb.Append(sOrig[i]);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
122
micasad/lib/common/WrappedObject.cs
Normal file
122
micasad/lib/common/WrappedObject.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
/***********************************************************************
|
||||
*
|
||||
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 Lesser 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, Novell, Inc.
|
||||
*
|
||||
* To contact Novell about this file by physical or electronic mail,
|
||||
* you may find current contact information at www.novell.com.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace Novell.CASA.MiCasa.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for MessageObject.
|
||||
/// </summary>
|
||||
///
|
||||
[Serializable]
|
||||
public class WrappedObject
|
||||
{
|
||||
public static string DEFAULT_KEYCHAIN_ID = "SSCS_SESSION_KEY_CHAIN_ID\0";
|
||||
|
||||
private int m_verb = 0;
|
||||
private string m_KeychainID = null;
|
||||
private string m_SecretID = null;
|
||||
private string m_KeyID = null;
|
||||
|
||||
private object m_object;
|
||||
|
||||
private int m_rcode = 0;
|
||||
private string m_errorMsg;
|
||||
|
||||
public WrappedObject(int rcode, string errorMsg)
|
||||
{
|
||||
m_rcode = rcode;
|
||||
m_errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
public WrappedObject(int verb, string sKeychainID, string sSecretID, string sKeyID, object theObject)
|
||||
{
|
||||
m_verb = verb;
|
||||
if (sKeychainID != null)
|
||||
m_KeychainID = sKeychainID + '\0';
|
||||
else
|
||||
m_KeychainID = DEFAULT_KEYCHAIN_ID;
|
||||
|
||||
if (sSecretID != null)
|
||||
{
|
||||
if (sSecretID.StartsWith("SS_CredSet"))
|
||||
m_SecretID = "SS_CredSet:" + Utils.EscapeReservedChars(sSecretID.Substring(11)) + '\0';
|
||||
else
|
||||
m_SecretID = "SS_CredSet:" + Utils.EscapeReservedChars(sSecretID) + '\0';
|
||||
}
|
||||
|
||||
if (sKeyID != null)
|
||||
m_KeyID = Utils.EscapeReservedChars(sKeyID); // + '\0';
|
||||
|
||||
// serialize the object
|
||||
m_object = theObject;
|
||||
}
|
||||
|
||||
public string GetKeyID()
|
||||
{
|
||||
return m_KeyID;
|
||||
}
|
||||
|
||||
public string GetSecretID()
|
||||
{
|
||||
return m_SecretID;
|
||||
}
|
||||
|
||||
public string GetKeychainID()
|
||||
{
|
||||
return m_KeychainID;
|
||||
}
|
||||
|
||||
public object GetObject()
|
||||
{
|
||||
return m_object;
|
||||
}
|
||||
|
||||
public void SetObject(object theobject)
|
||||
{
|
||||
m_object = theobject;
|
||||
}
|
||||
|
||||
public int GetAction()
|
||||
{
|
||||
return m_verb;
|
||||
}
|
||||
|
||||
public void SetError(int rcode, string message)
|
||||
{
|
||||
m_rcode = rcode;
|
||||
m_errorMsg = message;
|
||||
}
|
||||
|
||||
public int GetReturnCode()
|
||||
{
|
||||
return m_rcode;
|
||||
}
|
||||
|
||||
public string GetReturnMessage()
|
||||
{
|
||||
return m_errorMsg;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user