mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-26 09:09:36 -05:00
#2147 fix rewrites authorized_keys when builtin SSH server is enabled
This commit is contained in:
parent
40f3142264
commit
bc17f2f759
1 changed files with 10 additions and 0 deletions
|
@ -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 {
|
Loading…
Reference in a new issue