diff options
Diffstat (limited to 'incoming.go')
-rw-r--r-- | incoming.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/incoming.go b/incoming.go index e264262..35aa006 100644 --- a/incoming.go +++ b/incoming.go @@ -2,10 +2,10 @@ package main import ( "os" - "path" "time" "go.lindenii.runxiyu.org/lindenii-common/clog" + "go.lindenii.runxiyu.org/lindenii-common/misc" ) func deliver_incoming(envelope_from string, envelope_recipients []string, data []byte) error { @@ -16,14 +16,14 @@ func deliver_incoming(envelope_from string, envelope_recipients []string, data [ "data", string(data), ) t := time.Now() - fd, err := os.OpenFile(path.Join(config.Inbox_path, envelope_from+" "+t.Format(time.RFC3339Nano)+".eml"), os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0o660) // TODO: vulnerability + fd, err := misc.Open_file_at(directories.inbox, envelope_from+" "+t.Format(time.RFC3339Nano)+".eml", os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0o600) if err != nil { // TODO: handle fs.ErrExist - return err_deliver_write + return misc.Wrap_one_error(err_deliver_write, err) } _, err = fd.Write(data) if err != nil { - return err_deliver_write + return misc.Wrap_one_error(err_deliver_write, err) } return nil } |