Exemplo n.º 1
0
        public override void Attach(DatabaseParameterBuffer dpb, string dataSource, int port, string database, byte[] cryptKey)
        {
            try
            {
                SendAttachToBuffer(dpb, database);
                XdrStream.Flush();
                var response = ReadResponse();
                while (response is CryptKeyCallbackReponse cryptResponse)
                {
                    XdrStream.Write(IscCodes.op_crypt_key_callback);
                    XdrStream.WriteBuffer(cryptKey);
                    XdrStream.Flush();
                    response = ReadResponse();
                }
                ProcessAttachResponse(response as GenericResponse);
            }
            catch (IscException)
            {
                SafelyDetach();
                throw;
            }
            catch (IOException ex)
            {
                SafelyDetach();
                throw IscException.ForErrorCode(IscCodes.isc_net_write_err, ex);
            }

            AfterAttachActions();
        }
Exemplo n.º 2
0
 protected void ProcessTrustedAuthResponse(SspiHelper sspiHelper, ref IResponse response)
 {
     while (response is AuthResponse)
     {
         byte[] authData = sspiHelper.GetClientSecurity(((AuthResponse)response).Data);
         XdrStream.Write(IscCodes.op_trusted_auth);
         XdrStream.WriteBuffer(authData);
         XdrStream.Flush();
         response = ReadResponse();
     }
 }
 public IResponse ProcessCryptCallbackResponseIfNeeded(IResponse response, byte[] cryptKey)
 {
     while (response is CryptKeyCallbackResponse cryptResponse)
     {
         XdrStream.Write(IscCodes.op_crypt_key_callback);
         XdrStream.WriteBuffer(cryptKey);
         XdrStream.Flush();
         response = ReadResponse();
     }
     return(response);
 }
Exemplo n.º 4
0
 protected override void SendCreateToBuffer(DatabaseParameterBuffer dpb, string database)
 {
     XdrStream.Write(IscCodes.op_create);
     XdrStream.Write(0);
     if (AuthData != null)
     {
         dpb.Append(IscCodes.isc_dpb_specific_auth_data, AuthData);
     }
     dpb.Append(IscCodes.isc_dpb_utf8_filename, 0);
     XdrStream.WriteBuffer(Encoding.UTF8.GetBytes(database));
     XdrStream.WriteBuffer(dpb.ToArray());
 }
Exemplo n.º 5
0
 protected override void SendCreateToBuffer(DatabaseParameterBuffer dpb, string database)
 {
     XdrStream.Write(IscCodes.op_create);
     XdrStream.Write(0);
     if (!string.IsNullOrEmpty(Password))
     {
         dpb.Append(IscCodes.isc_dpb_password, Password);
     }
     dpb.Append(IscCodes.isc_dpb_utf8_filename, 0);
     XdrStream.WriteBuffer(Encoding.UTF8.GetBytes(database));
     XdrStream.WriteBuffer(dpb.ToArray());
 }