@ -86,7 +86,7 @@ func (s *FileStore) Release() error {
return err
return err
}
}
return ioutil . WriteFile ( s . p . filepath ( s . sid ) , data , os . ModePerm )
return ioutil . WriteFile ( s . p . filepath ( s . sid ) , data , 0600 )
}
}
// Flush deletes all session data.
// Flush deletes all session data.
@ -121,7 +121,7 @@ func (p *FileProvider) filepath(sid string) string {
// Read returns raw session store by session ID.
// Read returns raw session store by session ID.
func ( p * FileProvider ) Read ( sid string ) ( _ RawStore , err error ) {
func ( p * FileProvider ) Read ( sid string ) ( _ RawStore , err error ) {
filename := p . filepath ( sid )
filename := p . filepath ( sid )
if err = os . MkdirAll ( path . Dir ( filename ) , os . ModePerm ) ; err != nil {
if err = os . MkdirAll ( path . Dir ( filename ) , 0700 ) ; err != nil {
return nil , err
return nil , err
}
}
p . lock . RLock ( )
p . lock . RLock ( )
@ -129,7 +129,7 @@ func (p *FileProvider) Read(sid string) (_ RawStore, err error) {
var f * os . File
var f * os . File
if com . IsFile ( filename ) {
if com . IsFile ( filename ) {
f , err = os . OpenFile ( filename , os . O_RDWR , os . ModePerm )
f , err = os . OpenFile ( filename , os . O_RDONLY , 0600 )
} else {
} else {
f , err = os . Create ( filename )
f , err = os . Create ( filename )
}
}
@ -187,15 +187,15 @@ func (p *FileProvider) regenerate(oldsid, sid string) (err error) {
if err != nil {
if err != nil {
return err
return err
}
}
if err = os . MkdirAll ( path . Dir ( oldname ) , os . ModePerm ) ; err != nil {
if err = os . MkdirAll ( path . Dir ( oldname ) , 0700 ) ; err != nil {
return err
return err
}
}
if err = ioutil . WriteFile ( oldname , data , os . ModePerm ) ; err != nil {
if err = ioutil . WriteFile ( oldname , data , 0600 ) ; err != nil {
return err
return err
}
}
}
}
if err = os . MkdirAll ( path . Dir ( filename ) , os . ModePerm ) ; err != nil {
if err = os . MkdirAll ( path . Dir ( filename ) , 0700 ) ; err != nil {
return err
return err
}
}
if err = os . Rename ( oldname , filename ) ; err != nil {
if err = os . Rename ( oldname , filename ) ; err != nil {