示例#1
0
 internal void SetPathList(FileIOPermissionAccess access, AccessControlActions control, string[] pathList, bool checkForDuplicates)
 {
     FileIOPermission.VerifyAccess(access);
     if ((access & FileIOPermissionAccess.Read) != FileIOPermissionAccess.NoAccess)
     {
         this.m_read = (FileIOAccess)null;
     }
     if ((access & FileIOPermissionAccess.Write) != FileIOPermissionAccess.NoAccess)
     {
         this.m_write = (FileIOAccess)null;
     }
     if ((access & FileIOPermissionAccess.Append) != FileIOPermissionAccess.NoAccess)
     {
         this.m_append = (FileIOAccess)null;
     }
     if ((access & FileIOPermissionAccess.PathDiscovery) != FileIOPermissionAccess.NoAccess)
     {
         this.m_pathDiscovery = (FileIOAccess)null;
     }
     if ((control & AccessControlActions.View) != AccessControlActions.None)
     {
         this.m_viewAcl = (FileIOAccess)null;
     }
     if ((control & AccessControlActions.Change) != AccessControlActions.None)
     {
         this.m_changeAcl = (FileIOAccess)null;
     }
     this.m_unrestricted = false;
     this.AddPathList(access, control, pathList, checkForDuplicates, true, true);
 }
示例#2
0
     public void AddPathList( RegistryPermissionAccess access, AccessControlActions control, String pathList )
     {
         VerifyAccess( access );
         
         if ((access & RegistryPermissionAccess.Read) != 0)
         {
             if (m_read == null)
                 m_read = new StringExpressionSet();
             m_read.AddExpressions( pathList );
         }
         
         if ((access & RegistryPermissionAccess.Write) != 0)
         {
             if (m_write == null)
                 m_write = new StringExpressionSet();
             m_write.AddExpressions( pathList );
         }
 
         if ((access & RegistryPermissionAccess.Create) != 0)
         {
             if (m_create == null)
                 m_create = new StringExpressionSet();
             m_create.AddExpressions( pathList );
         }
     }
示例#3
0
 [System.Security.SecuritySafeCritical]  // auto-generated
 public FileIOPermission( FileIOPermissionAccess access, AccessControlActions control, String path )
 {
     VerifyAccess( access );
 
     String[] pathList = new String[] { path };
     AddPathList( access, control, pathList, false, true, false );
 }
示例#4
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        public FileIOPermission(FileIOPermissionAccess access, AccessControlActions control, String path)
        {
            VerifyAccess(access);

            String[] pathList = new String[] { path };
            AddPathList(access, control, pathList, false, true, false);
        }
示例#5
0
        public void AddPathList(RegistryPermissionAccess access, AccessControlActions control, String pathList)
        {
            VerifyAccess(access);

            if ((access & RegistryPermissionAccess.Read) != 0)
            {
                if (m_read == null)
                {
                    m_read = new StringExpressionSet();
                }
                m_read.AddExpressions(pathList);
            }

            if ((access & RegistryPermissionAccess.Write) != 0)
            {
                if (m_write == null)
                {
                    m_write = new StringExpressionSet();
                }
                m_write.AddExpressions(pathList);
            }

            if ((access & RegistryPermissionAccess.Create) != 0)
            {
                if (m_create == null)
                {
                    m_create = new StringExpressionSet();
                }
                m_create.AddExpressions(pathList);
            }
        }
示例#6
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        internal void SetPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathList, bool checkForDuplicates)
        {
            VerifyAccess(access);

            if ((access & FileIOPermissionAccess.Read) != 0)
            {
                m_read = null;
            }

            if ((access & FileIOPermissionAccess.Write) != 0)
            {
                m_write = null;
            }

            if ((access & FileIOPermissionAccess.Append) != 0)
            {
                m_append = null;
            }

            if ((access & FileIOPermissionAccess.PathDiscovery) != 0)
            {
                m_pathDiscovery = null;
            }

            m_viewAcl      = null;
            m_changeAcl    = null;
            m_unrestricted = false;

            AddPathList(access, pathList, checkForDuplicates, true, true);
        }
示例#7
0
文件: Drive.cs 项目: techienickb/hap
 public Drive(string name, string icon, decimal space, string path, AccessControlActions actions)
 {
     Name    = name;
     Icon    = icon;
     Space   = space;
     Path    = path;
     Actions = actions;
 }
示例#8
0
 public FileIOPermission(FileIOPermissionAccess access, AccessControlActions control, string path)
 {
     FileIOPermission.VerifyAccess(access);
     string[] pathListOrig = new string[1] {
         path
     };
     this.AddPathList(access, control, pathListOrig, false, true, false);
 }
示例#9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="access">Tipo de acesso.</param>
 /// <param name="control">Ações de controle de acesso.</param>
 /// <param name="path">Caminho do sistema onde a permissão será aplicada.</param>
 public SystemPermission(SystemPermissionAccess access, AccessControlActions control, string path)
 {
     this.VerifyAccess(access);
     string[] pathListOrig = new string[] {
         path
     };
     this.AddPathList(access, control, pathListOrig, false, true, false);
 }
示例#10
0
		public RegistryPermission (RegistryPermissionAccess access, AccessControlActions control, string pathList)
		{
			if (!Enum.IsDefined (typeof (AccessControlActions), control)) {
				string msg = String.Format (Locale.GetText ("Invalid enum {0}"), control);
				throw new ArgumentException (msg, "AccessControlActions");
			}
			_state = PermissionState.None;
			AddPathList (access, control, pathList);
		}
 /// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.RegistryPermission" /> class with the specified access to the specified registry variables and the specified access rights to registry control information.</summary>
 /// <param name="access">One of the <see cref="T:System.Security.Permissions.RegistryPermissionAccess" /> values.</param>
 /// <param name="control">A bitwise combination of the <see cref="T:System.Security.AccessControl.AccessControlActions" />  values.</param>
 /// <param name="pathList">A list of registry variables (semicolon-separated) to which access is granted.</param>
 /// <exception cref="T:System.ArgumentException">The <paramref name="access" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.RegistryPermissionAccess" />.-or- The <paramref name="pathList" /> parameter is not a valid string. </exception>
 public RegistryPermission(RegistryPermissionAccess access, AccessControlActions control, string pathList)
 {
     if (!Enum.IsDefined(typeof(AccessControlActions), control))
     {
         string message = string.Format(Locale.GetText("Invalid enum {0}"), control);
         throw new ArgumentException(message, "AccessControlActions");
     }
     this._state = PermissionState.None;
     this.AddPathList(access, control, pathList);
 }
示例#12
0
 public ComputerBrowserAPIItem(string name, string icon, string size, string type, BType btype, string path, string access, [Optional, DefaultParameterValue("")] string download)
 {
     Name          = name;
     Icon          = icon;
     Type          = type;
     Size          = size;
     BType         = btype;
     Path          = path;
     Download      = download;
     AccessControl = (AccessControlActions)Enum.Parse(typeof(AccessControlActions), access, true);
 }
示例#13
0
 public ComputerBrowserAPIItem(string name, string icon, string size, string type, BType btype, string path, AccessControlActions access, [Optional, DefaultParameterValue("")] string download)
 {
     Name          = name;
     Icon          = icon;
     Type          = type;
     Size          = size;
     BType         = btype;
     Path          = path;
     AccessControl = access;
     Download      = download;
 }
 internal void SetPathList(AccessControlActions control, string pathList)
 {
     this.m_unrestricted = false;
     if ((control & AccessControlActions.View) != AccessControlActions.None)
     {
         this.m_viewAcl = null;
     }
     if ((control & AccessControlActions.Change) != AccessControlActions.None)
     {
         this.m_changeAcl = null;
     }
     this.AddPathList(RegistryPermissionAccess.NoAccess, control, pathList);
 }
示例#15
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        public void AddPathList(RegistryPermissionAccess access, AccessControlActions control, String pathList)
        {
            VerifyAccess(access);

            if ((access & RegistryPermissionAccess.Read) != 0)
            {
                if (m_read == null)
                {
                    m_read = new StringExpressionSet();
                }
                m_read.AddExpressions(pathList);
            }

            if ((access & RegistryPermissionAccess.Write) != 0)
            {
                if (m_write == null)
                {
                    m_write = new StringExpressionSet();
                }
                m_write.AddExpressions(pathList);
            }

            if ((access & RegistryPermissionAccess.Create) != 0)
            {
                if (m_create == null)
                {
                    m_create = new StringExpressionSet();
                }
                m_create.AddExpressions(pathList);
            }

#if FEATURE_MACL
            if ((control & AccessControlActions.View) != 0)
            {
                if (m_viewAcl == null)
                {
                    m_viewAcl = new StringExpressionSet();
                }
                m_viewAcl.AddExpressions(pathList);
            }

            if ((control & AccessControlActions.Change) != 0)
            {
                if (m_changeAcl == null)
                {
                    m_changeAcl = new StringExpressionSet();
                }
                m_changeAcl.AddExpressions(pathList);
            }
#endif
        }
示例#16
0
 public void AddPathList(RegistryPermissionAccess access, AccessControlActions control, string pathList)
 {
     this.VerifyAccess(access);
     if ((access & RegistryPermissionAccess.Read) != RegistryPermissionAccess.NoAccess)
     {
         if (this.m_read == null)
         {
             this.m_read = new StringExpressionSet();
         }
         this.m_read.AddExpressions(pathList);
     }
     if ((access & RegistryPermissionAccess.Write) != RegistryPermissionAccess.NoAccess)
     {
         if (this.m_write == null)
         {
             this.m_write = new StringExpressionSet();
         }
         this.m_write.AddExpressions(pathList);
     }
     if ((access & RegistryPermissionAccess.Create) != RegistryPermissionAccess.NoAccess)
     {
         if (this.m_create == null)
         {
             this.m_create = new StringExpressionSet();
         }
         this.m_create.AddExpressions(pathList);
     }
     if ((control & AccessControlActions.View) != AccessControlActions.None)
     {
         if (this.m_viewAcl == null)
         {
             this.m_viewAcl = new StringExpressionSet();
         }
         this.m_viewAcl.AddExpressions(pathList);
     }
     if ((control & AccessControlActions.Change) == AccessControlActions.None)
     {
         return;
     }
     if (this.m_changeAcl == null)
     {
         this.m_changeAcl = new StringExpressionSet();
     }
     this.m_changeAcl.AddExpressions(pathList);
 }
示例#17
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        public void AddPathList( RegistryPermissionAccess access, AccessControlActions control, String pathList )
        { 
            VerifyAccess( access );
 
            if ((access & RegistryPermissionAccess.Read) != 0) 
            {
                if (m_read == null) 
                    m_read = new StringExpressionSet();
                m_read.AddExpressions( pathList );
            }
 
            if ((access & RegistryPermissionAccess.Write) != 0)
            { 
                if (m_write == null) 
                    m_write = new StringExpressionSet();
                m_write.AddExpressions( pathList ); 
            }

            if ((access & RegistryPermissionAccess.Create) != 0)
            { 
                if (m_create == null)
                    m_create = new StringExpressionSet(); 
                m_create.AddExpressions( pathList ); 
            }
 
#if !FEATURE_PAL && FEATURE_MACL
            if ((control & AccessControlActions.View) != 0)
            {
                if (m_viewAcl == null) 
                    m_viewAcl = new StringExpressionSet();
                m_viewAcl.AddExpressions( pathList ); 
            } 

            if ((control & AccessControlActions.Change) != 0) 
            {
                if (m_changeAcl == null)
                    m_changeAcl = new StringExpressionSet();
                m_changeAcl.AddExpressions( pathList ); 
            }
#endif 
        } 
        private unsafe static void InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj)
        {
#if FEATURE_MACL
            DirectorySecurity dirSecurity = (DirectorySecurity)dirSecurityObj;
#endif // FEATURE_MACL

            int length = fullPath.Length;

            // We need to trim the trailing slash or the code will try to create 2 directories of the same name.
            if (length >= 2 && Path.IsDirectorySeparator(fullPath[length - 1]))
            {
                length--;
            }

            int lengthRoot = LongPath.GetRootLength(fullPath);

#if !PLATFORM_UNIX
            // For UNC paths that are only // or ///
            if (length == 2 && Path.IsDirectorySeparator(fullPath[1]))
            {
                throw new IOException(Environment.GetResourceString("IO.IO_CannotCreateDirectory", path));
            }
#endif // !PLATFORM_UNIX

            List <string> stackDir = new List <string>();

            // Attempt to figure out which directories don't exist, and only
            // create the ones we need.  Note that InternalExists may fail due
            // to Win32 ACL's preventing us from seeing a directory, and this
            // isn't threadsafe.

            bool somepathexists = false;

            if (length > lengthRoot)
            { // Special case root (fullpath = X:\\)
                int i = length - 1;
                while (i >= lengthRoot && !somepathexists)
                {
                    String dir = fullPath.Substring(0, i + 1);

                    if (!InternalExists(dir)) // Create only the ones missing
                    {
                        stackDir.Add(dir);
                    }
                    else
                    {
                        somepathexists = true;
                    }

                    while (i > lengthRoot && fullPath[i] != Path.DirectorySeparatorChar && fullPath[i] != Path.AltDirectorySeparatorChar)
                    {
                        i--;
                    }
                    i--;
                }
            }

            int count = stackDir.Count;

            if (stackDir.Count != 0)
            {
                String[] securityList = new String[stackDir.Count];
                stackDir.CopyTo(securityList, 0);
                for (int j = 0; j < securityList.Length; j++)
                {
                    securityList[j] += "\\."; // leaf will never have a slash at the end
                }
                // Security check for all directories not present only.
#if !FEATURE_PAL && FEATURE_MACL
                AccessControlActions control = (dirSecurity == null) ? AccessControlActions.None : AccessControlActions.Change;
                new FileIOPermission(FileIOPermissionAccess.Write, control, securityList, false, false).Demand();
#else
                new FileIOPermission(FileIOPermissionAccess.Write, securityList, false, false).Demand();
#endif
            }

            // If we were passed a DirectorySecurity, convert it to a security
            // descriptor and set it in he call to CreateDirectory.
            Win32Native.SECURITY_ATTRIBUTES secAttrs = null;
#if FEATURE_MACL
            if (dirSecurity != null)
            {
                secAttrs         = new Win32Native.SECURITY_ATTRIBUTES();
                secAttrs.nLength = (int)Marshal.SizeOf(secAttrs);

                // For ACL's, get the security descriptor from the FileSecurity.
                byte[] sd           = dirSecurity.GetSecurityDescriptorBinaryForm();
                byte * bytesOnStack = stackalloc byte[sd.Length];
                Buffer.Memcpy(bytesOnStack, 0, sd, 0, sd.Length);
                secAttrs.pSecurityDescriptor = bytesOnStack;
            }
#endif

            bool   r           = true;
            int    firstError  = 0;
            String errorString = path;
            // If all the security checks succeeded create all the directories
            while (stackDir.Count > 0)
            {
                String name = stackDir[stackDir.Count - 1];
                stackDir.RemoveAt(stackDir.Count - 1);
                if (name.Length >= Path.MaxLongPath)
                {
                    throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
                }
                r = Win32Native.CreateDirectory(Path.AddLongPathPrefix(name), secAttrs);
                if (!r && (firstError == 0))
                {
                    int currentError = Marshal.GetLastWin32Error();
                    // While we tried to avoid creating directories that don't
                    // exist above, there are at least two cases that will
                    // cause us to see ERROR_ALREADY_EXISTS here.  InternalExists
                    // can fail because we didn't have permission to the
                    // directory.  Secondly, another thread or process could
                    // create the directory between the time we check and the
                    // time we try using the directory.  Thirdly, it could
                    // fail because the target does exist, but is a file.
                    if (currentError != Win32Native.ERROR_ALREADY_EXISTS)
                    {
                        firstError = currentError;
                    }
                    else
                    {
                        // If there's a file in this directory's place, or if we have ERROR_ACCESS_DENIED when checking if the directory already exists throw.
                        if (LongPathFile.InternalExists(name) || (!InternalExists(name, out currentError) && currentError == Win32Native.ERROR_ACCESS_DENIED))
                        {
                            firstError = currentError;
                            // Give the user a nice error message, but don't leak path information.
                            try
                            {
                                new FileIOPermission(FileIOPermissionAccess.PathDiscovery, new String[] { GetDemandDir(name, true) }, false, false).Demand();
                                errorString = name;
                            }
                            catch (SecurityException) { }
                        }
                    }
                }
            }

            // We need this check to mask OS differences
            // Handle CreateDirectory("X:\\foo") when X: doesn't exist. Similarly for n/w paths.
            if ((count == 0) && !somepathexists)
            {
                String root = InternalGetDirectoryRoot(fullPath);
                if (!InternalExists(root))
                {
                    // Extract the root from the passed in path again for security.
                    __Error.WinIOError(Win32Native.ERROR_PATH_NOT_FOUND, InternalGetDirectoryRoot(path));
                }
                return;
            }

            // Only throw an exception if creating the exact directory we
            // wanted failed to work correctly.
            if (!r && (firstError != 0))
            {
                __Error.WinIOError(firstError, errorString);
            }
        }
示例#19
0
		public FileIOPermission (FileIOPermissionAccess access, AccessControlActions control, string[] pathList)
		{
			throw new NotImplementedException ();
		}
 public FileIOPermission(FileIOPermissionAccess access, AccessControlActions control, string path)
 {
     VerifyAccess(access);
     string[] pathListOrig = new string[] { path };
     this.AddPathList(access, control, pathListOrig, false, true, false);
 }
示例#21
0
 public File(DirectoryInfo subdir, DriveMapping mapping, User user, AccessControlActions actions)
     : this(subdir, mapping, user)
 {
     this.Actions = actions;
 }
示例#22
0
 /// <summary>
 /// Adiciona uma lista de caminhos e acesso para a permissão.
 /// </summary>
 /// <param name="access"></param>
 /// <param name="control"></param>
 /// <param name="pathListOrig"></param>
 /// <param name="checkForDuplicates"></param>
 /// <param name="needFullPath"></param>
 /// <param name="copyPathList"></param>
 internal void AddPathList(SystemPermissionAccess access, AccessControlActions control, string[] pathListOrig, bool checkForDuplicates, bool needFullPath, bool copyPathList)
 {
     this.VerifyAccess(access);
     if (pathListOrig == null)
     {
         throw new ArgumentNullException("pathList");
     }
     if (pathListOrig.Length == 0)
     {
         throw new ArgumentException(Properties.Resources.Argument_EmptyPath);
     }
     if (!_unrestricted)
     {
         string[] destinationArray = pathListOrig;
         if (copyPathList)
         {
             destinationArray = new string[pathListOrig.Length];
             Array.Copy(pathListOrig, destinationArray, pathListOrig.Length);
         }
         HasIllegalCharacters(destinationArray);
         var values = StringExpressionSet.CreateListFromExpressions(destinationArray, needFullPath);
         if ((access & SystemPermissionAccess.Read) != SystemPermissionAccess.NoAccess)
         {
             if (_read == null)
             {
                 this._read = new SystemAccess();
             }
             this._read.AddExpressions(values, checkForDuplicates);
         }
         if ((access & SystemPermissionAccess.Write) != SystemPermissionAccess.NoAccess)
         {
             if (this._write == null)
             {
                 this._write = new SystemAccess();
             }
             this._write.AddExpressions(values, checkForDuplicates);
         }
         if ((access & SystemPermissionAccess.Execute) != SystemPermissionAccess.NoAccess)
         {
             if (this._execute == null)
             {
                 this._execute = new SystemAccess();
             }
             this._execute.AddExpressions(values, checkForDuplicates);
         }
         if ((control & AccessControlActions.View) != AccessControlActions.None)
         {
             if (this._viewAcl == null)
             {
                 this._viewAcl = new SystemAccess();
             }
             this._viewAcl.AddExpressions(values, checkForDuplicates);
         }
         if ((control & AccessControlActions.Change) != AccessControlActions.None)
         {
             if (this._changeAcl == null)
             {
                 this._changeAcl = new SystemAccess();
             }
             this._changeAcl.AddExpressions(values, checkForDuplicates);
         }
     }
 }
示例#23
0
		public void AddPathList (RegistryPermissionAccess access, AccessControlActions control, string pathList) 
		{
			throw new NotImplementedException ();
		}
示例#24
0
 public RegistryPermission(RegistryPermissionAccess access, AccessControlActions control, string pathList)
 {
 }
示例#25
0
        [System.Security.SecurityCritical]  // auto-generated
        internal FileIOPermission(FileIOPermissionAccess access, AccessControlActions control, String[] pathList, bool checkForDuplicates, bool needFullPath)
        {
            VerifyAccess(access);

            AddPathList(access, control, pathList, checkForDuplicates, needFullPath, true);
        }
示例#26
0
        private static unsafe void InternalCreateDirectory(string fullPath, string path, object dirSecurityObj)
        {
            DirectorySecurity security = (DirectorySecurity)dirSecurityObj;
            int length = fullPath.Length;

            if ((length >= 2) && Path.IsDirectorySeparator(fullPath[length - 1]))
            {
                length--;
            }
            int rootLength = LongPath.GetRootLength(fullPath);

            if ((length == 2) && Path.IsDirectorySeparator(fullPath[1]))
            {
                throw new IOException(Environment.GetResourceString("IO.IO_CannotCreateDirectory", new object[] { path }));
            }
            List <string> list = new List <string>();
            bool          flag = false;

            if (length > rootLength)
            {
                for (int i = length - 1; (i >= rootLength) && !flag; i--)
                {
                    string str = fullPath.Substring(0, i + 1);
                    if (!InternalExists(str))
                    {
                        list.Add(str);
                    }
                    else
                    {
                        flag = true;
                    }
                    while (((i > rootLength) && (fullPath[i] != Path.DirectorySeparatorChar)) && (fullPath[i] != Path.AltDirectorySeparatorChar))
                    {
                        i--;
                    }
                }
            }
            int count = list.Count;

            if (list.Count != 0)
            {
                string[] array = new string[list.Count];
                list.CopyTo(array, 0);
                for (int j = 0; j < array.Length; j++)
                {
                    string[] strArray2;
                    IntPtr   ptr;
                    (strArray2 = array)[(int)(ptr = (IntPtr)j)] = strArray2[(int)ptr] + @"\.";
                }
                AccessControlActions control = (security == null) ? AccessControlActions.None : AccessControlActions.Change;
                new FileIOPermission(FileIOPermissionAccess.Write, control, array, false, false).Demand();
            }
            Win32Native.SECURITY_ATTRIBUTES structure = null;
            if (security != null)
            {
                structure = new Win32Native.SECURITY_ATTRIBUTES {
                    nLength = Marshal.SizeOf(structure)
                };
                byte[] securityDescriptorBinaryForm = security.GetSecurityDescriptorBinaryForm();
                byte * pDest = stackalloc byte[(IntPtr)securityDescriptorBinaryForm.Length];
                Buffer.memcpy(securityDescriptorBinaryForm, 0, pDest, 0, securityDescriptorBinaryForm.Length);
                structure.pSecurityDescriptor = pDest;
            }
            bool   flag2         = true;
            int    errorCode     = 0;
            string maybeFullPath = path;

            while (list.Count > 0)
            {
                string str3 = list[list.Count - 1];
                list.RemoveAt(list.Count - 1);
                if (str3.Length >= Path.MaxLongPath)
                {
                    throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
                }
                flag2 = Win32Native.CreateDirectory(Path.AddLongPathPrefix(str3), structure);
                if (!flag2 && (errorCode == 0))
                {
                    int lastError = Marshal.GetLastWin32Error();
                    if (lastError != 0xb7)
                    {
                        errorCode = lastError;
                    }
                    else if (LongPathFile.InternalExists(str3) || (!InternalExists(str3, out lastError) && (lastError == 5)))
                    {
                        errorCode = lastError;
                        try
                        {
                            new FileIOPermission(FileIOPermissionAccess.PathDiscovery, new string[] { GetDemandDir(str3, true) }, false, false).Demand();
                            maybeFullPath = str3;
                            continue;
                        }
                        catch (SecurityException)
                        {
                            continue;
                        }
                    }
                }
            }
            if ((count == 0) && !flag)
            {
                if (!InternalExists(InternalGetDirectoryRoot(fullPath)))
                {
                    __Error.WinIOError(3, InternalGetDirectoryRoot(path));
                }
            }
            else if (!flag2 && (errorCode != 0))
            {
                __Error.WinIOError(errorCode, maybeFullPath);
            }
        }
示例#27
0
 public void AddPathList(RegistryPermissionAccess access, AccessControlActions control, string pathList)
 {
     throw new NotImplementedException();
 }
示例#28
0
 public IFileIOPermission CreateFileIOPermission(FileIOPermissionAccess access, AccessControlActions control, string[] pathList)
 {
     return new FileIOPermissionWrap(access, control, pathList);
 }
示例#29
0
 [System.Security.SecuritySafeCritical]  // auto-generated
 public RegistryPermission( RegistryPermissionAccess access, AccessControlActions control, String pathList ) 
 {
     m_unrestricted = false;
     AddPathList( access, control, pathList );
 } 
示例#30
0
 public IFileIOPermission CreateFileIOPermission(FileIOPermissionAccess access, AccessControlActions control, string[] pathList)
 {
     return(new FileIOPermissionWrap(access, control, pathList));
 }
示例#31
0
        internal void SetPathList( AccessControlActions control, String pathList ) 
        {
            m_unrestricted = false;

            if ((control & AccessControlActions.View) != 0) 
                m_viewAcl = null;
 
            if ((control & AccessControlActions.Change) != 0) 
                m_changeAcl = null;
 
            AddPathList( RegistryPermissionAccess.NoAccess, control, pathList );
        }
 public FileIOPermissionWrap(FileIOPermissionAccess access, AccessControlActions control, string[] pathList)
 {
     UnderlyingObject = new FileIOPermission(access,control, pathList);
 }
示例#33
0
 public void AddPathList(RegistryPermissionAccess access, AccessControlActions actions, string pathList)
 {
 }
示例#34
0
 public ComputerBrowserAPIItem(DirectoryInfo dir, UNCPath unc, User user, AccessControlActions access, [Optional, DefaultParameterValue("")] string download) : base(dir, unc, user)
 {
     AccessControl = access;
     Download      = download;
 }
示例#35
0
        [System.Security.SecurityCritical]  // auto-generated
        internal void AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, bool checkForDuplicates, bool needFullPath, bool copyPathList)
        {
            if (pathListOrig == null)
            {
                throw new ArgumentNullException("pathList");
            }
            if (pathListOrig.Length == 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
            }
            Contract.EndContractBlock();

            VerifyAccess(access);

            if (m_unrestricted)
            {
                return;
            }

            String[] pathList = pathListOrig;
            if (copyPathList)
            {
                // Make a copy of pathList (in case its value changes after we check for illegal chars)
                pathList = new String[pathListOrig.Length];
                Array.Copy(pathListOrig, pathList, pathListOrig.Length);
            }

            CheckIllegalCharacters(pathList);
            ArrayList pathArrayList = StringExpressionSet.CreateListFromExpressions(pathList, needFullPath);

            if ((access & FileIOPermissionAccess.Read) != 0)
            {
                if (m_read == null)
                {
                    m_read = new FileIOAccess();
                }
                m_read.AddExpressions(pathArrayList, checkForDuplicates);
            }

            if ((access & FileIOPermissionAccess.Write) != 0)
            {
                if (m_write == null)
                {
                    m_write = new FileIOAccess();
                }
                m_write.AddExpressions(pathArrayList, checkForDuplicates);
            }

            if ((access & FileIOPermissionAccess.Append) != 0)
            {
                if (m_append == null)
                {
                    m_append = new FileIOAccess();
                }
                m_append.AddExpressions(pathArrayList, checkForDuplicates);
            }

            if ((access & FileIOPermissionAccess.PathDiscovery) != 0)
            {
                if (m_pathDiscovery == null)
                {
                    m_pathDiscovery = new FileIOAccess(true);
                }
                m_pathDiscovery.AddExpressions(pathArrayList, checkForDuplicates);
            }

#if FEATURE_MACL
            if ((control & AccessControlActions.View) != 0)
            {
                if (m_viewAcl == null)
                {
                    m_viewAcl = new FileIOAccess();
                }
                m_viewAcl.AddExpressions(pathArrayList, checkForDuplicates);
            }

            if ((control & AccessControlActions.Change) != 0)
            {
                if (m_changeAcl == null)
                {
                    m_changeAcl = new FileIOAccess();
                }
                m_changeAcl.AddExpressions(pathArrayList, checkForDuplicates);
            }
#endif
        }
示例#36
0
        [System.Security.SecurityCritical]  // auto-generated
        internal void AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, bool checkForDuplicates, bool needFullPath, bool copyPathList)
        {
            if (pathListOrig == null)
            {
                throw new ArgumentNullException("pathList");
            }
            if (pathListOrig.Length == 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
            }
            Contract.EndContractBlock();

            VerifyAccess(access);

            if (m_unrestricted)
            {
                return;
            }

            String[] pathList = pathListOrig;
            if (copyPathList)
            {
                // Make a copy of pathList (in case its value changes after we check for illegal chars)
                pathList = new String[pathListOrig.Length];
                Array.Copy(pathListOrig, pathList, pathListOrig.Length);
            }

            ArrayList pathArrayList = StringExpressionSet.CreateListFromExpressions(pathList, needFullPath);

            // If we need the full path the standard illegal characters will be checked in StringExpressionSet.
            CheckIllegalCharacters(pathList, onlyCheckExtras: needFullPath);

            // StringExpressionSet will do minor normalization, trimming spaces and replacing alternate
            // directory separators. It will make an attemt to expand short file names and will check
            // for standard colon placement.
            //
            // If needFullPath is true it will call NormalizePath- which performs short name expansion
            // and does the normal validity checks.

            if ((access & FileIOPermissionAccess.Read) != 0)
            {
                if (m_read == null)
                {
                    m_read = new FileIOAccess();
                }
                m_read.AddExpressions(pathArrayList, checkForDuplicates);
            }

            if ((access & FileIOPermissionAccess.Write) != 0)
            {
                if (m_write == null)
                {
                    m_write = new FileIOAccess();
                }
                m_write.AddExpressions(pathArrayList, checkForDuplicates);
            }

            if ((access & FileIOPermissionAccess.Append) != 0)
            {
                if (m_append == null)
                {
                    m_append = new FileIOAccess();
                }
                m_append.AddExpressions(pathArrayList, checkForDuplicates);
            }

            if ((access & FileIOPermissionAccess.PathDiscovery) != 0)
            {
                if (m_pathDiscovery == null)
                {
                    m_pathDiscovery = new FileIOAccess(true);
                }
                m_pathDiscovery.AddExpressions(pathArrayList, checkForDuplicates);
            }
        }
示例#37
0
 [System.Security.SecuritySafeCritical]  // auto-generated
 public FileIOPermission(FileIOPermissionAccess access, AccessControlActions control, String[] pathList)
     : this(access, control, pathList, true, true)
 {
 }
示例#38
0
 public RegistryPermission(RegistryPermissionAccess access, AccessControlActions control, string pathList)
 {
 }
示例#39
0
 public FileIOPermission(FileIOPermissionAccess access, AccessControlActions control, string[] pathList)
 {
     throw new NotImplementedException();
 }
示例#40
0
        [System.Security.SecurityCritical]  // auto-generated
        internal FileIOPermission(FileIOPermissionAccess access, AccessControlActions control, String[] pathList, bool checkForDuplicates, bool needFullPath)
        {
            VerifyAccess(access);

            AddPathList(access, control, pathList, checkForDuplicates, needFullPath, true);
        }
示例#41
0
        [System.Security.SecurityCritical]  // auto-generated
        internal void AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, bool checkForDuplicates, bool needFullPath, bool copyPathList)
        {
            if (pathListOrig == null)
            {
                throw new ArgumentNullException("pathList");
            }
            if (pathListOrig.Length == 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
            }
            Contract.EndContractBlock();
            // @

            VerifyAccess(access);

            if (m_unrestricted)
                return;

            String[] pathList = pathListOrig;
            if (copyPathList)
            {
                // Make a copy of pathList (in case its value changes after we check for illegal chars)
                pathList = new String[pathListOrig.Length];
                Array.Copy(pathListOrig, pathList, pathListOrig.Length);
            }

            // If we need the full path the standard illegal characters will be checked in StringExpressionSet.
            CheckIllegalCharacters(pathList, onlyCheckExtras: needFullPath);

            // StringExpressionSet will do minor normalization, trimming spaces and replacing alternate
            // directory separators. It will make an attemt to expand short file names and will check
            // for standard colon placement.
            //
            // If needFullPath is true it will call NormalizePath- which performs short name expansion
            // and does the normal validity checks.
            ArrayList pathArrayList = StringExpressionSet.CreateListFromExpressions(pathList, needFullPath);

            if ((access & FileIOPermissionAccess.Read) != 0)
            {
                if (m_read == null)
                {
                    m_read = new FileIOAccess();
                }
                m_read.AddExpressions(pathArrayList, checkForDuplicates);
            }

            if ((access & FileIOPermissionAccess.Write) != 0)
            {
                if (m_write == null)
                {
                    m_write = new FileIOAccess();
                }
                m_write.AddExpressions(pathArrayList, checkForDuplicates);
            }

            if ((access & FileIOPermissionAccess.Append) != 0)
            {
                if (m_append == null)
                {
                    m_append = new FileIOAccess();
                }
                m_append.AddExpressions(pathArrayList, checkForDuplicates);
            }

            if ((access & FileIOPermissionAccess.PathDiscovery) != 0)
            {
                if (m_pathDiscovery == null)
                {
                    m_pathDiscovery = new FileIOAccess(true);
                }
                m_pathDiscovery.AddExpressions(pathArrayList, checkForDuplicates);
            }

#if FEATURE_MACL
            if ((control & AccessControlActions.View) != 0)
            {
                if (m_viewAcl == null)
                {
                    m_viewAcl = new FileIOAccess();
                }
                m_viewAcl.AddExpressions(pathArrayList, checkForDuplicates);
            }

            if ((control & AccessControlActions.Change) != 0)
            {
                if (m_changeAcl == null)
                {
                    m_changeAcl = new FileIOAccess();
                }
                m_changeAcl.AddExpressions(pathArrayList, checkForDuplicates);
            }
#endif
        }
示例#42
0
 public File(FileInfo file, DriveMapping mapping, User user, AccessControlActions actions)
     : this(file, mapping, user)
 {
     this.Actions = actions;
 }
示例#43
0
        [System.Security.SecurityCritical]  // auto-generated
        internal void AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, bool checkForDuplicates, bool needFullPath, bool copyPathList)
        {
            if (pathListOrig == null)
            {
                throw new ArgumentNullException( "pathList" );    
            }
            if (pathListOrig.Length == 0)
            {
                throw new ArgumentException( Environment.GetResourceString("Argument_EmptyPath" ));    
            }
            Contract.EndContractBlock();

            VerifyAccess(access);
                
            if (m_unrestricted)
                return;

            String[] pathList = pathListOrig;
            if(copyPathList)
            {
                // Make a copy of pathList (in case its value changes after we check for illegal chars)
                pathList = new String[pathListOrig.Length];
                Array.Copy(pathListOrig, pathList, pathListOrig.Length);
            }

            CheckIllegalCharacters( pathList );
            ArrayList pathArrayList = StringExpressionSet.CreateListFromExpressions(pathList, needFullPath);
            
            if ((access & FileIOPermissionAccess.Read) != 0)
            {
                if (m_read == null)
                {
                    m_read = new FileIOAccess();
                }
                m_read.AddExpressions( pathArrayList, checkForDuplicates);
            }
            
            if ((access & FileIOPermissionAccess.Write) != 0)
            {
                if (m_write == null)
                {
                    m_write = new FileIOAccess();
                }
                m_write.AddExpressions( pathArrayList, checkForDuplicates);
            }
    
            if ((access & FileIOPermissionAccess.Append) != 0)
            {
                if (m_append == null)
                {
                    m_append = new FileIOAccess();
                }
                m_append.AddExpressions( pathArrayList, checkForDuplicates);
            }

            if ((access & FileIOPermissionAccess.PathDiscovery) != 0)
            {
                if (m_pathDiscovery == null)
                {
                    m_pathDiscovery = new FileIOAccess( true );
                }
                m_pathDiscovery.AddExpressions( pathArrayList, checkForDuplicates);
            }

#if FEATURE_MACL
            if ((control & AccessControlActions.View) != 0)
            {
                if (m_viewAcl == null)
                {
                    m_viewAcl = new FileIOAccess();
                }
                m_viewAcl.AddExpressions( pathArrayList, checkForDuplicates);
            }

            if ((control & AccessControlActions.Change) != 0)
            {
                if (m_changeAcl == null)
                {
                    m_changeAcl = new FileIOAccess();
                }
                m_changeAcl.AddExpressions( pathArrayList, checkForDuplicates);
            }
#endif
        }
 public RegistryPermission(RegistryPermissionAccess access, AccessControlActions control, string pathList)
 {
     this.m_unrestricted = false;
     this.AddPathList(access, control, pathList);
 }
示例#45
0
 internal static void QuickDemand(FileIOPermissionAccess access, AccessControlActions control, string[] fullPathList, bool checkForDuplicates = true, bool needFullPath = true)
 {
     if (!CodeAccessSecurityEngine.QuickCheckForAllDemands())
     {
         new FileIOPermission(access, control, fullPathList, checkForDuplicates, needFullPath).Demand();
     }
     else
     {
         foreach (string fullPath in fullPathList)
         {
             EmulateFileIOPermissionChecks(fullPath);
         }
     }
 }
 internal void AddPathList(FileIOPermissionAccess access, AccessControlActions control, string[] pathListOrig, bool checkForDuplicates, bool needFullPath, bool copyPathList)
 {
     if (pathListOrig == null)
     {
         throw new ArgumentNullException("pathList");
     }
     if (pathListOrig.Length == 0)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
     }
     VerifyAccess(access);
     if (!this.m_unrestricted)
     {
         string[] destinationArray = pathListOrig;
         if (copyPathList)
         {
             destinationArray = new string[pathListOrig.Length];
             Array.Copy(pathListOrig, destinationArray, pathListOrig.Length);
         }
         HasIllegalCharacters(destinationArray);
         ArrayList values = StringExpressionSet.CreateListFromExpressions(destinationArray, needFullPath);
         if ((access & FileIOPermissionAccess.Read) != FileIOPermissionAccess.NoAccess)
         {
             if (this.m_read == null)
             {
                 this.m_read = new FileIOAccess();
             }
             this.m_read.AddExpressions(values, checkForDuplicates);
         }
         if ((access & FileIOPermissionAccess.Write) != FileIOPermissionAccess.NoAccess)
         {
             if (this.m_write == null)
             {
                 this.m_write = new FileIOAccess();
             }
             this.m_write.AddExpressions(values, checkForDuplicates);
         }
         if ((access & FileIOPermissionAccess.Append) != FileIOPermissionAccess.NoAccess)
         {
             if (this.m_append == null)
             {
                 this.m_append = new FileIOAccess();
             }
             this.m_append.AddExpressions(values, checkForDuplicates);
         }
         if ((access & FileIOPermissionAccess.PathDiscovery) != FileIOPermissionAccess.NoAccess)
         {
             if (this.m_pathDiscovery == null)
             {
                 this.m_pathDiscovery = new FileIOAccess(true);
             }
             this.m_pathDiscovery.AddExpressions(values, checkForDuplicates);
         }
         if ((control & AccessControlActions.View) != AccessControlActions.None)
         {
             if (this.m_viewAcl == null)
             {
                 this.m_viewAcl = new FileIOAccess();
             }
             this.m_viewAcl.AddExpressions(values, checkForDuplicates);
         }
         if ((control & AccessControlActions.Change) != AccessControlActions.None)
         {
             if (this.m_changeAcl == null)
             {
                 this.m_changeAcl = new FileIOAccess();
             }
             this.m_changeAcl.AddExpressions(values, checkForDuplicates);
         }
     }
 }
示例#47
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        internal void SetPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathList, bool checkForDuplicates)
        {
            VerifyAccess(access);

            if ((access & FileIOPermissionAccess.Read) != 0)
                m_read = null;

            if ((access & FileIOPermissionAccess.Write) != 0)
                m_write = null;

            if ((access & FileIOPermissionAccess.Append) != 0)
                m_append = null;

            if ((access & FileIOPermissionAccess.PathDiscovery) != 0)
                m_pathDiscovery = null;

#if FEATURE_MACL
            if ((control & AccessControlActions.View) != 0)
                m_viewAcl = null;

            if ((control & AccessControlActions.Change) != 0)
                m_changeAcl = null;
#else
            m_viewAcl = null;
            m_changeAcl = null;
#endif

            m_unrestricted = false;
#if FEATURE_MACL
            AddPathList(access, control, pathList, checkForDuplicates, true, true);
#else
            AddPathList( access, pathList, checkForDuplicates, true, true );
#endif
        }
示例#48
0
        internal void AddPathList(FileIOPermissionAccess access, AccessControlActions control, string[] pathListOrig, bool checkForDuplicates, bool needFullPath, bool copyPathList)
        {
            if (pathListOrig == null)
            {
                throw new ArgumentNullException("pathList");
            }
            if (pathListOrig.Length == 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
            }
            FileIOPermission.VerifyAccess(access);
            if (this.m_unrestricted)
            {
                return;
            }
            string[] str = pathListOrig;
            if (copyPathList)
            {
                str = new string[pathListOrig.Length];
                Array.Copy((Array)pathListOrig, (Array)str, pathListOrig.Length);
            }
            FileIOPermission.CheckIllegalCharacters(str);
            ArrayList listFromExpressions = StringExpressionSet.CreateListFromExpressions(str, needFullPath);

            if ((access & FileIOPermissionAccess.Read) != FileIOPermissionAccess.NoAccess)
            {
                if (this.m_read == null)
                {
                    this.m_read = new FileIOAccess();
                }
                this.m_read.AddExpressions(listFromExpressions, checkForDuplicates);
            }
            if ((access & FileIOPermissionAccess.Write) != FileIOPermissionAccess.NoAccess)
            {
                if (this.m_write == null)
                {
                    this.m_write = new FileIOAccess();
                }
                this.m_write.AddExpressions(listFromExpressions, checkForDuplicates);
            }
            if ((access & FileIOPermissionAccess.Append) != FileIOPermissionAccess.NoAccess)
            {
                if (this.m_append == null)
                {
                    this.m_append = new FileIOAccess();
                }
                this.m_append.AddExpressions(listFromExpressions, checkForDuplicates);
            }
            if ((access & FileIOPermissionAccess.PathDiscovery) != FileIOPermissionAccess.NoAccess)
            {
                if (this.m_pathDiscovery == null)
                {
                    this.m_pathDiscovery = new FileIOAccess(true);
                }
                this.m_pathDiscovery.AddExpressions(listFromExpressions, checkForDuplicates);
            }
            if ((control & AccessControlActions.View) != AccessControlActions.None)
            {
                if (this.m_viewAcl == null)
                {
                    this.m_viewAcl = new FileIOAccess();
                }
                this.m_viewAcl.AddExpressions(listFromExpressions, checkForDuplicates);
            }
            if ((control & AccessControlActions.Change) == AccessControlActions.None)
            {
                return;
            }
            if (this.m_changeAcl == null)
            {
                this.m_changeAcl = new FileIOAccess();
            }
            this.m_changeAcl.AddExpressions(listFromExpressions, checkForDuplicates);
        }
示例#49
0
 [System.Security.SecuritySafeCritical]  // auto-generated
 public FileIOPermission(FileIOPermissionAccess access, AccessControlActions control, String[] pathList)
     : this(access, control, pathList, true, true)
 {
 }
 internal void SetPathList(FileIOPermissionAccess access, AccessControlActions control, string[] pathList, bool checkForDuplicates)
 {
     VerifyAccess(access);
     if ((access & FileIOPermissionAccess.Read) != FileIOPermissionAccess.NoAccess)
     {
         this.m_read = null;
     }
     if ((access & FileIOPermissionAccess.Write) != FileIOPermissionAccess.NoAccess)
     {
         this.m_write = null;
     }
     if ((access & FileIOPermissionAccess.Append) != FileIOPermissionAccess.NoAccess)
     {
         this.m_append = null;
     }
     if ((access & FileIOPermissionAccess.PathDiscovery) != FileIOPermissionAccess.NoAccess)
     {
         this.m_pathDiscovery = null;
     }
     if ((control & AccessControlActions.View) != AccessControlActions.None)
     {
         this.m_viewAcl = null;
     }
     if ((control & AccessControlActions.Change) != AccessControlActions.None)
     {
         this.m_changeAcl = null;
     }
     this.m_unrestricted = false;
     this.AddPathList(access, control, pathList, checkForDuplicates, true, true);
 }