Blame SOURCES/screen-E3.patch

c18ec5
commit 0aec2900f63820c3405ba38a4d1cd67cc22f0715
c18ec5
Author: Miroslav Lichvar <mlichvar@redhat.com>
c18ec5
Date:   Mon Jul 18 17:26:47 2011 +0200
c18ec5
c18ec5
    Clear scrollback buffer when locking terminal
c18ec5
    
c18ec5
    Linux kernel 3.0 adds a new command to clear the scrollback buffer in
c18ec5
    the linux console. It's available in the ncurses terminfo entry as
c18ec5
    extended capability E3. This is useful to prevent an attacker to read
c18ec5
    content of a locked terminal via Shift-PgUp key.
c18ec5
c18ec5
diff --git a/src/display.c b/src/display.c
c18ec5
index 5fa11cb..038c435 100644
c18ec5
--- a/src/display.c
c18ec5
+++ b/src/display.c
c18ec5
@@ -3779,4 +3779,10 @@ char **cmdv;
c18ec5
 
c18ec5
 #endif /* BLANKER_PRG */
c18ec5
 
c18ec5
+void
c18ec5
+ClearScrollbackBuffer()
c18ec5
+{
c18ec5
+  if (D_CE3)
c18ec5
+    AddCStr(D_CE3);
c18ec5
+}
c18ec5
 
c18ec5
diff --git a/src/extern.h b/src/extern.h
c18ec5
index c787d99..d3fecf0 100644
c18ec5
--- a/src/extern.h
c18ec5
+++ b/src/extern.h
c18ec5
@@ -316,6 +316,7 @@ extern int   color256to88 __P((int));
c18ec5
 extern void  ResetIdle __P((void));
c18ec5
 extern void  KillBlanker __P((void));
c18ec5
 extern void  DisplaySleep1000 __P((int, int));
c18ec5
+extern void  ClearScrollbackBuffer __P((void));
c18ec5
 
c18ec5
 /* resize.c */
c18ec5
 extern int   ChangeWindowSize __P((struct win *, int, int, int));
c18ec5
diff --git a/src/screen.c b/src/screen.c
c18ec5
index cc8f565..3efb67b 100644
c18ec5
--- a/src/screen.c
c18ec5
+++ b/src/screen.c
c18ec5
@@ -1967,6 +1967,7 @@ int mode;
c18ec5
 #endif
c18ec5
     case D_LOCK:
c18ec5
       ClearAll();
c18ec5
+      ClearScrollbackBuffer();
c18ec5
       sign = SIG_LOCK;
c18ec5
       /* tell attacher to lock terminal with a lockprg. */
c18ec5
       break;
c18ec5
diff --git a/src/term.c b/src/term.c
c18ec5
index 991de1b..7485900 100644
c18ec5
--- a/src/term.c
c18ec5
+++ b/src/term.c
c18ec5
@@ -83,6 +83,7 @@ struct term term[T_N] =
c18ec5
   { "CD", T_STR  },
c18ec5
   { "ce", T_STR  },
c18ec5
   { "cb", T_STR  },
c18ec5
+  { "E3", T_STR  },
c18ec5
 
c18ec5
 /* initialise */
c18ec5
   { "is", T_STR  },