From fb6bc18dba8a176d9b634576394a09922890b40d Mon Sep 17 00:00:00 2001 From: schwarze <> Date: Fri, 21 Nov 2014 12:44:18 +0000 Subject: [PATCH] add ERRORS, HISTORY, AUTHORS, Copyright year, and some missing macros; ok tedu@ on a previous version --- src/lib/libc/crypt/crypt_checkpass.3 | 45 ++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/src/lib/libc/crypt/crypt_checkpass.3 b/src/lib/libc/crypt/crypt_checkpass.3 index 479a7864..0c9b673f 100644 --- a/src/lib/libc/crypt/crypt_checkpass.3 +++ b/src/lib/libc/crypt/crypt_checkpass.3 @@ -1,6 +1,6 @@ -.\" $OpenBSD: crypt_checkpass.3,v 1.2 2014/11/21 05:13:44 tedu Exp $ +.\" $OpenBSD: crypt_checkpass.3,v 1.3 2014/11/21 12:44:18 schwarze Exp $ .\" -.\" Copyright (c) Ted Unangst +.\" Copyright (c) 2014 Ted Unangst .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above @@ -34,10 +34,13 @@ function is provided to simplify checking a user's password. If both the hash and the password are the empty string, authentication is a success. Otherwise, the password is hashed and compared to the provided hash. -If the hash is NULL, authentication will always fail, but a default +If the hash is +.Dv NULL, +authentication will always fail, but a default amount of work is performed to simulate the hashing operation. A successful match will return 0. -A failure will return \-1 and set errno. +A failure will return \-1 and set +.Xr errno 2 . .Pp The .Fn crypt_newhash @@ -52,9 +55,39 @@ argument identifies the preferred hashing algorithm and parameters. Refer to .Xr login.conf 5 . .Sh RETURN VALUES -These functions -return 0 on success and -1 on failure. +.Rv -std crypt_checkpass crypt_newhash +.Sh ERRORS +The +.Fn crypt_checkpass +function sets +.Va errno +to +.Er EACCESS +when authentication fails. +.Pp +The +.Fn crypt_newhash +function sets +.Va errno +to +.Er EINVAL +or any of the errors specified for +.Xr strtonum 3 +if +.Fa pref +is unsupported. .Sh SEE ALSO .Xr crypt 3 , .Xr login.conf 5 , .Xr passwd 5 +.Sh HISTORY +The function +.Fn crypt_checkpass +first appeared in +.Ox 5.6 , +and +.Fn crypt_newhash +in +.Ox 5.7 . +.Sh AUTHORS +.An Ted Unangst Aq Mt tedu@openbsd.org