]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cmd/nncp-xfer/main.go
Fix encrypted packet magic number check
[nncp.git] / src / cmd / nncp-xfer / main.go
index e565ece351e5eb72a525f2a682e5680104828629..41e8c61c8e157f087d9fa5096990d92231bf316d 100644 (file)
@@ -1,6 +1,6 @@
 /*
 NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2021 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2022 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ import (
        "path/filepath"
 
        "github.com/dustin/go-humanize"
-       "go.cypherpunks.ru/nncp/v7"
+       "go.cypherpunks.ru/nncp/v8"
 )
 
 func usage() {
@@ -218,7 +218,7 @@ func main() {
                                continue
                        }
                        pktEnc, pktEncRaw, err := ctx.HdrRead(fd)
-                       if err != nil {
+                       if err == nil {
                                switch pktEnc.Magic {
                                case nncp.MagicNNCPEv1.B:
                                        err = nncp.MagicNNCPEv1.TooOld()
@@ -229,6 +229,8 @@ func main() {
                                case nncp.MagicNNCPEv4.B:
                                        err = nncp.MagicNNCPEv4.TooOld()
                                case nncp.MagicNNCPEv5.B:
+                                       err = nncp.MagicNNCPEv5.TooOld()
+                               case nncp.MagicNNCPEv6.B:
                                default:
                                        err = errors.New("is not an encrypted packet")
                                }