Added DeleteCredential(LUID) for Windows
This commit is contained in:
		| @@ -38,6 +38,10 @@ namespace Novell.Casa | ||||
| 		public static uint USERNAME_TYPE_EMAIL_F		 = 0x00000008; | ||||
| 		public static uint USERNAME_TYPE_OTHER_F		 = 0x00000010; | ||||
|          | ||||
|         private static uint SSCS_CRED_TYPE_BASIC_F		 = 0x00000001; | ||||
|         private static uint SSCS_CRED_TYPE_BINARY_F      = 0x00000002; | ||||
|         private static uint SSCS_CRED_TYPE_SERVER_F      = 0x00000004; | ||||
|  | ||||
|         public MiCasa() | ||||
| 		{ | ||||
| 			// | ||||
| @@ -152,6 +156,25 @@ namespace Novell.Casa | ||||
| 		} | ||||
|  | ||||
|  | ||||
|         public static void DeleteCredential( | ||||
|             uint ssFlags, | ||||
|             string sAppSecretID, | ||||
|             string sSharedSecretID) | ||||
|         { | ||||
|             DeleteCredential(ssFlags, sAppSecretID, sSharedSecretID, null); | ||||
|         } | ||||
|          | ||||
|  | ||||
|         public static void DeleteCredential( | ||||
|             uint ssFlags, | ||||
|             string sAppSecretID, | ||||
|             string sSharedSecretID, | ||||
|             WinLuid luid) | ||||
|         { | ||||
|             NativeCalls.DeleteCredential(ssFlags, sAppSecretID, sSharedSecretID, SSCS_CRED_TYPE_BASIC_F, luid); | ||||
|         } | ||||
|  | ||||
|  | ||||
| 		public static bool IsSecretPersistent( | ||||
| 			uint ssFlags, | ||||
| 			string secretID) | ||||
|   | ||||
| @@ -169,6 +169,16 @@ namespace Novell.Casa | ||||
|             [In, Out]	SSCS_EXT_T ext | ||||
|             ); | ||||
|  | ||||
|         [DllImport(NDK_LIBRARY)] | ||||
|         internal static extern int miCASADeleteCredential | ||||
|             ( | ||||
|             [In]		uint ssFlags, | ||||
|             [In]		SSCS_SECRET_ID_T appSecretID, | ||||
|             [In]		SSCS_SECRET_ID_T sharedSecretID, | ||||
|             [In]        uint iCredentialType, | ||||
|             [In, Out]	SSCS_EXT_T ext | ||||
|             ); | ||||
|  | ||||
|         [DllImport(NDK_LIBRARY)] | ||||
|         internal static extern int miCASAIsSecretPersistent | ||||
|             ( | ||||
| @@ -456,7 +466,8 @@ namespace Novell.Casa | ||||
|             } | ||||
|         } | ||||
|  | ||||
|  | ||||
|         // deprecated because of multiple credential types. | ||||
|         // use miCASADeleteCredential | ||||
|         internal static void RemoveCredential( | ||||
|             uint ssFlags, | ||||
|             string sAppSecretID, | ||||
| @@ -486,6 +497,54 @@ namespace Novell.Casa | ||||
|  | ||||
|         } | ||||
|  | ||||
|         internal static void DeleteCredential( | ||||
|             uint ssFlags, | ||||
|             string sAppSecretID, | ||||
|             string sSharedSecretID, | ||||
|             uint iCredType, | ||||
|             WinLuid luid) | ||||
|         { | ||||
|             if (sAppSecretID == null || sAppSecretID.Length == 0) | ||||
|                 throw new MiCasaException(MiCasaException.NSSCS_E_INVALID_PARAM); | ||||
|  | ||||
|             int rcode; | ||||
|             SSCS_SECRET_ID_T appSecretID = new SSCS_SECRET_ID_T(); | ||||
|             appSecretID.id = sAppSecretID; | ||||
|             appSecretID.len = sAppSecretID.Length + 1; | ||||
|  | ||||
|             SSCS_SECRET_ID_T sharedID = new SSCS_SECRET_ID_T(); | ||||
|             if (sSharedSecretID != null) | ||||
|             { | ||||
|                 sharedID.len = sSharedSecretID.Length + 1; | ||||
|                 sharedID.id = sSharedSecretID; | ||||
|             } | ||||
|  | ||||
|             SSCS_EXT_T ext = new SSCS_EXT_T(); | ||||
|             LUID sluid; | ||||
|             if ((luid != null) && | ||||
|                 ((luid.GetHighPart() != 0) || (luid.GetLowPart() != 0))) | ||||
|             { | ||||
|                 // allocate a structure to marshal | ||||
|                 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); | ||||
|             } | ||||
|  | ||||
|             rcode = miCASADeleteCredential(ssFlags, appSecretID, sharedID, iCredType, ext); | ||||
|  | ||||
|             if (rcode != 0) | ||||
|             { | ||||
|                 throw new MiCasaException(rcode); | ||||
|             } | ||||
|  | ||||
|         } | ||||
|  | ||||
|  | ||||
|         internal static bool IsSecretPersistent(uint ssFlags, string id) | ||||
|         { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user