1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2025-02-08 03:54:18 +01:00

32 Commits

Author SHA1 Message Date
Karol Babioch
c32ddd9665 Limit action length when parsing arguments
This limits the allowable action length when arguments are parsed to
ACTION_MAX_LEN, since this might be exploited otherwise.
2018-05-04 17:06:59 +02:00
Karol Babioch
89c1622ba2 Use strncpy() instead of strcpy()
Not an issue, just the former is considered good practice.
2018-05-04 17:05:43 +02:00
Karol Babioch
66265a3343 ykpamcfg: Use snprintf() instead of strncpy()
strncpy() is _NOT_ a safe version of strcpy() and it should not be used
(ineffective and dangerous since a NUL termination might be missing).
Instead snprintf() the way to safely construct a string with a given
limit. This commit implements this for the action parsing in ykpamcfg.
2018-05-04 17:05:38 +02:00
Karol Babioch
a7c1d0adfd Check whether fullpath can be constructed correctly
This checks the return code of snprintf() and makes sure that fullpath
actually fits into a buffer of size PATH_MAX. Otherwise, it will output
an error and exit.
2018-05-04 17:05:29 +02:00
Karol Babioch
daad39345d Make use of PATH_MAX for fullpath
Instead of hardcoding the buffer size to 256, using PATH_MAX makes more
sense here, since this can be defined differently on different
platforms. This is not perfect, though, refer to [1] for some details.
In our case it should be good enough.

[1]: https://eklitzke.org/path-max-is-tricky
2018-05-04 17:05:15 +02:00
Karol Babioch
320f487265 Spell YubiKey consistently
This makes sure that YubiKey is spelled consistently throughout the project,
since it was spelled in many different ways beforehand.
2018-05-03 10:59:44 +02:00
Karol Babioch
bb3e2030eb Fix a couple of typos and spell phrases more consistently
Certain phrases (Challenge-response) were not spelled consistently
throughout the project. This commit adjusts for that and fixes a
couple of typos along the way and uses the base form of verbs in
case of error messages.
2018-04-25 15:22:30 +02:00
Karol Babioch
e5bd2ef844 Open file handlers manually using open() and fdopen() instead of using fopen()
A previous commit (d51124e) added the `e` flag to the `fopen()` calls. However
this flag is not supported on all platforms (MacOS) and will be silently
dropped (see #145). This patch works around those issues by manually opening
the file descriptor using `open()` with the `O_CLOEXEC` flag, and invoking
`fd_open()` on the resulting file descriptor to open an appropriate `FILE`
stream.

This makes sure that all files used by pam_yubico will be opened with the
`O_CLOEXEC` flag on all supported platforms to mitigate issues with missing
`fclose()` invocation (see #136).
2018-04-11 14:15:53 +02:00
Karol Babioch
d51124e884 Add "e" flag to fopen() calls
This adds the `e` flag to fopen() calls, making sure the `O_CLOEXEC` flag is
used. This makes sure that the file descriptor is being closed and not leaked
into child processes. This was an issues previously due to a missing fclose()
(#136).
2018-04-10 11:28:03 +02:00
Klas Lindfors
fc9a4255f0 refactor the debug mode
add a debug_file option for where to write debug info (default to stdout)
stop compiling with DEBUG_PAM and PAM_DEBUG
make debugging behave the same way on linux-pam and openpam
2016-06-16 09:02:49 +02:00
Klas Lindfors
9eb630a383 use umask instead of chmod to set file permissions 2016-06-03 09:08:22 +02:00
Klas Lindfors
0a1051f6df check that file doesn't exist before we try to write it 2016-03-31 10:13:00 +02:00
Klas Lindfors
7639f4684a set file permissions when creating a new challenge file 2016-03-31 10:12:03 +02:00
Klas Lindfors
70f27b98a2 include pwd.h in util.h 2015-09-09 08:24:57 +02:00
Klas Lindfors
237ed18b9f use pam_modutil_getpwnam() if it's available
also refactor to pass in a passwd struct to the util functions
2015-09-08 09:15:07 +02:00
Klas Lindfors
ec730d7cb4 add -V for version to ykpamcfg and exit earlier
also error on any part of iterations being non-numeric
2015-02-12 13:38:57 +01:00
Klas Lindfors
e2f9a7b95c don't write to a constant pointer
instead allocate action on the stack and copy the data there
2014-10-31 09:21:06 +01:00
Simon Josefsson
43cd3b4621 Update copyright years. 2014-04-30 13:16:09 +02:00
Klas Lindfors
eb1ba8a52a update copyright years 2013-09-19 08:35:15 +02:00
Klas Lindfors
ba4e56667b add -i switch for setting iterations with ykpamcfg 2013-09-18 14:10:35 +02:00
Klas Lindfors
307c88d76d fix warnings 2013-09-18 14:10:35 +02:00
Klas Lindfors
eb78d4882b refactor to use chalresp function from ykpers
so challenge_response() now calls yk_challenge_response() to
do the yubikey internal stuff.
2013-09-18 14:10:35 +02:00
Tommaso Galassi De Orchi
1eff1ad71b New feature, create directory in the user home. 2012-11-14 14:14:06 +01:00
Tommaso Galassi De Orchi
ad27af3518 Added option to specify a path for ykpamcfg. 2012-11-14 10:43:47 +01:00
Klas Lindfors
6db8c640ef add check that two challenges get different responses 2012-06-08 13:19:24 +02:00
Fredrik Thulin
fb6281fa3f Fix clang indicated printf format warnings. 2012-02-08 15:53:18 +01:00
Simon Josefsson
3828953374 Bump version. Use silent rules. Bump copyright years. 2012-01-23 20:25:06 +01:00
Fredrik Thulin
4ce59833ba Further pointer signedness fixes. 2011-12-06 13:46:30 +01:00
Fredrik Thulin
fa8a9ff074 Fix pointer signedness warnings. 2011-12-06 11:56:52 +01:00
Fredrik Thulin
8930cca53e parse_args: getopt() return value is int. 2011-11-22 11:03:51 +01:00
Fredrik Thulin
1d62f8d48b whitespace 2011-04-11 14:49:02 +02:00
Fredrik Thulin
839b33a0a1 Add ykpamcfg - C/R setup command line utility. 2011-03-18 22:57:46 +01:00