Using std::regex for pkinit on Windows

Greg Hudson ghudson at mit.edu
Sat Nov 23 17:25:29 EST 2024


On 11/23/24 13:38, Ken Hornstein wrote:
> In terms of mechanics, are you thinking of having every caller make
> calls into krb5int_regcomp() (and associated functions) and put the
> compatibility glue in libkrb5support?

The ideal would be that code using regular expressions would include a 
<k5-regex.h> from src/include and use the POSIX APIs.  On POSIX 
platforms this header would include <regex.h> and otherwise do nothing; 
on Windows it would #define the POSIX symbols to k5_ symbols implemented 
in libkrb5support.

If it's not possible to express the POSIX API perfectly in terms of 
std::regex, then we can invent a least-common-denominator API with k5_ 
names.  In that case, k5-regex.h would use macros or inline functions to 
express the common API in terms of the POSIX ones on POSIX platforms, 
and they would be implemented in libkrb5support otherwise.
> There is some support for older regular expression libraries that use
> the functions compile() and re_comp().

It looks like we used to have this for an2ln in 1.11, and I got rid of 
it for 1.12.  Nobody has complained about it.  So I think we can safely 
assume POSIX regex.h for Unix-like platforms, and expunge any 
compatibility code using older regex APIs.



More information about the krbdev mailing list