openpty(): do we have it in QNX v4.25GSecurity patch?

openpty() is listed in <unix.h> but not included in the Watcom C v10.6B
documentation.
Is it usable?

Tony.

Tony <mts.spb.suxx@mail.ru> wrote:

openpty() is listed in <unix.h> but not included in the Watcom C v10.6B
documentation.
Is it usable?

Did you try linking “-lunix”?

There looks to be an openpty symbol in that library.

(Many of the portability functions defined in unix.h are in the
unix library, not the standard C libraries.)

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com

On 11 Jan 2005 16:13:45 GMT, David Gibbs <dagibbs@qnx.com> wrote:

openpty() is listed in <unix.h> but not included in the Watcom C v10.6B
documentation.
Is it usable?
Did you try linking “-lunix”?
There looks to be an openpty symbol in that library.
(Many of the portability functions defined in unix.h are in the unix
library, not the standard C libraries.)
Yes I did “-lunix” and it did linked and seems worked…

Why it is not listed nether in printed nor in on-line Watcom C functions?
Does this http://www.rocketaware.com/man/man3/openpty.3.htm description
fully applies to the QNX’s 'openpty"?

I ask this because roumors are “setlogin” is somehow ‘crippled’ and the
substitution was proposed here in the ng. (Roumor does not specify the
library version however…)

I’m afraid to use those ‘undocumented’ system calls…
The <sys/time.h> lists as available:
gettimeofday()
settimeofday()
But some older ports to QNX do have the substitutions for them. (NTP v1 is
an example)

The <unix.h> lists:
openpty()
login_tty()
forkpty()
setlogin()

Are they usable in Watcom C v10.6B+Security patch unix3[r|s].lib?

Tony.

PS
This is what I use instead of the default setlogin():

#include <sys/types.h>
#include <sys/proc_msg.h>
#include <sys/kernel.h>
#include <string.h>

struct _proc_session ps_sl;
struct _proc_session_reply rps_sl;

int
setlogin(const char *login)
{
memset(&ps_sl, 0, sizeof(ps_sl));
memset(&rps_sl, 0, sizeof(rps_sl));

ps_sl.type = _PROC_SESSION;
ps_sl.subtype = _PROC_SUB_ACTION1;
ps_sl.sid = getsid(getpid());
strcpy(ps_sl.name, login);
if (!Send(PROC_PID, &ps_sl, &rps_sl, sizeof(ps_sl), sizeof(rps_sl)) &&
(rps_sl.status == 0))
return 0;
else
return -1;
}

This is based on J.C.Michot’s function qsetlogin() in his port of SSH-1 to
QNX4.

Tony <mts.spb.suxx@mail.ru> wrote:

On 11 Jan 2005 16:13:45 GMT, David Gibbs <> dagibbs@qnx.com> > wrote:

openpty() is listed in <unix.h> but not included in the Watcom C v10.6B
documentation.
Is it usable?
Did you try linking “-lunix”?
There looks to be an openpty symbol in that library.
(Many of the portability functions defined in unix.h are in the unix
library, not the standard C libraries.)
Yes I did “-lunix” and it did linked and seems worked…
Why it is not listed nether in printed nor in on-line Watcom C functions?

Because it is not a documented nor supported function. The unix library
is provided for convenience in porting Unix code, primarily planned for
desktop/development system convenience, to QNX 4.

Does this > http://www.rocketaware.com/man/man3/openpty.3.htm > description
fully applies to the QNX’s 'openpty"?

Dunno.

I ask this because roumors are “setlogin” is somehow ‘crippled’ and the
substitution was proposed here in the ng. (Roumor does not specify the
library version however…)

Could be, I don’t remember those rumours off-hand – but I may not have
been paying close enough attention, or I may just not remember.

I’m afraid to use those ‘undocumented’ system calls…
The <sys/time.h> lists as available:
gettimeofday()
settimeofday()
But some older ports to QNX do have the substitutions for them. (NTP v1 is
an example)

They are, again, probably cover functions for porting, they probably
cover qnx_setclock() and qnx_getclock().

The <unix.h> lists:
openpty()
login_tty()
forkpty()
setlogin()

Are they usable in Watcom C v10.6B+Security patch unix3[r|s].lib?

openpty() and forkpty() aren’t going to matter.

Hm…looking at login_tty() in the web page you specified, it’s not
gonna be affected by the security patch either – it does session/
process group type work, nothing to do with the change in the password
encryption algorithm.

I don’t think setlogin() will be affected either – again, it isn’t
going to go through any of the encryption stuff, so the security
patch shouldn’t affect it.

(IIRC, the security patch was primarily about changing the password
encryption algorithm, and any functions that had to deal with it.)

-David

Tony.

PS
This is what I use instead of the default setlogin():

#include <sys/types.h
#include <sys/proc_msg.h
#include <sys/kernel.h
#include <string.h

struct _proc_session ps_sl;
struct _proc_session_reply rps_sl;

int
setlogin(const char *login)
{
memset(&ps_sl, 0, sizeof(ps_sl));
memset(&rps_sl, 0, sizeof(rps_sl));

ps_sl.type = _PROC_SESSION;
ps_sl.subtype = _PROC_SUB_ACTION1;
ps_sl.sid = getsid(getpid());
strcpy(ps_sl.name, login);
if (!Send(PROC_PID, &ps_sl, &rps_sl, sizeof(ps_sl), sizeof(rps_sl)) &&
(rps_sl.status == 0))
return 0;
else
return -1;
}

This is based on J.C.Michot’s function qsetlogin() in his port of SSH-1 to
QNX4.


David Gibbs
QNX Training Services
dagibbs@qnx.com

On 12 Jan 2005 15:03:06 GMT, David Gibbs <dagibbs@qnx.com> wrote:

The <unix.h> lists:
openpty()
login_tty()
forkpty()
setlogin()

Are they usable in Watcom C v10.6B+Security patch unix3[r|s].lib?

openpty() and forkpty() aren’t going to matter.

Hm…looking at login_tty() in the web page you specified, it’s not
gonna be affected by the security patch either – it does session/
process group type work, nothing to do with the change in the password
encryption algorithm.
Yes, I know that QNX4 Security patch just replaces /bin/login, /bin/su and

/bin/passwd.
But Watcom C 10.6B Security patch brings much more changes to
/usr/lib/unix3[r|s}.lib than just replacing crypt.o there…
That’s why I ask.

The 'crippled" status of “setlogin()” I know from the posting of Rob Hem:
Newsgroups: qnx.qnx4
Subject: Re: setlogin() : do we have it in QNX4? (+)
Date: Mon, 12 Apr 2004 10:18:08 -0500

Tony.

Tony <mts.spb.suxx@mail.ru> wrote:

The 'crippled" status of “setlogin()” I know from the posting of Rob Hem:
Newsgroups: qnx.qnx4
Subject: Re: setlogin() : do we have it in QNX4? (+)
Date: Mon, 12 Apr 2004 10:18:08 -0500

archived here:
http://www.openqnx.com/PNphpBB2-viewtopic-t4412-.html

On 12 Jan 2005 17:01:09 GMT, Frank Liu <fliu@usdjmp1.eng.vodafone-us.com>
wrote:

archived here:
http://www.openqnx.com/PNphpBB2-viewtopic-t4412-.html

:slight_smile:
That “booBot” person is me, actually!.

Tony.