]> git.plutz.net Git - shellwiki/commitdiff
Squashed 'cgilite/' changes from 417cc425..221c2b7d
authorPaul Hänsch <paul@plutz.net>
Wed, 17 Jun 2026 16:29:40 +0000 (18:29 +0200)
committerPaul Hänsch <paul@plutz.net>
Wed, 17 Jun 2026 16:29:40 +0000 (18:29 +0200)
221c2b7d avoid null characters in server secret, remove debug output

git-subtree-dir: cgilite
git-subtree-split: 221c2b7d4a177530c113cbf62470705c3044a84c

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")"