Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
efb4250
Initial prototypes for new X.509 certificate support (Issue #53)
michaelrsweet Apr 11, 2023
3da4b2f
Save work on new cupsMakeCredentials.
michaelrsweet Apr 14, 2023
6b6c820
Add credential type argument to cupsMakeServerCredentials.
michaelrsweet Apr 14, 2023
d630e9e
Save work.
michaelrsweet Apr 14, 2023
e7a984b
Fix some Coverity issues.
michaelrsweet Apr 22, 2023
8a70202
Fix compile error
michaelrsweet Apr 23, 2023
9e3f272
Rework OpenSSL X.509 extension handling.
michaelrsweet May 4, 2023
ff12bf3
Stub out a new unit test/test command for the credentials APIs.
michaelrsweet May 4, 2023
101006e
More cert test stuff.
michaelrsweet May 7, 2023
79d237d
Separate 'unittests' target, drop 'local' target.
michaelrsweet May 7, 2023
677e1bd
Fix up subjectAltName support.
michaelrsweet May 8, 2023
2d570f3
Don't use _cupsStrAlloc for globals - causes recursion.
michaelrsweet May 8, 2023
db2cd3d
Fix testpwg.
michaelrsweet May 10, 2023
3b2aa18
Save additions to support server mode in testcreds.
michaelrsweet May 12, 2023
4f73e48
Mirror JSON output fix from CUPS 2.x repo.
michaelrsweet May 13, 2023
8b05605
Save work.
michaelrsweet May 16, 2023
ca61e3b
Fix OpenSSL key generation to use modern API that doesn't crash with …
michaelrsweet May 16, 2023
cf992f5
Save work on GNU TLS.
michaelrsweet May 16, 2023
57d3a3d
Implement root certificate/key support.
michaelrsweet May 16, 2023
41255a8
Add GNU TLS CSR generation, clean up CRT generation.
michaelrsweet May 18, 2023
97e2b7c
Fix typos in new CSR code.
michaelrsweet May 18, 2023
6227ff6
Save work.
michaelrsweet May 25, 2023
79af0a9
Copy extensions from request to certificate.
michaelrsweet May 25, 2023
8335d5b
Save more work.
michaelrsweet May 26, 2023
453159f
Implement the rest of the X.509 request validation code in cupsSignCr…
michaelrsweet May 31, 2023
e20bd45
Save work on GNU TLS version of cupsSignCredentialsRequest.
michaelrsweet May 31, 2023
20cc44b
Finalize GNU TLS version of cupsSignCredentialsRequest.
michaelrsweet May 31, 2023
5ea0717
Add testcreds to test suite.
michaelrsweet Jun 1, 2023
9195144
Update to use C99 comments.
michaelrsweet Jun 1, 2023
5d17c1e
Documentation.
michaelrsweet Jun 1, 2023
513839f
Fix usage output.
michaelrsweet Jun 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/configure~
/cups3.pc
/Makedefs
/cups/.testssl
/cups/fuzzipp
/cups/libcups.a
/cups/libcups.dylib
Expand All @@ -23,6 +24,7 @@
/cups/locale/
/cups/rasterbench
/cups/test.json
/cups/test.log
/cups/test.pwg
/cups/test.raster
/cups/testarray
Expand Down
8 changes: 0 additions & 8 deletions Makedefs.in
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ INSTALL_LIB = $(INSTALL) -c -m 755
INSTALL_MAN = $(INSTALL) -c -m 444


#
# Cross-compilation support: "local" target is used for any tools that are
# built and run locally.
#

LOCALTARGET = @LOCALTARGET@


#
# Libraries...
#
Expand Down
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Top-level Makefile for libcups.
#
# Copyright © 2020-2022 by OpenPrinting
# Copyright © 2020-2023 by OpenPrinting
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more
# information.
Expand Down Expand Up @@ -100,6 +100,17 @@ uninstall:
done


#
# Build all unit tests...
#

unittests: all
for dir in $(DIRS); do\
echo "======== unittests in $$dir ========";\
(cd $$dir ; $(MAKE) $(MFLAGS) unittests) || exit 1;\
done


#
# Test everything...
#
Expand Down
44 changes: 21 additions & 23 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,6 @@ CC
OPTIM
DSOFLAGS
CODE_SIGN
LOCALTARGET
host_os
host_vendor
host_cpu
Expand Down Expand Up @@ -745,7 +744,7 @@ enable_static
enable_shared
enable_debug
enable_maintainer
enable_sanitizer
with_sanitizer
with_dsoflags
with_ldflags
with_domainsocket
Expand Down Expand Up @@ -1386,13 +1385,14 @@ Optional Features:
--disable-shared do not install shared library
--enable-debug turn on debugging, default=no
--enable-maintainer turn on maintainer mode, default=no
--enable-sanitizer build with AddressSanitizer, default=no

Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-dnssd=LIBRARY set DNS-SD library (auto, avahi, mdnsresponder)
--with-tls=... use gnutls or openssl/libressl for TLS support
--with-sanitizer build with address, leak, memory, thread, or
undefined sanitizer, default=no
--with-dsoflags=... Specify additional DSOFLAGS
--with-ldflags=... Specify additional LDFLAGS
--with-domainsocket set unix domain socket name
Expand Down Expand Up @@ -2558,20 +2558,6 @@ then :
fi


if test "$build" = "$host"
then :

# No, build local targets
LOCALTARGET="local"

else $as_nop

# Yes, don't build local targets
LOCALTARGET=""

fi


for ac_prog in codesign true
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
Expand Down Expand Up @@ -5217,12 +5203,24 @@ then :
enableval=$enable_maintainer;
fi

# Check whether --enable-sanitizer was given.
if test ${enable_sanitizer+y}

# Check whether --with-sanitizer was given.
if test ${with_sanitizer+y}
then :
enableval=$enable_sanitizer;
withval=$with_sanitizer;
fi

if test "x$with_sanitizer" = x
then :

with_sanitizer="address"

elif test "$with_sanitizer" != address -a "$with_sanitizer" != leak -a "$with_sanitizer" != memory -a "$with_sanitizer" != no -a "$with_sanitizer" != thread -a "$with_sanitizer" != undefined
then :

as_fn_error $? "Unsupported --with-sanitizer value \"$with_sanitizer\" specified." "$LINENO" 5

fi

if test x$enable_debug = xyes
then :
Expand All @@ -5248,11 +5246,11 @@ WARNINGS=""
if test -n "$GCC"
then :

if test x$enable_sanitizer = xyes
if test x$with_sanitizer != xno
then :

# Use -fsanitize=address with debugging...
OPTIM="$OPTIM -fsanitize=address"
# Use -fsanitize=FOO with debugging...
OPTIM="$OPTIM -fsanitize=$with_sanitizer"

elif echo "$CPPFLAGS $CFLAGS" | grep -q _FORTIFY_SOURCE
then :
Expand Down
22 changes: 9 additions & 13 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@ AS_IF([test "x$host_os_version" = x], [


dnl Determine whether we are cross-compiling...
AS_IF([test "$build" = "$host"], [
# No, build local targets
LOCALTARGET="local"
], [
# Yes, don't build local targets
LOCALTARGET=""
])
AC_SUBST([LOCALTARGET])

AC_PATH_PROGS([CODE_SIGN], [codesign true])


Expand Down Expand Up @@ -463,7 +454,12 @@ AC_SUBST([LIBCUPS_STATIC])
dnl Extra compiler options...
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [turn on debugging, default=no]))
AC_ARG_ENABLE([maintainer], AS_HELP_STRING([--enable-maintainer], [turn on maintainer mode, default=no]))
AC_ARG_ENABLE([sanitizer], AS_HELP_STRING([--enable-sanitizer], [build with AddressSanitizer, default=no]))
AC_ARG_WITH([sanitizer], AS_HELP_STRING([--with-sanitizer], [build with address, leak, memory, thread, or undefined sanitizer, default=no]))
AS_IF([test "x$with_sanitizer" = x], [
with_sanitizer="address"
], [test "$with_sanitizer" != address -a "$with_sanitizer" != leak -a "$with_sanitizer" != memory -a "$with_sanitizer" != no -a "$with_sanitizer" != thread -a "$with_sanitizer" != undefined], [
AC_MSG_ERROR([Unsupported --with-sanitizer value "$with_sanitizer" specified.])
])

AS_IF([test x$enable_debug = xyes], [
CSFLAGS=""
Expand All @@ -482,9 +478,9 @@ WARNINGS=""
AC_SUBST([WARNINGS])

AS_IF([test -n "$GCC"], [
AS_IF([test x$enable_sanitizer = xyes], [
# Use -fsanitize=address with debugging...
OPTIM="$OPTIM -fsanitize=address"
AS_IF([test x$with_sanitizer != xno], [
# Use -fsanitize=FOO with debugging...
OPTIM="$OPTIM -fsanitize=$with_sanitizer"
], [echo "$CPPFLAGS $CFLAGS" | grep -q _FORTIFY_SOURCE], [
# Don't add _FORTIFY_SOURCE if it is already there
], [
Expand Down
34 changes: 29 additions & 5 deletions cups/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ TESTOBJS = \
testjson.o \
testjwt.o \
testoptions.o \
testpwg.o \
testraster.o \
testtestpage.o \
testthreads.o \
Expand All @@ -83,7 +84,6 @@ OBJS = \
$(TESTOBJS)

# testlang.o \
# testpwg.o \


#
Expand Down Expand Up @@ -156,13 +156,13 @@ UNITTARGETS = \
testjson \
testjwt \
testoptions \
testpwg \
testraster \
testtestpage \
testthreads \
tlscheck

# testlang \
# testpwg \

TARGETS = \
$(LIBTARGETS)
Expand All @@ -181,43 +181,69 @@ all: $(TARGETS)

test: $(UNITTARGETS)
rm -f test.log
date >test.log
echo Running array API tests...
./testarray 2>>test.log
# if test `uname` != Darwin; then \
# echo Running CUPS API tests...; \
# ./testcups 2>>test.log; \
# fi
echo ""
echo Running credentials API tests...
./testcreds 2>>test.log
echo ""
echo Running file API tests...
./testfile 2>>test.log
echo ""
echo Running form API tests...
./testform 2>>test.log
# echo ""
# echo Running cupsGetDests API tests...
# ./testgetdests 2>>test.log
echo ""
echo Running hash API tests...
./testhash 2>>test.log
echo ""
echo Running HTTP API tests...
./testhttp 2>>test.log
echo ""
echo Running IPP API tests...
./testipp 2>>test.log
echo ""
echo Running internationalization API tests...
./testi18n 2>>test.log
echo ""
echo Running JSON API tests...
./testjson 2>>test.log
echo ""
echo Running JWT API tests...
./testjwt 2>>test.log
echo ""
echo Running option API tests...
./testoptions 2>>test.log
echo ""
echo Running PWG API tests...
./testpwg 2>>test.log
echo ""
echo Running raster API tests...
./testraster 2>>test.log
./testtestpage 2>>test.log

fuzz: $(UNITTARGETS)
echo Fuzzing IPP API...
./fuzzipp 2>fuzz.log
echo ""
echo Fuzzing JSON API...
AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=yes AFL_NO_UI=yes afl-fuzz -n -i json-afl-in -o json-afl-out -V 120 -- ./testjson 2>>fuzz.log


#
# Make unit tests...
#

unittests: $(UNITTARGETS)


#
# Remove object and target files...
#
Expand Down Expand Up @@ -572,8 +598,6 @@ testpwg: testpwg.o $(LIBCUPS_STATIC) test.ppd
echo Linking $@...
$(CC) $(LDFLAGS) $(OPTIM) -o $@ testpwg.o $(LIBCUPS_STATIC) $(LIBS)
$(CODE_SIGN) $(CSFLAGS) $@
echo Running PWG API tests...
./testpwg test.ppd


#
Expand Down Expand Up @@ -624,7 +648,7 @@ doc:
echo "Generating CUPS Programming Manual..."
$(RM) cupspm.xml
codedoc --section "Programming" --body cupspm.md cupspm.xml \
$(LIBOBJS:.o=.c) $(HEADERS) --coverimage cupspm.png \
$(LIBOBJS:.o=.c) tls-openssl.c $(HEADERS) --coverimage cupspm.png \
--epub ../doc/cupspm.epub
codedoc --section "Programming" --body cupspm.md \
cupspm.xml > ../doc/cupspm.html
Expand Down
4 changes: 2 additions & 2 deletions cups/cups-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
{
/* Multiple places... */
const char *datadir, // Data directory (CUPS_DATADIR environment var)
*sysconfig, // System config files (CUPS_SERVERROOT environment var)
*userconfig; // User-specific config files (various environment vars)
*sysconfig; // System config files (CUPS_SERVERROOT environment var)
char *userconfig; // User-specific config files
#ifndef _WIN32
#define PW_BUF_SIZE 16384 /* As per glibc manual page */
char pw_buf[PW_BUF_SIZE];
Expand Down
Loading