aboutsummaryrefslogtreecommitdiff
path: root/internal/db/ssh_key.go
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2023-02-07 23:39:00 +0800
committerGitHub <noreply@github.com>2023-02-07 23:39:00 +0800
commit133b9d90441008ee175e1f8e6369e06309e1392a (patch)
tree70f29798055962f6700ba6a93b023a8328a5eff4 /internal/db/ssh_key.go
parent7c453d5b3632a6bbdbd99205c518303a9e25a4e1 (diff)
refactor(db): finish migrate methods off `user.go` (#7337)
Diffstat (limited to 'internal/db/ssh_key.go')
-rw-r--r--internal/db/ssh_key.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/db/ssh_key.go b/internal/db/ssh_key.go
index 50ac324f..d022e207 100644
--- a/internal/db/ssh_key.go
+++ b/internal/db/ssh_key.go
@@ -517,6 +517,8 @@ func DeletePublicKey(doer *User, id int64) (err error) {
// RewriteAuthorizedKeys removes any authorized key and rewrite all keys from database again.
// Note: x.Iterate does not get latest data after insert/delete, so we have to call this function
// outside any session scope independently.
+//
+// Deprecated: Use PublicKeys.RewriteAuthorizedKeys instead.
func RewriteAuthorizedKeys() error {
sshOpLocker.Lock()
defer sshOpLocker.Unlock()
@@ -524,7 +526,7 @@ func RewriteAuthorizedKeys() error {
log.Trace("Doing: RewriteAuthorizedKeys")
_ = os.MkdirAll(conf.SSH.RootPath, os.ModePerm)
- fpath := filepath.Join(conf.SSH.RootPath, "authorized_keys")
+ fpath := authorizedKeysPath()
tmpPath := fpath + ".tmp"
f, err := os.OpenFile(tmpPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil {