java - Is there an easy way to investigate if AccessController.doPrivileged() is really needed? -
i have code attaches javaserver rmiregistry, done in privilegedaction
//start javaengineserver accesscontroller.doprivileged(new privilegedaction() { public object run() { try { startserver(port, getsession()); } catch (rmiexception e) { e.printstacktrace(); awtswingerrordialog.show(e, "error while attaching javaengineserver rmiregistry.exe"); } return null; } }); i found other questions doprivileged method, , there comands need permissions getting environment variables.
so looked threw code behind startserver(port, session) method , haven't found looks needs permissions, there way confirm that, other test usages , functionality hand?
thank you.
i don't think there (reliable) easy way. there unreliable way though: temporarily replace code calls startserver, , try running in security sandbox.
i suspect doprivileged call needed though. method name , port parameter try create / bind / listen on serversocket. latter fail if securitymanager.checklisten method not allow operation ... won't in typical sandbox. (we don't want untrusted code able start stealth network services ...)
Comments
Post a Comment