Merge pull request #1475 from donbowman/master

Fix race condition on ssh key delete, and revert re-revert of hard line break
This commit is contained in:
无闻 2015-08-15 17:27:20 +08:00
commit ce8864c69a
2 changed files with 3 additions and 4 deletions

View file

@ -386,9 +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 {
return err return err
@ -444,6 +441,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

View file

@ -198,7 +198,6 @@ func RenderRawMarkdown(body []byte, urlPrefix string) []byte {
extensions |= blackfriday.EXTENSION_FENCED_CODE extensions |= blackfriday.EXTENSION_FENCED_CODE
extensions |= blackfriday.EXTENSION_AUTOLINK extensions |= blackfriday.EXTENSION_AUTOLINK
extensions |= blackfriday.EXTENSION_STRIKETHROUGH extensions |= blackfriday.EXTENSION_STRIKETHROUGH
extensions |= blackfriday.EXTENSION_HARD_LINE_BREAK
extensions |= blackfriday.EXTENSION_SPACE_HEADERS extensions |= blackfriday.EXTENSION_SPACE_HEADERS
extensions |= blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK extensions |= blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK