private void InitializeClient(out byte[] clientBlob, byte[] serverBlob, out bool continueProcessing) { clientBlob = null; continueProcessing = true; SecBufferDesc secBufferDesc = new SecBufferDesc(12288); SECURITY_INTEGER sECURITY_INTEGER = new SECURITY_INTEGER(0); int num = -1; try { uint num2 = 0u; if (serverBlob == null) { num = MySqlWindowsAuthenticationPlugin.InitializeSecurityContext(ref this.outboundCredentials, IntPtr.Zero, this.targetName, 0, 0, 0, IntPtr.Zero, 0, out this.clientContext, out secBufferDesc, out num2, out sECURITY_INTEGER); } else { SecBufferDesc secBufferDesc2 = new SecBufferDesc(serverBlob); try { num = MySqlWindowsAuthenticationPlugin.InitializeSecurityContext(ref this.outboundCredentials, ref this.clientContext, this.targetName, 0, 0, 0, ref secBufferDesc2, 0, out this.clientContext, out secBufferDesc, out num2, out sECURITY_INTEGER); } finally { secBufferDesc2.Dispose(); } } if (4115 == num || 4116 == num) { MySqlWindowsAuthenticationPlugin.CompleteAuthToken(ref this.clientContext, ref secBufferDesc); } if (num != 0 && num != 590610 && num != 4115 && num != 4116) { throw new MySqlException("InitializeSecurityContext() failed with errorcode " + num); } clientBlob = secBufferDesc.GetSecBufferByteArray(); } finally { secBufferDesc.Dispose(); } continueProcessing = (num != 0 && num != 4115); }
void InitializeClient(out byte[] clientBlob, byte[] serverBlob, out bool continueProcessing) { clientBlob = null; continueProcessing = true; SecBufferDesc clientBufferDesc = new SecBufferDesc(MAX_TOKEN_SIZE); SECURITY_INTEGER initLifetime = new SECURITY_INTEGER(0); int ss = -1; try { uint ContextAttributes = 0; if (serverBlob == null) { ss = InitializeSecurityContext( ref outboundCredentials, IntPtr.Zero, targetName, STANDARD_CONTEXT_ATTRIBUTES, 0, SECURITY_NETWORK_DREP, IntPtr.Zero, /* always zero first time around */ 0, out clientContext, out clientBufferDesc, out ContextAttributes, out initLifetime); } else { SecBufferDesc serverBufferDesc = new SecBufferDesc(serverBlob); try { ss = InitializeSecurityContext(ref outboundCredentials, ref clientContext, targetName, STANDARD_CONTEXT_ATTRIBUTES, 0, SECURITY_NETWORK_DREP, ref serverBufferDesc, 0, out clientContext, out clientBufferDesc, out ContextAttributes, out initLifetime); } finally { serverBufferDesc.Dispose(); } } if ((SEC_I_COMPLETE_NEEDED == ss) || (SEC_I_COMPLETE_AND_CONTINUE == ss)) { CompleteAuthToken(ref clientContext, ref clientBufferDesc); } if (ss != SEC_E_OK && ss != SEC_I_CONTINUE_NEEDED && ss != SEC_I_COMPLETE_NEEDED && ss != SEC_I_COMPLETE_AND_CONTINUE) { throw new MySqlException( "InitializeSecurityContext() failed with errorcode " + ss); } clientBlob = clientBufferDesc.GetSecBufferByteArray(); } finally { clientBufferDesc.Dispose(); } continueProcessing = (ss != SEC_E_OK && ss != SEC_I_COMPLETE_NEEDED); }
void InitializeClient(out byte[] clientBlob, byte[] serverBlob, out bool continueProcessing) { clientBlob = null; continueProcessing = true; var clientBufferDesc = new SecBufferDesc(MAX_TOKEN_SIZE); var initLifetime = new SECURITY_INTEGER(0); var ss = -1; try { uint ContextAttributes = 0; if (serverBlob == null) { ss = InitializeSecurityContext( ref outboundCredentials, IntPtr.Zero, targetName, STANDARD_CONTEXT_ATTRIBUTES, 0, SECURITY_NETWORK_DREP, IntPtr.Zero, /* always zero first time around */ 0, out clientContext, out clientBufferDesc, out ContextAttributes, out initLifetime); } else { var serverBufferDesc = new SecBufferDesc(serverBlob); try { ss = InitializeSecurityContext(ref outboundCredentials, ref clientContext, targetName, STANDARD_CONTEXT_ATTRIBUTES, 0, SECURITY_NETWORK_DREP, ref serverBufferDesc, 0, out clientContext, out clientBufferDesc, out ContextAttributes, out initLifetime); } finally { serverBufferDesc.Dispose(); } } if ((SEC_I_COMPLETE_NEEDED == ss) || (SEC_I_COMPLETE_AND_CONTINUE == ss)) { CompleteAuthToken(ref clientContext, ref clientBufferDesc); } if (ss != SEC_E_OK && ss != SEC_I_CONTINUE_NEEDED && ss != SEC_I_COMPLETE_NEEDED && ss != SEC_I_COMPLETE_AND_CONTINUE) { throw new MySqlException( "InitializeSecurityContext() failed with errorcode " + ss); } clientBlob = clientBufferDesc.GetSecBufferByteArray(); } finally { clientBufferDesc.Dispose(); } continueProcessing = (ss != SEC_E_OK && ss != SEC_I_COMPLETE_NEEDED); }