Fix infamous bug that prevented konsole to run from xdm.

This commit is contained in:
espie 2000-11-24 16:55:28 +00:00
parent 7cceab8e78
commit b4e12f03fb
2 changed files with 41 additions and 2 deletions

View File

@ -1,5 +1,5 @@
--- konsole/src/TEPty.C.orig Fri Oct 20 21:57:06 2000
+++ konsole/src/TEPty.C Fri Oct 20 22:04:22 2000
--- konsole/src/TEPty.C.orig Tue Oct 3 21:57:30 2000
+++ konsole/src/TEPty.C Fri Nov 24 17:52:38 2000
@@ -180,9 +180,14 @@ int chownpty(int fd, int grant)
// param grant: 1 to grant, 0 to revoke
// returns 1 on success 0 on fail
@ -23,3 +23,30 @@
return (rc != -1 && WIFEXITED(w) && WEXITSTATUS(w) == 0);
}
return 0; //dummy.
@@ -227,7 +233,11 @@ void TEPty::donePty()
#elif defined(USE_LOGIN)
char *tty_name=ttyname(0);
if (tty_name)
+ {
+ if (strncmp(tty_name, "/dev/", 5) == 0)
+ tty_name += 5;
logout(tty_name);
+ }
#endif
if (needGrantPty) chownpty(fd,FALSE);
emit done(status);
@@ -435,10 +445,13 @@ void TEPty::makePty(const char* dev, con
l_struct.ut_host[UT_HOSTSIZE]=0;
}
- if (! (str_ptr=ttyname(0)) ) {
+ if (! (str_ptr=ttyname(tt)) ) {
abort();
}
+ if (strncmp(str_ptr, "/dev/", 5) == 0)
+ str_ptr += 5;
strncpy(l_struct.ut_line, str_ptr, UT_LINESIZE);
+ time(&l_struct.ut_time);
login(&l_struct);
#endif

View File

@ -0,0 +1,12 @@
--- konsole/src/main.C.orig Fri Nov 24 17:06:12 2000
+++ konsole/src/main.C Fri Nov 24 17:05:40 2000
@@ -46,7 +46,9 @@ static KCmdLineOptions options[] =
/* --| main |------------------------------------------------------ */
int main(int argc, char* argv[])
{
+#ifndef __OpenBSD__
setuid(getuid()); setgid(getgid()); // drop privileges
+#endif
// deal with shell/command ////////////////////////////
bool login_shell = false;