diff --git a/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/Authtoken.cs b/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/Authtoken.cs
index 3feefa21..1f23695c 100644
--- a/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/Authtoken.cs
+++ b/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/Authtoken.cs
@@ -36,15 +36,39 @@ namespace Novell.Casa.Client.Auth
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,
- [In, Out] byte[] baToken,
- [In, Out] ref int iTokenLength
- );
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
+ public struct LUID
+ {
+ public int luidLow;
+ public int luidHigh;
+ }
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
+ public class SSCS_EXT_T
+ {
+ public int extID = 0; // defined to identify the extension
+ public int version = 0; // defined as the version of the specified extension
+ public IntPtr ext; // points to the actual extension
+ } ;
+
+ [DllImport(AUTH_LIBRARY, CharSet=CharSet.None) ]
+ private static extern int ObtainAuthToken
+ (
+ [In] byte[] baService,
+ [In] byte[] baHost,
+ [In, Out] byte[] baToken,
+ [In, Out] ref int iTokenLength
+ );
+
+ [DllImport(AUTH_LIBRARY, CharSet=CharSet.None) ]
+ private static extern int ObtainAuthTokenEx
+ (
+ [In] byte[] baService,
+ [In] byte[] baHost,
+ [In, Out] byte[] baToken,
+ [In, Out] ref int iTokenLength,
+ [In] SSCS_EXT_T ext
+ );
public Authtoken()
@@ -53,11 +77,17 @@ namespace Novell.Casa.Client.Auth
public static byte[] ObtainAuthToken(string sService, string sHost)
+ {
+ return ObtainAuthToken(sService, sHost, null);
+ }
+
+ public static byte[] ObtainAuthToken(string sService, string sHost, WinLuid luid)
{
int rcode = 0;
byte[] baService = null;
byte[] baHost = null;
int bufferSize = 0;
+ bool bLuidPassedIn = false;
byte[] baToken = new byte[bufferSize];
@@ -81,11 +111,35 @@ namespace Novell.Casa.Client.Auth
throw new Exception("Invalid parameter");
}
+
+ SSCS_EXT_T ext = new SSCS_EXT_T();
+ if ((luid.GetHighPart() != 0) || (luid.GetLowPart() != 0))
+ {
+ // allocate a structure to marshal
+ LUID sluid = new LUID();
+ sluid.luidHigh = luid.GetHighPart();
+ sluid.luidLow = luid.GetLowPart();
+
+ ext.extID = 1;
+ ext.version = 1;
+ ext.ext = Marshal.AllocHGlobal(Marshal.SizeOf(sluid));
+
+ Marshal.StructureToPtr(sluid, ext.ext, false);
+ bLuidPassedIn = true;
+ }
+
// call with buffersize of 0. This way we determine the exact size.
try
{
- rcode = ObtainAuthToken(baService, baHost, baToken, ref bufferSize);
+ if (bLuidPassedIn)
+ {
+ rcode = ObtainAuthTokenEx(baService, baHost, baToken, ref bufferSize, ext);
+ }
+ else
+ {
+ rcode = ObtainAuthToken(baService, baHost, baToken, ref bufferSize);
+ }
int test = (rcode & BUFFER_OVERFLOW);
if (test == BUFFER_OVERFLOW)
@@ -101,6 +155,8 @@ namespace Novell.Casa.Client.Auth
return null;
}
+ if (ext.ext != IntPtr.Zero)
+ Marshal.FreeHGlobal(ext.ext);
if (rcode != 0)
{
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 1f419bbd..89da51ec 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
@@ -93,6 +93,11 @@
SubType = "Code"
BuildAction = "Compile"
/>
+
diff --git a/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/WinLuid.cs b/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/WinLuid.cs
new file mode 100644
index 00000000..bb7e753d
--- /dev/null
+++ b/CASA-auth-token/non-java/client/csharp/Novell.Casa.Authtoken/WinLuid.cs
@@ -0,0 +1,29 @@
+using System;
+
+namespace Novell.Casa.Client.Auth
+{
+ ///
+ /// Summary description for WinLuid.
+ ///
+ public class WinLuid
+ {
+ private int m_low = 0;
+ private int m_high = 0;
+
+ public WinLuid(int lowPart, int highPart )
+ {
+ m_low = lowPart;
+ m_high = highPart;
+ }
+
+ public int GetLowPart()
+ {
+ return m_low;
+ }
+
+ public int GetHighPart()
+ {
+ return m_high;
+ }
+ }
+}
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 87aa14aa..313e455b 100644
--- a/CASA-auth-token/non-java/client/csharp/test/Class1.cs
+++ b/CASA-auth-token/non-java/client/csharp/test/Class1.cs
@@ -48,6 +48,10 @@ namespace TestClientAuth
try
{
+
+ WinLuid luid = new WinLuid(1234, 5678);
+ Authtoken.ObtainAuthToken("testService", args[0], luid);
+
byte[] baToken = Authtoken.ObtainAuthToken("testService", args[0]);
Console.WriteLine("Token returned: ("+ baToken.Length + ")");
for (int i=0; i