From 0f368ece4ec73bc058d5fb1459221ffd860d3bf3 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 8 Jun 2019 14:33:58 +0200 Subject: [PATCH] nsscash: add support to convert plain files For plain files this is just a copy. But it prepares for conversion of other types in the future. --- main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index cef6c61..db21997 100644 --- a/main.go +++ b/main.go @@ -82,15 +82,21 @@ func main() { if err != nil { log.Fatal(err) } + var x bytes.Buffer + if t == FileTypePlain { + x.Write(src) + } else if t == FileTypePasswd { pws, err := ParsePasswds(bytes.NewReader(src)) if err != nil { log.Fatal(err) } - var x bytes.Buffer err = SerializePasswds(&x, pws) if err != nil { log.Fatal(err) } + } else { + log.Fatalf("unsupported file type %v", t) + } // We must create the file first or deployFile() will abort f, err := os.Create(args[3]) -- 2.45.2