summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2014-08-06 14:11:57 +0200
committerGravatar Christian Hesse <mail@eworm.de>2014-08-06 14:11:57 +0200
commite657eb874cab9a39ec2310d6b478526bb5206e94 (patch)
treee493d512dab35106ac84d474cdab158f9bf32c03
parent5d82914c34b3cb86e1d6ef50f6a15470de13cbaf (diff)
downloadnullshell-e657eb874cab9a39ec2310d6b478526bb5206e94.tar.gz
nullshell-e657eb874cab9a39ec2310d6b478526bb5206e94.tar.zst
show banner in relation to start time
-rw-r--r--nullshell.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/nullshell.c b/nullshell.c
index 0b24ef0..7422b4a 100644
--- a/nullshell.c
+++ b/nullshell.c
@@ -8,6 +8,7 @@
* by Mario A. Valdez-Ramirez (http://www.mariovaldez.net/)
*/
+#include <inttypes.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@ -26,9 +27,14 @@ void sig_callback(int signal) {
int main(int argc, char **argv) {
time_t now;
+ uint8_t start;
char *ssh_connection, *ssh_client, *ssh_tty;
char * string = BANNER;
+ /* get the start time and calculate modulo */
+ time(&now);
+ start = (now / 30) % 30;
+
/* read environment variables */
ssh_connection = getenv("SSH_CONNECTION");
ssh_client = getenv("SSH_CLIENT");
@@ -57,7 +63,7 @@ int main(int argc, char **argv) {
fflush(NULL);
if (*string == 0) {
time(&now);
- if ((now / 30) % 30 > 0)
+ if ((now / 30) % 30 != start)
string = ctime(&now);
else
string = BANNER;