mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 02:57:59 +00:00
merge two consecutive if checks, update comments (#27963)
This commit is contained in:
@@ -199,11 +199,7 @@ func remotePort(req *logical.Request) int {
|
|||||||
// clientCertSerialNumber attempts the retrieve the serial number of the peer
|
// clientCertSerialNumber attempts the retrieve the serial number of the peer
|
||||||
// certificate from the specified tls.ConnectionState.
|
// certificate from the specified tls.ConnectionState.
|
||||||
func clientCertSerialNumber(req *logical.Request) string {
|
func clientCertSerialNumber(req *logical.Request) string {
|
||||||
if req == nil {
|
if req == nil || req.Connection == nil {
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if req.Connection == nil {
|
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,8 +257,8 @@ func clone[V any](s V) (V, error) {
|
|||||||
// an audit Auth.
|
// an audit Auth.
|
||||||
// tokenRemainingUses should be the client token remaining uses to include in auth.
|
// tokenRemainingUses should be the client token remaining uses to include in auth.
|
||||||
// This usually can be found in logical.Request.ClientTokenRemainingUses.
|
// This usually can be found in logical.Request.ClientTokenRemainingUses.
|
||||||
// NOTE: supplying a nil value for auth will result in a nil return value and error.
|
// NOTE: supplying a nil value for auth will result in a nil return value and
|
||||||
// The caller should check the return value before attempting to use it.
|
// (nil) error. The caller should check the return value before attempting to use it.
|
||||||
func newAuth(auth *logical.Auth, tokenRemainingUses int) (*Auth, error) {
|
func newAuth(auth *logical.Auth, tokenRemainingUses int) (*Auth, error) {
|
||||||
if auth == nil {
|
if auth == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
@@ -399,6 +395,8 @@ func newRequest(req *logical.Request, ns *namespace.Namespace) (*Request, error)
|
|||||||
// newResponse takes a logical.Response and logical.Request, transforms and
|
// newResponse takes a logical.Response and logical.Request, transforms and
|
||||||
// aggregates them into an audit Response.
|
// aggregates them into an audit Response.
|
||||||
// isElisionRequired is used to indicate that response 'Data' should be elided.
|
// isElisionRequired is used to indicate that response 'Data' should be elided.
|
||||||
|
// NOTE: supplying a nil value for response will result in a nil return value and
|
||||||
|
// (nil) error. The caller should check the return value before attempting to use it.
|
||||||
func newResponse(resp *logical.Response, req *logical.Request, isElisionRequired bool) (*Response, error) {
|
func newResponse(resp *logical.Response, req *logical.Request, isElisionRequired bool) (*Response, error) {
|
||||||
if resp == nil {
|
if resp == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user