From: wild@nessie.cs.id.ethz.ch (Markus Wild)
Newsgroups: comp.unix.amiga
Subject: Re: AMIGADOS <=> UNIX problems
Date: 20 Dec 92 18:11:27 GMT
Organization: Swiss Federal Institute of Technology (ETH), Zurich, CH

In article <1992Dec19.173029.2818@ckctpa.UUCP> crash%ckctpa@tct.com (Frank "Crash" Edwards) writes:
>jea@prodigal.psych.rochester.edu (Joanne Albano) writes:
>>I have been trying to go between AMIGADOS and AMIGAUNIX
>>
>>1. DNET: So far I have found that DNET works nicely between
>>SUN UNIX and AMIGADOS but unfortunately I have a
>>ATT unix machine. Is there a DNET that goes between
>>ATT unix and ADOS?
>
>Well, this is probably a good time for an update.
>
>I've tried out the bsd-emul library from Markus on DNet on my Amix
>2.1 machine.  The initial attempt didn't go.  Dnet itself started but
>none of the servers would start.  One problem appeared to be that dnet
>was trying to access port number 9492 on the Unix side, and it
>shouldn't have been.  Tracking down the call to startserver() I found
>that reading the port number from the AmigaDOS side was pretty basic
>stuff, and so I have no explanation for this one, but I'll look into
>it more later.

I did the same thing;-) And of course, pty stuff can't be emulated in the
library, or I'd have to patch all functions dealing with filenames
to filter out access to /dev/pty* /dev/ttyp* stuff, not really reasonable.

I didn't see the problem you had, ie. the one with port 9492. But I did
have some problems with dnet, where one of them was a real bug. In control.c,
a socket address is filled with family == AF_INET, and is later bound to
an AF_UNIX socket. Funny enough, this seems to work on SunOS, it definitely
doesn't on AT&T socket code. There have been some more minor changes, I
have uploaded my complete dnet (unix) sources to amiga.physik 
(amix/new/dnetsvr4.tar.Z). The archive includes binaries, for those who
don't want to recompile.

I added utmp support to dnet, ie. your fterm sessions should now appear in
`w' output. To make this work, utmp either has to be world writable, or -
what I'm using on amiga.physik, all programs that need to write umtp are
in an `utmp' group. That way you can avoid making programs like screen and
xterm (and dnet) suid-root, which is a large security hole and really overkill
for this purpose.

>Also, on Monday I'll post a uuencoded binary for the bsd emulation
>library.  My gcc doesn't have the PIC patches installed so I can't
>generate a shared object; hence they will be link libraries.

*PLEASE* don't.. my port of dnet also led to fixing some stuff in the library.
The select() function didn't seem to behave 100% like a real BSD select(),
and this tiny difference caused dnet not to recognise when a connection has
been dropped. A working version (I tested fterm, putfiles, irc, loadav) is
in the same directory (amix/new), libbsd43.so.Z. When time permits, I'll
distribute source diffs as well.

>I will be posting binaries for dnet here as well, zoo'ed and uuencoded.  
>These should be considered beta versions; they may work, and they may
>not.  They do allow connections and the STERM appears to work fine.  If
>the above port number and pty problems have been corrected by my latest
>changes, then there should be little left to do.  (Although I still
>have high hopes of doing the POSIX conversion, but if the emul library
>works it won't be quite as critical anymore.)

I found the `double' program to be of immense value for testing dnet clients.
To compile, I just did
  gcc -I/usr/local/bsd43include double.c -o double -lbsd43
Since it uses socketpair(), you'd have to include -lsocket -lnsl if not
using the emulator. To test, these steps work:
  $ mkdir /tmp/d1 /tmp/d2
  $ cp <dnettree>/unix/dnet.servers /tmp/d1
  $ cp <dnettree>/unix/dnet.servers /tmp/d1
  $ DNETDIR=/tmp double /tmp/d1/ /tmp/d2/

You can then test fterm with
  $ DNETDIR=/tmp/d1/ draw 8195
putfiles with
  $ DNETDIR=/tmp/d1/ putfiles some_file
etc.

If you want more debugging information, start double with truss:
  # DNETDIR=/tmp truss -vall -f -o/tmp/log double /tmp/d1/ /tmp/d2/

(if you don't have dnet setgid-utmp, you don't need to run this as root).

It's important to test external servers (like with putfiles) as well, as
fterm as an internal server works even if the external stuff doesn't.

One thing that didn't work so far (and which I couldn't test under unix)
is the nfs server. I'd be interested in seing this fixed.

-Markus

-- 
Markus M. Wild    -  wild@nessie.cs.id.ethz.ch  |  wild@amiga.physik.unizh.ch 
Vital papers will demonstrate their vitality by spontaneously moving
from where you left them to where you can't find them.
Newsgroups: comp.unix.amiga