Blame SOURCES/screen-E3.patch

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