public DbConnectionOptions(string connectionString, Hashtable synonyms, bool useOdbcRules)
 {
     this.UseOdbcRules = useOdbcRules;
     this._parsetable = new Hashtable();
     this._usersConnectionString = (connectionString != null) ? connectionString : "";
     if (0 < this._usersConnectionString.Length)
     {
         this.KeyChain = ParseInternal(this._parsetable, this._usersConnectionString, true, synonyms, this.UseOdbcRules);
         this.HasPasswordKeyword = this._parsetable.ContainsKey("password") || this._parsetable.ContainsKey("pwd");
     }
 }
Exemplo n.º 2
0
 public DbConnectionOptions(string connectionString, Hashtable synonyms, bool useOdbcRules)
 {
     this.UseOdbcRules           = useOdbcRules;
     this._parsetable            = new Hashtable();
     this._usersConnectionString = (connectionString != null) ? connectionString : "";
     if (0 < this._usersConnectionString.Length)
     {
         this.KeyChain           = ParseInternal(this._parsetable, this._usersConnectionString, true, synonyms, this.UseOdbcRules);
         this.HasPasswordKeyword = this._parsetable.ContainsKey("password") || this._parsetable.ContainsKey("pwd");
     }
 }
Exemplo n.º 3
0
        internal System.Data.OracleClient.NameValuePair ReplacePasswordPwd(out string constr, bool fakePassword)
        {
            int startIndex = 0;

            System.Data.OracleClient.NameValuePair pair4 = null;
            System.Data.OracleClient.NameValuePair pair3 = null;
            System.Data.OracleClient.NameValuePair pair2 = null;
            StringBuilder builder = new StringBuilder(this._usersConnectionString.Length);

            for (System.Data.OracleClient.NameValuePair pair = this.KeyChain; pair != null; pair = pair.Next)
            {
                if (("password" != pair.Name) && ("pwd" != pair.Name))
                {
                    builder.Append(this._usersConnectionString, startIndex, pair.Length);
                    if (fakePassword)
                    {
                        pair2 = new System.Data.OracleClient.NameValuePair(pair.Name, pair.Value, pair.Length);
                    }
                }
                else if (fakePassword)
                {
                    builder.Append(pair.Name).Append("=*;");
                    pair2 = new System.Data.OracleClient.NameValuePair(pair.Name, "*", pair.Name.Length + "=*;".Length);
                }
                if (fakePassword)
                {
                    if (pair3 != null)
                    {
                        pair3 = pair3.Next = pair2;
                    }
                    else
                    {
                        pair3 = pair4 = pair2;
                    }
                }
                startIndex += pair.Length;
            }
            constr = builder.ToString();
            return(pair4);
        }
Exemplo n.º 4
0
        private static System.Data.OracleClient.NameValuePair ParseInternal(Hashtable parsetable, string connectionString, bool buildChain, Hashtable synonyms, bool firstKey)
        {
            StringBuilder buffer = new StringBuilder();

            System.Data.OracleClient.NameValuePair pair  = null;
            System.Data.OracleClient.NameValuePair pair2 = null;
            int num    = 0;
            int length = connectionString.Length;

            while (num < length)
            {
                string str2;
                string str3;
                int    currentPosition = num;
                num = GetKeyValuePair(connectionString, currentPosition, buffer, firstKey, out str2, out str3);
                if (System.Data.Common.ADP.IsEmpty(str2))
                {
                    return(pair2);
                }
                string keyname = (synonyms != null) ? ((string)synonyms[str2]) : str2;
                if (!IsKeyNameValid(keyname))
                {
                    throw System.Data.Common.ADP.KeywordNotSupported(str2);
                }
                if (!firstKey || !parsetable.Contains(keyname))
                {
                    parsetable[keyname] = str3;
                }
                if (pair != null)
                {
                    pair = pair.Next = new System.Data.OracleClient.NameValuePair(keyname, str3, num - currentPosition);
                }
                else if (buildChain)
                {
                    pair2 = pair = new System.Data.OracleClient.NameValuePair(keyname, str3, num - currentPosition);
                }
            }
            return(pair2);
        }
 internal System.Data.OracleClient.NameValuePair ReplacePasswordPwd(out string constr, bool fakePassword)
 {
     int startIndex = 0;
     System.Data.OracleClient.NameValuePair pair4 = null;
     System.Data.OracleClient.NameValuePair pair3 = null;
     System.Data.OracleClient.NameValuePair pair2 = null;
     StringBuilder builder = new StringBuilder(this._usersConnectionString.Length);
     for (System.Data.OracleClient.NameValuePair pair = this.KeyChain; pair != null; pair = pair.Next)
     {
         if (("password" != pair.Name) && ("pwd" != pair.Name))
         {
             builder.Append(this._usersConnectionString, startIndex, pair.Length);
             if (fakePassword)
             {
                 pair2 = new System.Data.OracleClient.NameValuePair(pair.Name, pair.Value, pair.Length);
             }
         }
         else if (fakePassword)
         {
             builder.Append(pair.Name).Append("=*;");
             pair2 = new System.Data.OracleClient.NameValuePair(pair.Name, "*", pair.Name.Length + "=*;".Length);
         }
         if (fakePassword)
         {
             if (pair3 != null)
             {
                 pair3 = pair3.Next = pair2;
             }
             else
             {
                 pair3 = pair4 = pair2;
             }
         }
         startIndex += pair.Length;
     }
     constr = builder.ToString();
     return pair4;
 }
 private static System.Data.OracleClient.NameValuePair ParseInternal(Hashtable parsetable, string connectionString, bool buildChain, Hashtable synonyms, bool firstKey)
 {
     StringBuilder buffer = new StringBuilder();
     System.Data.OracleClient.NameValuePair pair = null;
     System.Data.OracleClient.NameValuePair pair2 = null;
     int num = 0;
     int length = connectionString.Length;
     while (num < length)
     {
         string str2;
         string str3;
         int currentPosition = num;
         num = GetKeyValuePair(connectionString, currentPosition, buffer, firstKey, out str2, out str3);
         if (System.Data.Common.ADP.IsEmpty(str2))
         {
             return pair2;
         }
         string keyname = (synonyms != null) ? ((string) synonyms[str2]) : str2;
         if (!IsKeyNameValid(keyname))
         {
             throw System.Data.Common.ADP.KeywordNotSupported(str2);
         }
         if (!firstKey || !parsetable.Contains(keyname))
         {
             parsetable[keyname] = str3;
         }
         if (pair != null)
         {
             pair = pair.Next = new System.Data.OracleClient.NameValuePair(keyname, str3, num - currentPosition);
         }
         else if (buildChain)
         {
             pair2 = pair = new System.Data.OracleClient.NameValuePair(keyname, str3, num - currentPosition);
         }
     }
     return pair2;
 }