165 Commits

Author SHA1 Message Date
Jeffrey Altman
ec37879038 appl/tests: auditdns eliminate use of 'restrict' keyword if !C99
The 'restrict' keyword was introduced in C99 and provides a hint to
the compiler that can be used to better optimized code.  The 'restrict'
keyword results in build failures when the compiler is not C99.

  auditdns.c:101:37: error: expected ‘;’, ‘,’ or ‘)’ before ‘hints’
     const struct addrinfo *restrict hints,
                                     ^
  auditdns.c:409:45: error: expected ‘;’, ‘,’ or ‘)’ before ‘sa’
     getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
                                                 ^

This change defines 'register' to nothing if the compiler does not
implement the C99 standard.

Observed with gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44).
2024-09-03 13:41:22 -04:00
Taylor R Campbell
cb9a130322 auditdns: Cover getnameinfo and gethostbyaddr too.
Fixes the final remaining part of:
https://github.com/heimdal/heimdal/issues/1214
2024-01-09 21:19:30 -06:00
Taylor R Campbell
d73910c588 auditdns: Tidy up minor issues.
- Omit needless semicolon.
- Reject obscene service numbers in getaddrinfo.
- Fix mistake in comment about EAI_NONAME failure branch.

Leftovers from: https://github.com/heimdal/heimdal/pull/1213
2024-01-09 21:19:30 -06:00
Taylor R Campbell
e75e549252 Use AI_NUMERICSERV if block_dns, and use local getaddrinfo to audit.
This change has two parts:

1. Provide our own local implementation of numeric-only getaddrinfo
   in auditdns.c used to audit for DNS leaks, rather than deferring
   to dlsym(RTLD_NEXT, "getaddrinfo"), in terms of inet_pton.

   To keep review and implementation simple, this is limited to
   AI_NUMERICHOST _and_ AI_NUMERICSERV -- this requires that we
   arrange to pass AI_NUMERICSERV in callers too.

2. Wherever we implement block_dns, set AI_NUMERICSERV in addition to
   AI_NUMERICHOST as needed by the new auditdns.c getaddrinfo.

   (In principle this might also avoid other network leaks -- POSIX
   guarantees no name resolution service will be invoked, and gives
   NIS+ as an example.)

   One tiny semantic change to avoid tripping over the auditor:
   kadmin(8) now uses the string "749" rather than the string
   "kerberos-adm".  (Currently we don't audit kadmin(8) for DNS leaks
   but let's avoid leaving a rake to step on.)  Every other caller I
   found is already guaranteed to pass a numeric service rather than
   named service to getaddrinfo.

fix https://github.com/heimdal/heimdal/issues/1212
2024-01-09 16:06:32 -06:00
Taylor R Campbell
ad23636db8 Add a test for potential DNS leaks via symbol interposition.
We build variants of kinit and test_acquire_cred that define their
own symbols rk_dns_lookup, gethostbyname, gethostbyname2, and
getaddrinfo to print a message and abort.  For getaddrinfo, we abort
only if the caller failed to specify AI_NUMERICHOST; otherwise we use
dlsym(RTLD_NEXT, "getaddrinfo") instead.

The new test tests/gss/check-nodns is like tests/gss/check-basic, but
uses kinit_auditdns and test_acquire_cred_auditdns to verify that no
DNS resolution happens.

This test should work and be effective on ELF platforms where the
getaddrinfo function is implemented by the symbol `getaddrinfo'.  On
non-ELF platforms it may not be effective -- and on platforms where
the getaddrinfo function is implemented by another symbol (like
`__getaddrinfo50') it may not work, but we can cross that bridge when
we come to it.

Verified manually that the test fails, with the expected error
message and abort, without `block_dns = yes' in krb5-nodns.conf.  No
automatic test of the mechanism for now because it might not work on
some platforms.

XXX check-nodns.in is copypasta of check-basic.in, should factor out
the common parts so they don't get out of sync.
2024-01-08 10:22:02 -06:00
Nicolas Williams
0bedcc5c62 appl: Fix warnings in test utils 2023-01-04 01:36:03 -06:00
Nicolas Williams
deb0c7f940 uu_server: Fix a few leaks 2022-02-11 15:19:58 -06:00
Nicolas Williams
96b7ea671d gss: Fix warnings 2022-01-14 17:39:05 -06:00
Love Hörnquist Åstrand
37afa01be3 rename roken base64, fixes #107 2014-08-22 20:57:24 -07:00
Love Hornquist Astrand
f17c4a6c5c only check for keytab content where its needed 2013-04-24 16:42:30 -07:00
Love Hornquist Astrand
f97f15a86c bound len 2012-11-27 22:01:37 -08:00
Love Hornquist Astrand
764e701e2d try to unconfuse coverity 2012-11-27 21:58:05 -08:00
Marco Molteni
8cdcd53a5a Add comments to tcp_server.c, to make it easier for a newcomer to understand the krb5 API usage.
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2012-05-09 08:15:51 +02:00
Marco Molteni
e242c40746 Verify the existence of the keytab for tcp_server, gssapi_server
appl/test/tcp_server and gssapi_server try to open the keytab file only when processing a connection.

This patch verifies the existence of the keytab file on program startup, so that troubleshooting is easier. In addition it adds some comments.

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2012-05-01 23:01:19 +02:00
Love Hörnquist Åstrand
d791e70894 support ipv6 2012-03-07 07:58:50 -08:00
Roland C. Dowdeswell
cc47c8fa7b Turn on -Wextra -Wno-sign-compare -Wno-unused-paramter and fix issues.
We turn on a few extra warnings and fix the fallout that occurs
when building with --enable-developer.  Note that we get different
warnings on different machines and so this will be a work in
progress.  So far, we have built on NetBSD/amd64 5.99.64 (which
uses gcc 4.5.3) and Ubuntu 10.04.3 LTS (which uses gcc 4.4.3).

Notably, we fixed

	1.  a lot of missing structure initialisers,

	2.  unchecked return values for functions that glibc
	    marks as __attribute__((warn-unused-result)),

	3.  made minor modifications to slc and asn1_compile
	    which can generate code which generates warnings,
	    and

	4.  a few stragglers here and there.

We turned off the extended warnings for many programs in appl/ as
they are nearing the end of their useful lifetime, e.g.  rsh, rcp,
popper, ftp and telnet.

Interestingly, glibc's strncmp() macro needed to be worked around
whereas the function calls did not.

We have not yet tried this on 32 bit platforms, so there will be
a few more warnings when we do.
2012-02-20 19:45:41 +00:00
Love Hornquist Astrand
84caf5bbd8 jgssapi_server is a java file 2011-11-09 08:04:52 -08:00
Love Hornquist Astrand
483afb3390 avoid compile warning 2011-10-29 19:14:14 -07:00
Love Hornquist Astrand
00773b4119 test verify_mic is both directions 2011-09-25 20:38:17 +02:00
Love Hornquist Astrand
d9dc7c9761 try read message in java code too 2011-09-25 19:40:02 +02:00
Love Hornquist Astrand
aabe9f0f4a let client do unwrap, handle keytab for gss 2011-09-22 16:10:06 +02:00
Love Hornquist Astrand
d3b5bc36fe support ipv6 and don't use channelbindings 2011-08-10 17:25:09 -07:00
Love Hornquist Astrand
960b5d4c5b include jgssapi_server.c 2011-08-10 17:24:20 -07:00
Love Hornquist Astrand
ed573ce9fa test java gssapi server 2011-08-10 17:24:01 -07:00
Love Hörnquist Åstrand
7aaba443bc add NTMakefile and windows directories 2011-07-17 12:16:59 -07:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Luke Howard
79ff133ae9 make gss_acquire_cred_ext private 2011-05-20 14:31:08 +02:00
Luke Howard
b9c96aa6de use gss_acquire_cred_ext in test app 2011-05-14 17:13:51 +02:00
Luke Howard
e128b0ca01 Merge branch 'master' into lukeh/moonshot
Conflicts:
	lib/gssapi/krb5/external.c
	lib/libedit/src/vi.c
2011-05-12 13:04:55 +02:00
Love Hornquist Astrand
0363c62520 no more strndup 2011-05-04 21:53:10 -07:00
Luke Howard
0fbfe9b38e Revert MIT code from gss test application 2011-03-22 16:51:30 +11:00
Luke Howard
9455577b65 Merge branch 'master' of github.com:heimdal/heimdal
Conflicts:
	lib/gssapi/gssapi/gssapi.h
	lib/gssapi/gssapi_mech.h
	lib/gssapi/mech/gss_mech_switch.c
2011-03-20 19:08:10 +11:00
Love Hornquist Astrand
679c708f5f use krb5_err() instead of krb5_get_err_text() 2011-03-12 13:35:21 -08:00
Asanka Herath
d00f9984a5 Make roken build on windows
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2009-11-24 21:42:02 -08:00
Love Hornquist Astrand
c6bbdb545b First drop of Windows build infrastructure from Secure Endpoints 2009-11-24 12:12:53 -08:00
Love Hörnquist Åstrand
c045e38e44 use krb5_principal_get_realm
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25110 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-16 07:59:55 +00:00
Love Hörnquist Åstrand
3b181a7dab use gssapi/*.h
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24399 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:37:49 +00:00
Love Hörnquist Åstrand
e3fc4a73cb use gssapi/*.h
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24398 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:37:39 +00:00
Love Hörnquist Åstrand
92237c38a7 use gssapi/*.h
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24397 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:37:29 +00:00
Love Hörnquist Åstrand
aab4e5a9ca use gssapi/*.h
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24396 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:37:20 +00:00
Love Hörnquist Åstrand
aebaed1535 use gssapi/*.h
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24395 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:37:10 +00:00
Love Hörnquist Åstrand
25a7b258ea make sure we dont print off the end of the gss_buffer_t, they are defined to not included NULL, in heimdal they are but thats an implementation detail, dont teach people about that. From: Christian Krause
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24035 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-11-12 04:19:52 +00:00
Love Hörnquist Åstrand
63a449b610 use gsskrb5_extract_authz_data_from_sec_context()
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23874 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-10-08 16:14:30 +00:00
Love Hörnquist Åstrand
6937d41a02 remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 09:21:03 +00:00
Love Hörnquist Åstrand
e172367898 switch to utf8 encoding of all files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 08:53:55 +00:00
Love Hörnquist Åstrand
fb2afb96fd catch error
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23514 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-11 10:01:11 +00:00
Love Hörnquist Åstrand
ae597b8166 catch error
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23511 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-11 10:00:57 +00:00
Love Hörnquist Åstrand
259576387c Fix pointer vs strict alias rules.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21522 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-07-12 13:15:04 +00:00
Love Hörnquist Åstrand
b49b2cdabf Fix pointer vs strict alias rules.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21521 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-07-12 13:13:40 +00:00
Love Hörnquist Åstrand
cc4333b758 remove cvs ignore files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21026 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-06-09 03:09:59 +00:00