From 2ec99203a268fc01dde825e423db448148093134 Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Fri, 18 Aug 2006 17:41:08 +0000 Subject: [PATCH] c# wrapper updates, etc. --- CASA-auth-token/non-java/auth.sln | 2 +- .../authtokenclient_msm.vdproj | 116 ++++++++++-------- .../Novell.Casa.Authtoken/AssemblyInfo.cs | 13 +- .../Novell.Casa.Authtoken/AuthToken.snk | Bin 0 -> 596 bytes .../csharp/Novell.Casa.Authtoken/Authtoken.cs | 56 ++++----- .../Novell.Casa.Client.csproj | 2 +- .../non-java/client/csharp/test/Class1.cs | 2 +- 7 files changed, 98 insertions(+), 93 deletions(-) create mode 100644 CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/AuthToken.snk diff --git a/CASA-auth-token/non-java/auth.sln b/CASA-auth-token/non-java/auth.sln index 848aebfb..00efd6af 100644 --- a/CASA-auth-token/non-java/auth.sln +++ b/CASA-auth-token/non-java/auth.sln @@ -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 diff --git a/CASA-auth-token/non-java/client/authtokenclient_msm/authtokenclient_msm.vdproj b/CASA-auth-token/non-java/client/authtokenclient_msm/authtokenclient_msm.vdproj index 0f8c97b6..8ffcc127 100644 --- a/CASA-auth-token/non-java/client/authtokenclient_msm/authtokenclient_msm.vdproj +++ b/CASA-auth-token/non-java/client/authtokenclient_msm/authtokenclient_msm.vdproj @@ -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" diff --git a/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/AssemblyInfo.cs b/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/AssemblyInfo.cs index 177a4f0e..2548f91a 100644 --- a/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/AssemblyInfo.cs +++ b/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/AssemblyInfo.cs @@ -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("")] diff --git a/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/AuthToken.snk b/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/AuthToken.snk new file mode 100644 index 0000000000000000000000000000000000000000..a319b439b3364814c424cd1f1ca6d9af7371b6bb GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50097>KBPAGtY+GH^IdH;O{XoDURcNEA}tV; zRVw%vkeFZ!dfnfC74ZZJb_k9jZzCJaDv2i`t3 z9EcJ{%KQ>-;{x8RnLhz4!k$QwS!&I_>N@7ZyuFN76ZSYsK{04>kDj=T(%<&}$dJ5u zL9WYS@Zx}`2-MyQHSsucI8)q$$cMa#?kfiQq?W_^iDBF0bkLxbIL!;M>{}>0XH;FmVBr< zRad*g(|A-ABfWvYT#B&@Or@V#(6Puv&dL(23m!CE`7}49Q`RN-0u0!t4}~>ARA%%s zatv2quwfwMgU?Q>!BSs#9)VnBVc2FX!tbQA3d}AtXWE^dDj$+bWt-BgX7{! zT~jjA8~G*eL$qC7YJO3;B%usXZ>uBH=rU%*3fq+;rT(GBKuj{g@GX8Nn%8GvLFV$ z+@??})z!?|jK5(?Rw}>oEy?PBm)rB?=%Q!4)s~$Og4`Zo<(pm<#~2+GY)kGehDPJ2 id<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); } - } } diff --git a/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/Novell.Casa.Client.csproj b/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/Novell.Casa.Client.csproj index 75a56d67..1f419bbd 100644 --- a/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/Novell.Casa.Client.csproj +++ b/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/Novell.Casa.Client.csproj @@ -76,7 +76,7 @@ /> diff --git a/CASA-auth-token/non-java/client/csharp/test/Class1.cs b/CASA-auth-token/non-java/client/csharp/test/Class1.cs index 8cbd3c4c..c92843f4 100644 --- a/CASA-auth-token/non-java/client/csharp/test/Class1.cs +++ b/CASA-auth-token/non-java/client/csharp/test/Class1.cs @@ -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