add protect and enable unveil on openbsd

This commit is contained in:
Aaron Bieber 2020-02-02 11:13:43 -07:00
parent ffcd01a772
commit aa6e22ff39
3 changed files with 14 additions and 7 deletions

2
go.mod
View File

@ -7,5 +7,5 @@ require (
go.etcd.io/bbolt v1.3.3
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9 // indirect
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9
)

1
go.sum
View File

@ -11,4 +11,5 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9 h1:1/DFK4b7JH8DmkqhUk48onnSfrPzImPoVxuomtbT2nk=
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

18
main.go
View File

@ -32,20 +32,26 @@ func sendMessage(c *gomatrix.Client, roomID, message string) error {
}
func main() {
var store, err = NewStore("mcchunkie.db")
if err != nil {
log.Fatalf("%s\n", err)
}
var username, password, userID, accessToken, server string
var username, password, userID, accessToken, server, db string
var setup bool
flag.StringVar(&username, "user", "", "username to connect to matrix server with")
flag.StringVar(&server, "server", "", "matrix server")
flag.BoolVar(&setup, "s", false, "setup account")
flag.StringVar(&db, "db", "mcchunkie.db", "full path to database file")
flag.Parse()
unveil("/etc/resolv.conf", "r")
unveil("/etc/ssl/cert.pem", "r")
unveil(db, "rwc")
unveilBlock()
var store, err = NewStore(db)
if err != nil {
log.Fatalf("%s\n", err)
}
if server == "" {
server, err = store.get("config", "server")
if server == "" {