Lines 80-85
Link Here
|
80 |
# include <utmp.h> |
80 |
# include <utmp.h> |
81 |
#endif |
81 |
#endif |
82 |
|
82 |
|
|
|
83 |
#ifdef HAVE_UTEMPTER |
84 |
# include <utempter.h> |
85 |
#endif |
86 |
|
83 |
#ifdef HAVE_TERMIOS_H |
87 |
#ifdef HAVE_TERMIOS_H |
84 |
/* for HP-UX (some versions) the extern C is needed, and for other |
88 |
/* for HP-UX (some versions) the extern C is needed, and for other |
85 |
platforms it doesn't hurt */ |
89 |
platforms it doesn't hurt */ |
Lines 138-158
Link Here
|
138 |
// private functions // |
142 |
// private functions // |
139 |
/////////////////////// |
143 |
/////////////////////// |
140 |
|
144 |
|
141 |
#ifdef HAVE_UTEMPTER |
|
|
142 |
class KProcess_Utmp : public KProcess |
143 |
{ |
144 |
public: |
145 |
int commSetupDoneC() |
146 |
{ |
147 |
dup2(cmdFd, 0); |
148 |
dup2(cmdFd, 1); |
149 |
dup2(cmdFd, 3); |
150 |
return 1; |
151 |
} |
152 |
int cmdFd; |
153 |
}; |
154 |
#endif |
155 |
|
156 |
#define BASE_CHOWN "kgrantpty" |
145 |
#define BASE_CHOWN "kgrantpty" |
157 |
|
146 |
|
158 |
|
147 |
|
Lines 399-410
Link Here
|
399 |
void KPty::login(const char *user, const char *remotehost) |
388 |
void KPty::login(const char *user, const char *remotehost) |
400 |
{ |
389 |
{ |
401 |
#ifdef HAVE_UTEMPTER |
390 |
#ifdef HAVE_UTEMPTER |
402 |
KProcess_Utmp utmp; |
391 |
addToUtmp (d->ttyName, remotehost, d->masterFd); |
403 |
utmp.cmdFd = d->masterFd; |
|
|
404 |
utmp << "/usr/sbin/utempter" << "-a" << d->ttyName << ""; |
405 |
utmp.start(KProcess::Block); |
406 |
Q_UNUSED(user); |
392 |
Q_UNUSED(user); |
407 |
Q_UNUSED(remotehost); |
|
|
408 |
#elif defined(USE_LOGIN) |
393 |
#elif defined(USE_LOGIN) |
409 |
const char *str_ptr; |
394 |
const char *str_ptr; |
410 |
struct utmp l_struct; |
395 |
struct utmp l_struct; |
Lines 442-451
Link Here
|
442 |
void KPty::logout() |
427 |
void KPty::logout() |
443 |
{ |
428 |
{ |
444 |
#ifdef HAVE_UTEMPTER |
429 |
#ifdef HAVE_UTEMPTER |
445 |
KProcess_Utmp utmp; |
430 |
removeLineFromUtmp(d->ttyName, d->masterFd); |
446 |
utmp.cmdFd = d->masterFd; |
|
|
447 |
utmp << "/usr/sbin/utempter" << "-d" << d->ttyName; |
448 |
utmp.start(KProcess::Block); |
449 |
#elif defined(USE_LOGIN) |
431 |
#elif defined(USE_LOGIN) |
450 |
const char *str_ptr = d->ttyName.data(); |
432 |
const char *str_ptr = d->ttyName.data(); |
451 |
if (!memcmp(str_ptr, "/dev/", 5)) |
433 |
if (!memcmp(str_ptr, "/dev/", 5)) |