File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -451,11 +451,9 @@ func GetPublicKeyByID(keyID int64) (*PublicKey, error) {
451451 return key , nil
452452}
453453
454- // SearchPublicKeyByContent searches content as prefix (leak e-mail part)
455- // and returns public key found.
456- func SearchPublicKeyByContent (content string ) (* PublicKey , error ) {
454+ func searchPublicKeyByContentWithEngine (e Engine , content string ) (* PublicKey , error ) {
457455 key := new (PublicKey )
458- has , err := x .
456+ has , err := e .
459457 Where ("content like ?" , content + "%" ).
460458 Get (key )
461459 if err != nil {
@@ -466,6 +464,12 @@ func SearchPublicKeyByContent(content string) (*PublicKey, error) {
466464 return key , nil
467465}
468466
467+ // SearchPublicKeyByContent searches content as prefix (leak e-mail part)
468+ // and returns public key found.
469+ func SearchPublicKeyByContent (content string ) (* PublicKey , error ) {
470+ return searchPublicKeyByContentWithEngine (x , content )
471+ }
472+
469473// SearchPublicKey returns a list of public keys matching the provided arguments.
470474func SearchPublicKey (uid int64 , fingerprint string ) ([]* PublicKey , error ) {
471475 keys := make ([]* PublicKey , 0 , 5 )
Original file line number Diff line number Diff line change @@ -1402,7 +1402,7 @@ func deleteKeysMarkedForDeletion(keys []string) (bool, error) {
14021402 // Delete keys marked for deletion
14031403 var sshKeysNeedUpdate bool
14041404 for _ , KeyToDelete := range keys {
1405- key , err := SearchPublicKeyByContent ( KeyToDelete )
1405+ key , err := searchPublicKeyByContentWithEngine ( sess , KeyToDelete )
14061406 if err != nil {
14071407 log .Error (4 , "SearchPublicKeyByContent: %v" , err )
14081408 continue
You can’t perform that action at this time.
0 commit comments