From c9126fc0a9f612c582e1eca07ea167ef5b4ebfd4 Mon Sep 17 00:00:00 2001
From: Alex Vanin <alexey@nspcc.ru>
Date: Thu, 28 Apr 2022 17:21:56 +0300
Subject: [PATCH] [#409] authmate: Fix container ID parsing

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
---
 cmd/authmate/main.go | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cmd/authmate/main.go b/cmd/authmate/main.go
index 3dcaef09..8eab65fd 100644
--- a/cmd/authmate/main.go
+++ b/cmd/authmate/main.go
@@ -245,8 +245,9 @@ It will be ceil rounded to the nearest amount of epoch.`,
 			}
 
 			agent := authmate.New(log, neoFS)
-			var containerID cid.ID
+			var containerID *cid.ID // keep nil value if container flag is not set
 			if len(containerIDFlag) > 0 {
+				containerID = new(cid.ID)
 				if err = containerID.DecodeString(containerIDFlag); err != nil {
 					return cli.Exit(fmt.Sprintf("failed to parse auth container id: %s", err), 3)
 				}
@@ -282,7 +283,7 @@ It will be ceil rounded to the nearest amount of epoch.`,
 
 			issueSecretOptions := &authmate.IssueSecretOptions{
 				Container: authmate.ContainerOptions{
-					ID:              &containerID,
+					ID:              containerID,
 					FriendlyName:    containerFriendlyName,
 					PlacementPolicy: containerPlacementPolicy,
 				},