… | |
… | |
71 | // in C: ptytty_init (); |
71 | // in C: ptytty_init (); |
72 | |
72 | |
73 | // initialise, parse arguments, etc. |
73 | // initialise, parse arguments, etc. |
74 | } |
74 | } |
75 | |
75 | |
76 | This checks wether the program runs setuid or setgid. If yes then it |
76 | This checks whether the program runs setuid or setgid. If yes then it |
77 | will fork a helper process and drop privileges. |
77 | will fork a helper process and drop privileges. |
78 | |
78 | |
79 | Some programs need finer control over if and when this helper process is |
79 | Some programs need finer control over if and when this helper process is |
80 | started, and if and how to drop privileges. For those programs, the |
80 | started, and if and how to drop privileges. For those programs, the |
81 | methods "ptytty::use_helper" and "ptytty::drop_privileges" are more |
81 | methods "ptytty::use_helper" and "ptytty::drop_privileges" are more |
… | |
… | |
86 | ptytty::init () |
86 | ptytty::init () |
87 | The default way to initialise libptytty. Must be called imemdiately |
87 | The default way to initialise libptytty. Must be called imemdiately |
88 | as the first thing in the "main" function, or earlier e.g. during |
88 | as the first thing in the "main" function, or earlier e.g. during |
89 | static construction time. The earlier, the better. |
89 | static construction time. The earlier, the better. |
90 | |
90 | |
91 | This method checks wether the program runs with setuid/setgid |
91 | This method checks whether the program runs with setuid/setgid |
92 | permissions and, if yes, spawns a helper process for pty/tty |
92 | permissions and, if yes, spawns a helper process for pty/tty |
93 | management. It then drops the privileges completely, so the actual |
93 | management. It then drops the privileges completely, so the actual |
94 | program runs without setuid/setgid privileges. |
94 | program runs without setuid/setgid privileges. |
95 | |
95 | |
96 | ptytty::use_helper () |
96 | ptytty::use_helper () |
… | |
… | |
143 | "true" when successful. |
143 | "true" when successful. |
144 | |
144 | |
145 | pty->login (int cmd_pid, bool login_shell, const char *hostname) |
145 | pty->login (int cmd_pid, bool login_shell, const char *hostname) |
146 | Creates an entry in the systems session database(s) (utmp, wtmp, |
146 | Creates an entry in the systems session database(s) (utmp, wtmp, |
147 | lastlog). "cmd_pid" must be the pid of the process representing the |
147 | lastlog). "cmd_pid" must be the pid of the process representing the |
148 | session (such as the login shell), "login_shell" defines wether the |
148 | session (such as the login shell), "login_shell" defines whether the |
149 | session is associated with a login, which influences wether wtmp and |
149 | session is associated with a login, which influences whether wtmp and |
150 | lastlog entries are created, and "hostname" should identify the |
150 | lastlog entries are created, and "hostname" should identify the |
151 | "hostname" the user logs in from, which often is the value of the |
151 | "hostname" the user logs in from, which often is the value of the |
152 | "DISPLAY" variable or tty line in case of local logins. |
152 | "DISPLAY" variable or tty line in case of local logins. |
153 | |
153 | |
154 | Calling this method is optional. A session starts at the time of the |
154 | Calling this method is optional. A session starts at the time of the |