From 895d14292811520f6bdfd0bdd6aba11b97b2d384 Mon Sep 17 00:00:00 2001 From: Pariksheet Nanda Date: Sat, 6 Jun 2020 11:08:10 -0400 Subject: [PATCH] configure: Add option to only create read-only sessions for #84 --- configure.ac | 9 +++++++++ tmate-decoder.c | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 028d5559..309f3030 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,15 @@ if test "x$found_static" = xyes; then ]) fi +# Is this a readonly session build? +AC_ARG_ENABLE( + session-write, + AC_HELP_STRING(--disable-session-write, create read-only sessions) +) +if test "x${enable_session_write}" = xno; then + CFLAGS="$CFLAGS -DTMATE_SESSION_RO" +fi + # Is this gcc? AM_CONDITIONAL(IS_GCC, test "x$GCC" = xyes) diff --git a/tmate-decoder.c b/tmate-decoder.c index 3b1e31af..8c93beb2 100644 --- a/tmate-decoder.c +++ b/tmate-decoder.c @@ -5,7 +5,12 @@ static void handle_notify(__unused struct tmate_session *session, struct tmate_unpacker *uk) { char *msg = unpack_string(uk); - tmate_status_message("%s", msg); +#ifdef TMATE_SESSION_RO + if (!strstr(msg, "session: ")) + tmate_status_message("%s", msg); +#else + tmate_status_message("%s", msg); +#endif free(msg); }