]> git.plutz.net Git - cgilite/commitdiff
avoid null characters in server secret, remove debug output master
authorPaul Hänsch <paul@plutz.net>
Wed, 17 Jun 2026 16:28:43 +0000 (18:28 +0200)
committerPaul Hänsch <paul@plutz.net>
Wed, 17 Jun 2026 16:28:43 +0000 (18:28 +0200)
session.sh

index c3a44e80b335cc21ef36f23b7761065b883724b2..a29cbf4377c09ca01618c1754622e271561d8b5a 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright 2018 - 2022 Paul Hänsch
+# Copyright 2018 - 2022, 2026 Paul Hänsch
 # 
 # Permission to use, copy, modify, and/or distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
@@ -45,7 +45,8 @@ fi
 server_key(){
   IDFILE="${IDFILE:-${_DATA:-.}/serverkey}"
   if [ "$(stat -c %s "$IDFILE")" -ne 512 ] || ! cat "$IDFILE"; then
-    dd count=1 bs=512 if=/dev/urandom \
+    tr -d \\0 </dev/urandom \
+    | dd count=1 bs=512 \
     | tee "$IDFILE"
   fi 2>&-
 }
@@ -116,7 +117,7 @@ update_session(){
 new_session(){
   local sid time sig
 
-  debug "Setting up new session"
+  debug "Setting up new session"
   sid="$(randomid)"
   time=$(( $_DATE + $SESSION_TIMEOUT ))
   sig="$(session_mac "$sid" "$time")"