nametransform: return EINVAL on invalid padding

With the generic fmt.Errorf we trigger a warning from go-fuse:

  2016/09/21 21:42:31 can't convert error type: Invalid padding
This commit is contained in:
Jakob Unterwurzacher 2016-09-21 21:43:56 +02:00
parent d76e7aadb4
commit 01c18dbcab
1 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import (
"crypto/aes"
"encoding/base64"
"fmt"
"syscall"
"github.com/rfjakob/eme"
@ -46,7 +47,7 @@ func (n *NameTransform) DecryptName(cipherName string, iv []byte) (string, error
// unPad16 returns detailed errors including the position of the
// incorrect bytes. Kill the padding oracle by lumping everything into
// a generic error.
return "", fmt.Errorf("Invalid padding")
return "", syscall.EINVAL
}
plain := string(bin)
return plain, err