How do I get an extended SecurityManager to handle privileged code?

Hi.
I have written my own SecurityManager which asks if the user wants to allow the action before denying it. It also offers to write the whole permission into the current policy file.
The problem I have is that I can't get the securitymanager to handle privileged code. At the moment I get the call stack and check which classes that doesn't have the permission, check their codebase and write the permission to that codebase. But that will fail if any code is privileged.
So what I need is to get some information about those protection domains that are marked privileged, and it seems that the only way to get that is by using DomainCombiner.
But it doesn't seem to work at all, thinking that it might have something to do with that I have to run the critical code in my security manager as privileged, and that I do something wrong when I am extracting the DomainCombiner.
Well, I hope you understand my problem and that someone have some nice idea about how to do it in a clean nice way.
best regards,
Fredrik

Might be better if I post the whole code, it aint that big.
package tddc03;
public class SecMan2 extends SecurityManager { 
    private static String separator = System.getProperty("file.separator");
    public SecMan2() {
         super();
    public void checkPermission(final Permission perm) {
     try {
         super.checkPermission(perm);
     catch (final SecurityException se) {
         System.out.println("Securityexception caught: " + se.getMessage());
         System.out.println("Would you like to: 1. Allow once, 2. Allow everytime, 3. Deny?");
         try {
          char res = (char)System.in.read();
          /*Read until end of line, or eof. to descard anything other then the first character*/
          char tmp;
          int readItem;
          do {
              tmp = (char) (readItem = System.in.read());
          }  while ( tmp != '\n' && readItem != -1 );
          if ((res != '1') && (res != '2')) {
              System.out.println("deny!");
              throw se;
          else if (res == '2')
               /*Well, we need to make the handleException() code to run as privileged code
                * since it need access to resources that the caller shouldn't have access to.
                * The code that runs marked as privileged only rely on its own permission, so
                * we can give this package the permission to write to the policy file without giving
                * it to the program that is running*/
                try {
                    AccessController.doPrivileged(
                                   new PrivilegedExceptionAction() {
                                       public Object run() throws SecurityException {
                                                  handleException(se, perm);
                                                  return null;
                } catch (PrivilegedActionException e) {
                    throw (SecurityException) e.getException();
         } catch (IOException ioe) {
              System.out.println("IOException on input:" + ioe.getMessage());
              throw se;
     catch (Exception e) {
         System.out.println("Exception caught :" + e.getMessage());
         e.printStackTrace();
    private void handleException(SecurityException e, final Permission perm) {
     String provider;
     Vector<String> codebase = new Vector();
     /*if you only using your own policy file, there will be one '=' infront of the
       searchpath which we have to remove*/
     provider = System.getProperty("java.security.policy");     
     provider = provider.replaceFirst("=","");     
     /*this means we have to use the default one.*/
     if (provider == null)
         provider = System.getProperty("java.home") + separator +"lib"
          + separator +"security"+separator+"java.policy";
     //codebase = "file:" + System.getProperty("user.dir") + separator + "-";
     Class[] classes = getClassContext();
     ProtectionDomain pd = null;
     for(int i=0; i < classes.length; i++) {
         pd = classes.getProtectionDomain();
     if (pd.implies(perm) == true) {
                    System.out.println(i + ". " + classes[i].toString());
     else {
                    System.out.print(i + ". " + classes[i].toString()+ "[");
                    System.out.println(pd.getCodeSource().getLocation().toString() + "]");
                    codebase.add(pd.getCodeSource().getLocation().toString());
     final File policy_file = new File(provider);
     final PolicyParser parser = new PolicyParser();
     PolicyParser.PermissionEntry perm_entry;
     PolicyParser.GrantEntry grant_entry;
     //Traverse the exception message to get the specs for the new permission
     String perm_type, perm_action, perm_param;
     try {
     //We need to get the data from the exception message, so we will split it up.
     String temp[] = e.getMessage().split("[()]",3);
     temp = temp[1].split("\\s",3);
     perm_type = temp[0];
     perm_param = temp[1];
     if (temp.length > 2)
          perm_action = temp[2];
     else
          perm_action = "";
     perm_entry = new PolicyParser.PermissionEntry(perm_type, perm_param, perm_action);
     FileReader p_reader = new FileReader(policy_file);
     parser.read(p_reader);
     p_reader.close();
     //Travers all grants, looking for the current codeBase
     PolicyParser.GrantEntry list_entry;
     Enumeration elements;
     for(Enumeration ec = codebase.elements(); ec.hasMoreElements();) {
          elements = parser.grantElements();
          grant_entry= new PolicyParser.GrantEntry();
          grant_entry.codeBase = (String) ec.nextElement();
          while(elements.hasMoreElements()) {
          list_entry = (PolicyParser.GrantEntry) elements.nextElement();
          //If null == null or codeBase == codeBase
          if (grant_entry.codeBase.equals(list_entry.codeBase)) {
               list_entry.add(perm_entry);
               //To mark that the entry was successfully found
               grant_entry = null;
               break;
          if (grant_entry != null) {
          grant_entry.add(perm_entry);
          parser.add(grant_entry);
     FileWriter p_writer = new FileWriter(policy_file);
     parser.write(p_writer);
     p_writer.close();
     Policy.getPolicy().refresh();
     } catch (IOException ioe) {
     System.out.println("IOException caught:" + ioe.getMessage());
     } catch (ParsingException pe) {
     System.out.println("ParsingException caught:" + pe.getMessage());
     } catch (Exception ex) {
     System.out.println("Exception caught:" + ex.getMessage());

Similar Messages

  • How do I get CS4 extended to run on Lion?

    I upgraded my imac from snow leopard th lion. CS4 extended no longer works and I uninstalled it! How do I get CS4 extended to work on lion?

    It should work just fine with Mac OS 10.7. What specific error messages are you receiving?  What happens when you reinstall the software?

  • How do I get photoshop extended?

    okay so I already have the photoshop $9.99 monthly subscription how do I get the extended version???

    From station_two:
    "Beginning Photoshop CS6, the repousse feature has changed and is now called 3D Extrusion. For details, see Create and adjust 3D Extrusions."

  • How can I get the Airport Express to handle all the PPPoE stuff?

    Hi, I’m visiting my family in China, and now trying to help my dad, with his Airport Express and how to set up a PPPoE connection.
    We have currently set up the Airport Express in bridge mode (not distributing IP adresses and selecting DHCP under the Internet tab in admin utility). The Airport settings on our two computers is set up to connect using PPPoE using the given login name and password. (ps! we can not see the Base station in Airport Admin Utility when using these settings, we would have to select a new location from the Apple menu to see it and make condigurations.)
    What we want is to do, is to have the Airport Express connect to the ISP using a PPPoE connection and not through the computer.
    I know there is a 'Connect using PPPoE' option in Airport admin util, letting me input account name and password. If I select this setting instead of DHCP, enable distribution of IP addresses and configure my Airport card to NOT connect using PPPoE, I will see my base station in the Airport admin util with the IP address of 10.0.1.1 (or similar) and my computer will have x.x.x.2. Next to the Airport icon in the menubar, a scrolling message will say 'Looking for PPPoE host' without anything happen. I am sure my account name and password is correct as they've both worked when using this computer to connect to PPPoE (like now)
    How can I get the Airport Express to handle all the PPPoE stuff without using bridge mode?
    Ps! Both me and my dad have iPhones whom we can’t seem to get to connect unless its been distributed an IP address cause there's as fars as I know, no options of inputing a PPPoE user name and password.

    Any solutions to this? I'm in China also, in Beijing, trying to get my Airport Express to work with an ADSL modem.
    Direct ethernet cable connection to my Macbook works fine.
    When I configure the Airport Express with the ID and password that seems to be fine also – Airport Express shows a green light.
    But I cannot figure out the settings to connect wirelessly from my Macbook to the Airport Express. I get a constantly scolling message: "Looking for PPPoEhost..."
    thanks
    Paul

  • How do I get CS5 Bridge/Photoshp to handle RAW files from my D800E?

    How do I get CS5 Bridge/Photoshop to handle RAW files from my D~800E?

    There are many who would say, based only on empiric data (boo) and not opinion (yay), that the most accurate raw conversions would be obtained using the Nikon software and not secondary processors like the Adobe converter. The DNG process makes irreversible changes to the raw data which may or may not matter but the DNG is not the same as the original raw file.
    You can do the experiment yourself, for FREE, and compare different methods of raw conversion. You may be surprised at what you see. You have to be because different converters tune to different image characteristics. Don't be taken in about claims Adobe makes for its convertor without proving them to yourself. Adobe has made deliberate pre-set choices for its converter and they may not be the best for you. Or they may be, as we have all become so used to what Adobe chooses we think we chose it ourselves.
    If I were able to afford, and had the energy to lug around a D800e, I might not want to compromise the image quality I just shelled out such massive bucks to obtain using the Adobe converter without proving that was the best option for me, but I don't do it for a living. Also, if you can shell out for a D800e and are enamored of the Adobe Converter realize it only costs $10/month for a CC subscription, possibly tax deductible, and you can still retain your older version of PS. The CC version of PS allows use of the ACR as a filter layer, if you are fond of the converter tools (which are much improved in the latest version).

  • My iPad with this security code and forgot it,how can I get him ?  Is that 4 digit code

    my iPad with this security code and forgot it,how can I get him ?  Is that 4 digit code.

    Recovery Mode
    1. Disconnect the USB cable from the device, but leave the other end of the cable connected to your computer's USB port.
    2. Turn off the device: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for the device to turn off.
    3.While pressing and holding the Home button, reconnect the USB cable to the device. The device should turn on.
    4. Continue holding the Home button until you see the "Connect to iTunes" screen. When this screen appears, release the Home button. iTunes should alert you that it has detected a device in recovery mode. Click OK, and then click Restore to restore the device.
    Note: Data will be lost. You may have to repeat the above many times.

  • How can we get requester's user id using java code

    Hi,
    How can we get requester's user id using java code?
    eg: If i had logged in as xelsysadm and request a resource for user uid101 on the userid field it should display uid101 and not xelsysadm.
    also,
    I have a resoure "A" which on revoking should also revoke resources B and C. How can it be done. Resource A, B, and C are 3 different resource objects.
    ==Thanks,
    doki

    Ok, so there is a way, but it's not available during submission. You can use the findRequests api. From the result set, get the "Requests.Consolidated Data Value" value. In this information, you will get an xml formatted data. It provides the list of users on the request on the left side after submission. After the request is completed, this value is available. Upon completion, you could get the request information, get this value, and parse the information for user ids.
    In the same adapter, use the following API:
    formIntf.setObjectFormData(objInstanceKey, formHash)
    The formHash is a hashtable containing the field name on your object form, and the values you wish to populate it with. You could create a textarea box on your object form and populate the userids for who the request is for.
    However, this makes absolutely 0 sense. When you get a request, the list of userids are listed right there on the request.
    -Kevin

  • How can I get an extender if they are always out of stock?

    I recently moved to an area that shows on the connection maps as covered, but after reporting an issue with my service on my iPhone 5 LTE phone, I was told I was in a "fringe" area.  I was told my only options were to change to a different carrier or get an extender.  The rep noted on my account that the ETF would be waived if I left and I did some investigating
    It seems that where I moved is a dead zone for almost all the carriers so I decided to try to get one of the extenders.  They offered me a refurb for $99, but then told me it wasn't available.  I have tried repeatedly over the last two months to get one, even a new one, and have had no luck.
    For the last three months, I am paying for cell coverage that I don't have, dropping calls if I don't stand in the one spot in my home I can get one bar of coverage. At this moment, I am 10 ft away from that spot and the phone continues to search for coverage.
    How am I supposed to get a device that is never in stock?  I'm not happy I am going to have to buy something AT&T and Sprint offered for free, and at this point I am wondering if Verizon cares anything for brand loyalty.  Just totally frustrated and really wanting to use a service I pay a lot for monthly.

    @VZWSupport, LasinaH_VZW
    I do not want and cannot afford to spend $250 dollars for something two of your competitors have offered me for free if I switch, to fix a problem your technical support has already diagnosed as an issue with YOUR signal and not MY apartment.  Your maps show me has having "excellent" coverage, however your technical support has confirmed with an engineer that we are actually in a "fringe" area and qualify for an extender.  After 10 years and tens of thousands of dollars, I would thing sending me an extender gratis for my continued loyalty would be nothing for Verizon.
    Right now I am more than a little aggravated as I was SUPPOSED to be called yesterday when refurb extenders were available as I was offered one at a reduced price.  It is almost 48 hours since the promised follow-up and I have heard NOTHING. I am not happy to be spending the $99 but if it means I can take a call in my apartment without worrying about it dropping every three minutes, then so be it.
    So here's what's going to happen.  I am going to call and talk to technical support one more time.  If we don't reach some sort of satisfactory solution, I will be taking advantage of the waived ETF I was promised and go to a competitor who will be more than pleased to give me their version of an extender before I walk out of their retail location.  I actually have that from them in writing.  What I pay may not enter into anyone's calculation on the bottom line and I do not imagine my leaving will have any great impact on Verizon's profitability, I do know that turning promoters into detractors will eventually catch up to the company at some point.

  • How can I get typekit fonts to display in edge code live preview?

    I'm wondering how I can get typekit fonts to display when using adobe code cc live preview? I'm aware that it's an issue with my local base url, but I'm confused as to how to fix the issue.
    Right now my site is stored locally in a folder on my desktop. I'm not sure what to put in the typekit settings under "domain" and what URL to put in the project settings in edge code.
    A little help please?

    Hello,
    I'm sorry that you ran into trouble with this. In order for the Typekit fonts to load, you need to add the IP address that you are using for Live Preview to the domain listing on the kit. 
    By default, Edge Code uses the IP address "http://127.0.0.1/"; you should see that listed in the web browser when previewing your site.  If you've changed the preview URL in Edge Code, it might be something like butterville.local instead.
    In either case, copy the URL where you are previewing the site, and add it to your domains: go to http://typekit.com and launch your Kit Editor. Click Kit Settings in the upper right corner and add your domain to the domains field, then save your settings.
    Make sure you republish your kit after saving the changes.
    I hope that this helps! If you still have trouble with the font loading, please send me the preview URL you are using along with your Typekit kit ID.  You may post those here or email us at [email protected]
    Best,
    -- liz

  • Layman's term , how do I get past "dont have enough access privileges" I am the admin

    layman's terms , please , how do I get around "not enough access privileges " to update iphone , I am admin

    You might get more adept advice on the iPad forum.
    It tells you to do videos because they take up a lot of room, then pictures.  If you have tons of music on there, or other media then you can fill up a drive pretty quickly.  You'll have to do an inventory of how much is on there.
    I don't know anything about iPads but if they are anything like computers you need to empty the trash to actually free up space from deleted items.

  • How can i get the extended warrnty for my apple ipad 3..in india ..

    is it realy required..? kindely sujest..

    If you didn't purchase it when you bought the iPad, you have to make an appointment to have it inspected at a store. Then you can buy it. I don't think it's ness because if a problem is going to happen with the hardware, it will happen in the first year or few months. What is nice about the plus care, it protects against accidental damage 2 times. I figured, if something happens after the year, most likely I am going to want the newest iPad version. I'll sell my old one, even if it's cracked, people are buying them. Then put that money towards the newest model. I have dropped a phone, but not my ipad( knock on wood). It's to big I think. Accidents do happen, do you feel the accident coverage is nessecary? That's the question you need to answer. It covers twice, plus 50$ US every time it happens, to get a new one. I don't know what that translates to rupees.

  • How do I get a real person to handle my complaint???

    I currently have 4 lines with VerizonOn Saturday June 7, 2014, I placed an order through the Verizon website to upgrade the 5559 and 5551 lines under the Verizon Edge promotion.  Both phones I ordered were the Droid MAXX 16 GB Black.  
    On Tuesday June 10, 2014, FedEx delivered the phones to my husband’s office.  The phones were ordered separately and subsequently were shipped in separate boxes.  The phone for the 5551 line was order number (removed).  It was shipped in a 9x6x4 inch box with a preprinted FedEx label and arrived undamaged and in working condition.  The phone for the 5559 line was order number (removed).  It was shipped in a 12x12x10 inch box with a hand-written FedEx address label.
    The box was barely taped together on the bottom and had a one corner that was crushed in and another corner that was torn down the side.  Upon opening this package, it was discovered the contents of this order were severely damaged.  Photos of damage are below.
    View of box contents upon opening.
    Order paperwork crumpled and torn.  Verizon Edge return bag ripped.
    Front cover of paperwork folder that was torn in half.
    Black outer band of phone packaging ripped apart and found lying loose inside box.
    Bottom portion of phone packaging containing charger.  Packaging is crushed on one corner and along one side.  Packaging was separate from lid lying in box and no longer held phone when package was opened.
    Top of box lid for phone and charger found lying in packaging separate from the rest of the box.  Lid corners ripped and side of box crushed.
    Bottom corner of my brand new $500 phone delivered shattered.  Phone was lying in the box separated from the retail packaging with cracked screen.
    I called on Tuesday June 10, 2014 at 3:37 pm central to advise customer service that the package arrived damaged.  At this time, I had not yet been home to personally observe the damage.  I was advised to call back once I determined which line the phone was assigned to and an escalation ticket would be generated.  I was further advised that the escalation ticket would take up to 24 hours to be resolved and following that a new phone would be shipped overnight or that arrangements could possibly be made for me to pick up a replacement in store.  I was also advised that there would be no need for me to contact FedEx (Call Time 14:30 minutes)
    I called back in at 5:59 pm central once I arrived home to provide which line the phone was supposed to be assigned to.  After explaining the situation again, the representative went to start the escalation ticket but was having difficulty.  She put me on hold to contact technical support, and the call dropped shortly thereafter.  Representative did not call me back.  (Call Time 14:00 minutes)
    After waiting for a call back, I called customer service again at 6:23 pm central and was connected to a different representative.  After explaining the situation again, he stated he would handle the escalation ticket.  An escalation ticket number 167881 was finally created.  The representative explained to me that it could take 24-48 hours (twice as long as previously advised) for the escalation ticket to be resolved, but once it was resolved, someone with Verizon would contact me and advise how to proceed but that a new phone should be shipped to me at that point.  (Call Time 25:00 minutes)
    On June 12, 2014 at 2:51 pm central, I called customer service to check on the status of the escalation ticket and to see when I could expect my new phone to be shipped.  After explaining the situation again, the representative told me that management must have my ticket on their desk to call and that she couldn’t advise me of the status.  She stated there should be a return label in my Verizon account to print to ship the damaged phone back before my new phone would be shipped.  I advised that I had seen a return label in my account while looking for something else earlier in the day but that I was afraid it was for shipping the phone for the Edge trade-in.  The representative said she would have to check the tracking number and see which phone the label was supposed to be for.  While on hold, the call disconnected and no one called me back.  (Call Time 31:00 minutes)
    I decided to wait to call back until after the 48 hour mark for the escalation ticket in case someone with management whose desk it was supposedly on would happen to call me.  When they didn’t call within the time window give, I attempted to call back.  At 8:00 pm central, I called, held for over 9 minutes, and had the call drop.  I called back at 8:10, spent 2 minutes navigating the menu again, and had call drop.  I called back again at 8:12, spent approximately 10 minutes on hold, and was finally connected to a person so I could once again explain my situation.  While explaining the situation to her, my call once again dropped, but this representative at least called me back.  The call repeatedly dropped (5 additional times) but the representative did continue to keep calling me back (except for final time) while I attempted to explain the situation.  She originally advised that I would need to file a claim against my phone insurance which I stated I did not feel was the case since it arrived damaged.  She then proceeded to tell me she could see where the representative earlier in the day was working to fill out an order to have my new phone shipped overnight to me when the call with that representative dropped.  She then advised me that I would have to first ship the broken phone back before my other phone would even be shipped.  I advised her I didn’t have a problem returning the broken phone, but that I was tired of waiting for a replacement phone that I was originally told I would already have.  She then consulted with her support team and advised she would place an order to overnight me a new phone.  After working on the order for the better part of the hour phone call, she stated she was unable to finish the process since it was ordered on the Edge program.  While trying to obtain clarification as to why nothing I was being told by representatives matched actual actions and procedures, I was never able to get a straight answer other than she wasn’t responsible for the incorrect information and what she was telling me now was correct.  When the call dropped the last time at 9:13 pm central, I received an automated text message apologizing for the dropped call and stating the representative would call me back shortly, but never received another call.
    Today is Friday June 13, 2014.  I am utilizing the return label found underneath the order number on the My Verizon website.  The label provided to me was for United State Postal Service 1st Class Package. I will be calling again this evening to complain about the fact the label I was provided was for a non-priority service, and I again was left waiting even longer than expected after being led to believe throughout my conversations I would be sending it back through an expedited shipping manner as well.
    I am completely dissatisfied with my Verizon experience.  Now I am left having to decide whether or not to return the phone for the 5551 line, revert to my old phone on the line, and cancel my 3 available lines in November or be obligated to an additional 2 years of a service before I will even know if this issue is satisfactorily resolved.  It is a sad reflection on your company that customers are of such low priority that no one is responsible enough to return phone calls in the time frame given or even held accountable for the information and/or misinformation they provide.  I can guarantee I will NOT recommend anyone to Verizon or the Verizon Edge program.
    I am also enclosing copies of all the tracking paperwork from FedEx that would indicate Verizon damaged my phone prior to shipping and knowingly shipped it anyway! Unfortunately, I am the one who pays monetarily, with my time (almost 3 hours that I can account for), and my headaches while your company continues to give me the run around.
    Personal info removed as required by the Verizon Wireless Terms of Service
    Message was edited by: Admin Moderator

        @shellk159
    I am deeply sorry to hear about your experience with upgrading your device and for the service you received since this issue began!  I want you to know that we do value your time as well as your business and would love the opportunity to restore your confidence in our service.
    I would like to further investigate this issue and check the status of your ticket.  Please accept my "Follow" request, "Follow" me back and send me a Direct Message so that I can further assist.  Thank you for being a part of Verizon Wireless!
    AnthonyTa_VZW
    Follow us on Twitter @VZWSupport

  • How can I get login.c, passwd.c command source code in Solaris 8.0 ?

    Hi, Everybody,
    How are you doing?
    I have lots of questions.
    Q1)
    I can't rebuild kernel of Solaris 8.0 source.
    If someone has an answer, would you give it to me ?
    It will help for me.
    Q2)
    In addition I want get login.c and passwd.c command source.
    I unziped the CD of Solaris 8.0 source, buf I cannot find the source code for login.c and passwd.c command.
    Would you help me ?
    Thank you

    http://www.4shared.com/file/210566155/c080d93a/db_online.html

  • How do I get hold of my quicktime Pro registration code if now i'm away

    I'm abroad and away from home. have bought a new mac and want to get qt pro which i paid for already for my old one. however, i don't know how to get hold of my registration code which was sent to me but is in my emails on my old computer. how do get in touch with quicktime themselves?

    Try the instructions in this article.
    (29535)

  • I have just purchased Lightroom 5 and cannot get a serial number as it says the redemption service is unavailable, how do I get my Serial number, using my Abruf-Code pls?

    I am trying to get a serial number for my purchased version of lightroom 5, using the Abruf-code, but keep being told the redemption service is unavailable,a nd the website I am given in the packaging sends me to an error page. Pls help as I am about to launch 130 Euros of software of the balcony.

    I don’t think there are many “must have” features in PSE13 especially if you are doing most of your editing non-destructively in Lightroom and only going to the external editor occasionally.
    https://forums.adobe.com/message/6761649#6761649

Maybe you are looking for

  • Cisco Jabber client installation issue

    I am trying to install Jabber Client 9.6(1) with this installation command msiexec.exe /i CiscoJabberSetup.msi /quiet CLEAR=1 AUTHENTICATOR=CUP CUP_ADDRESS=1.2.3.4 but it didn't set account type as cisco IM & Presence instead it stays in Automatic Is

  • Home Sharing in Itunes 9 on Windows Home Server

    I have installed iTunes 9 and have started using Home Sharing. I want to be able to use Home Sharing with my WHS (Windows Home Server) as our music is stored there and we have iTunes on all computers, plus 2 iphones and iPods. This would need a Home

  • Please help...battery problem...PLEASE

    i really need help in this one or i'll get f**ked...now, my boss's ipod was with me and i tried connecting it to my computer to charge it...when i cama to take it i found it very hot and not recognized in the computer and not trning on...I reseted it

  • What to do to AR invoices which will not get any receipts

    what to do to AR invoices which will not get any receipts. There are a few invoices which have been created and these invoices will not get any receipts, so how do i remove them from the system

  • How to save PDF files on an iPad files

    How do I save PDF files onto an iPad?