/// <include file='doc\OraclePermission.uex' path='docs/doc[@for="OraclePermission.Union"]/*' /> override public IPermission Union(IPermission target) { if (null == target) { return(this.Copy()); } if (target.GetType() != this.GetType()) { throw ADP.Argument("target"); } if (IsUnrestricted()) // MDAC 84803 { return(this.Copy()); } OraclePermission newPermission = (OraclePermission)target.Copy(); if (!newPermission.IsUnrestricted()) { newPermission._allowBlankPassword |= AllowBlankPassword; if (null != _keyvalues) { foreach (DBConnectionString entry in _keyvalues) { newPermission.AddEntry(entry); } } } return(newPermission); }
public override bool IsSubsetOf(IPermission target) { if (target == null) { return(this.IsEmpty()); } if (target.GetType() != base.GetType()) { throw System.Data.Common.ADP.PermissionTypeMismatch(); } OraclePermission permission = target as OraclePermission; bool flag = permission.IsUnrestricted(); if ((!flag && !this.IsUnrestricted()) && (!this.AllowBlankPassword || permission.AllowBlankPassword)) { if ((this._keyvalues != null) && (permission._keyvaluetree == null)) { return(flag); } flag = true; if (this._keyvalues == null) { return(flag); } foreach (System.Data.OracleClient.DBConnectionString str in this._keyvalues) { if (!permission._keyvaluetree.CheckValueForKeyPermit(str)) { return(false); } } } return(flag); }
private void CopyFrom(OraclePermission permission) { _isUnrestricted = permission.IsUnrestricted(); if (!_isUnrestricted) { _allowBlankPassword = permission.AllowBlankPassword; try { lock (permission) { // single writer, multiple reader if (null != permission._keyvalues) { _keyvalues = (ArrayList)permission._keyvalues.Clone(); if (null != permission._keyvaluetree) { _keyvaluetree = permission._keyvaluetree.Copy(); } } } } catch { // MDAC 80973 throw; } } }
public override IPermission Union(IPermission target) { if (target == null) { return(this.Copy()); } if (target.GetType() != base.GetType()) { throw System.Data.Common.ADP.PermissionTypeMismatch(); } if (this.IsUnrestricted()) { return(this.Copy()); } OraclePermission permission = (OraclePermission)target.Copy(); if (!permission.IsUnrestricted()) { permission._allowBlankPassword |= this.AllowBlankPassword; if (this._keyvalues != null) { foreach (System.Data.OracleClient.DBConnectionString str in this._keyvalues) { permission.AddPermissionEntry(str); } } } if (!permission.IsEmpty()) { return(permission); } return(null); }
private static CodeAccessPermission CreateExecutePermission() { OraclePermission permission = new OraclePermission(PermissionState.None); permission.Add(string.Empty, string.Empty, KeyRestrictionBehavior.AllowOnly); return(permission); }
/// <include file='doc\OraclePermission.uex' path='docs/doc[@for="OraclePermission.OraclePermission3"]/*' /> private OraclePermission(OraclePermission permission) // for Copy { if (null == permission) { throw ADP.ArgumentNull("permissionAttribute"); } CopyFrom(permission); }
private OraclePermission(OraclePermission permission) { this._keyvaluetree = System.Data.OracleClient.NameValuePermission.Default; if (permission == null) { throw System.Data.Common.ADP.ArgumentNull("permissionAttribute"); } this.CopyFrom(permission); }
private OraclePermission(OraclePermission permission) { this._keyvaluetree = System.Data.OracleClient.NameValuePermission.Default; if (permission == null) { throw System.Data.Common.ADP.ArgumentNull("permissionAttribute"); } this.CopyFrom(permission); }
/// <include file='doc\OraclePermission.uex' path='docs/doc[@for="OraclePermission.IsSubsetOf"]/*' /> override public bool IsSubsetOf(IPermission target) { if (null == target) { return(IsEmpty()); } if (target.GetType() != this.GetType()) { throw ADP.WrongType(this.GetType()); } OraclePermission superset = (target as OraclePermission); #if DATAPERMIT if (null != superset._keyvalues) { Debug.WriteLine("+ " + (superset._keyvalues[0] as DBConnectionString).ConnectionString); } else { Debug.WriteLine("+ <>"); } if (null != _keyvalues) { Debug.WriteLine("- " + (_keyvalues[0] as DBConnectionString).ConnectionString); } else { Debug.WriteLine("- <>"); } #endif bool subset = superset.IsUnrestricted(); if (!subset) { subset = (!IsUnrestricted() && (!AllowBlankPassword || superset.AllowBlankPassword) && ((null == _keyvalues) || (null != superset._keyvaluetree))); if (subset && (null != _keyvalues)) { foreach (DBConnectionString kventry in _keyvalues) { if (!superset._keyvaluetree.CheckValueForKeyPermit(kventry)) { subset = false; break; } } } } return(subset); }
private void CopyFrom(OraclePermission permission) { this._isUnrestricted = permission.IsUnrestricted(); if (!this._isUnrestricted) { this._allowBlankPassword = permission.AllowBlankPassword; if (permission._keyvalues != null) { this._keyvalues = (ArrayList)permission._keyvalues.Clone(); if (permission._keyvaluetree != null) { this._keyvaluetree = permission._keyvaluetree.CopyNameValue(); } } } }
/// <include file='doc\OracleConnection.uex' path='docs/doc[@for="OracleConnection.EnlistDistributedTransaction"]/*' /> public void EnlistDistributedTransaction(ITransaction distributedTransaction) // MDAC 82856 { OracleConnectionString parsedConnectionString = _parsedConnectionString; // prevent race condition ConnectionState state = _state; //(new NamedPermissionSet("FullTrust")).Demand(); // SECURITY: Need this if we ever become semi-trusted. OraclePermission.Demand(); switch (state) { case ConnectionState.Closed: throw ADP.ClosedConnectionError(); case ConnectionState.Open: // Since in Oracle-land, the connection flows from the transaction and we don't // have a way to enlist a connection in a distributed transaction, we simply // close the existing connection and open a new, transacted, one. // What this means is that we'll rollback any existing local transaction, so we // need to make sure that there isn't a local transaction before we close the // connection. Of course, if the local transaction is dead, we can roll it back // first. RollbackDeadTransaction(); if (HasTransaction) { throw ADP.TransactionPresent(); } // Now silently close the current connection, and reopen a new distributed // connection. if (null != distributedTransaction) { CloseInternal(); OpenInternal(parsedConnectionString, (object)distributedTransaction); } break; default: Debug.Assert(false, "Invalid Connection State in OracleConnection.EnlistDistributedTransaction)"); break; } }
/// <include file='doc\OraclePermission.uex' path='docs/doc[@for="OraclePermission.Intersect"]/*' /> override public IPermission Intersect(IPermission target) // used during Deny actions { if (null == target) { return(null); } if (target.GetType() != this.GetType()) { throw ADP.Argument("target"); } if (IsUnrestricted()) // MDAC 84803 { return(Copy()); } OraclePermission newPermission = (OraclePermission)target.Copy(); if (!newPermission.IsUnrestricted()) { newPermission._allowBlankPassword &= AllowBlankPassword; if ((null != _keyvalues) && (null != newPermission._keyvalues)) { newPermission._keyvalues.Clear(); newPermission._keyvaluetree.Intersect(newPermission._keyvalues, _keyvaluetree); if (0 == newPermission._keyvalues.Count) // no intersection { newPermission = null; } } else { // either target.Add or this.Add have not been called // return a non-null object so IsSubset calls will fail newPermission._keyvalues = null; newPermission._keyvaluetree = null; } } return(newPermission); }
public override IPermission Intersect(IPermission target) { if (target == null) { return(null); } if (target.GetType() != base.GetType()) { throw System.Data.Common.ADP.PermissionTypeMismatch(); } if (this.IsUnrestricted()) { return(target.Copy()); } OraclePermission permission2 = (OraclePermission)target; if (permission2.IsUnrestricted()) { return(this.Copy()); } OraclePermission permission = (OraclePermission)permission2.Copy(); permission._allowBlankPassword &= this.AllowBlankPassword; if ((this._keyvalues != null) && (permission._keyvalues != null)) { permission._keyvalues.Clear(); permission._keyvaluetree.Intersect(permission._keyvalues, this._keyvaluetree); } else { permission._keyvalues = null; permission._keyvaluetree = null; } if (permission.IsEmpty()) { permission = null; } return(permission); }
static internal PermissionSet CreatePermission(OracleConnectionString constr) { OraclePermission p = new OraclePermission(constr); if (null == constr) { p.Add(ADP.StrEmpty, ADP.StrEmpty, KeyRestrictionBehavior.AllowOnly); // ExecuteOnly permission } PermissionSet permission; NamedPermissionSet fulltrust = new NamedPermissionSet("FullTrust"); // MDAC 83159 fulltrust.Assert(); try { try { permission = new PermissionSet(fulltrust); permission.AddPermission(p); } finally { CodeAccessPermission.RevertAssert(); } } catch { throw; } return permission; }
private static CodeAccessPermission CreateExecutePermission() { OraclePermission permission = new OraclePermission(PermissionState.None); permission.Add(string.Empty, string.Empty, KeyRestrictionBehavior.AllowOnly); return permission; }
private void CopyFrom(OraclePermission permission) { this._isUnrestricted = permission.IsUnrestricted(); if (!this._isUnrestricted) { this._allowBlankPassword = permission.AllowBlankPassword; if (permission._keyvalues != null) { this._keyvalues = (ArrayList) permission._keyvalues.Clone(); if (permission._keyvaluetree != null) { this._keyvaluetree = permission._keyvaluetree.CopyNameValue(); } } } }