Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Writing phlogin
Ref. No. QNX.000009914
Category(ies) Development
Issue We are writing our own phlogin, but we are experiencing some problems.

How does phlogin communicate with its parent (Photon), when a user has been authentified?



Solution This is what phlogin does after the user has entered the correct password:
x09Sets the login name of its session by calling sid_name()(sid_name is not in the regular C library, so if it's not in the login libraries we ship, you can write your own).
It sends a _PROC_SESSION message to Proc; message structure is struct _proc_session and subtype is _PROC_SUB_ACTION1 (see <sys/proc_msg.h>)).

x09chdir()s to the user's home
x09chown()s Photon device to the user and chmod()s it to 0666
x09Sets HOME, LOGNAME and SHELL
x09Sets its real and effective user and group IDs to the user and group ID of the user.

x09exec()s a login shell to execute the ph script:
x09x09argv[] = {"-sh", "-c", command, NULL};
x09where command is either "$PHOTON_PATH/bin/ph" or the argument to the -L option.