Age | Commit message (Collapse) | Author |
|
|
|
to use RAND_bytes() instead.
Modified by Philip Prindeville <philipp@redfish-solutions.com>
|
|
|
|
|
|
For ASCII login, data field is not used ([1] Section 9.0.2 Inbound ASCII Login).
So do not add the user password for the login authentication with type ASCII.
[1] https://tools.ietf.org/html/draft-grant-tacacs-02
|
|
Reorg magic
|
|
Add runtime debugging
|
|
Add --enable-runtime-debugging option to ./configure.
Add example logmsg() to tacc.c so it can be built with debugging.
Fix logmsg() prototype (it's supposed to match the prototype of
syslog() which returns void).
Export build-time value of --enable-runtime-debugging into libtac.pc.
|
|
|
|
|
|
The pseudo-random number function magic() needs to be primed via
magic_init() before being invoked. The standard (but klunky) way
of handling this is with a static bool inside the function which
indicates whether initialization has happened, and if not, handles
initialization and then sets the flag.
Sometimes it's more desireable to have initialization happen in
a known order before program execution starts (this helps with
reproducibility). We can do this by indicating to the compiler/
linker that particular functions need to be executed after __start()
but before main().
|
|
|
|
authenticate() doesn't handle the case of an ASCII login which
results in a continue request being required to complete the
transaction.
|
|
Wrong subscript (subscript of digest should always be modulo
digest size [16 bytes]).
|
|
Various cryptography improvements
|
|
Also, correct the -DTACDEBUG_AT_RUNTIME scenario so that TACDEBUG()
binds correct when used in an if-body with an else following it, e.g.:
if (test)
TACDEBUG(LOG_DEBUG, "test is true");
else
return;
would previously have ended up as expanding to:
if (test)
if (tac_debug_enable) logmsg(LOG_DEBUG, "test is true");
else
return;
with the indent redone to reflect the nesting correctly. This now
expands (correctly) to:
if (test)
do { if (tac_debug_enable) logmsg(LOG_DEBUG, "test is true"); } while (0);
else
return;
|
|
It's easier to read, debug, and maintain that way.
Also, avoid unnecessary marshalling while we're at it, since
MD5Update() can be called iteratively, which obviates having to
gather the data to be digested into a contiguous buffer.
|
|
This saves us having to marshall data and allocate a buffer for
the entire pad (bitstream cipher). We only need it in blocks of
16 bytes (the size of the MD5 digest), so let's compute it piecemeal
as we need it.
This has the added benefit of avoiding any calls to malloc() which
might be result in system calls (i.e. sbrk() to extend the heap).
|
|
Why make copies of the payload length to pass as parameters when
it's already present in the header?
|
|
MD5Update supports incremental digesting, so we can invoke it
multiple times to collect data rather than having to marshall it
into a contiguous buffer.
|
|
So make that parameter be 'const' instead.
|
|
More factoring of the cleanup code for tac_connect_single
|
|
|
|
Commit 654b79e removed a very similar check, but with the new
common exit strategy for this function, it is in fact possible to
have fd be set without having copied fd into retval (i.e. retval
still being set to an error value, which is negative).
|
|
This is so that tracing is always the same, even when exceptions occur.
|
|
Turn on stricter compiler warnings
|
|
Fix the prototyping in lib/md5.h.
Accommodate the function name differences between lib/md5.h and
the equivalent functions in openssl/md5.h.
Accommodate replacement of MD5_LEN with MD5_LBLOCK (note that
MD5_CBLOCK and MD5_DIGEST_LEN aren't referenced) and use this
consistently.
|
|
And fix subsequent warnings caused by:
- shadowed variables (i.e. variables existing in nested scopes);
- signed vs. unsigned comparisons
- string pointers and buffers being unsigned which don't need to be;
- unnecessary casts;
- unused variables (or only used when debugging is enabled);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Fix various declaration inconsistencies that were throwing compiler
warnings
|
|
The getrandom(2) is experimental (on Linux at least) and the presence of
headers doesn't guarantee it's usable. It seems to be available from
3.17 kernels only as syscall.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|