From a3b47d6e860d15afcf2e3b65a9c304e8d95162b2 Mon Sep 17 00:00:00 2001 From: Joe Skazinski Date: Fri, 16 Sep 2022 11:21:04 -0700 Subject: [PATCH 1/2] fix: Change kmip20/op_locate to be an array of strings Signed-off-by: Joe Skazinski --- kmip20/op_locate.go | 2 +- src/kmipapi/kmip20.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kmip20/op_locate.go b/kmip20/op_locate.go index b8ca00b..51aee2e 100644 --- a/kmip20/op_locate.go +++ b/kmip20/op_locate.go @@ -17,7 +17,7 @@ type LocateRequestPayload struct { // Table 230 type LocateResponsePayload struct { - UniqueIdentifier string + UniqueIdentifier []string } type LocateHandler struct { diff --git a/src/kmipapi/kmip20.go b/src/kmipapi/kmip20.go index b497073..2aedd08 100755 --- a/src/kmipapi/kmip20.go +++ b/src/kmipapi/kmip20.go @@ -336,7 +336,7 @@ func (kmips *kmip20service) Locate(ctx context.Context, settings *ConfigurationS uid := respPayload.UniqueIdentifier logger.V(4).Info("XXX Locate response payload", "uid", respPayload.UniqueIdentifier) - return &LocateResponse{UniqueIdentifier: uid}, nil + return &LocateResponse{UniqueIdentifier: uid[0]}, nil } // SetAttribute: From fc514ddb8e1fa2d3ed93bf771305d1171d19138b Mon Sep 17 00:00:00 2001 From: Joe Skazinski Date: Fri, 16 Sep 2022 11:38:17 -0700 Subject: [PATCH 2/2] fix: Change kmip14/op_locate to be an array of strings Signed-off-by: Joe Skazinski --- op_locate.go | 4 ++-- src/kmipapi/kmip14.go | 9 ++++++++- src/kmipapi/kmip20.go | 9 +++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/op_locate.go b/op_locate.go index 74c91e7..4398525 100644 --- a/op_locate.go +++ b/op_locate.go @@ -19,8 +19,8 @@ type LocateRequestPayload struct { // Table 191 type LocateResponsePayload struct { - LocatedItems uint32 // Required: No - UniqueIdentifier string // Required: No + LocatedItems uint32 // Required: No + UniqueIdentifier []string // Required: No } type LocateHandler struct { diff --git a/src/kmipapi/kmip14.go b/src/kmipapi/kmip14.go index 524c7e9..5ef1a7c 100755 --- a/src/kmipapi/kmip14.go +++ b/src/kmipapi/kmip14.go @@ -301,9 +301,16 @@ func (kmips *kmip14service) Locate(ctx context.Context, settings *ConfigurationS return nil, fmt.Errorf("unable to decode GetResponsePayload, error: %v", err) } - uid := respPayload.UniqueIdentifier + logger.V(4).Info("XXX Locate response payload", "respPayload", respPayload) + + uids := respPayload.UniqueIdentifier logger.V(4).Info("XXX Locate response payload", "uid", respPayload.UniqueIdentifier) + uid := "" + if len(uids) > 0 { + uid = uids[0] + } + return &LocateResponse{UniqueIdentifier: uid}, nil } diff --git a/src/kmipapi/kmip20.go b/src/kmipapi/kmip20.go index 2aedd08..1f29abc 100755 --- a/src/kmipapi/kmip20.go +++ b/src/kmipapi/kmip20.go @@ -333,10 +333,15 @@ func (kmips *kmip20service) Locate(ctx context.Context, settings *ConfigurationS return nil, fmt.Errorf("unable to decode GetResponsePayload, error: %v", err) } - uid := respPayload.UniqueIdentifier + uids := respPayload.UniqueIdentifier logger.V(4).Info("XXX Locate response payload", "uid", respPayload.UniqueIdentifier) - return &LocateResponse{UniqueIdentifier: uid[0]}, nil + uid := "" + if len(uids) > 0 { + uid = uids[0] + } + + return &LocateResponse{UniqueIdentifier: uid}, nil } // SetAttribute: