mirror of
https://github.com/go-gitea/gitea.git
synced 2024-08-26 21:54:19 -04:00
race condition on keydelete
This commit is contained in:
parent
1cb46ede1a
commit
ab0247b4dc
@ -386,8 +386,6 @@ func ListPublicKeys(uid int64) ([]*PublicKey, error) {
|
|||||||
|
|
||||||
// rewriteAuthorizedKeys finds and deletes corresponding line in authorized_keys file.
|
// rewriteAuthorizedKeys finds and deletes corresponding line in authorized_keys file.
|
||||||
func rewriteAuthorizedKeys(key *PublicKey, p, tmpP string) error {
|
func rewriteAuthorizedKeys(key *PublicKey, p, tmpP string) error {
|
||||||
sshOpLocker.Lock()
|
|
||||||
defer sshOpLocker.Unlock()
|
|
||||||
|
|
||||||
fr, err := os.Open(p)
|
fr, err := os.Open(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -444,6 +442,9 @@ func UpdatePublicKey(key *PublicKey) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func deletePublicKey(e *xorm.Session, key *PublicKey) error {
|
func deletePublicKey(e *xorm.Session, key *PublicKey) error {
|
||||||
|
sshOpLocker.Lock()
|
||||||
|
defer sshOpLocker.Unlock()
|
||||||
|
|
||||||
has, err := e.Get(key)
|
has, err := e.Get(key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user