*BSD News Article 38677


Return to BSD News archive

Newsgroups: comp.os.386bsd.misc
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!yarrina.connect.com.au!werple.apana.org.au!otis.apana.org.au!serval.net.wsu.edu!netnews.nwnet.net!oracle.pnl.gov!osi-east2.es.net!cronkite.nersc.gov!dancer.ca.sandia.gov!overload.lbl.gov!agate!howland.reston.ans.net!cs.utexas.edu!newsfeed.rice.edu!news.sesqui.net!uuneo.neosoft.com!bonkers.taronga.com!peter
From: peter@bonkers.taronga.com (Peter da Silva)
Subject: Re: modems and FreeBSD 2.0A
Organization: Taronga Park BBS
Message-ID: <CztnF9.HB6@bonkers.taronga.com>
References: <3aq0ql$m9q@wizard.pn.com> <CzMC2n.7rr@bonkers.taronga.com> <3b3m5s$inb@wizard.pn.com>
Date: Fri, 25 Nov 1994 11:47:33 GMT
Lines: 31

In article <3b3m5s$inb@wizard.pn.com>, Bill Heiser <bill@bhhome.bh.org> wrote:
>I guess that means changing all of the modem-related applications to 
>set a CLOCAL flag when opening the port (?)    Is there an easier 
>"global" way to do this?  :-)

Well, on FreeBSD you can set CLOCAL on the "locking" device for the port
in /etc/rc, but I didn't think NetBSD was going the multi-device route.
In any case, once the call is complete you don't want CLOCAL because you need
to know if the call terminates unexpectedly.

If you don't have CLOCAL set, how do you open the device in the first
place? Well, you do this:

	fd = open(path, O_NONBLOCK|otherflags);
	ioctl(fd, stuff for CLOCAL);
	fcntl(fd, turn off O_NONBLOCK);

	Do dialling stuff, set up connection, etc...

	ioctl(fd, turn off CLOCAL);

	Run session, secure in the knowledge that you'll catch hangup.

Once you do, you may have to close and re-open the port to raise DTR
again: setting to 0 baud doesn't work any more, for security reasons.
In POSIX and in more recent BSD variants that follow POSIX you also have
to be a process group leader and have no control terminal! This is all
to keep some bad guy from writing a password stealer on a modem port.

I think the last is overkill... it would be better to use permissions on
the port. Oh well...