CVS: sml-dist/src/eXene/graph-util get-dpy.sml,1.5,1.6 xauth.sml,1.6,1.7

Matthias Blume <[email protected]>
Newsgroups gmane.comp.lang.sml.smlnj.commits
Message-ID <[email protected]>
Update of /cvsroot/smlnj/sml-dist/src/eXene/graph-util
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv31409/src/eXene/graph-util

Modified Files:
	get-dpy.sml xauth.sml 
Log Message:
freeze for 110.59

Index: get-dpy.sml
===================================================================
RCS file: /cvsroot/smlnj/sml-dist/src/eXene/graph-util/get-dpy.sml,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** get-dpy.sml	3 Mar 2006 03:33:15 -0000	1.5
--- get-dpy.sml	17 May 2006 18:49:08 -0000	1.6
***************
*** 41,46 ****
          (case dpy of 
              "" =>   XAuth.getAuthByAddr {
                          family = XAuth.familyLocal,
!                         addr = "",
                          dpy = "0"
                      }
--- 41,53 ----
          (case dpy of 
              "" =>   XAuth.getAuthByAddr {
+                         (* modified ddeboer, spring 2005:
+                          * this condition should probably throw exception;
+                          * xlib XOpenDisplay code "/* Oops! No DISPLAY environment variable..."
+                          * returns NULL from XOpenDisplay (fails to open connection).
+                          * was:
                          family = XAuth.familyLocal,
!                         addr = "", *)
!                         family = XAuth.familyWild,
!                         addr = NetHostDB.getHostName(), (* necessary to look up xrdb record *)
                          dpy = "0"
                      }
***************
*** 49,60 ****
                val {dpy,...} = parseDisplay d *)
                val {dpy,host,...} = parseDisplay d
                in
                      XAuth.getAuthByAddr {
                          family = XAuth.familyInternet,
!                         (* following line modified, ddeboer, Jan 2005: was:
!                         addr = "", *)
!                         addr = host,
                          dpy = dpy
                      }
                end
          (* end case *))
--- 56,86 ----
                val {dpy,...} = parseDisplay d *)
                val {dpy,host,...} = parseDisplay d
+               (* added ddeboer, spring 2005 *)
+               fun mkXA fam addr = XAuth.getAuthByAddr{
+                                   family = fam,
+                                   addr   = addr,
+                                   dpy    = dpy
+                                 }
                in
+                 (* added ddeboer, spring 2005, was:
                      XAuth.getAuthByAddr {
                          family = XAuth.familyInternet,
!                         addr = "",
                          dpy = dpy
                      }
+                 *)
+                 (* we must obtain the string to be used for comparison in getAuthByAddr.
+                  * for familyLocal, this is the local hostname.
+                  * for familyInternet, this is the IP address (as a string) *)
+                 case host of
+                     ""          => mkXA XAuth.familyLocal (NetHostDB.getHostName())
+                   | "localhost" => mkXA XAuth.familyLocal (NetHostDB.getHostName())
+                   | _           => mkXA XAuth.familyInternet 
+                     (* this should more properly be set to the peer address of the
+                      * connection, *after* the connection has been made. However,
+                      * that would be a bit difficult with this architecture. *)
+                         (case (NetHostDB.getByName host) of 
+                           SOME e => (NetHostDB.toString (NetHostDB.addr e))
+                         | _ => "")
                end
          (* end case *))

Index: xauth.sml
===================================================================
RCS file: /cvsroot/smlnj/sml-dist/src/eXene/graph-util/xauth.sml,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** xauth.sml	3 Mar 2006 03:33:15 -0000	1.6
--- xauth.sml	17 May 2006 18:49:08 -0000	1.7
***************
*** 95,99 ****
              (* modified by ddeboer: 
               * entries of family=familyInternet are stored as 4-byte ip addresses.
-              * it seems that we must convert these into hostnames for comparison...?!?
              original:
              family = get16 (contents, offset),
--- 95,98 ----
***************
*** 101,111 ****
              family = family,
              addr = (if (family = familyInternet) 
!                 then (let val str = getAddressString(contents,addrStart,addrLen) in
                      (case (NetHostDB.fromString str) of
                          NONE => ""
                        | SOME ia => (case (NetHostDB.getByAddr ia) of 
                                          NONE => "" 
!                                       | SOME e => (NetHostDB.name e))) end)
!                 else getString (contents, addrStart, addrLen)),
              (* end modification *)
              dpy = getString (contents, dpyStart, dpyLen),
--- 100,111 ----
              family = family,
              addr = (if (family = familyInternet) 
!                 then (getAddressString (contents,addrStart,addrLen))
!                 (* (let val str = getAddressString(contents,addrStart,addrLen) in
                      (case (NetHostDB.fromString str) of
                          NONE => ""
                        | SOME ia => (case (NetHostDB.getByAddr ia) of 
                                          NONE => "" 
!                                       | SOME e => (NetHostDB.name e))) end) *)
!                 else (getString (contents, addrStart, addrLen)) ),
              (* end modification *)
              dpy = getString (contents, dpyStart, dpyLen),
***************
*** 128,135 ****
        (* hack by ddeboer, Feb 2005 - this is surely not the right way to do this...?? 
           if family is internet and address is localhost, change to the local hostname
!          and familyLocal. *)
!       val (family,addr) = if (((addr="localhost") (* orelse (addr="")*) ) andalso family=familyInternet) 
                              then (familyLocal,NetHostDB.getHostName())
!                             else (family,addr) 
        (* end hack *)
        fun cmpStr ("", _) = true
--- 128,135 ----
        (* hack by ddeboer, Feb 2005 - this is surely not the right way to do this...?? 
           if family is internet and address is localhost, change to the local hostname
!          and familyLocal. 
!       val (family,addr) = if (((addr="localhost")) andalso family=familyInternet) 
                              then (familyLocal,NetHostDB.getHostName())
!                             else (family,addr) *)
        (* end hack *)
        fun cmpStr ("", _) = true
***************
*** 149,160 ****
          (* end case *))
        in
!          look 0 
          (* modified ddeboer, Jan 2005 for testing. *)
!         (*(let val rv = look 0 in 
              (case rv of (SOME (EXB.AUTH{addr,dpy,name,data,...})) =>
!                 (TextIO.print ("getAuthByAddr returns SOME EXB.AUTH{addr="^
!                     addr^",dpy="^dpy^",name="^name^",...}\n"))
!                 | NONE => (TextIO.print ("getAuthByAddr returns NONE (addr="^
!                     addr^",dpy="^dpy^")\n"))); rv end)*) 
        end
          handle _ => NONE
--- 149,160 ----
          (* end case *))
        in
!         (* look 0 *)
          (* modified ddeboer, Jan 2005 for testing. *)
!         (let val rv = look 0 in 
              (case rv of (SOME (EXB.AUTH{addr,dpy,name,data,...})) =>
!                 ((*TextIO.print ("getAuthByAddr returns SOME EXB.AUTH{addr="^
!                     addr^",dpy="^dpy^",name="^name^",...}\n")*))
!                 | NONE => ((*TextIO.print ("getAuthByAddr returns NONE (addr="^
!                     addr^",dpy="^dpy^")\n")*))); rv end)
        end
          handle _ => NONE
***************
*** 169,176 ****
        (* hack by ddeboer, Feb 2005 - this is surely not the right way to do this...?? 
           if family is internet and address is localhost, change to the local hostname
!          and familyLocal. *)
!       val (family,addr) = if (((addr="localhost") (* orelse (addr="")*) ) andalso family=familyInternet) 
                              then (familyLocal,NetHostDB.getHostName())
!                             else (family,addr)
        (* end hack *)
        fun cmpStr ("", _) = true
--- 169,176 ----
        (* hack by ddeboer, Feb 2005 - this is surely not the right way to do this...?? 
           if family is internet and address is localhost, change to the local hostname
!          and familyLocal. 
!       val (family,addr) = if (((addr="localhost") ) andalso family=familyInternet) 
                              then (familyLocal,NetHostDB.getHostName())
!                             else (family,addr)*)
        (* end hack *)
        fun cmpStr ("", _) = true



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.