From aeb29a5048ad341c404eaf7eadcbf2f102b8eec9 Mon Sep 17 00:00:00 2001 From: Brian Kassouf Date: Tue, 29 May 2018 15:23:51 -0700 Subject: [PATCH] Update proto files (#4651) --- .../logical/database/dbplugin/database.pb.go | 24 +++---- logical/plugin/pb/backend.pb.go | 64 +++++++++---------- vault/request_forwarding_service.pb.go | 12 ++-- vendor/github.com/golang/protobuf/LICENSE | 3 - .../golang/protobuf/proto/encode.go | 15 ++--- .../golang/protobuf/proto/table_marshal.go | 4 ++ .../golang/protobuf/proto/table_unmarshal.go | 30 ++++++--- .../github.com/golang/protobuf/ptypes/any.go | 10 +-- vendor/vendor.json | 36 +++++------ 9 files changed, 106 insertions(+), 92 deletions(-) diff --git a/builtin/logical/database/dbplugin/database.pb.go b/builtin/logical/database/dbplugin/database.pb.go index 7f6b89d555..7440ccd026 100644 --- a/builtin/logical/database/dbplugin/database.pb.go +++ b/builtin/logical/database/dbplugin/database.pb.go @@ -671,8 +671,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for Database service - +// DatabaseClient is the client API for Database service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type DatabaseClient interface { Type(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TypeResponse, error) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) @@ -694,7 +695,7 @@ func NewDatabaseClient(cc *grpc.ClientConn) DatabaseClient { func (c *databaseClient) Type(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TypeResponse, error) { out := new(TypeResponse) - err := grpc.Invoke(ctx, "/dbplugin.Database/Type", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/dbplugin.Database/Type", in, out, opts...) if err != nil { return nil, err } @@ -703,7 +704,7 @@ func (c *databaseClient) Type(ctx context.Context, in *Empty, opts ...grpc.CallO func (c *databaseClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) { out := new(CreateUserResponse) - err := grpc.Invoke(ctx, "/dbplugin.Database/CreateUser", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/dbplugin.Database/CreateUser", in, out, opts...) if err != nil { return nil, err } @@ -712,7 +713,7 @@ func (c *databaseClient) CreateUser(ctx context.Context, in *CreateUserRequest, func (c *databaseClient) RenewUser(ctx context.Context, in *RenewUserRequest, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := grpc.Invoke(ctx, "/dbplugin.Database/RenewUser", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/dbplugin.Database/RenewUser", in, out, opts...) if err != nil { return nil, err } @@ -721,7 +722,7 @@ func (c *databaseClient) RenewUser(ctx context.Context, in *RenewUserRequest, op func (c *databaseClient) RevokeUser(ctx context.Context, in *RevokeUserRequest, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := grpc.Invoke(ctx, "/dbplugin.Database/RevokeUser", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/dbplugin.Database/RevokeUser", in, out, opts...) if err != nil { return nil, err } @@ -730,7 +731,7 @@ func (c *databaseClient) RevokeUser(ctx context.Context, in *RevokeUserRequest, func (c *databaseClient) RotateRootCredentials(ctx context.Context, in *RotateRootCredentialsRequest, opts ...grpc.CallOption) (*RotateRootCredentialsResponse, error) { out := new(RotateRootCredentialsResponse) - err := grpc.Invoke(ctx, "/dbplugin.Database/RotateRootCredentials", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/dbplugin.Database/RotateRootCredentials", in, out, opts...) if err != nil { return nil, err } @@ -739,7 +740,7 @@ func (c *databaseClient) RotateRootCredentials(ctx context.Context, in *RotateRo func (c *databaseClient) Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*InitResponse, error) { out := new(InitResponse) - err := grpc.Invoke(ctx, "/dbplugin.Database/Init", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/dbplugin.Database/Init", in, out, opts...) if err != nil { return nil, err } @@ -748,7 +749,7 @@ func (c *databaseClient) Init(ctx context.Context, in *InitRequest, opts ...grpc func (c *databaseClient) Close(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := grpc.Invoke(ctx, "/dbplugin.Database/Close", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/dbplugin.Database/Close", in, out, opts...) if err != nil { return nil, err } @@ -758,15 +759,14 @@ func (c *databaseClient) Close(ctx context.Context, in *Empty, opts ...grpc.Call // Deprecated: Do not use. func (c *databaseClient) Initialize(ctx context.Context, in *InitializeRequest, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := grpc.Invoke(ctx, "/dbplugin.Database/Initialize", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/dbplugin.Database/Initialize", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for Database service - +// DatabaseServer is the server API for Database service. type DatabaseServer interface { Type(context.Context, *Empty) (*TypeResponse, error) CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) diff --git a/logical/plugin/pb/backend.pb.go b/logical/plugin/pb/backend.pb.go index d4e6fc44ae..ea76ad6580 100644 --- a/logical/plugin/pb/backend.pb.go +++ b/logical/plugin/pb/backend.pb.go @@ -2375,8 +2375,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for Backend service - +// BackendClient is the client API for Backend service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type BackendClient interface { // HandleRequest is used to handle a request and generate a response. // The plugins must check the operation type and handle appropriately. @@ -2422,7 +2423,7 @@ func NewBackendClient(cc *grpc.ClientConn) BackendClient { func (c *backendClient) HandleRequest(ctx context.Context, in *HandleRequestArgs, opts ...grpc.CallOption) (*HandleRequestReply, error) { out := new(HandleRequestReply) - err := grpc.Invoke(ctx, "/pb.Backend/HandleRequest", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.Backend/HandleRequest", in, out, opts...) if err != nil { return nil, err } @@ -2431,7 +2432,7 @@ func (c *backendClient) HandleRequest(ctx context.Context, in *HandleRequestArgs func (c *backendClient) SpecialPaths(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*SpecialPathsReply, error) { out := new(SpecialPathsReply) - err := grpc.Invoke(ctx, "/pb.Backend/SpecialPaths", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.Backend/SpecialPaths", in, out, opts...) if err != nil { return nil, err } @@ -2440,7 +2441,7 @@ func (c *backendClient) SpecialPaths(ctx context.Context, in *Empty, opts ...grp func (c *backendClient) HandleExistenceCheck(ctx context.Context, in *HandleExistenceCheckArgs, opts ...grpc.CallOption) (*HandleExistenceCheckReply, error) { out := new(HandleExistenceCheckReply) - err := grpc.Invoke(ctx, "/pb.Backend/HandleExistenceCheck", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.Backend/HandleExistenceCheck", in, out, opts...) if err != nil { return nil, err } @@ -2449,7 +2450,7 @@ func (c *backendClient) HandleExistenceCheck(ctx context.Context, in *HandleExis func (c *backendClient) Cleanup(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := grpc.Invoke(ctx, "/pb.Backend/Cleanup", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.Backend/Cleanup", in, out, opts...) if err != nil { return nil, err } @@ -2458,7 +2459,7 @@ func (c *backendClient) Cleanup(ctx context.Context, in *Empty, opts ...grpc.Cal func (c *backendClient) InvalidateKey(ctx context.Context, in *InvalidateKeyArgs, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := grpc.Invoke(ctx, "/pb.Backend/InvalidateKey", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.Backend/InvalidateKey", in, out, opts...) if err != nil { return nil, err } @@ -2467,7 +2468,7 @@ func (c *backendClient) InvalidateKey(ctx context.Context, in *InvalidateKeyArgs func (c *backendClient) Setup(ctx context.Context, in *SetupArgs, opts ...grpc.CallOption) (*SetupReply, error) { out := new(SetupReply) - err := grpc.Invoke(ctx, "/pb.Backend/Setup", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.Backend/Setup", in, out, opts...) if err != nil { return nil, err } @@ -2476,15 +2477,14 @@ func (c *backendClient) Setup(ctx context.Context, in *SetupArgs, opts ...grpc.C func (c *backendClient) Type(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TypeReply, error) { out := new(TypeReply) - err := grpc.Invoke(ctx, "/pb.Backend/Type", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.Backend/Type", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for Backend service - +// BackendServer is the server API for Backend service. type BackendServer interface { // HandleRequest is used to handle a request and generate a response. // The plugins must check the operation type and handle appropriately. @@ -2687,8 +2687,9 @@ var _Backend_serviceDesc = grpc.ServiceDesc{ Metadata: "logical/plugin/pb/backend.proto", } -// Client API for Storage service - +// StorageClient is the client API for Storage service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type StorageClient interface { List(ctx context.Context, in *StorageListArgs, opts ...grpc.CallOption) (*StorageListReply, error) Get(ctx context.Context, in *StorageGetArgs, opts ...grpc.CallOption) (*StorageGetReply, error) @@ -2706,7 +2707,7 @@ func NewStorageClient(cc *grpc.ClientConn) StorageClient { func (c *storageClient) List(ctx context.Context, in *StorageListArgs, opts ...grpc.CallOption) (*StorageListReply, error) { out := new(StorageListReply) - err := grpc.Invoke(ctx, "/pb.Storage/List", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.Storage/List", in, out, opts...) if err != nil { return nil, err } @@ -2715,7 +2716,7 @@ func (c *storageClient) List(ctx context.Context, in *StorageListArgs, opts ...g func (c *storageClient) Get(ctx context.Context, in *StorageGetArgs, opts ...grpc.CallOption) (*StorageGetReply, error) { out := new(StorageGetReply) - err := grpc.Invoke(ctx, "/pb.Storage/Get", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.Storage/Get", in, out, opts...) if err != nil { return nil, err } @@ -2724,7 +2725,7 @@ func (c *storageClient) Get(ctx context.Context, in *StorageGetArgs, opts ...grp func (c *storageClient) Put(ctx context.Context, in *StoragePutArgs, opts ...grpc.CallOption) (*StoragePutReply, error) { out := new(StoragePutReply) - err := grpc.Invoke(ctx, "/pb.Storage/Put", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.Storage/Put", in, out, opts...) if err != nil { return nil, err } @@ -2733,15 +2734,14 @@ func (c *storageClient) Put(ctx context.Context, in *StoragePutArgs, opts ...grp func (c *storageClient) Delete(ctx context.Context, in *StorageDeleteArgs, opts ...grpc.CallOption) (*StorageDeleteReply, error) { out := new(StorageDeleteReply) - err := grpc.Invoke(ctx, "/pb.Storage/Delete", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.Storage/Delete", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for Storage service - +// StorageServer is the server API for Storage service. type StorageServer interface { List(context.Context, *StorageListArgs) (*StorageListReply, error) Get(context.Context, *StorageGetArgs) (*StorageGetReply, error) @@ -2850,8 +2850,9 @@ var _Storage_serviceDesc = grpc.ServiceDesc{ Metadata: "logical/plugin/pb/backend.proto", } -// Client API for SystemView service - +// SystemViewClient is the client API for SystemView service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type SystemViewClient interface { // DefaultLeaseTTL returns the default lease TTL set in Vault configuration DefaultLeaseTTL(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TTLReply, error) @@ -2897,7 +2898,7 @@ func NewSystemViewClient(cc *grpc.ClientConn) SystemViewClient { func (c *systemViewClient) DefaultLeaseTTL(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TTLReply, error) { out := new(TTLReply) - err := grpc.Invoke(ctx, "/pb.SystemView/DefaultLeaseTTL", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.SystemView/DefaultLeaseTTL", in, out, opts...) if err != nil { return nil, err } @@ -2906,7 +2907,7 @@ func (c *systemViewClient) DefaultLeaseTTL(ctx context.Context, in *Empty, opts func (c *systemViewClient) MaxLeaseTTL(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TTLReply, error) { out := new(TTLReply) - err := grpc.Invoke(ctx, "/pb.SystemView/MaxLeaseTTL", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.SystemView/MaxLeaseTTL", in, out, opts...) if err != nil { return nil, err } @@ -2915,7 +2916,7 @@ func (c *systemViewClient) MaxLeaseTTL(ctx context.Context, in *Empty, opts ...g func (c *systemViewClient) SudoPrivilege(ctx context.Context, in *SudoPrivilegeArgs, opts ...grpc.CallOption) (*SudoPrivilegeReply, error) { out := new(SudoPrivilegeReply) - err := grpc.Invoke(ctx, "/pb.SystemView/SudoPrivilege", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.SystemView/SudoPrivilege", in, out, opts...) if err != nil { return nil, err } @@ -2924,7 +2925,7 @@ func (c *systemViewClient) SudoPrivilege(ctx context.Context, in *SudoPrivilegeA func (c *systemViewClient) Tainted(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TaintedReply, error) { out := new(TaintedReply) - err := grpc.Invoke(ctx, "/pb.SystemView/Tainted", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.SystemView/Tainted", in, out, opts...) if err != nil { return nil, err } @@ -2933,7 +2934,7 @@ func (c *systemViewClient) Tainted(ctx context.Context, in *Empty, opts ...grpc. func (c *systemViewClient) CachingDisabled(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*CachingDisabledReply, error) { out := new(CachingDisabledReply) - err := grpc.Invoke(ctx, "/pb.SystemView/CachingDisabled", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.SystemView/CachingDisabled", in, out, opts...) if err != nil { return nil, err } @@ -2942,7 +2943,7 @@ func (c *systemViewClient) CachingDisabled(ctx context.Context, in *Empty, opts func (c *systemViewClient) ReplicationState(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ReplicationStateReply, error) { out := new(ReplicationStateReply) - err := grpc.Invoke(ctx, "/pb.SystemView/ReplicationState", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.SystemView/ReplicationState", in, out, opts...) if err != nil { return nil, err } @@ -2951,7 +2952,7 @@ func (c *systemViewClient) ReplicationState(ctx context.Context, in *Empty, opts func (c *systemViewClient) ResponseWrapData(ctx context.Context, in *ResponseWrapDataArgs, opts ...grpc.CallOption) (*ResponseWrapDataReply, error) { out := new(ResponseWrapDataReply) - err := grpc.Invoke(ctx, "/pb.SystemView/ResponseWrapData", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.SystemView/ResponseWrapData", in, out, opts...) if err != nil { return nil, err } @@ -2960,7 +2961,7 @@ func (c *systemViewClient) ResponseWrapData(ctx context.Context, in *ResponseWra func (c *systemViewClient) MlockEnabled(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*MlockEnabledReply, error) { out := new(MlockEnabledReply) - err := grpc.Invoke(ctx, "/pb.SystemView/MlockEnabled", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.SystemView/MlockEnabled", in, out, opts...) if err != nil { return nil, err } @@ -2969,15 +2970,14 @@ func (c *systemViewClient) MlockEnabled(ctx context.Context, in *Empty, opts ... func (c *systemViewClient) LocalMount(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*LocalMountReply, error) { out := new(LocalMountReply) - err := grpc.Invoke(ctx, "/pb.SystemView/LocalMount", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.SystemView/LocalMount", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for SystemView service - +// SystemViewServer is the server API for SystemView service. type SystemViewServer interface { // DefaultLeaseTTL returns the default lease TTL set in Vault configuration DefaultLeaseTTL(context.Context, *Empty) (*TTLReply, error) diff --git a/vault/request_forwarding_service.pb.go b/vault/request_forwarding_service.pb.go index d9c709ace5..920c03d028 100644 --- a/vault/request_forwarding_service.pb.go +++ b/vault/request_forwarding_service.pb.go @@ -149,8 +149,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for RequestForwarding service - +// RequestForwardingClient is the client API for RequestForwarding service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type RequestForwardingClient interface { ForwardRequest(ctx context.Context, in *forwarding.Request, opts ...grpc.CallOption) (*forwarding.Response, error) Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoReply, error) @@ -166,7 +167,7 @@ func NewRequestForwardingClient(cc *grpc.ClientConn) RequestForwardingClient { func (c *requestForwardingClient) ForwardRequest(ctx context.Context, in *forwarding.Request, opts ...grpc.CallOption) (*forwarding.Response, error) { out := new(forwarding.Response) - err := grpc.Invoke(ctx, "/vault.RequestForwarding/ForwardRequest", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/vault.RequestForwarding/ForwardRequest", in, out, opts...) if err != nil { return nil, err } @@ -175,15 +176,14 @@ func (c *requestForwardingClient) ForwardRequest(ctx context.Context, in *forwar func (c *requestForwardingClient) Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoReply, error) { out := new(EchoReply) - err := grpc.Invoke(ctx, "/vault.RequestForwarding/Echo", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/vault.RequestForwarding/Echo", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for RequestForwarding service - +// RequestForwardingServer is the server API for RequestForwarding service. type RequestForwardingServer interface { ForwardRequest(context.Context, *forwarding.Request) (*forwarding.Response, error) Echo(context.Context, *EchoRequest) (*EchoReply, error) diff --git a/vendor/github.com/golang/protobuf/LICENSE b/vendor/github.com/golang/protobuf/LICENSE index 1b1b1921ef..0f646931a4 100644 --- a/vendor/github.com/golang/protobuf/LICENSE +++ b/vendor/github.com/golang/protobuf/LICENSE @@ -1,7 +1,4 @@ -Go support for Protocol Buffers - Google's data interchange format - Copyright 2010 The Go Authors. All rights reserved. -https://github.com/golang/protobuf Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/vendor/github.com/golang/protobuf/proto/encode.go b/vendor/github.com/golang/protobuf/proto/encode.go index c27d35f866..4c35d33738 100644 --- a/vendor/github.com/golang/protobuf/proto/encode.go +++ b/vendor/github.com/golang/protobuf/proto/encode.go @@ -41,20 +41,17 @@ import ( "reflect" ) -// RequiredNotSetError is the error returned if Marshal is called with -// a protocol buffer struct whose required fields have not -// all been initialized. It is also the error returned if Unmarshal is -// called with an encoded protocol buffer that does not include all the -// required fields. -// -// When printed, RequiredNotSetError reports the first unset required field in a -// message. If the field cannot be precisely determined, it is reported as -// "{Unknown}". +// RequiredNotSetError is an error type returned by either Marshal or Unmarshal. +// Marshal reports this when a required field is not initialized. +// Unmarshal reports this when a required field is missing from the wire data. type RequiredNotSetError struct { field string } func (e *RequiredNotSetError) Error() string { + if e.field == "" { + return fmt.Sprintf("proto: required field not set") + } return fmt.Sprintf("proto: required field %q not set", e.field) } diff --git a/vendor/github.com/golang/protobuf/proto/table_marshal.go b/vendor/github.com/golang/protobuf/proto/table_marshal.go index 0f212b3029..be7b2428cb 100644 --- a/vendor/github.com/golang/protobuf/proto/table_marshal.go +++ b/vendor/github.com/golang/protobuf/proto/table_marshal.go @@ -277,6 +277,10 @@ func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte if err == errRepeatedHasNil { err = errors.New("proto: repeated field " + f.name + " has nil element") } + if err == errInvalidUTF8 { + fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name + err = fmt.Errorf("proto: string field %q contains invalid UTF-8", fullName) + } return b, err } } diff --git a/vendor/github.com/golang/protobuf/proto/table_unmarshal.go b/vendor/github.com/golang/protobuf/proto/table_unmarshal.go index 55f0340a3f..96764347a4 100644 --- a/vendor/github.com/golang/protobuf/proto/table_unmarshal.go +++ b/vendor/github.com/golang/protobuf/proto/table_unmarshal.go @@ -97,6 +97,8 @@ type unmarshalFieldInfo struct { // if a required field, contains a single set bit at this field's index in the required field list. reqMask uint64 + + name string // name of the field, for error reporting } var ( @@ -181,6 +183,10 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { continue } if err != errInternalBadWireType { + if err == errInvalidUTF8 { + fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name + err = fmt.Errorf("proto: string field %q contains invalid UTF-8", fullName) + } return err } // Fragments with bad wire type are treated as unknown fields. @@ -351,7 +357,7 @@ func (u *unmarshalInfo) computeUnmarshalInfo() { } // Store the info in the correct slot in the message. - u.setTag(tag, toField(&f), unmarshal, reqMask) + u.setTag(tag, toField(&f), unmarshal, reqMask, name) } // Find any types associated with oneof fields. @@ -366,10 +372,17 @@ func (u *unmarshalInfo) computeUnmarshalInfo() { f := typ.Field(0) // oneof implementers have one field baseUnmarshal := fieldUnmarshaler(&f) - tagstr := strings.Split(f.Tag.Get("protobuf"), ",")[1] - tag, err := strconv.Atoi(tagstr) + tags := strings.Split(f.Tag.Get("protobuf"), ",") + fieldNum, err := strconv.Atoi(tags[1]) if err != nil { - panic("protobuf tag field not an integer: " + tagstr) + panic("protobuf tag field not an integer: " + tags[1]) + } + var name string + for _, tag := range tags { + if strings.HasPrefix(tag, "name=") { + name = strings.TrimPrefix(tag, "name=") + break + } } // Find the oneof field that this struct implements. @@ -380,7 +393,7 @@ func (u *unmarshalInfo) computeUnmarshalInfo() { // That lets us know where this struct should be stored // when we encounter it during unmarshaling. unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal) - u.setTag(tag, of.field, unmarshal, 0) + u.setTag(fieldNum, of.field, unmarshal, 0, name) } } } @@ -401,7 +414,7 @@ func (u *unmarshalInfo) computeUnmarshalInfo() { // [0 0] is [tag=0/wiretype=varint varint-encoded-0]. u.setTag(0, zeroField, func(b []byte, f pointer, w int) ([]byte, error) { return nil, fmt.Errorf("proto: %s: illegal tag 0 (wire type %d)", t, w) - }, 0) + }, 0, "") // Set mask for required field check. u.reqMask = uint64(1)<= 0 && (tag < 16 || tag < 2*n) { // TODO: what are the right numbers here? for len(u.dense) <= tag { diff --git a/vendor/github.com/golang/protobuf/ptypes/any.go b/vendor/github.com/golang/protobuf/ptypes/any.go index b2af97f4a9..70276e8f5c 100644 --- a/vendor/github.com/golang/protobuf/ptypes/any.go +++ b/vendor/github.com/golang/protobuf/ptypes/any.go @@ -130,10 +130,12 @@ func UnmarshalAny(any *any.Any, pb proto.Message) error { // Is returns true if any value contains a given message type. func Is(any *any.Any, pb proto.Message) bool { - aname, err := AnyMessageName(any) - if err != nil { + // The following is equivalent to AnyMessageName(any) == proto.MessageName(pb), + // but it avoids scanning TypeUrl for the slash. + if any == nil { return false } - - return aname == proto.MessageName(pb) + name := proto.MessageName(pb) + prefix := len(any.TypeUrl) - len(name) + return prefix >= 1 && any.TypeUrl[prefix-1] == '/' && any.TypeUrl[prefix:] == name } diff --git a/vendor/vendor.json b/vendor/vendor.json index 1df8112195..39c378197a 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -985,52 +985,52 @@ "revisionTime": "2016-01-25T20:49:56Z" }, { - "checksumSHA1": "Pyou8mceOASSFxc7GeXZuVdSMi0=", + "checksumSHA1": "8e94vVGc8ssfxcpgDSGLmp1hRJM=", "path": "github.com/golang/protobuf/proto", - "revision": "b4deda0973fb4c70b50d226b1af49f3da59f5265", - "revisionTime": "2018-04-30T18:52:41Z" + "revision": "3a3da3a4e26776cc22a79ef46d5d58477532dede", + "revisionTime": "2018-05-22T22:42:51Z" }, { "checksumSHA1": "DA2cyOt1W92RTyXAqKQ4JWKGR8U=", "path": "github.com/golang/protobuf/protoc-gen-go/descriptor", - "revision": "b4deda0973fb4c70b50d226b1af49f3da59f5265", - "revisionTime": "2018-04-30T18:52:41Z" + "revision": "3a3da3a4e26776cc22a79ef46d5d58477532dede", + "revisionTime": "2018-05-22T22:42:51Z" }, { - "checksumSHA1": "/s0InJhSrxhTpqw5FIKgSMknCfM=", + "checksumSHA1": "tkJPssYejSjuAwE2tdEnoEIj93Q=", "path": "github.com/golang/protobuf/ptypes", - "revision": "b4deda0973fb4c70b50d226b1af49f3da59f5265", - "revisionTime": "2018-04-30T18:52:41Z" + "revision": "3a3da3a4e26776cc22a79ef46d5d58477532dede", + "revisionTime": "2018-05-22T22:42:51Z" }, { "checksumSHA1": "3eqU9o+NMZSLM/coY5WDq7C1uKg=", "path": "github.com/golang/protobuf/ptypes/any", - "revision": "b4deda0973fb4c70b50d226b1af49f3da59f5265", - "revisionTime": "2018-04-30T18:52:41Z" + "revision": "3a3da3a4e26776cc22a79ef46d5d58477532dede", + "revisionTime": "2018-05-22T22:42:51Z" }, { "checksumSHA1": "ZIF0rnVzNLluFPqUebtJrVonMr4=", "path": "github.com/golang/protobuf/ptypes/duration", - "revision": "b4deda0973fb4c70b50d226b1af49f3da59f5265", - "revisionTime": "2018-04-30T18:52:41Z" + "revision": "3a3da3a4e26776cc22a79ef46d5d58477532dede", + "revisionTime": "2018-05-22T22:42:51Z" }, { "checksumSHA1": "7Az4Zl9T11I+xOfjgs/3/YMJ24I=", "path": "github.com/golang/protobuf/ptypes/empty", - "revision": "b4deda0973fb4c70b50d226b1af49f3da59f5265", - "revisionTime": "2018-04-30T18:52:41Z" + "revision": "3a3da3a4e26776cc22a79ef46d5d58477532dede", + "revisionTime": "2018-05-22T22:42:51Z" }, { "checksumSHA1": "QwgMLtaLi/6xHaNiDFwHN844AkI=", "path": "github.com/golang/protobuf/ptypes/struct", - "revision": "b4deda0973fb4c70b50d226b1af49f3da59f5265", - "revisionTime": "2018-04-30T18:52:41Z" + "revision": "3a3da3a4e26776cc22a79ef46d5d58477532dede", + "revisionTime": "2018-05-22T22:42:51Z" }, { "checksumSHA1": "1FJvuT0UllZaaS43kmPlx8oNiCs=", "path": "github.com/golang/protobuf/ptypes/timestamp", - "revision": "b4deda0973fb4c70b50d226b1af49f3da59f5265", - "revisionTime": "2018-04-30T18:52:41Z" + "revision": "3a3da3a4e26776cc22a79ef46d5d58477532dede", + "revisionTime": "2018-05-22T22:42:51Z" }, { "checksumSHA1": "p/8vSviYF91gFflhrt5vkyksroo=",