Browse Source

race condition on keydelete

tags/v1.2.0-rc1
Don Bowman 10 years ago
parent
commit
0a86464348
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      models/publickey.go

+ 3
- 2
models/publickey.go View File

@@ -386,8 +386,6 @@ func ListPublicKeys(uid int64) ([]*PublicKey, error) {

// rewriteAuthorizedKeys finds and deletes corresponding line in authorized_keys file.
func rewriteAuthorizedKeys(key *PublicKey, p, tmpP string) error {
sshOpLocker.Lock()
defer sshOpLocker.Unlock()

fr, err := os.Open(p)
if err != nil {
@@ -444,6 +442,9 @@ func UpdatePublicKey(key *PublicKey) error {
}

func deletePublicKey(e *xorm.Session, key *PublicKey) error {
sshOpLocker.Lock()
defer sshOpLocker.Unlock()

has, err := e.Get(key)
if err != nil {
return err


Loading…
Cancel
Save