Commit Graph

37 Commits

Author SHA1 Message Date
Nicolas Williams
686d5116de roken: Unparse wider ints 2021-12-18 11:34:12 +11:00
Nicolas Williams
f6ac4ee864 roken: Fix parse flags bug 2021-06-22 13:01:24 -05:00
Nicolas Williams
8af2d79d35 hx509: Add missing CSR extension request support
This is necessary in order to add proper support for CSRs in kx509,
where the KDC can examine all requested KUs/EKUs/SANs, check
authorization, and issue a certificate with all those extensions if
authorized.

This is the convention used by OpenSSL, of encoding all the KU, EKUs,
and SANs being requested as Extensions as they would appear in the
TBSCertificate, then putting those in as a single Attribute in the CSR's
Attributes list with attribute OID {id-pkcs-9, 14}.

 - expose all hx509_request_*() functions
 - finish support in hx509_request_parse*() for KU, EKU, and SAN CSR
   attributes
 - finish support in hx509_request_to_pkcs10() for encoding all
   requested KU, EKU, and SAN extensions as a CSR extReq (extension request)
 - add hx509_request_add_*() support for:
    - id-pkinit-san and ms-upn-pkinit-san
    - XMPP (Jabber) SAN
    - registeredID (useless but trivial)
 - add hxtool request-create options for all supported SANs
 - add hxtool request-create options for KeyUsage
 - add hxtool request-create options for ExtKeyUsage
 - add hxtool request-print support for all these things
 - fix bugs in existing id-pkinit-san handling

Possible future improvements

 - add HX509_TRACE env var and support (it would be nice to be able to
   observe why some certificate is rejected, or not matched in a query)
 - add testing that CSR creating and printing round-trip for all KUs,
   EKUs, and SANs
   (probably in tests/kdc/check-pkinit.in)
 - add testing that OpenSSL can print a CSR made by hxtool and
   vice-versa
 - hxtool ca: add KU sanity checking (via hx509_ca_sign() and/or friends)
   (don't allow encrypt for signing-only algs)
   (don't allow encrypt for RSA at all, or for RSA with small e exponents)
 - hxtool request-print: warn about all unknown attributes and
   extensions
 - hxtool ca: MAYBE add support for adding requested extensions from the
   --req=CSR
   ("Maybe" because CA operators should really verify and authorize all
    requested attributes, and should acknowledge that they have, and the
    simplest way to do this is to make them add all the corresponding
    CLI arguments to the hxtool ca command, but too, that is
    error-prone, thus it's not clear yet which approach is best.
    Perhaps interactively prompt for yes/no for each attribute.)
 - add additional SAN types:
    - iPAddress                 (useless?)
    - dNSSrv                    (useful!)
    - directoryName             (useless, but trivial)
    - uniformResourceIdentifier (useful)
 - it would be nice if the ASN.1 compiler could generate print
   functions..., and/or even better, to-JSON functions
 - it would be nice if we had a known-OID db, including the names of the
   types they refer to in certificate extensions, otherName SANs and CSR
   attributes, then we could generate a CSR and certificate printer for
   all known options even when they are not supported by the rest of
   Heimdal
    - and we could also get friendly names for OIDs, and we could
      resolve their arc names
    - longer term, we could also stand to add some ASN.1 information
      object system functionality, just enough to make
      lib/hx509/asn1_print awesome by being able to automatically decode
      all heim_any and OCTET STRING content (better than its current
      --inner option)
2019-10-08 22:20:40 -05:00
Nicolas Williams
af9e938867 Fix infinite loop in print_units_table() 2018-12-25 22:11:19 -06:00
Daria Phoebe Brashear
7333c2c945 roken: parse_units returns void
despite the fact that the called function returns void,
returning a result here throws an error with solaris cc.

just call the function and don't return
2018-04-19 13:12:59 -04:00
Jeffrey Altman
7ee3cc6855 Update parse_units.c 2018-04-04 11:27:23 -04:00
Harald Barth
7a2767e610 Make parse_units() handle trailing whitespace
Skipping any trailing whitespace characters
2018-04-04 11:27:23 -04:00
Viktor Dukhovni
b860b70ada Fix missing rk_ prefix 2017-10-17 03:11:55 -04:00
Viktor Dukhovni
d73ec2510a Try to avoid parse_{time,units,flags} symbol conflicts
On Debian stretch systems PAM modules linked against Heimdal run into
symbol conflicts with parse_time() in systemd libraries.  We redefine
parse_time() and friends to rk_parse_time(), ... while keeping the old
names for ABI compatibility with existing clients.

The legacy names should eventually be droppped.
2017-08-23 15:09:11 -05:00
Love Hornquist Astrand
f5f9014c90 Warning fixes from Christos Zoulas
- shadowed variables
- signed/unsigned confusion
- const lossage
- incomplete structure initializations
- unused code
2011-04-29 20:25:05 -07:00
Love Hornquist Astrand
7a7061ac70 use strtol 2009-12-23 17:07:36 +01: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 Hörnquist Åstrand
0d31d3d686 drop rcsid
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24356 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:30:37 +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
1d7cce4014 make max_sz int since it will passed to %*s
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23487 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-11 09:58:29 +00:00
Love Hörnquist Åstrand
5cd0815781 use "roken.h" consitantly
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21005 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-06-08 01:54:35 +00:00
Love Hörnquist Åstrand
9df9f6a9da revert 21003
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21004 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-06-08 01:53:10 +00:00
Love Hörnquist Åstrand
12df8538af use "roken.h" consitantly
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21003 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-06-08 01:42:05 +00:00
Love Hörnquist Åstrand
709aa58c74 define ROKEN_LIB_FUNCTION on all exported functions
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14773 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-04-12 11:29:18 +00:00
Love Hörnquist Åstrand
3eeb75e552 make previous commit really work
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14699 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-03-30 16:53:19 +00:00
Love Hörnquist Åstrand
dbba0be7b2 avoid shadowing div
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14696 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-03-30 16:43:52 +00:00
Love Hörnquist Åstrand
78e5e11b1a Change the behavior of the parse_unit code to return the number of
bytes needed to print the whole string (minus the trailing '\0'), just
like snprintf.  Idea from bugreport from Gabriel Kihlman <gk@stacken.kth.se>.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14324 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-10-30 22:33:08 +00:00
Assar Westerlund
0a5f6ffdd9 use int instead of size_t as return values to be compatible with snprintf
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10655 ec53bebd-3082-4978-b11e-865c3cabbd6b
2001-09-04 09:56:00 +00:00
Assar Westerlund
75ffa984b1 (parse_something): do not check the return value from strtod, it might
return != 0.0 when the string has no digits.  just testing if it
consumed any characters is enough and more resilient


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9758 ec53bebd-3082-4978-b11e-865c3cabbd6b
2001-03-26 00:47:06 +00:00
Johan Danielsson
3ca5f8150f remove advertising clause
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7463 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-12-02 16:58:55 +00:00
Assar Westerlund
a17faa3b99 (parse_something): try to handle the case of no value specified a
little bit better


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7322 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-11-07 11:10:03 +00:00
Assar Westerlund
2dbeee4ddc (acc_units): move the special case of 0 -> 1 to parse_something to
avoid having it happen at the end of the string


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6358 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-06-23 12:41:35 +00:00
Assar Westerlund
fb8d7e5910 unsigned char-correctness
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5269 ec53bebd-3082-4978-b11e-865c3cabbd6b
1998-12-20 15:36:03 +00:00
Assar Westerlund
617e2be4a3 (parse_something): func is called with val == 0 if no unit was given
(acc_flags, acc_units): update to new standard


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5263 ec53bebd-3082-4978-b11e-865c3cabbd6b
1998-12-06 18:52:09 +00:00
Assar Westerlund
66b3034e8e more braces
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5226 ec53bebd-3082-4978-b11e-865c3cabbd6b
1998-11-22 09:45:42 +00:00
Assar Westerlund
a42a349ed6 (unparse_units_approx): new function that will only print the first unit.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4442 ec53bebd-3082-4978-b11e-865c3cabbd6b
1998-02-20 07:51:04 +00:00
Assar Westerlund
c696f60eb3 (print_flags_table, print_units_table): new functions
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4217 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-12-17 03:21:31 +00:00
Johan Danielsson
2e46dd73d2 Change the list of separating characters (between units) to comma,
space, and tab, removing digits. Having digits in this list makes a
flag like `T42 generate a parse error. This change makes `17m3s' an
invalid time-spec (you need a space).


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3932 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-11-11 20:12:02 +00:00
Assar Westerlund
076ee4208c (parse_something): ignore white-space and ','
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3828 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-11-09 01:00:06 +00:00
Assar Westerlund
fa382cbd3f generalised parse_units' and unparse_units' and added new functions
`parse_flags' and `unparse_flags' that use these


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3237 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-08-28 22:12:30 +00:00
Assar Westerlund
8cae578cb0 new files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2621 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-07-24 11:31:43 +00:00