diff options
author | Unknwon <u@gogs.io> | 2015-03-12 01:15:01 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-03-12 01:15:01 -0400 |
commit | 4aafeace230a35e80fb443739c2642d23fc93e51 (patch) | |
tree | 3dc6b008a4469232521ecf834b43acf17ae439dc /models | |
parent | 34102f788945b1c73a845f7916d01d216baa56ad (diff) |
fix HTTP/HTTPS push update func call panic #1037 and `http: multiple response.WriteHeader calls`
Diffstat (limited to 'models')
-rw-r--r-- | models/login.go | 6 | ||||
-rw-r--r-- | models/publickey.go | 7 |
2 files changed, 6 insertions, 7 deletions
diff --git a/models/login.go b/models/login.go index e00d59b0..5e5fbf43 100644 --- a/models/login.go +++ b/models/login.go @@ -215,11 +215,9 @@ func UserSignIn(uname, passwd string) (*User, error) { switch u.LoginType { case LDAP: - return LoginUserLdapSource(u, u.LoginName, passwd, - source.Id, source.Cfg.(*LDAPConfig), false) + return LoginUserLdapSource(u, u.LoginName, passwd, source.Id, source.Cfg.(*LDAPConfig), false) case SMTP: - return LoginUserSMTPSource(u, u.LoginName, passwd, - source.Id, source.Cfg.(*SMTPConfig), false) + return LoginUserSMTPSource(u, u.LoginName, passwd, source.Id, source.Cfg.(*SMTPConfig), false) } return nil, ErrUnsupportedLoginType } diff --git a/models/publickey.go b/models/publickey.go index 6bec1139..c8098748 100644 --- a/models/publickey.go +++ b/models/publickey.go @@ -254,15 +254,16 @@ func saveAuthorizedKeyFile(keys ...*PublicKey) error { } defer f.Close() - finfo, err := f.Stat() + fi, err := f.Stat() if err != nil { return err } // FIXME: following command does not support in Windows. if !setting.IsWindows { - if finfo.Mode().Perm() > 0600 { - log.Error(4, "authorized_keys file has unusual permission flags: %s - setting to -rw-------", finfo.Mode().Perm().String()) + // .ssh directory should have mode 700, and authorized_keys file should have mode 600. + if fi.Mode().Perm() > 0600 { + log.Error(4, "authorized_keys file has unusual permission flags: %s - setting to -rw-------", fi.Mode().Perm().String()) if err = f.Chmod(0600); err != nil { return err } |