diff options
author | Unknwon <u@gogs.io> | 2015-12-11 05:02:33 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-12-11 05:02:33 -0500 |
commit | bc17f2f759b5c40ee1a7f5de064b4a9f622f6b19 (patch) | |
tree | 1e01cf8a247b72bdd1158949c8ea0736180c5eb4 /models | |
parent | 40f3142264aa20103ba2c6375b344e491cff27f5 (diff) | |
download | gitea-bc17f2f759b5c40ee1a7f5de064b4a9f622f6b19.tar.gz gitea-bc17f2f759b5c40ee1a7f5de064b4a9f622f6b19.zip |
#2147 fix rewrites authorized_keys when builtin SSH server is enabled
Diffstat (limited to 'models')
-rw-r--r-- | models/ssh_key.go (renamed from models/publickey.go) | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/models/publickey.go b/models/ssh_key.go index 6838947814..e213d083c1 100644 --- a/models/publickey.go +++ b/models/ssh_key.go @@ -299,6 +299,11 @@ func addKey(e Engine, key *PublicKey) (err error) { if _, err = e.Insert(key); err != nil { return err } + + // Don't need to rewrite this file if builtin SSH server is enabled. + if setting.StartSSHServer { + return nil + } return saveAuthorizedKeyFile(key) } @@ -439,6 +444,11 @@ func deletePublicKey(e *xorm.Session, keyID int64) error { return err } + // Don't need to rewrite this file if builtin SSH server is enabled. + if setting.StartSSHServer { + return nil + } + fpath := filepath.Join(SSHPath, "authorized_keys") tmpPath := filepath.Join(SSHPath, "authorized_keys.tmp") if err = rewriteAuthorizedKeys(key, fpath, tmpPath); err != nil { |