Пример #1
0
        private void AddPermission(PEAPI.SecurityAction sec_action, object perm, DeclSecurity decl_sec)
        {
            SSPermissionSet ps = perm as SSPermissionSet;

            if (ps != null)
            {
                decl_sec.AddPermissionSet(sec_action, ps);
                return;
            }

            IPermission iper = perm as IPermission;

            if (iper != null)
            {
                decl_sec.AddPermission(sec_action, iper);
                return;
            }

            MIPermissionSet ps20 = perm as MIPermissionSet;

            if (ps20 != null)
            {
                decl_sec.AddPermissionSet(sec_action, ps20);
                return;
            }
        }
Пример #2
0
        public void AddTo(CodeGen code_gen, PEAPI.MetaDataElement elem)
        {
            System.Text.UnicodeEncoding ue = new System.Text.UnicodeEncoding();
            foreach (DictionaryEntry entry in permissionset_table)
            {
                PEAPI.SecurityAction sec_action = (PEAPI.SecurityAction)entry.Key;
                SSPermissionSet      ps         = (SSPermissionSet)entry.Value;

                code_gen.PEFile.AddDeclSecurity(sec_action,
                                                ue.GetBytes(ps.ToXml().ToString()),
                                                elem);
            }

            if (permissionset20_table == null)
            {
                return;
            }

            foreach (DictionaryEntry entry in permissionset20_table)
            {
                PEAPI.SecurityAction sec_action = (PEAPI.SecurityAction)entry.Key;
                MIPermissionSet      ps         = (MIPermissionSet)entry.Value;

                code_gen.PEFile.AddDeclSecurity(sec_action,
                                                ps.Resolve(code_gen),
                                                elem);
            }
        }
Пример #3
0
                public void AddPermissionSet (PEAPI.SecurityAction sec_action, MIPermissionSet perm_set)
                {
                        PermissionSet ps = null;

                        if (permissionset20_table == null)
                                permissionset20_table = new Hashtable ();
                        else
                                ps = (MIPermissionSet) permissionset20_table [sec_action];

                        if (ps == null) {
                                permissionset20_table [sec_action] = perm_set;
                                return;
                        }

                        foreach (Permission perm in perm_set.Permissions)
                                ps.AddPermission (perm);
                }
Пример #4
0
        //Not called by parser for profile != NET_2_0
        public void AddPermissionSet(PEAPI.SecurityAction sec_action, MIPermissionSet perm_set)
        {
            PermissionSet ps = null;

            if (permissionset20_table == null)
            {
                permissionset20_table = new Hashtable();
            }
            else
            {
                ps = (MIPermissionSet)permissionset20_table [sec_action];
            }

            if (ps == null)
            {
                permissionset20_table [sec_action] = perm_set;
                return;
            }

            foreach (Permission perm in perm_set.Permissions)
            {
                ps.AddPermission(perm);
            }
        }