<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Applet &amp;quot;codebase&amp;quot;  to IP address resolution in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/applet-quot-codebase-quot-to-ip-address-resolution/m-p/4247884#M44573</link>
    <description>I know nothing but with the help of Google found the following.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.mozilla.org/projects/security/components/same-origin.html" target="_blank"&gt;http://www.mozilla.org/projects/security/components/same-origin.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Wim</description>
    <pubDate>Mon, 11 Aug 2008 08:38:18 GMT</pubDate>
    <dc:creator>Wim Van den Wyngaert</dc:creator>
    <dc:date>2008-08-11T08:38:18Z</dc:date>
    <item>
      <title>Applet "codebase"  to IP address resolution</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/applet-quot-codebase-quot-to-ip-address-resolution/m-p/4247883#M44572</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Can someone please tell me the strategy(ies) used by Java (the Security&lt;BR /&gt;Manager or whatever) to determine if a given IP address conforms to the&lt;BR /&gt;definition of the codebase from which an applet was retrieved?&lt;BR /&gt;&lt;BR /&gt;For example, if an Applet was loaded from mycluster.mydomain.com, and&lt;BR /&gt;"mycluster" was a cluster alias that was using DNS load-balancing (or&lt;BR /&gt;round-robin or a.n.other distribution technique) to distribute client&lt;BR /&gt;connections among available nodes in the cluster, could such an unsigned&lt;BR /&gt;applet connect a socket to *any* of the available nodes or interface&lt;BR /&gt;addresses?&lt;BR /&gt;&lt;BR /&gt;Is the DNS translation done only once when the Object/Applet tag is&lt;BR /&gt;encountered and, from then on, all "codebase" checks must match that same IP&lt;BR /&gt;address?&lt;BR /&gt;&lt;BR /&gt;Is it just an ASCII string check, so that one relative -vs- one absolute URL&lt;BR /&gt;specification could point to the same address yet fail the check?&lt;BR /&gt;&lt;BR /&gt;But then, when it comes to UDP messages arriving at an Applet's socket, when&lt;BR /&gt;only the IP address is available, what criteria is used to say "Hey, did&lt;BR /&gt;this message come from my codebase?&lt;BR /&gt;&lt;BR /&gt;Is the equivalent a C gethostent() call performed, and *all* alias addresses&lt;BR /&gt;and names are checked to say "It's in there somewhere"? (This would be nice&lt;BR /&gt;:-)&lt;BR /&gt;&lt;BR /&gt;I've got two sheep-stations and an oil-rig that says checkConnect() socketPermission() etc, do a InetAddress.getAllByName(host) and anyone who says otherwise is a lying dog :-)&lt;BR /&gt;&lt;BR /&gt;To see an example of just such code, please click on: -&lt;BR /&gt;&lt;A href="http://manson.vistech.net/~tier3/tier3pager.html" target="_blank"&gt;http://manson.vistech.net/~tier3/tier3pager.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Once you've done that (and read the gumpf) please then also telnet to manson.vistect.net (If you don't have an account then use Username: DEMO Password: USER) Then: -&lt;BR /&gt;&lt;BR /&gt;DEMO$ SET TERM/WIDTH=132&lt;BR /&gt;DEMO$ RUN SYS$USERS:[USERS.TIER3.WEB]DEMO_UDP_MSG&lt;BR /&gt;&lt;BR /&gt;. . . and enter the IP Address of your browser client node.&lt;BR /&gt;&lt;BR /&gt;Your client should spring into life and you should be able to type-in adhoc messages and have them appear in the seperate Java Frame on the client.&lt;BR /&gt;&lt;BR /&gt;See attached for source code of DEMO_UDP_MSG.COB See below for source for Tier3Pager.java But *all* can be found on MANSON at: -&lt;BR /&gt;&lt;BR /&gt;SYS$USERS:[USERS.TIER3.WEB]&lt;BR /&gt;&lt;BR /&gt;Enjoy!&lt;BR /&gt;&lt;BR /&gt;Cheers Richard Maher&lt;BR /&gt;&lt;BR /&gt;PS. Why can't a Multicast message from the Applet's codebase be retrieved&lt;BR /&gt;from an unsigned Applet in the same way a UDP message can?&lt;BR /&gt;&lt;BR /&gt;Tier3Pager.java&lt;BR /&gt;================&lt;BR /&gt;&lt;BR /&gt;/**&lt;BR /&gt;  * Copyight Tier3 Software. All rights reserved.&lt;BR /&gt;  *&lt;BR /&gt;  * Author: Richard Maher&lt;BR /&gt;  *&lt;BR /&gt; **/&lt;BR /&gt;&lt;BR /&gt;import java.applet.Applet;&lt;BR /&gt;import java.awt.*;&lt;BR /&gt;import java.net.*;&lt;BR /&gt;import java.io.IOException;&lt;BR /&gt;import netscape.javascript.JSObject;&lt;BR /&gt;import netscape.javascript.JSException;&lt;BR /&gt;&lt;BR /&gt;public class Tier3Pager extends Applet&lt;BR /&gt;{&lt;BR /&gt;    private        String         hostName;&lt;BR /&gt;    private        JSObject       browser;&lt;BR /&gt;    private static MessageThread  socketThread;&lt;BR /&gt;    private static Tier3Talk      chat;&lt;BR /&gt;&lt;BR /&gt;    public class MessageThread extends Thread&lt;BR /&gt;    {&lt;BR /&gt;        private    DatagramSocket socket;&lt;BR /&gt;        private    DatagramPacket packet;&lt;BR /&gt;        private    String         threadData;&lt;BR /&gt;    &lt;BR /&gt;        public MessageThread(String name, String txt) throws Exception&lt;BR /&gt;        {&lt;BR /&gt;            super(name);&lt;BR /&gt;&lt;BR /&gt;            byte[] buffer;&lt;BR /&gt;            threadData = txt;&lt;BR /&gt;&lt;BR /&gt;            String port     = getParameter("PORT");&lt;BR /&gt;            String maxBuf   = getParameter("MAXBUF");&lt;BR /&gt;            try&lt;BR /&gt;                {&lt;BR /&gt;                if (port == null)&lt;BR /&gt;                    socket = new DatagramSocket();&lt;BR /&gt;                else&lt;BR /&gt;                    socket = new DatagramSocket(Integer.parseInt(port));&lt;BR /&gt;&lt;BR /&gt;                if (maxBuf == null)&lt;BR /&gt;                    buffer = new byte[512];&lt;BR /&gt;                else&lt;BR /&gt;                    buffer = new byte[Integer.parseInt(maxBuf)];&lt;BR /&gt;&lt;BR /&gt;                packet = new DatagramPacket(buffer, buffer.length); &lt;BR /&gt;                }&lt;BR /&gt;            catch (Exception e)&lt;BR /&gt;                {&lt;BR /&gt;                e.printStackTrace();&lt;BR /&gt;                System.out.println("Unable to create UDP Socket");&lt;BR /&gt;                throw new Exception("Message thread could not be created");&lt;BR /&gt;                }&lt;BR /&gt;  &lt;BR /&gt;            setDaemon(true);&lt;BR /&gt;            start();&lt;BR /&gt;        }&lt;BR /&gt;&lt;BR /&gt;        public void shutdown()&lt;BR /&gt;        {&lt;BR /&gt;            socket.close();&lt;BR /&gt;        }&lt;BR /&gt;&lt;BR /&gt;        public int getLocalPort()&lt;BR /&gt;        {&lt;BR /&gt;            return socket.getLocalPort();&lt;BR /&gt;        }&lt;BR /&gt;&lt;BR /&gt;        public void run()&lt;BR /&gt;        {&lt;BR /&gt;            System.out.println("Started Message thread. ThreadData = " + threadData);&lt;BR /&gt;            String args[] = {"Started Message Thread " + threadData};&lt;BR /&gt;            browser.call("alert", args);&lt;BR /&gt;            boolean stopThread = false;&lt;BR /&gt;&lt;BR /&gt;        readLoop:&lt;BR /&gt;            while (!stopThread)&lt;BR /&gt;            {&lt;BR /&gt;              try&lt;BR /&gt;                  { &lt;BR /&gt;                  socket.receive(packet);&lt;BR /&gt;                  String received = new String(packet.getData(), 0, packet.getLength());&lt;BR /&gt;                  processMessage(received);&lt;BR /&gt;                  }&lt;BR /&gt;              catch (SocketException e)&lt;BR /&gt;                  {&lt;BR /&gt;                  System.out.println("Shutting up shop");&lt;BR /&gt;                  stopThread = true;&lt;BR /&gt;                  continue readLoop;&lt;BR /&gt;                  }&lt;BR /&gt;              catch (IOException e)&lt;BR /&gt;                  {&lt;BR /&gt;                  e.printStackTrace();&lt;BR /&gt;                  System.out.println("Unable to retrieve UDP message");&lt;BR /&gt;                  }&lt;BR /&gt;            }&lt;BR /&gt; &lt;BR /&gt;            System.out.println("Thread run() unit terminating");&lt;BR /&gt;        }&lt;BR /&gt;&lt;BR /&gt;        public void processMessage(String msgText)&lt;BR /&gt;        {&lt;BR /&gt;             int msgType = Integer.parseInt(msgText.substring(0,2));&lt;BR /&gt;             switch (msgType){&lt;BR /&gt;               case    1:&lt;BR /&gt;                             chat.append(msgText.substring(2));&lt;BR /&gt;                             break;&lt;BR /&gt;               case    2:&lt;BR /&gt;                             String args[] = {msgText.substring(2)};&lt;BR /&gt;                             try {browser.call("priceUpdate", args);}&lt;BR /&gt;                             catch (JSException e)&lt;BR /&gt;                             {&lt;BR /&gt;                               System.out.println("Error when calling JS priceUpdate()");&lt;BR /&gt;                             }&lt;BR /&gt;                             break;&lt;BR /&gt;               default:&lt;BR /&gt;                             System.out.println("Unknown rec type "+msgText);&lt;BR /&gt;             }&lt;BR /&gt;        }&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    public void init()&lt;BR /&gt;    {&lt;BR /&gt;        System.out.println("Initializing. . .");&lt;BR /&gt;        hostName = getCodeBase().getHost();&lt;BR /&gt;&lt;BR /&gt;        chat = new Tier3Talk("Tier3 Messages");&lt;BR /&gt;        requestFocus();&lt;BR /&gt;&lt;BR /&gt;        browser = JSObject.getWindow(this);&lt;BR /&gt;&lt;BR /&gt;        if (socketThread == null)&lt;BR /&gt;        {&lt;BR /&gt;          try&lt;BR /&gt;              {&lt;BR /&gt;              socketThread = new MessageThread("MsgDaemon", "SomeData");&lt;BR /&gt;              }&lt;BR /&gt;          catch (Exception e)&lt;BR /&gt;              {&lt;BR /&gt;              e.printStackTrace();&lt;BR /&gt;              System.out.println("Could not init Tier3Pager");&lt;BR /&gt;              }&lt;BR /&gt;        }&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    public void alert(String alertText)&lt;BR /&gt;    {&lt;BR /&gt;        String args[] = {alertText};&lt;BR /&gt;        browser.call("alert", args);&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    public void destroy() &lt;BR /&gt;    {&lt;BR /&gt;        if (chat != null)&lt;BR /&gt;            chat.dispose();&lt;BR /&gt;&lt;BR /&gt;        boolean stillDying;&lt;BR /&gt;&lt;BR /&gt;        if (socketThread != null){&lt;BR /&gt;            socketThread.shutdown();&lt;BR /&gt;            do &lt;BR /&gt;            {&lt;BR /&gt;                stillDying = false;&lt;BR /&gt;                System.out.println("Joining MessageThread");&lt;BR /&gt;                try {socketThread.join();}&lt;BR /&gt;                catch (InterruptedException e){&lt;BR /&gt;                    System.out.println("Interrupted Join");&lt;BR /&gt;                    stillDying = true;&lt;BR /&gt;                }&lt;BR /&gt;            } while (stillDying);&lt;BR /&gt;&lt;BR /&gt;            socketThread = null;&lt;BR /&gt;        }&lt;BR /&gt;&lt;BR /&gt;        System.out.println("Tier3Pager Applet Rundown complete");&lt;BR /&gt;        super.destroy();&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Aug 2008 10:13:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/applet-quot-codebase-quot-to-ip-address-resolution/m-p/4247883#M44572</guid>
      <dc:creator>Richard J Maher</dc:creator>
      <dc:date>2008-08-07T10:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: Applet "codebase"  to IP address resolution</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/applet-quot-codebase-quot-to-ip-address-resolution/m-p/4247884#M44573</link>
      <description>I know nothing but with the help of Google found the following.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.mozilla.org/projects/security/components/same-origin.html" target="_blank"&gt;http://www.mozilla.org/projects/security/components/same-origin.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Wim</description>
      <pubDate>Mon, 11 Aug 2008 08:38:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/applet-quot-codebase-quot-to-ip-address-resolution/m-p/4247884#M44573</guid>
      <dc:creator>Wim Van den Wyngaert</dc:creator>
      <dc:date>2008-08-11T08:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Applet "codebase"  to IP address resolution</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/applet-quot-codebase-quot-to-ip-address-resolution/m-p/4247885#M44574</link>
      <description>This one is more neutral&lt;BR /&gt;&lt;A href="http://en.wikipedia.org/wiki/Same_origin_policy" target="_blank"&gt;http://en.wikipedia.org/wiki/Same_origin_policy&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Wim</description>
      <pubDate>Mon, 11 Aug 2008 09:00:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/applet-quot-codebase-quot-to-ip-address-resolution/m-p/4247885#M44574</guid>
      <dc:creator>Wim Van den Wyngaert</dc:creator>
      <dc:date>2008-08-11T09:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Applet "codebase"  to IP address resolution</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/applet-quot-codebase-quot-to-ip-address-resolution/m-p/4247886#M44575</link>
      <description>Hi Wim,&lt;BR /&gt;&lt;BR /&gt;Thanks for replying. Unfortunately you are talking apples and my oranges still have fruit-fly.&lt;BR /&gt;&lt;BR /&gt;Your "same-origin" policy is for http stuff like Ajax (although easily defeatable with run-time &amp;lt;script&amp;gt; tag insertion and JSON - So why bother? But then we all love those Google-Map mash-ups so who cares about security?) &lt;BR /&gt;&lt;BR /&gt;If you re-read my post you'll see that my Applet "codebase" issue involves many questions (such as UDP datagram-origin vetting)that appear to be out of the scope of the bollocks http "same-origin" policy.&lt;BR /&gt;&lt;BR /&gt;Has Bojan stopped listening/replying?&lt;BR /&gt;&lt;BR /&gt;Cheers Richard Maher</description>
      <pubDate>Mon, 11 Aug 2008 10:04:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/applet-quot-codebase-quot-to-ip-address-resolution/m-p/4247886#M44575</guid>
      <dc:creator>Richard J Maher</dc:creator>
      <dc:date>2008-08-11T10:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: Applet "codebase"  to IP address resolution</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/applet-quot-codebase-quot-to-ip-address-resolution/m-p/4247887#M44576</link>
      <description>Richard,&lt;BR /&gt;&lt;BR /&gt;I am still listening, but have no time to reply. I was also on holidays last 14 days so I missed your thread.&lt;BR /&gt;&lt;BR /&gt;Now abbout your problem. First I must say that I have no experience with this problem.&lt;BR /&gt;&lt;BR /&gt;I think that the implementation is (once again) browser dependant. The browser puts the Applet in a sandbox replacing the java.lang.SecurityManager or java.security.AccessControler or both (I am not shure how this is done).&lt;BR /&gt;A quick look to the Java source code shows that the default implementation of the SecurityManager checks the IP address expressed as a string (InetAddress.getHostAddress()).&lt;BR /&gt;I think that the address is checked only at connect time. You can find the exact behavior exploring the Java source code (provided in the top directory of the Java SDK in the src.zip file).&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Bojan</description>
      <pubDate>Mon, 18 Aug 2008 07:38:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/applet-quot-codebase-quot-to-ip-address-resolution/m-p/4247887#M44576</guid>
      <dc:creator>Bojan Nemec</dc:creator>
      <dc:date>2008-08-18T07:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: Applet "codebase"  to IP address resolution</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/applet-quot-codebase-quot-to-ip-address-resolution/m-p/4247888#M44577</link>
      <description>Hi Bojan,&lt;BR /&gt;&lt;BR /&gt;Thanks for the reply.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; You can find the exact behavior exploring&lt;BR /&gt;&amp;gt; the Java source code (provided in the top&lt;BR /&gt;&amp;gt; directory of the Java SDK in the src.zip&lt;BR /&gt;&amp;gt; file).&lt;BR /&gt;&lt;BR /&gt;I had rather hoped someone else out there would've already done the hard work for me :-)&lt;BR /&gt;&lt;BR /&gt;I think you're probably right about "implementation dependant" but when it comes to security-policy enforcement a universal, transparent, and common approach would probably have been a better idea.&lt;BR /&gt;&lt;BR /&gt;With clustering these days, and mutliple-interfaces from long before that, it seems strange to be restricting the code-base or document-base to a single IP address :-(&lt;BR /&gt;&lt;BR /&gt;Anyway sorry for the late reply, I was wondering if anyone had an example of an Applet receiving Multicast datagrams? A public web-page would be ideal!&lt;BR /&gt;&lt;BR /&gt;I beleive that such an  Applet has to be signed, is that true?&lt;BR /&gt;&lt;BR /&gt;Is it also true that some routers and public networks are not interested in propagating Multicast data?&lt;BR /&gt;&lt;BR /&gt;Any other problems/issues?&lt;BR /&gt;&lt;BR /&gt;Cheers Richard Maher</description>
      <pubDate>Sat, 20 Sep 2008 21:53:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/applet-quot-codebase-quot-to-ip-address-resolution/m-p/4247888#M44577</guid>
      <dc:creator>Richard J Maher</dc:creator>
      <dc:date>2008-09-20T21:53:02Z</dc:date>
    </item>
  </channel>
</rss>

