Skip to content

Commit

Permalink
fix check rangeEnd when revoking perm
Browse files Browse the repository at this point in the history
  • Loading branch information
soyking committed Dec 7, 2017
1 parent 554492e commit e17ca48
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions auth.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package client

import (
"strings"

"github.com/coreos/etcd/auth/authpb"
"github.com/coreos/etcd/clientv3"
"strings"
)

func (clt *EtcdHRCHYClient) permPath(key string) (string, error) {
Expand Down Expand Up @@ -62,9 +63,11 @@ func (clt *EtcdHRCHYClient) RoleRevokePermission(name string, key, rangeEnd stri
return err
}

rangeEnd, _, err = clt.ensureKey(rangeEnd)
if err != nil {
return err
if rangeEnd != "" {
rangeEnd, _, err = clt.ensureKey(rangeEnd)
if err != nil {
return err
}
}

_, err = clt.client.RoleRevokePermission(clt.ctx, name, key, rangeEnd)
Expand Down

0 comments on commit e17ca48

Please sign in to comment.