Skip to content

Commit

Permalink
Bail early if we protector is enabled (#470)
Browse files Browse the repository at this point in the history
As pointed out in #469, the pledging breaks the version check.
My testing "worked" because of the HEAD check..

Since we typically disable remote version checks in OpenBSD anyway
(doing an update would break the package otherwise), we might as
well disable it here.
  • Loading branch information
qbit authored and dominikschulz committed Nov 17, 2017
1 parent f86ae17 commit 4802d7f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions action/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/dominikschulz/github-releases/ghrel"
"github.com/fatih/color"
"github.com/justwatchcom/gopass/utils/out"
"github.com/justwatchcom/gopass/utils/protect"
"github.com/urfave/cli"
)

Expand All @@ -27,8 +28,9 @@ func (s *Action) Version(ctx context.Context, c *cli.Context) error {
return
}

if strings.HasSuffix(s.version.String(), "+HEAD") {
// chan not check version against HEAD
if strings.HasSuffix(s.version.String(), "+HEAD") || protect.ProtectEnabled {
// chan not check version against HEAD or
// against pledge(2)'d OpenBSD
u <- ""
return
}
Expand Down
3 changes: 3 additions & 0 deletions utils/protect/protect.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

package protect

// ProtectEnabled lets us know if we have protection or not
var ProtectEnabled = false

// Pledge on any other system than OpenBSD doesn't do anything
func Pledge(s string) {
return
Expand Down
3 changes: 3 additions & 0 deletions utils/protect/protect_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ package protect

import "golang.org/x/sys/unix"

// ProtectEnabled lets us know if we have protection or not
var ProtectEnabled = true

// Pledge on OpenBSD lets us "promise" to only run a subset of
// system calls: http://man.openbsd.org/pledge
func Pledge(s string) {
Expand Down

0 comments on commit 4802d7f

Please sign in to comment.