Skip to content

Commit

Permalink
chmod 0777 the .sock file so non-root can use it
Browse files Browse the repository at this point in the history
  • Loading branch information
vito committed Nov 10, 2013
1 parent fc5d251 commit c1bac50
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io"
"log"
"net"
"os"
"time"

"code.google.com/p/gogoprotobuf/proto"
Expand Down Expand Up @@ -40,6 +41,8 @@ func (s *WardenServer) Start() error {
return err
}

os.Chmod(s.socketPath, 0777)

go s.handleConnections(listener)

return nil
Expand Down
7 changes: 6 additions & 1 deletion server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
)

var _ = Describe("The Warden server", func() {
It("listens on the given socket path", func() {
It("listens on the given socket path and chmod it to 0777", func() {
tmpdir, err := ioutil.TempDir(os.TempDir(), "warden-server-test")
Expect(err).ToNot(HaveOccured())

Expand All @@ -33,6 +33,11 @@ var _ = Describe("The Warden server", func() {
Expect(err).ToNot(HaveOccured())

Eventually(ErrorDialingUnix(socketPath)).ShouldNot(HaveOccured())

stat, err := os.Stat(socketPath)
Expect(err).ToNot(HaveOccured())

Expect(int(stat.Mode() & 0777)).To(Equal(0777))
})

Context("when starting fails", func() {
Expand Down

0 comments on commit c1bac50

Please sign in to comment.