Skip to content

Commit

Permalink
fix: Change kmip14/op_locate to be an array of strings
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Skazinski <[email protected]>
  • Loading branch information
jskazinski committed Sep 16, 2022
1 parent a3b47d6 commit fc514dd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions op_locate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 8 additions & 1 deletion src/kmipapi/kmip14.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
9 changes: 7 additions & 2 deletions src/kmipapi/kmip20.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit fc514dd

Please sign in to comment.