mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00:00 
			
		
		
		
	Fix empty ssh key importing in ldap (#5984)
This commit is contained in:
		| @@ -1501,9 +1501,12 @@ func synchronizeLdapSSHPublicKeys(usr *User, s *LoginSource, SSHPublicKeys []str | |||||||
| 	// Get Public Keys from LDAP and skip duplicate keys | 	// Get Public Keys from LDAP and skip duplicate keys | ||||||
| 	var ldapKeys []string | 	var ldapKeys []string | ||||||
| 	for _, v := range SSHPublicKeys { | 	for _, v := range SSHPublicKeys { | ||||||
| 		ldapKey := strings.Join(strings.Split(v, " ")[:2], " ") | 		sshKeySplit := strings.Split(v, " ") | ||||||
| 		if !util.ExistsInSlice(ldapKey, ldapKeys) { | 		if len(sshKeySplit) > 1 { | ||||||
| 			ldapKeys = append(ldapKeys, ldapKey) | 			ldapKey := strings.Join(sshKeySplit[:2], " ") | ||||||
|  | 			if !util.ExistsInSlice(ldapKey, ldapKeys) { | ||||||
|  | 				ldapKeys = append(ldapKeys, ldapKey) | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 zeripath
					zeripath