c# wrapper updates, etc.
This commit is contained in:
		@@ -28,7 +28,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Novell.Casa.Client", "clien
 | 
			
		||||
	ProjectSection(ProjectDependencies) = postProject
 | 
			
		||||
	EndProjectSection
 | 
			
		||||
EndProject
 | 
			
		||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestClientAuth", "TestClientAuth\TestClientAuth.csproj", "{0EA635EA-97F2-4950-B36B-8151ED858DA4}"
 | 
			
		||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestClientAuth", "client\csharp\test\TestClientAuth.csproj", "{0EA635EA-97F2-4950-B36B-8151ED858DA4}"
 | 
			
		||||
	ProjectSection(ProjectDependencies) = postProject
 | 
			
		||||
	EndProjectSection
 | 
			
		||||
EndProject
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,12 @@
 | 
			
		||||
        "Entry"
 | 
			
		||||
        {
 | 
			
		||||
        "MsmKey" = "8:_313DE095D13281AF91A64E3F3D472413"
 | 
			
		||||
        "OwnerKey" = "8:_409269C4EABE4CC18045A808B7B1C104"
 | 
			
		||||
        "MsmSig" = "8:_UNDEFINED"
 | 
			
		||||
        }
 | 
			
		||||
        "Entry"
 | 
			
		||||
        {
 | 
			
		||||
        "MsmKey" = "8:_313DE095D13281AF91A64E3F3D472413"
 | 
			
		||||
        "OwnerKey" = "8:_9A2FC85FE99C48E8AD1E4813BE33A03A"
 | 
			
		||||
        "MsmSig" = "8:_UNDEFINED"
 | 
			
		||||
        }
 | 
			
		||||
@@ -57,14 +63,14 @@
 | 
			
		||||
        }
 | 
			
		||||
        "Entry"
 | 
			
		||||
        {
 | 
			
		||||
        "MsmKey" = "8:_71C343EBC4935F8914C3145115EDEC4A"
 | 
			
		||||
        "OwnerKey" = "8:_0C0B5ECE6E9C47F1A1F13B58141B5DC8"
 | 
			
		||||
        "MsmKey" = "8:_7A0B81639B6D4DB1839306A9290BDE2D"
 | 
			
		||||
        "OwnerKey" = "8:_8292EFFD84EF46C6BD2F1F3E20808684"
 | 
			
		||||
        "MsmSig" = "8:_UNDEFINED"
 | 
			
		||||
        }
 | 
			
		||||
        "Entry"
 | 
			
		||||
        {
 | 
			
		||||
        "MsmKey" = "8:_71C343EBC4935F8914C3145115EDEC4A"
 | 
			
		||||
        "OwnerKey" = "8:_409269C4EABE4CC18045A808B7B1C104"
 | 
			
		||||
        "MsmKey" = "8:_8292EFFD84EF46C6BD2F1F3E20808684"
 | 
			
		||||
        "OwnerKey" = "8:_UNDEFINED"
 | 
			
		||||
        "MsmSig" = "8:_UNDEFINED"
 | 
			
		||||
        }
 | 
			
		||||
        "Entry"
 | 
			
		||||
@@ -73,12 +79,6 @@
 | 
			
		||||
        "OwnerKey" = "8:_UNDEFINED"
 | 
			
		||||
        "MsmSig" = "8:_UNDEFINED"
 | 
			
		||||
        }
 | 
			
		||||
        "Entry"
 | 
			
		||||
        {
 | 
			
		||||
        "MsmKey" = "8:_FE85A5D48B5A23F3077871E9FD2378DE"
 | 
			
		||||
        "OwnerKey" = "8:_0C0B5ECE6E9C47F1A1F13B58141B5DC8"
 | 
			
		||||
        "MsmSig" = "8:_UNDEFINED"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    "Configurations"
 | 
			
		||||
    {
 | 
			
		||||
@@ -228,52 +228,23 @@
 | 
			
		||||
            "IsDependency" = "11:FALSE"
 | 
			
		||||
            "IsolateTo" = "8:"
 | 
			
		||||
            }
 | 
			
		||||
            "{A582A373-4685-4296-BEFE-614B80A702C3}:_71C343EBC4935F8914C3145115EDEC4A"
 | 
			
		||||
            {
 | 
			
		||||
            "SourcePath" = "8:micasa.dll"
 | 
			
		||||
            "TargetName" = "8:micasa.dll"
 | 
			
		||||
            "Tag" = "8:"
 | 
			
		||||
            "Folder" = "8:_01897726E7804A3B875B67A1C2692147"
 | 
			
		||||
            "Condition" = "8:"
 | 
			
		||||
            "Transitive" = "11:FALSE"
 | 
			
		||||
            "Vital" = "11:TRUE"
 | 
			
		||||
            "ReadOnly" = "11:FALSE"
 | 
			
		||||
            "Hidden" = "11:FALSE"
 | 
			
		||||
            "System" = "11:FALSE"
 | 
			
		||||
            "Permanent" = "11:FALSE"
 | 
			
		||||
            "SharedLegacy" = "11:FALSE"
 | 
			
		||||
            "PackageAs" = "3:1"
 | 
			
		||||
            "Register" = "3:1"
 | 
			
		||||
            "Exclude" = "11:TRUE"
 | 
			
		||||
            "IsDependency" = "11:TRUE"
 | 
			
		||||
            "IsolateTo" = "8:"
 | 
			
		||||
            }
 | 
			
		||||
            "{A582A373-4685-4296-BEFE-614B80A702C3}:_FE85A5D48B5A23F3077871E9FD2378DE"
 | 
			
		||||
            {
 | 
			
		||||
            "SourcePath" = "8:WINHTTP.dll"
 | 
			
		||||
            "TargetName" = "8:WINHTTP.dll"
 | 
			
		||||
            "Tag" = "8:"
 | 
			
		||||
            "Folder" = "8:_01897726E7804A3B875B67A1C2692147"
 | 
			
		||||
            "Condition" = "8:"
 | 
			
		||||
            "Transitive" = "11:FALSE"
 | 
			
		||||
            "Vital" = "11:TRUE"
 | 
			
		||||
            "ReadOnly" = "11:FALSE"
 | 
			
		||||
            "Hidden" = "11:FALSE"
 | 
			
		||||
            "System" = "11:FALSE"
 | 
			
		||||
            "Permanent" = "11:FALSE"
 | 
			
		||||
            "SharedLegacy" = "11:FALSE"
 | 
			
		||||
            "PackageAs" = "3:1"
 | 
			
		||||
            "Register" = "3:1"
 | 
			
		||||
            "Exclude" = "11:TRUE"
 | 
			
		||||
            "IsDependency" = "11:TRUE"
 | 
			
		||||
            "IsolateTo" = "8:"
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        "FileType"
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
        "Folder"
 | 
			
		||||
        {
 | 
			
		||||
            "{B4CE2BB7-2D9F-4E14-A952-99DFEBF520A8}:_8E0BBDD021EA45308BD98380F28EB7F6"
 | 
			
		||||
            {
 | 
			
		||||
            "Name" = "8:#1927"
 | 
			
		||||
            "AlwaysCreate" = "11:FALSE"
 | 
			
		||||
            "Condition" = "8:"
 | 
			
		||||
            "Transitive" = "11:FALSE"
 | 
			
		||||
            "Property" = "8:GAC"
 | 
			
		||||
                "Folders"
 | 
			
		||||
                {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            "{78BAF5CE-F2E5-45BE-83BC-DB6AF387E941}:_DB481DA18FE347988F44E459AD84EDE9"
 | 
			
		||||
            {
 | 
			
		||||
            "Name" = "8:#1912"
 | 
			
		||||
@@ -382,6 +353,17 @@
 | 
			
		||||
        }
 | 
			
		||||
        "MergeModule"
 | 
			
		||||
        {
 | 
			
		||||
            "{35A69C6E-5BA4-440D-803D-762B59A45393}:_7A0B81639B6D4DB1839306A9290BDE2D"
 | 
			
		||||
            {
 | 
			
		||||
            "UseDynamicProperties" = "11:FALSE"
 | 
			
		||||
            "IsDependency" = "11:TRUE"
 | 
			
		||||
            "SourcePath" = "8:dotnetfxredist_x86.msm"
 | 
			
		||||
            "LanguageId" = "3:1033"
 | 
			
		||||
            "Exclude" = "11:FALSE"
 | 
			
		||||
            "Folder" = "8:"
 | 
			
		||||
            "Feature" = "8:"
 | 
			
		||||
            "IsolateTo" = "8:"
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        "Module"
 | 
			
		||||
        {
 | 
			
		||||
@@ -399,7 +381,7 @@
 | 
			
		||||
        {
 | 
			
		||||
            "{8062640A-2EEE-46E9-AB67-688E9A886E9F}:_0C0B5ECE6E9C47F1A1F13B58141B5DC8"
 | 
			
		||||
            {
 | 
			
		||||
            "SourcePath" = "8:..\\windows\\debug\\authtoken.dll"
 | 
			
		||||
            "SourcePath" = "8:..\\windows\\Debug\\authtoken.dll"
 | 
			
		||||
            "TargetName" = "8:"
 | 
			
		||||
            "Tag" = "8:"
 | 
			
		||||
            "Folder" = "8:_01897726E7804A3B875B67A1C2692147"
 | 
			
		||||
@@ -427,7 +409,7 @@
 | 
			
		||||
            }
 | 
			
		||||
            "{8062640A-2EEE-46E9-AB67-688E9A886E9F}:_409269C4EABE4CC18045A808B7B1C104"
 | 
			
		||||
            {
 | 
			
		||||
            "SourcePath" = "8:..\\mechanisms\\pwd\\windows\\Debug\\pwmech.dll"
 | 
			
		||||
            "SourcePath" = "8:..\\mechanisms\\krb5\\windows\\Debug\\krb5mech.dll"
 | 
			
		||||
            "TargetName" = "8:"
 | 
			
		||||
            "Tag" = "8:"
 | 
			
		||||
            "Folder" = "8:_F5F5F604B81645F8B6463F7A7D6A53AD"
 | 
			
		||||
@@ -453,9 +435,37 @@
 | 
			
		||||
                {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            "{8062640A-2EEE-46E9-AB67-688E9A886E9F}:_8292EFFD84EF46C6BD2F1F3E20808684"
 | 
			
		||||
            {
 | 
			
		||||
            "SourcePath" = "8:..\\csharp\\Novell.Casa.Authtoken\\obj\\Debug\\Novell.Casa.Client.Auth.dll"
 | 
			
		||||
            "TargetName" = "8:"
 | 
			
		||||
            "Tag" = "8:"
 | 
			
		||||
            "Folder" = "8:_8E0BBDD021EA45308BD98380F28EB7F6"
 | 
			
		||||
            "Condition" = "8:"
 | 
			
		||||
            "Transitive" = "11:FALSE"
 | 
			
		||||
            "Vital" = "11:TRUE"
 | 
			
		||||
            "ReadOnly" = "11:FALSE"
 | 
			
		||||
            "Hidden" = "11:FALSE"
 | 
			
		||||
            "System" = "11:FALSE"
 | 
			
		||||
            "Permanent" = "11:FALSE"
 | 
			
		||||
            "SharedLegacy" = "11:FALSE"
 | 
			
		||||
            "PackageAs" = "3:1"
 | 
			
		||||
            "Register" = "3:1"
 | 
			
		||||
            "Exclude" = "11:FALSE"
 | 
			
		||||
            "IsDependency" = "11:FALSE"
 | 
			
		||||
            "IsolateTo" = "8:"
 | 
			
		||||
            "ProjectOutputGroupRegister" = "3:1"
 | 
			
		||||
            "OutputConfiguration" = "8:"
 | 
			
		||||
            "OutputGroupCanonicalName" = "8:Built"
 | 
			
		||||
            "OutputProjectGuid" = "8:{1BA1FC97-5AF1-4506-A7FD-EBFD46D361A0}"
 | 
			
		||||
            "ShowKeyOutput" = "11:TRUE"
 | 
			
		||||
                "ExcludeFilters"
 | 
			
		||||
                {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            "{8062640A-2EEE-46E9-AB67-688E9A886E9F}:_9A2FC85FE99C48E8AD1E4813BE33A03A"
 | 
			
		||||
            {
 | 
			
		||||
            "SourcePath" = "8:..\\mechanisms\\krb5\\windows\\debug\\krb5mech.dll"
 | 
			
		||||
            "SourcePath" = "8:..\\mechanisms\\krb5\\windows\\Debug\\krb5mech.dll"
 | 
			
		||||
            "TargetName" = "8:"
 | 
			
		||||
            "Tag" = "8:"
 | 
			
		||||
            "Folder" = "8:_F5F5F604B81645F8B6463F7A7D6A53AD"
 | 
			
		||||
 
 | 
			
		||||
@@ -6,15 +6,14 @@ using System.Runtime.CompilerServices;
 | 
			
		||||
// set of attributes. Change these attribute values to modify the information
 | 
			
		||||
// associated with an assembly.
 | 
			
		||||
//
 | 
			
		||||
[assembly: AssemblyTitle("")]
 | 
			
		||||
[assembly: AssemblyDescription("")]
 | 
			
		||||
[assembly: AssemblyTitle("AuthToken Wrapper")]
 | 
			
		||||
[assembly: AssemblyDescription("C# Wrapper for Authentication Tokens")]
 | 
			
		||||
[assembly: AssemblyConfiguration("")]
 | 
			
		||||
[assembly: AssemblyCompany("")]
 | 
			
		||||
[assembly: AssemblyProduct("")]
 | 
			
		||||
[assembly: AssemblyCompany("Novell, Inc")]
 | 
			
		||||
[assembly: AssemblyProduct("CASA")]
 | 
			
		||||
[assembly: AssemblyCopyright("")]
 | 
			
		||||
[assembly: AssemblyTrademark("")]
 | 
			
		||||
[assembly: AssemblyCulture("")]		
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Version information for an assembly consists of the following four values:
 | 
			
		||||
//
 | 
			
		||||
@@ -26,7 +25,7 @@ using System.Runtime.CompilerServices;
 | 
			
		||||
// You can specify all the values or you can default the Revision and Build Numbers 
 | 
			
		||||
// by using the '*' as shown below:
 | 
			
		||||
 | 
			
		||||
[assembly: AssemblyVersion("1.0.*")]
 | 
			
		||||
[assembly: AssemblyVersion("1.7.*")]
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// In order to sign your assembly you must specify a key to use. Refer to the 
 | 
			
		||||
@@ -54,5 +53,5 @@ using System.Runtime.CompilerServices;
 | 
			
		||||
//       documentation for more information on this.
 | 
			
		||||
//
 | 
			
		||||
[assembly: AssemblyDelaySign(false)]
 | 
			
		||||
[assembly: AssemblyKeyFile("")]
 | 
			
		||||
[assembly: AssemblyKeyFile("../../AuthToken.snk")]
 | 
			
		||||
[assembly: AssemblyKeyName("")]
 | 
			
		||||
 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							@@ -10,23 +10,21 @@ namespace Novell.Casa.Client.Auth
 | 
			
		||||
	public class Authtoken
 | 
			
		||||
	{
 | 
			
		||||
		private const string AUTH_LIBRARY = "C:\\Program Files\\Novell\\CASA\\lib\\authtoken";
 | 
			
		||||
		private const int BUFFER_OVERFLOW = 6;
 | 
			
		||||
 | 
			
		||||
		[DllImport(AUTH_LIBRARY, CharSet=CharSet.None) ]
 | 
			
		||||
		public static extern int ObtainAuthToken
 | 
			
		||||
			(
 | 
			
		||||
				[In]		byte[] 			baService,		
 | 
			
		||||
				[In]		byte[]  		baHost,
 | 
			
		||||
							IntPtr			pToken,				
 | 
			
		||||
				[In, Out]	ref int 		iTokenLength								
 | 
			
		||||
				[In, Out]	byte[]	 		baToken,							
 | 
			
		||||
				[In, Out]	ref int 		iTokenLength
 | 
			
		||||
			);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		public Authtoken()
 | 
			
		||||
		{
 | 
			
		||||
			//
 | 
			
		||||
			// TODO: Add constructor logic here
 | 
			
		||||
			//
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -34,10 +32,8 @@ namespace Novell.Casa.Client.Auth
 | 
			
		||||
		{
 | 
			
		||||
			int rcode = 0;
 | 
			
		||||
			byte[] baService = null;
 | 
			
		||||
			byte[] baHost =  null;
 | 
			
		||||
			
 | 
			
		||||
			int bufferSize = 4096;
 | 
			
		||||
			IntPtr pBuffer = Marshal.AllocHGlobal(bufferSize);
 | 
			
		||||
			byte[] baHost =  null;			
 | 
			
		||||
			int bufferSize = 0;			
 | 
			
		||||
 | 
			
		||||
			byte[] baToken = new byte[bufferSize];
 | 
			
		||||
 | 
			
		||||
@@ -56,45 +52,45 @@ namespace Novell.Casa.Client.Auth
 | 
			
		||||
			{
 | 
			
		||||
				baHost = Encoding.ASCII.GetBytes(sHost);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			LogMessage("Calling Native API->ObtainAuthToken");
 | 
			
		||||
			LogMessage("Buffer size is "+ bufferSize);
 | 
			
		||||
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				throw new Exception("Invalid parameter");
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			
 | 
			
		||||
			// call with buffersize of 0.  This way we determine the exact size.
 | 
			
		||||
			try
 | 
			
		||||
			{
 | 
			
		||||
				rcode = ObtainAuthToken(baService, baHost, pBuffer, ref bufferSize);						
 | 
			
		||||
				rcode = ObtainAuthToken(baService, baHost, baToken, ref bufferSize);
 | 
			
		||||
				
 | 
			
		||||
				int test = (rcode & BUFFER_OVERFLOW);
 | 
			
		||||
				if (test == BUFFER_OVERFLOW)
 | 
			
		||||
				{				
 | 
			
		||||
					// now allocate the proper size
 | 
			
		||||
					baToken = new byte[bufferSize];
 | 
			
		||||
					rcode = ObtainAuthToken(baService, baHost, baToken, ref bufferSize);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			catch (Exception e)
 | 
			
		||||
			{
 | 
			
		||||
				LogMessage(e.ToString());
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			LogMessage("ObtainAuthToken returned " + rcode);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
									
 | 
			
		||||
 | 
			
		||||
			if (rcode != 0)
 | 
			
		||||
			{
 | 
			
		||||
				Marshal.FreeHGlobal(pBuffer);
 | 
			
		||||
			{				
 | 
			
		||||
				throw new Exception(rcode.ToString());
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				// marshal the IntPtr into a byte array
 | 
			
		||||
				String sTemp = Marshal.PtrToStringAnsi(pBuffer, bufferSize);
 | 
			
		||||
				Marshal.FreeHGlobal(pBuffer);
 | 
			
		||||
				return (Encoding.ASCII.GetBytes(sTemp));
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			return null;
 | 
			
		||||
			
 | 
			
		||||
				return baToken;
 | 
			
		||||
			}			
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		private static void LogMessage(string sMessage)
 | 
			
		||||
		{
 | 
			
		||||
			System.Diagnostics.Trace.WriteLine("(C#)AuthToken: " + sMessage);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -76,7 +76,7 @@
 | 
			
		||||
                />
 | 
			
		||||
                <Reference
 | 
			
		||||
                    Name = "System.XML"
 | 
			
		||||
                    AssemblyName = "System.XML"
 | 
			
		||||
                    AssemblyName = "System.Xml"
 | 
			
		||||
                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
 | 
			
		||||
                />
 | 
			
		||||
            </References>
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ namespace TestClientAuth
 | 
			
		||||
			try
 | 
			
		||||
			{
 | 
			
		||||
				byte[] baToken = Authtoken.ObtainAuthToken("testService", args[0]);
 | 
			
		||||
				Console.WriteLine("Token returned:");
 | 
			
		||||
				Console.WriteLine("Token returned: ("+ baToken.Length + ")");
 | 
			
		||||
				for (int i=0; i<baToken.Length; i++)
 | 
			
		||||
				{
 | 
			
		||||
					Console.Write(baToken[i].ToString());
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user