[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Receiving and setting TERM env


On 4/13/23 21:37, Jose David Bravo A wrote:
Hello,

I implemented an SSH server using the example in ssh_server.c as a base.

In the exec_pty function, I'm executing another program that uses ncurses.

I believe I need to pass the client's TERM environment variable to the PTY allocated to that client so that the ncurses program knows how to display itself properly. Am I correct?

How can I receive the TERM environment variable sent by the client and set it in the allocated PTY?

Correct. As you can see in the SSH specification, the TERM environment variable is passed as part of the SSH_MSG_CHANNEL_REQUEST of type "pty-req" so in your code you should find it in your ssh_message structure when you handle this message under msg->channel_request.TERM.

https://www.rfc-editor.org/rfc/rfc4254#section-6.2

Regards,
--
Jakub Jelen
Crypto Team, Security Engineering
Red Hat, Inc.


Follow-Ups:
Re: Receiving and setting TERM envJose David Bravo A <jbravo@xxxxxxxxxxxxxxxxxxxxxx>
References:
Receiving and setting TERM envJose David Bravo A <jbravo@xxxxxxxxxxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org