dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnet ChangeLog codegen/cg_decls.tc ilalink/link...


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnet ChangeLog codegen/cg_decls.tc ilalink/link...
Date: Sat, 09 May 2009 11:09:46 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnet
Changes by:     Klaus Treichel <ktreichel>      09/05/09 11:09:46

Modified files:
        .              : ChangeLog 
        codegen        : cg_decls.tc 
        ilalink        : link_attrs.c 
        ilsize         : ilsize_est.c 
        image          : item.c misc_token.c 
        include        : il_program.h 

Log message:
        Handle more than one security item attached to the same owner.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3623&r2=1.3624
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_decls.tc?cvsroot=dotgnu-pnet&r1=1.64&r2=1.65
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/link_attrs.c?cvsroot=dotgnu-pnet&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pnet/ilsize/ilsize_est.c?cvsroot=dotgnu-pnet&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/pnet/image/item.c?cvsroot=dotgnu-pnet&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pnet/image/misc_token.c?cvsroot=dotgnu-pnet&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pnet/include/il_program.h?cvsroot=dotgnu-pnet&r1=1.68&r2=1.69

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3623
retrieving revision 1.3624
diff -u -b -r1.3623 -r1.3624
--- ChangeLog   3 May 2009 12:20:32 -0000       1.3623
+++ ChangeLog   9 May 2009 11:09:45 -0000       1.3624
@@ -1,3 +1,24 @@
+2009-05-09  Klaus Treichel  <address@hidden>
+
+       * codegen/cg_decls.tc (ILGenOutputAttributes): Iterate over the security
+       items attached to a program item instead of dumping only the first one.
+
+       * ilalink/link_attrs.c (_ILLinkerConvertSecurity): Iterate over the
+       security items attached to a program item instead of converting only the
+       first one.
+
+       * ilsize/ilsize_est.c (GetMetadataSizeWithAttrs): Iterate over the
+       security items attached to a program item instead of calculating only
+       the size of the first one.
+
+       * image/item.c (ILProgramItemNextDeclSecurity): Add function for
+       iterating over the secutity items attached to a program item.
+
+       * image/misc_token.c (SearchForOwnedItem): Allow more than one security
+       item attached to the same owner.
+
+       * include/il_program.h (ILProgramItemNextDeclSecurity): Add prototype.
+
 2009-05-03  Klaus Treichel  <address@hidden>
 
        * codegen/cg_decls.tc (ILGenOutputAttributes): Print the .permissionset

Index: codegen/cg_decls.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_decls.tc,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- codegen/cg_decls.tc 3 May 2009 12:20:34 -0000       1.64
+++ codegen/cg_decls.tc 9 May 2009 11:09:46 -0000       1.65
@@ -35,7 +35,6 @@
        const void *value;
        unsigned long valueLen;
        unsigned long posn;
-       ILDeclSecurity *decl;
 
        attr = 0;
        while((attr = ILProgramItemNextAttribute(item, attr)) != 0)
@@ -73,8 +72,9 @@
           ILProgramItemToClass(item) ||
           ILProgramItemToMethod(item))
        {
-               decl = ILDeclSecurityGetFromOwner(item);
-               if(decl)
+               ILDeclSecurity *decl = 0;
+
+               while((decl = ILProgramItemNextDeclSecurity(item, decl)) != 0)
                {
                        static char * const actionNames[] = {
                                "demand /*nil*/", "request", "demand", "assert",

Index: ilalink/link_attrs.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/link_attrs.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- ilalink/link_attrs.c        4 Oct 2008 20:13:23 -0000       1.6
+++ ilalink/link_attrs.c        9 May 2009 11:09:46 -0000       1.7
@@ -85,16 +85,14 @@
                                                     ILProgramItem *newItem)
 {
        ILDeclSecurity *decl;
-       ILDeclSecurity *newDecl;
-       const void *blob;
-       unsigned long blobLen;
 
        /* Get the security declaration from the old item */
-       decl = ILDeclSecurityGetFromOwner(oldItem);
-       if(!decl)
+       decl = 0;
+       while((decl = ILProgramItemNextDeclSecurity(oldItem, decl)) != 0)
        {
-               return 1;
-       }
+               ILDeclSecurity *newDecl;
+               const void *blob;
+               unsigned long blobLen;
 
        /* Create a security declaration on the new item */
        newDecl = ILDeclSecurityCreate(linker->image, 0, newItem,
@@ -115,6 +113,7 @@
                        return 0;
                }
        }
+       }
 
        /* Done */
        return 1;

Index: ilsize/ilsize_est.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilsize/ilsize_est.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ilsize/ilsize_est.c 18 Apr 2003 09:44:37 -0000      1.1
+++ ilsize/ilsize_est.c 9 May 2009 11:09:46 -0000       1.2
@@ -381,8 +381,8 @@
        }
 
        /* Account for the security declaration if there is one */
-       decl = ILDeclSecurityGetFromOwner(item);
-       if(decl)
+       decl = 0;
+       while((decl = ILProgramItemNextDeclSecurity(item, decl)) != 0)
        {
                GetMetadataSize(info, ILToProgramItem(decl));
        }

Index: image/item.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/item.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- image/item.c        26 Nov 2008 20:15:25 -0000      1.11
+++ image/item.c        9 May 2009 11:09:46 -0000       1.12
@@ -157,6 +157,39 @@
        return count;
 }
 
+ILDeclSecurity *ILProgramItemNextDeclSecurity(ILProgramItem *item,
+                                                                               
          ILDeclSecurity *security)
+{
+       ILToken token;
+       ILImage *image;
+       ILDeclSecurity *newSecurity;
+
+       if(!security)
+       {
+               return ILDeclSecurityGetFromOwner(item);
+       }
+       image = security->ownedItem.programItem.image;
+       token = security->ownedItem.programItem.token;
+       ++token;
+       while((newSecurity = ILDeclSecurity_FromToken(image, token)) != 0)
+       {
+               if(newSecurity->ownedItem.owner == security->ownedItem.owner)
+               {
+                       return newSecurity;
+               }
+               if(image->type != IL_IMAGETYPE_BUILDING)
+               {
+                       /*
+                        * In loaded images the security records have to be 
sorted on
+                        * owner. So if the owner changes we are at the end of 
the list.
+                        */
+                       return 0;
+               }
+               ++token;
+       }
+       return 0;
+}
+
 ILImage *ILProgramItemGetImage(ILProgramItem *item)
 {
        return item->image;

Index: image/misc_token.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/misc_token.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- image/misc_token.c  18 Nov 2008 20:06:08 -0000      1.14
+++ image/misc_token.c  9 May 2009 11:09:46 -0000       1.15
@@ -363,7 +363,12 @@
        num = _ILSearchForRawToken(image, OwnedItemCompareRaw, tokenType, 
&token,
                                                           ((ILProgramItem 
*)owner)->token,
                                                           valueField);
-       if(num != 1)
+       /*
+        * Check if the number of owned items of this token type is valid or no
+        * owned item was found.
+        */
+       if((num < 1) ||
+          ((num > 1) && (tokenType != IL_META_TOKEN_DECL_SECURITY)))
        {
                return 0;
        }

Index: include/il_program.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/include/il_program.h,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- include/il_program.h        18 Apr 2009 19:18:20 -0000      1.68
+++ include/il_program.h        9 May 2009 11:09:46 -0000       1.69
@@ -2368,12 +2368,22 @@
 const void *ILDeclSecurityGetBlob(ILDeclSecurity *security, unsigned long 
*len);
 
 /*
- * Get the security record that is associated with a program item.
+ * Get the first security record that is associated with a program item.
  * Returns NULL if no such security record.
  */
 ILDeclSecurity *ILDeclSecurityGetFromOwner(ILProgramItem *owner);
 
 /*
+ * Iterate over the list of security records that are associated
+ * with a program item.  If "security" is NULL, then return the
+ * first security record in the list.  Otherwise return the next
+ * security record in the list after "security".  Returns NULL at the
+ * end of the list.
+ */
+ILDeclSecurity *ILProgramItemNextDeclSecurity(ILProgramItem *item,
+                                                                               
          ILDeclSecurity *security);
+
+/*
  * Helper macros for querying information about security records.
  */
 #define        ILDeclSecurity_FromToken(image,token)   \




reply via email to

[Prev in Thread] Current Thread [Next in Thread]