[PATCH v3 2/5] hood file: Use different files for www and for checksum comparison
Fabian Bläse
fabian at blaese.de
Di Jul 10 23:08:40 CEST 2018
Hallo zusammen,
> On 8. Jul 2018, at 19:57, Adrian Schmutzler <freifunk at adrianschmutzler.de> wrote:
>
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
>
> Reviewed-by: Fabian Bläse <fabian at blaese.de>
>
> ---
>
> Changes in v2:
> none
>
> Changes in v3:
> Rebased
> ---
> src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 6 ++++--
> src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange | 3 +++
> src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html | 2 +-
> 3 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index 1a2c12a..b6ba3e3 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -83,7 +83,8 @@ else
> if ! isGatewayAvailable ; then
> #now we haven't a gateway in Range, we search for a hidden AP to get a keyxchangev2data file!
> #first we delete all wifi settings
> - rm -f "$hoodfilewww" # delete this, so interfaces are recreated if reconnect with unchanged hood file takes place
> + rm -f "$hoodfileref" # delete this, so interfaces are recreated if reconnect with unchanged hood file takes place
> + rm -f "$hoodfilewww" # delete this, so wrong hood file is not broadcasted anymore
>
> uci -q del "system. at system[0].hood"
> uci -q commit system
> @@ -106,7 +107,7 @@ if [ -s "$hoodfiletmp" ]; then
> # but without signature, every hood file we get is valid!
>
> catnew="$(cat "$hoodfiletmp" | sed 's/"timestamp”: *"[0-9]*"/"timestamp":0/')"
> - catold="$(cat "$hoodfilewww" 2>/dev/null | sed 's/"timestamp”: *"[0-9]*"/"timestamp":0/')"
> + catold="$(cat "$hoodfileref" 2>/dev/null | sed 's/"timestamp”: *"[0-9]*"/"timestamp":0/')"
> sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ")
> sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ")
>
> @@ -185,6 +186,7 @@ if [ -s "$hoodfiletmp" ]; then
>
> # copy the file to webroot so that other mesh routers can download it;
> # copy only after all other steps so IF can be reentered if something goes wrong
> + cp "$hoodfiletmp" "$hoodfileref"
> cp "$hoodfiletmp" "$hoodfilewww"
>
> # This is a workaround to enable alfred on devices which do not see a configap during initial setup
> diff --git a/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange b/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange
> index 4d624a1..40ebe4f 100644
> --- a/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange
> +++ b/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange
> @@ -5,12 +5,15 @@
> . /usr/share/libubox/jshn.sh
>
> hoodfiletmp="/tmp/hoodfile"
> +hoodfileref="/tmp/hoodfileref"
> hoodfilewww="/www/hood/keyxchangev2data"
>
> getJsonPath() {
> jsonfile=""
> if [ -s "$hoodfilewww" ] ; then
> jsonfile="$hoodfilewww"
> + if [ -s "$hoodfileref" ] ; then
In dieser Zeile sollte wohl ein elif stehen…
Das muss unbedingt noch gefixt werden, sonst gibts Syntaxfehler und alles bricht auseinander.
Gerne auch einfach beim applien.
Gruß
Fabian
-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname : signature.asc
Dateityp : application/pgp-signature
Dateigröße : 833 bytes
Beschreibung: Message signed with OpenPGP
URL : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20180710/09d42c84/attachment.sig>
Mehr Informationen über die Mailingliste franken-dev