mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	Synchronize SSH keys on login with LDAP + Fix SQLite deadlock on ldap ssh key deletion (#5557)
* Synchronize SSH keys on login with LDAP * BUG: Fix hang on sqlite during LDAP key deletion
This commit is contained in:
		@@ -451,11 +451,9 @@ func GetPublicKeyByID(keyID int64) (*PublicKey, error) {
 | 
			
		||||
	return key, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SearchPublicKeyByContent searches content as prefix (leak e-mail part)
 | 
			
		||||
// and returns public key found.
 | 
			
		||||
func SearchPublicKeyByContent(content string) (*PublicKey, error) {
 | 
			
		||||
func searchPublicKeyByContentWithEngine(e Engine, content string) (*PublicKey, error) {
 | 
			
		||||
	key := new(PublicKey)
 | 
			
		||||
	has, err := x.
 | 
			
		||||
	has, err := e.
 | 
			
		||||
		Where("content like ?", content+"%").
 | 
			
		||||
		Get(key)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
@@ -466,6 +464,12 @@ func SearchPublicKeyByContent(content string) (*PublicKey, error) {
 | 
			
		||||
	return key, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SearchPublicKeyByContent searches content as prefix (leak e-mail part)
 | 
			
		||||
// and returns public key found.
 | 
			
		||||
func SearchPublicKeyByContent(content string) (*PublicKey, error) {
 | 
			
		||||
	return searchPublicKeyByContentWithEngine(x, content)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SearchPublicKey returns a list of public keys matching the provided arguments.
 | 
			
		||||
func SearchPublicKey(uid int64, fingerprint string) ([]*PublicKey, error) {
 | 
			
		||||
	keys := make([]*PublicKey, 0, 5)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user