major source structure and module name changes

This commit is contained in:
soochoi
2006-06-07 16:34:19 +00:00
parent 5c75241b4b
commit 1fa6f07e83
651 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
/***********************************************************************
*
* 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.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("Novell.CASA.Common.dll")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Novell, Inc")]
[assembly: AssemblyProduct("CASA")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.6.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]

111
micasad/lib/Makefile.am Normal file
View File

@@ -0,0 +1,111 @@
#######################################################################
#
# 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.
#
#
#######################################################################
if DEBUG
TARGET_CFG = Debug
CFLAGS += -v -w
#CS_EXTRA_FLAGS = $(CSCFLAGS_DEBUG)
else
TARGET_CFG = Release
endif
SUBDIRS =
DIST_SUBDIRS = common communication
EXTRA_DIST = $(CSFILES)
CASAROOT = ../..
CASALIBDIR = $(CASAROOT)/$(LIB)
# handle Mono secondary dependencies
export MONO_PATH := $(MONO_PATH)
PLATFORMINDEPENDENTSOURCEDIR =
PLATFORMDEPENDENTSOURCEDIR = .
MODULE_NAME =Novell.CASA.Common
MODULE_EXT =dll
CSFILES = $(srcdir)/AssemblyInfo.cs \
$(srcdir)/common/LinkedKeyInfo.cs \
$(srcdir)/common/Utils.cs \
$(srcdir)/common/Ping.cs \
$(srcdir)/common/ResetMasterPassword.cs \
$(srcdir)/common/WrappedObject.cs \
$(srcdir)/common/MiCASAStore.cs \
$(srcdir)/communication/IClientChannel.cs \
$(srcdir)/communication/IPCClientFactory.cs \
$(srcdir)/communication/MiCasaRequestReply.cs \
$(srcdir)/communication/UnixIPCClientChannel.cs
CSFILES_CSC := $(subst /,$(SEP),$(CSFILES))
CS_INCLUDES = -I. -I.. -I$(CASAROOT)/include
CS_FLAGS = /target:"library" /r:Mono.Posix.dll -d:LINUX
CS_RESOURCES =
CS_LIBS =
CS_LIBPATH =
OBJDIR = ./$(TARGET_CFG)/$(LIB)
#OBJS = $(addprefix $(OBJDIR)/, $(CSFILES:%.dll=%.cs))
CUR_DIR := $(shell pwd)
all: $(OBJDIR)/$(MODULE_NAME).$(MODULE_EXT)
#
# Pattern based rules.
#
vpath %.c $(PLATFORMDEPENDENTSOURCEDIR) $(PLATFORMINDEPENDENTSOURCEDIR)
vpath %.cpp $(PLATFORMDEPENDENTSOURCEDIR) $(PLATFORMINDEPENDENTSOURCEDIR)
vpath %.cs $(PLATFORMDEPENDENTSOURCEDIR) $(PLATFORMINDEPENDENTSOURCEDIR)
$(OBJDIR)/$(MODULE_NAME).$(MODULE_EXT): $(OBJDIR) $(CSFILES)
$(CSC) $(CS_FLAGS) $(CS_EXTRA_FLAGS) -out:$@ $(CSFILES_CSC)
cp -f $(OBJDIR)/$(MODULE_NAME).$(MODULE_EXT) $(CASALIBDIR)/$(TARGET_CFG)/$(MODULE_NAME).$(MODULE_EXT)
$(OBJDIR):
[ -d $(OBJDIR) ] || mkdir -p $(OBJDIR)
[ -d $(CASALIBDIR) ] || mkdir -p $(CASALIBDIR)
[ -d $(CASALIBDIR)/$(TARGET_CFG) ] || mkdir -p $(CASALIBDIR)/$(TARGET_CFG)
install-exec-local: $(OBJDIR)/$(MODULE_NAME).$(MODULE_EXT)
$(mkinstalldirs) $(DESTDIR)$(libdir)
$(INSTALL_PROGRAM) $(OBJDIR)/$(MODULE_NAME).$(MODULE_EXT) $(DESTDIR)$(libdir)/
uninstall-local:
cd $(DESTDIR)$(libdir); rm -f $(OBJDIR)/$(MODULE_NAME).$(MODULE_EXT)
rmdir $(DESTDIR)$(libdir)
#installcheck-local: install
# $(mkinstalldirs) $(DESTDIR)$(libdir)
# $(INSTALL_PROGRAM) $(DESTDIR)$(libdir)
# cd $(DESTDIR)$(libdir); $(MONO)
clean-local:
if [ -d $(TARGET_CFG) ]; then rm -rf $(TARGET_CFG); fi
distclean-local:
maintainer-clean-local:
rm -f Makefile.in

View File

@@ -0,0 +1,155 @@
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{57CD94A2-5B4A-40C3-8189-CB760FB78357}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "Novell.CASA.Common"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "MiCasaLibrary"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE;W32"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE; W32"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
/>
<Reference
Name = "AppModule.InterProcessComm"
Project = "{E98F1F7E-40B6-44C8-AC66-EC867B141FA1}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "AppModule.NamedPipes"
Project = "{077B53BB-404A-4B2F-BA17-AAE98C5E9C66}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "AssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "common\LinkedKeyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "common\MiCASAStore.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "common\Ping.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "common\ResetMasterPassword.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "common\Utils.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "common\WrappedObject.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "communication\IClientChannel.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "communication\IPCClientFactory.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "communication\MiCasaRequestReply.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "communication\WinIPCClientChannel.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>

View File

@@ -0,0 +1,48 @@
<VisualStudioProject>
<CSHARP LastOpenVersion = "7.10.3077" >
<Build>
<Settings ReferencePath = "D:\csharp\namedpipe2\AppModule.InterProcessComm\bin\Debug\;D:\csharp\namedpipe2\AppModule.NamedPipes\bin\Debug\;D:\casatest\extern\w32\namedpipes\;D:\casaoutside\extern\w32\namedpipes\;D:\casaAll\trunk\extern\w32\namedpipes\" >
<Config
Name = "Debug"
EnableASPDebugging = "false"
EnableASPXDebugging = "false"
EnableUnmanagedDebugging = "false"
EnableSQLServerDebugging = "false"
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
StartArguments = ""
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
StartWithIE = "true"
/>
<Config
Name = "Release"
EnableASPDebugging = "false"
EnableASPXDebugging = "false"
EnableUnmanagedDebugging = "false"
EnableSQLServerDebugging = "false"
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
StartArguments = ""
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
StartWithIE = "true"
/>
</Settings>
</Build>
<OtherProjectSettings
CopyProjectDestinationFolder = ""
CopyProjectUncPath = ""
CopyProjectOption = "0"
ProjectView = "ShowAllFiles"
ProjectTrust = "0"
/>
</CSHARP>
</VisualStudioProject>

View 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;
}
}
}

View 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

View 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;
}
}
}

View 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;
}
}

View 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;
}
}
}

View 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();
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,40 @@
/***********************************************************************
*
* 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.Net;
using System.Net.Sockets;
//using sscs.communication.win.NamedPipes;
namespace Novell.CASA.MiCasa.Communication
{
public interface ClientChannel
{
void Open();
int Read(byte[] buf);
byte[] Read();
int Write(byte[] buf);
void Close();
}
}

View File

@@ -0,0 +1,50 @@
/***********************************************************************
*
* 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.Communication
{
/// <summary>
/// Summary description for IPCClientFactory.
/// </summary>
public class IPCClientFactory
{
private IPCClientFactory()
{
}
public static ClientChannel CreateClientConnection()
{
#if LINUX
return( new UnixIPCClientChannel());
#endif
#if W32
return (new WinIPCClientChannel());
#endif
}
}
}

View 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

View File

@@ -0,0 +1,185 @@
/***********************************************************************
*
* 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;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using Novell.CASA.MiCasa.Common;
namespace Novell.CASA.MiCasa.Communication
{
/// <summary>
/// Summary description for MiCasaRequestReply.
/// </summary>
public class MiCasaRequestReply
{
//public const int VERB_GET_SECRET = 1;
//public const int VERB_SET_SECRET = 2;
//public const int VERB_GET_KEYCHAIN = 3;
//public const int VERB_GET_STORE = 4;
//public const int VERB_SET_KEYVALUE = 5;
//public const int VERB_GET_KEYVALUE = 6;
public const int VERB_SET_LINKED_KEY = 7;
public const int VERB_GET_LINKED_KEYS = 8;
public const int VERB_REMOVE_LINKED_KEY = 9;
public const int VERB_WRITE_KEY = 10;
public const int VERB_REMOVE_ALL_SECRETS = 11;
public const int VERB_LOCK_STORE = 12;
public const int VERB_UNLOCK_STORE = 13;
public const int VERB_GET_STORE_STATUS = 14;
public const int VERB_REMOVE_KEY = 15;
public const int VERB_READ_KEY = 16;
public const int VERB_GET_KEY_LIST = 17;
public const int VERB_RESET_MASTER_PASSWORD = 18;
public const int VERB_GET_SECRETIDS = 19;
public const int VERB_VALIDATE_DESKTOP_PWD = 20;
public const int VERB_DUMP_LINKED_KEYS = 96;
public const int VERB_CREATE_TEST_SECRETS = 97;
public const int VERB_REMOVE_TEST_SECRETS = 98;
public const int VERB_PING_MICASAD = 99;
public MiCasaRequestReply()
{
//
// TODO: Add constructor logic here
//
}
public static object Send(int verb)
{
return Send(verb, null, null, null, null);
}
public static object Send(int verb, object wo)
{
return Send(verb, null, null, null, wo);
}
public static object Send(int verb,
string sKeyChainID,
string sSecretID,
string sKeyID,
object theObject)
{
// Lengths of message fields
int MSGID_LEN = 2;
int MSG_LEN = 4;
WrappedObject request;
WrappedObject reply = null;
// open a client connection
//IInterProcessConnection clientConnection = null;
ClientChannel ipcChannel = IPCClientFactory.CreateClientConnection();
ipcChannel.Open();
try
{
// contruct and serialize the Message Object
request = new WrappedObject(verb, sKeyChainID, sSecretID, sKeyID, theObject);
BinaryFormatter formatter = new BinaryFormatter();
MemoryStream ms = new MemoryStream();
formatter.Serialize(ms, request);
ms.Flush();
ms.Position = 0;
byte[] rawBytes = new byte[2+4+ms.Length];
byte[] t = new byte[10];
// set message id
int destIndex = 0;
ushort msgId = 20;
t = BitConverter.GetBytes((ushort)msgId);
Array.Copy(t,0,rawBytes,destIndex,MSGID_LEN);
destIndex += MSGID_LEN;
// set the object length
//Poorna
int msgLen = 2+4+(int)ms.Length;
// int msgLen = (int)ms.Length;
t = BitConverter.GetBytes(msgLen);
// t = BitConverter.GetBytes(ms.Length);
Array.Copy(t,0,rawBytes,destIndex,MSG_LEN);
destIndex += MSG_LEN;
// copy in the object
Array.Copy(ms.GetBuffer(), 0, rawBytes, destIndex, ms.Length);
//clientConnection = new ClientPipeConnection("MyPipe", ".");
//clientConnection = new ClientPipeConnection(XTIER_RPC_PIPE, ".");
//clientConnection.Connect();
// write the bytes
//clientConnection.WriteBytes(rawBytes);
ipcChannel.Write(rawBytes);
// read the bytes
//byte[] returnBuffer = clientConnection.ReadBytes();
byte[] returnBuffer = ipcChannel.Read();
if (returnBuffer != null)
{
// deserialize MessageObject
uint iMsgLen = BitConverter.ToUInt32(returnBuffer,0);
ms = new MemoryStream(returnBuffer, 4, (int)iMsgLen);
ms.Position = 0;
reply = (WrappedObject)formatter.Deserialize(ms);
if (reply.GetReturnCode() != 0)
{
ipcChannel.Close();
throw new Exception(reply.GetReturnCode().ToString());
}
}
// close the connection
//clientConnection.Close();
ipcChannel.Close();
}
catch (Exception e1)
{
//Console.WriteLine(e1.ToString());
//clientConnection.Dispose();
//throw new Exception(e1.ToString());
}
if (reply != null)
return reply.GetObject();
else
return null;
}
}
}

View File

@@ -0,0 +1,178 @@
/***********************************************************************
*
* 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.Net;
using System.IO;
using System.Net.Sockets;
using Mono.Unix;
using System.Text;
namespace Novell.CASA.MiCasa.Communication
{
/// <summary>
/// Summary description for UnixIPCClientChannel.
/// </summary>
public class UnixIPCClientChannel : ClientChannel
{
private Socket mSocket = null;
private string socketFileName = "/tmp/.novellCASA";
private EndPoint sockEndPoint;
public UnixIPCClientChannel()
{
}
public void Open()
{
mSocket = new Socket( AddressFamily.Unix,
SocketType.Stream,
ProtocolType.IP );
if (mSocket == null)
{
throw new Exception("could not get socket");
}
sockEndPoint = new UnixEndPoint(socketFileName);
UnixFileSystemInfo sockFileInfo = new UnixFileInfo(socketFileName);
UnixUserInfo sockFileOwner = sockFileInfo.OwnerUser;
// root is the owner of the file "/tmp/.novellCASA"
if (sockFileOwner.UserId == 0)
{
mSocket.Connect(sockEndPoint);
}
else
{
throw new Exception("not a valid miCASA service");
}
}
public int Read(byte[] buf)
{
buf = Read();
if (buf != null)
{
//Console.WriteLine("Bytes read = " + buf.Length);
return buf.Length;
}
else
return 0;
}
public byte[] Read()
{
byte[] returnBuffer = null;
int bytesRecvd = 0;
try
{
/* We need to read 'msgLen' to know how many bytes to
* allocate.
*/
byte[] msgIdBytes = new byte[2];
bytesRecvd = mSocket.Receive(msgIdBytes);
if( 0 == bytesRecvd )
{
return null;
}
byte[] msgLenBytes = new byte[4];
bytesRecvd = mSocket.Receive(msgLenBytes);
if( 0 == bytesRecvd )
{
return null;
}
uint msgLen = BitConverter.ToUInt32(msgLenBytes,0);
if( msgLen > 6 )
{
System.Text.Encoding encoding = System.Text.Encoding.ASCII;
byte[] buf = null;
int bytesAvailable;
int totalBytes = 0;
int msgLencount = 0;
string bufstring = null;
byte[] temp = null;
while(totalBytes<(msgLen-6))
{
bytesAvailable = mSocket.Available;
if( 0 == bytesAvailable)
{
break;
}
buf = new byte[bytesAvailable];
bytesRecvd = mSocket.Receive (buf);
bufstring = bufstring + encoding.GetString(buf); //keep buffering in a string
totalBytes = totalBytes + bytesAvailable;
}
if(totalBytes==0)
return null;
byte[] finalbuf = encoding.GetBytes(bufstring);//finally, convert the string to a byte array of size 'totalBytes'
int returnBufferLen = msgIdBytes.Length+msgLenBytes.Length+totalBytes;
returnBuffer = new byte[returnBufferLen];
Array.Copy(msgIdBytes,returnBuffer,2);
Array.Copy(msgLenBytes,0,returnBuffer,2,4);
Array.Copy(finalbuf,0,returnBuffer,6,finalbuf.Length);
return returnBuffer;
}
else
{
returnBuffer = new byte[6];
Array.Copy(msgIdBytes,returnBuffer,2);
Array.Copy(msgLenBytes,0,returnBuffer,2,4);
return returnBuffer;
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
return null;
}
}
public int Write(byte[] buf)
{
try
{
mSocket.Send(buf);
//Console.WriteLine("Bytes written = " + buf.Length);
return buf.Length;
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
return 0;
}
}
public void Close()
{
mSocket.Close();
}
}
}

View File

@@ -0,0 +1,103 @@
/***********************************************************************
*
* 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 AppModule.InterProcessComm;
using AppModule.NamedPipes;
namespace Novell.CASA.MiCasa.Communication
{
/// <summary>
/// Summary description for WinIPCClientChannel.
/// </summary>
public class WinIPCClientChannel : ClientChannel
{
private static IInterProcessConnection clientConnection = null;
private static string XTIER_RPC_PIPE = "SS_RPC_PIPE";
public WinIPCClientChannel()
{
}
public void Open()
{
if (clientConnection == null)
{
clientConnection = new ClientPipeConnection(XTIER_RPC_PIPE, ".");
clientConnection.Connect();
}
}
public int Read(byte[] buf)
{
buf = Read();
if (buf != null)
return 0;
else
return -1;
}
public byte[] Read()
{
byte[] returnBuffer;
try
{
returnBuffer = clientConnection.ReadBytes();
return returnBuffer;
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
return null;
}
}
public int Write(byte[] buf)
{
try
{
clientConnection.WriteBytes(buf);
return 0;
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
return -1;
}
}
public void Close()
{
//clientConnection.Close();
//clientConnection.Dispose();
}
}
}

13
micasad/lib/objs.lux Normal file
View File

@@ -0,0 +1,13 @@
OBJS=\
AssemblyInfo \
common/Utils \
common/LinkedKeyInfo \
common/Ping \
common/ResetMasterPassword \
common/WrappedObject \
common/MiCASAStore \
communication/IClientChannel \
communication/IPCClientFactory \
communication/MiCasaRequestReply \
communication/UnixIPCClientChannel

13
micasad/lib/src.lux Normal file
View File

@@ -0,0 +1,13 @@
SRC=\
AssemblyInfo.cs \
common/Utils.cs \
common/LinkedKeyInfo.cs \
common/Ping.cs \
common/ResetMasterPassword.cs \
common/WrappedObject.cs \
common/MiCASAStore.cs \
communication/IClientChannel.cs \
communication/IPCClientFactory.cs \
communication/MiCasaRequestReply.cs \
communication/UnixIPCClientChannel.cs