Exemple #1
0
 protected void ProcessTrustedAuthResponse(SSPIHelper sspiHelper, ref IResponse response)
 {
     while (response is AuthResponse)
     {
         byte[] authData = sspiHelper.GetClientSecurity(((AuthResponse)response).Data);
         this.Write(IscCodes.op_trusted_auth);
         this.WriteBuffer(authData);
         this.Flush();
         response = this.ReadResponse();
     }
 }
Exemple #2
0
        public override void AttachWithTrustedAuth(DatabaseParameterBuffer dpb, string dataSource, int port, string database)
        {
#if (!LINUX)
            lock (this.SyncObject)
            {
                try
                {
                    using (SSPIHelper sspiHelper = new SSPIHelper())
                    {
                        byte[] authData = sspiHelper.InitializeClientSecurity();
                        SendTrustedAuthToBuffer(dpb, authData);
                        SendAttachToBuffer(dpb, database);
                        this.Flush();

                        IResponse response = this.ReadResponse();
                        ProcessTrustedAuthResponse(sspiHelper, ref response);
                        ProcessAttachResponse((GenericResponse)response);
                    }
                }
                catch (IOException)
                {
                    try
                    {
                        this.Detach();
                    }
                    catch (Exception)
                    {
                    }

                    throw new IscException(IscCodes.isc_net_write_err);
                }

                // Get server version
                this.serverVersion = this.GetServerVersion();
            }
#else
            throw new NotSupportedException();
#endif
        }
        public override void AttachWithTrustedAuth(DatabaseParameterBuffer dpb, string dataSource, int port, string database)
        {
#if (!LINUX)
            lock (this.SyncObject)
            {
                try
                {
                    using (SSPIHelper sspiHelper = new SSPIHelper())
                    {
                        byte[] authData = sspiHelper.InitializeClientSecurity();
						SendTrustedAuthToBuffer(dpb, authData);
						SendAttachToBuffer(dpb, database);
                        this.Flush();

                        IResponse response = this.ReadResponse();
						ProcessTrustedAuthResponse(sspiHelper, ref response);
                        ProcessAttachResponse((GenericResponse)response);
                    }
                }
                catch (IOException)
                {
                    try
                    {
                        this.Detach();
                    }
                    catch (Exception)
                    {
                    }

                    throw new IscException(IscCodes.isc_net_write_err);
                }

                // Get server version
                this.serverVersion = this.GetServerVersion();
            }
#else            
            throw new NotSupportedException();
#endif
        }
		public override void AttachWithTrustedAuth(DatabaseParameterBuffer dpb, string dataSource, int port, string database)
		{
#if (!LINUX)
			lock (SyncObject)
			{
				try
				{
					using (SSPIHelper sspiHelper = new SSPIHelper())
					{
						byte[] authData = sspiHelper.InitializeClientSecurity();
						SendTrustedAuthToBuffer(dpb, authData);
						SendAttachToBuffer(dpb, database);
						XdrStream.Flush();

						IResponse response = ReadResponse();
						ProcessTrustedAuthResponse(sspiHelper, ref response);
						ProcessAttachResponse((GenericResponse)response);
					}
				}
				catch (IscException)
				{
					SafelyDetach();
					throw;
				}
				catch (IOException ex)
				{
					SafelyDetach();
					throw IscException.ForErrorCode(IscCodes.isc_net_write_err, ex);
				}

				AfterAttachActions();
			}
#else
			throw new NotSupportedException();
#endif
		}
		protected void ProcessTrustedAuthResponse(SSPIHelper sspiHelper, ref IResponse response)
		{
			while (response is AuthResponse)
			{
				byte[] authData = sspiHelper.GetClientSecurity(((AuthResponse)response).Data);
				this.Write(IscCodes.op_trusted_auth);
				this.WriteBuffer(authData);
				this.Flush();
				response = this.ReadResponse();
			}
		}