-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
According to the docs:
Any C function (even void functions) may be called in a multiple assignment context to retrieve both the return value (if any) and the C
errno
variable as an error
But crypt()
does not set errno
, and the call to C.crypt()
is building a error
variable with a value of some other call. If errno
is not 0, then err
is not nil
. Both
https://github.com/amoghe/go-crypt/blob/master/crypt.go#L41
and
https://github.com/amoghe/go-crypt/blob/master/crypt.go#L48
are returning an unrelated value.
So this code might or might fail:
password, err := Crypt(password, salt)
if err != nil {
// TODO: oh no!
log.Printf("crypt: [%v] %v", password, err)
return err
}
Like this:
2019/11/12 05:56:42 $6$iq.dbF2KUB2h, x
2019/11/12 05:56:42 crypt: [$6$iq.dbF2KUB2h$nV.xPcJUqHN1r46FQ/MJJc7OVbSb5Yd4nsOLU.XZ3QsVdwgGjqVoNeEx.u8MIFC1seQcS8jAelI95Z8BlBmeC/] errno -8191
Metadata
Metadata
Assignees
Labels
No labels