Skip to content

Commit ff74241

Browse files
dnmgnslunny
authored andcommitted
Delete Public SSH Key tmp file after calculating fingerprint (#1855)
* Delete public key tmp file after calculating fingerprint Signed-off-by: Magnus Lindvall <[email protected]> * Move line Signed-off-by: Magnus Lindvall <[email protected]> * Remove defer statement Signed-off-by: Magnus Lindvall <[email protected]> * Readd defer statement and move remove Signed-off-by: Magnus Lindvall <[email protected]> * Delete space Signed-off-by: Magnus Lindvall <[email protected]>
1 parent 65cf6cc commit ff74241

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

models/ssh_key.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ func calcFingerprint(publicKeyContent string) (string, error) {
376376
if err != nil {
377377
return "", err
378378
}
379+
defer os.Remove(tmpPath)
379380
stdout, stderr, err := process.GetManager().Exec("AddPublicKey", "ssh-keygen", "-lf", tmpPath)
380381
if err != nil {
381382
return "", fmt.Errorf("'ssh-keygen -lf %s' failed with error '%s': %s", tmpPath, err, stderr)

0 commit comments

Comments
 (0)