Hello community, here is the log from the commit of package ulfius for openSUSE:Factory checked in at 2019-10-08 19:57:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ulfius (Old) and /work/SRC/openSUSE:Factory/.ulfius.new.2352 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ulfius" Tue Oct 8 19:57:31 2019 rev:9 rq:735822 version:2.6.4 Changes: -------- --- /work/SRC/openSUSE:Factory/ulfius/ulfius.changes 2019-08-16 15:51:42.785568799 +0200 +++ /work/SRC/openSUSE:Factory/.ulfius.new.2352/ulfius.changes 2019-10-08 19:57:33.212265191 +0200 @@ -1,0 +2,12 @@ +Sat Oct 5 20:18:07 UTC 2019 - Martin Hauke <[email protected]> + +- Update to version 2.6.4 + * Add precision for chunked response, got the inspiration + from #132. + * Update access token for oauth2 bearer validation callback + function, add precision concerning libjwt. + * Update callback_check_glewlwyd_access_token to the up-to-date + version. + * Various small fixes. + +------------------------------------------------------------------- Old: ---- ulfius-2.6.3.tar.gz New: ---- ulfius-2.6.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ulfius.spec ++++++ --- /var/tmp/diff_new_pack.wRgyGH/_old 2019-10-08 19:57:34.560261154 +0200 +++ /var/tmp/diff_new_pack.wRgyGH/_new 2019-10-08 19:57:34.568261130 +0200 @@ -19,7 +19,7 @@ %define sover 2_6 Name: ulfius -Version: 2.6.3 +Version: 2.6.4 Release: 0 Summary: Web Framework for REST Applications in C License: MIT @@ -34,7 +34,7 @@ BuildRequires: pkgconfig(libcurl) BuildRequires: pkgconfig(libmicrohttpd) BuildRequires: pkgconfig(liborcania) -BuildRequires: pkgconfig(libyder) >= 1.4.6 +BuildRequires: pkgconfig(libyder) >= 1.4.8 %description The library is based on GNU libmicrohttpd for the backend web server, jansson ++++++ ulfius-2.6.3.tar.gz -> ulfius-2.6.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.6.3/.github/workflows/ccpp.yml new/ulfius-2.6.4/.github/workflows/ccpp.yml --- old/ulfius-2.6.3/.github/workflows/ccpp.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/ulfius-2.6.4/.github/workflows/ccpp.yml 2019-10-05 19:25:34.000000000 +0200 @@ -0,0 +1,395 @@ +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: install dependencies + run: | + sudo apt-get update + sudo apt-get install -y cmake pkg-config check libsubunit-dev cppcheck libsystemd-dev libmicrohttpd-dev libgnutls28-dev libjansson-dev libcurl4-gnutls-dev + sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 + sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0 + - name: cppcheck + run: cppcheck --force --enable=warning,missingInclude --error-exitcode=1 . + - name: build + run: | + # prepare build folders + mkdir build + mkdir example_programs/build + + # build ulfius, run tests, build package + cd build + cmake -DBUILD_ULFIUS_TESTING=on .. + make test || (cat Testing/Temporary/LastTest.log && false) + make package + sudo make install + + # build examples + cd ../example_programs/build + cmake .. + make + + # test build options + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=off .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + cd ../../build + sudo make uninstall && rm -rf * + cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=on .. + make package + sudo make install + cd ../example_programs/build + rm -rf * + cmake .. + make + + # build with Makefile + cd ../../ + make + make clean debug CURLFLAG=1 JANSSONFLAG=1 WEBSOCKETFLAG=1 YDERFLAG=1 + make clean debug CURLFLAG=1 JANSSONFLAG=1 YDERFLAG=1 + make clean debug CURLFLAG=1 WEBSOCKETFLAG=1 YDERFLAG=1 + make clean debug CURLFLAG=1 YDERFLAG=1 + make clean debug JANSSONFLAG=1 WEBSOCKETFLAG=1 YDERFLAG=1 + make clean debug CURLFLAG=1 JANSSONFLAG=1 YDERFLAG=1 + make clean debug CURLFLAG=1 WEBSOCKETFLAG=1 YDERFLAG=1 + make clean debug CURLFLAG=1 YDERFLAG=1 + make clean debug CURLFLAG=1 JANSSONFLAG=1 WEBSOCKETFLAG=1 + make clean debug CURLFLAG=1 JANSSONFLAG=1 + make clean debug CURLFLAG=1 WEBSOCKETFLAG=1 + make clean debug CURLFLAG=1 + make clean debug JANSSONFLAG=1 WEBSOCKETFLAG=1 + make clean debug CURLFLAG=1 JANSSONFLAG=1 + make clean debug CURLFLAG=1 WEBSOCKETFLAG=1 + make clean debug CURLFLAG=1 + make clean debug GNUTLSFLAG=1 CURLFLAG=1 JANSSONFLAG=1 WEBSOCKETFLAG=1 YDERFLAG=1 + make clean debug GNUTLSFLAG=1 CURLFLAG=1 JANSSONFLAG=1 YDERFLAG=1 + make clean debug GNUTLSFLAG=1 CURLFLAG=1 WEBSOCKETFLAG=1 YDERFLAG=1 + make clean debug GNUTLSFLAG=1 CURLFLAG=1 YDERFLAG=1 + make clean debug GNUTLSFLAG=1 JANSSONFLAG=1 WEBSOCKETFLAG=1 YDERFLAG=1 + make clean debug GNUTLSFLAG=1 CURLFLAG=1 JANSSONFLAG=1 YDERFLAG=1 + make clean debug GNUTLSFLAG=1 CURLFLAG=1 WEBSOCKETFLAG=1 YDERFLAG=1 + make clean debug GNUTLSFLAG=1 CURLFLAG=1 YDERFLAG=1 + make clean debug GNUTLSFLAG=1 CURLFLAG=1 JANSSONFLAG=1 WEBSOCKETFLAG=1 + make clean debug GNUTLSFLAG=1 CURLFLAG=1 JANSSONFLAG=1 + make clean debug GNUTLSFLAG=1 CURLFLAG=1 WEBSOCKETFLAG=1 + make clean debug GNUTLSFLAG=1 CURLFLAG=1 + make clean debug GNUTLSFLAG=1 JANSSONFLAG=1 WEBSOCKETFLAG=1 + make clean debug GNUTLSFLAG=1 CURLFLAG=1 JANSSONFLAG=1 + make clean debug GNUTLSFLAG=1 CURLFLAG=1 WEBSOCKETFLAG=1 + make clean debug GNUTLSFLAG=1 CURLFLAG=1 + + # run tests with Makefile + sudo ldconfig + make clean debug check diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.6.3/API.md new/ulfius-2.6.4/API.md --- old/ulfius-2.6.3/API.md 2019-07-31 01:31:43.000000000 +0200 +++ new/ulfius-2.6.4/API.md 2019-10-05 19:25:34.000000000 +0200 @@ -516,8 +516,8 @@ * ca_path specify a path to CA certificates instead of system path, used by ulfius_send_http_request * timeout connection timeout used by ulfius_send_http_request, default is 0 * client_address: IP address of the client - * auth_basic_user: basic authtication username - * auth_basic_password: basic authtication password + * auth_basic_user: basic authentication username + * auth_basic_password: basic authentication password * map_url: map containing the url variables, both from the route and the ?key=value variables * map_header: map containing the header variables * map_cookie: map containing the cookie variables @@ -971,7 +971,7 @@ ### Streaming data -If you need to stream data, i.e. send a variable and potentially large amount of data, you can define and use `stream_callback_function` in the `struct _u_response`. +If you need to stream data, i.e. send a variable and potentially large amount of data, or if you need to send a chunked response, you can define and use `stream_callback_function` in the `struct _u_response`. Not that if you stream data to the client, any data that was in the `response->binary_body` will be ignored. You must at least set the function pointer `struct _u_response.stream_callback` to stream data. Set `stream_size` to U_STREAM_SIZE_UNKOWN if you don't know the size of the data you need to send, like in audio stream for example. Set `stream_block_size` according to you system resources to avoid out of memory errors, also, set `stream_callback_free` with a pointer to a function that will free values allocated by your stream callback function, as a `close()` file for example, and finally, you can set `stream_user_data` to a pointer. @@ -1322,7 +1322,9 @@ You can fill the maps in the `_u_request` structure with parameters, they will be used to build the request. Note that if you fill `_u_request.map_post_body` with parameters, the content-type `application/x-www-form-urlencoded` will be use to encode the data. -The response parameters is stored into the `_u_response` structure. If you specify NULL for the response structure, the http call will still be made but no response details will be returned. If you use `ulfius_send_http_request`, the response body will be stored in the parameter `response->*body*`, if you use `ulfius_send_http_streaming_request`, the response body will be available in the `write_body_function` specified in the call. The `ulfius_send_http_streaming_request` can be used for streaming data or large response. +The response parameters is stored into the `_u_response` structure. If you specify NULL for the response structure, the http call will still be made but no response details will be returned. If you use `ulfius_send_http_request`, the response body will be stored in the parameter `response->*body*`. + +If you use `ulfius_send_http_streaming_request`, the response body will be available in the `write_body_function` specified in the call. The `ulfius_send_http_streaming_request` can be used for streaming data or large response, or if you need to receive a chenked response from the server. Return value is `U_OK` on success. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.6.3/CHANGELOG.md new/ulfius-2.6.4/CHANGELOG.md --- old/ulfius-2.6.3/CHANGELOG.md 2019-07-31 01:31:43.000000000 +0200 +++ new/ulfius-2.6.4/CHANGELOG.md 2019-10-05 19:25:34.000000000 +0200 @@ -1,5 +1,12 @@ # Ulfius Changelog +## 2.6.4 + +- Add precision for chunked response, got the inspiration from #132 +- Update access token for oauth2 bearer validation callback function, add precision concerning libjwt, fix #133 +- Update callback_check_glewlwyd_access_token to the up-to-date version +- Various small fixes + ## 2.6.3 - Fix warning appeared with gcc 9.1, fixes #128 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.6.3/CMakeLists.txt new/ulfius-2.6.4/CMakeLists.txt --- old/ulfius-2.6.3/CMakeLists.txt 2019-07-31 01:31:43.000000000 +0200 +++ new/ulfius-2.6.4/CMakeLists.txt 2019-10-05 19:25:34.000000000 +0200 @@ -30,13 +30,13 @@ set(PROJECT_BUGREPORT_PATH "https://github.com/babelouest/ulfius/issues") set(LIBRARY_VERSION_MAJOR "2") set(LIBRARY_VERSION_MINOR "6") -set(LIBRARY_VERSION_PATCH "3") +set(LIBRARY_VERSION_PATCH "4") set(PROJECT_VERSION "${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH}") set(LIBRARY_VERSION "${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH}") set(LIBRARY_SOVERSION "${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}") set(ORCANIA_VERSION_REQUIRED "2.0.1") -set(YDER_VERSION_REQUIRED "1.4.7") +set(YDER_VERSION_REQUIRED "1.4.8") # cmake modules diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.6.3/README.md new/ulfius-2.6.4/README.md --- old/ulfius-2.6.3/README.md 2019-07-31 01:31:43.000000000 +0200 +++ new/ulfius-2.6.4/README.md 2019-10-05 19:25:34.000000000 +0200 @@ -1,4 +1,4 @@ -# Ulfius +# Ulfius HTTP Framework [](https://travis-ci.com/babelouest/ulfius) @@ -112,10 +112,10 @@ ## Projects using Ulfius framework - [Angharad](https://github.com/babelouest/angharad), House automation system for ZWave and other types of devices -- [Glewlwyd](https://github.com/babelouest/glewlwyd), a lightweight OAuth2 authentication server that provides [JSON Web Tokens](https://jwt.io/) -- [Hutch](https://github.com/babelouest/hutch), a safe locker for passwords and other secrets, using client side encryption only +- [Glewlwyd](https://github.com/babelouest/glewlwyd), a lightweight SSO server that provides OAuth2 and OpenID Connect authentication protocols +- [Hutch](https://github.com/babelouest/hutch), a safe locker for passwords and other secrets, using javascript client side encryption only - [Taliesin](https://github.com/babelouest/taliesin), a lightweight audio streaming server -- [Taulas Raspberry Pi Serial interface](https://github.com/babelouest/taulas/tree/master/taulas_raspberrypi_serial), an interface for Arduino devices that implent [Taulas](https://github.com/babelouest/taulas/) protocol, a house automation protocol +- [Taulas Raspberry Pi Serial interface](https://github.com/babelouest/taulas/tree/master/taulas_raspberrypi_serial), an interface for Arduino devices that implent [Taulas](https://github.com/babelouest/taulas/) protocol, a house automation protocol for Angharad ## Questions, problems ? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.6.3/example_callbacks/oauth2_bearer/README.md new/ulfius-2.6.4/example_callbacks/oauth2_bearer/README.md --- old/ulfius-2.6.3/example_callbacks/oauth2_bearer/README.md 2019-07-31 01:31:43.000000000 +0200 +++ new/ulfius-2.6.4/example_callbacks/oauth2_bearer/README.md 2019-10-05 19:25:34.000000000 +0200 @@ -2,6 +2,8 @@ These files contain an authentication callback for Ulfius framework to validate a Glewlwyd access token with the correct scope. +[libjwt](https://github.com/benmcollins/libjwt) is required. + To use this file, you must create a `struct _glewlwyd_resource_config` with your specific parameters: ```C @@ -11,7 +13,7 @@ char * jwt_decode_key; // The key used to decode an access token jwt_alg_t jwt_alg; // The algorithm used to encode a token, see http://benmcollins.github.io/libjwt/ char * realm; // Optional, a realm value that will be sent back to the client - unsigned short accept_access_token; // required, accept type acces_token + unsigned short accept_access_token; // required, accept type access_token unsigned short accept_client_token; // required, accept type client_token }; ``` @@ -29,5 +31,5 @@ g_config.accept_client_token = 0; // Example, add an authentication callback callback_check_glewlwyd_access_token for the endpoint GET "/api/resource/*" -ulfius_add_endpoint_by_val(instance, "GET", "/api", "/resource/*", 0, &callback_check_glewlwyd_access_token, (void*)g_config); +ulfius_add_endpoint_by_val(instance, "GET", "/api", "/resource/*", &callback_check_glewlwyd_access_token, (void*)g_config); ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.6.3/example_callbacks/oauth2_bearer/glewlwyd_resource.c new/ulfius-2.6.4/example_callbacks/oauth2_bearer/glewlwyd_resource.c --- old/ulfius-2.6.3/example_callbacks/oauth2_bearer/glewlwyd_resource.c 2019-07-31 01:31:43.000000000 +0200 +++ new/ulfius-2.6.4/example_callbacks/oauth2_bearer/glewlwyd_resource.c 2019-10-05 19:25:34.000000000 +0200 @@ -1,23 +1,30 @@ /** * - * Glewlwyd OAuth2 Authorization token check + * Glewlwyd SSO Access Token token check * - * Copyright 2016-2018 Nicolas Mora <[email protected]> + * Copyright 2016-2019 Nicolas Mora <[email protected]> * - * Version 20180607 + * Version 20190810 * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * License as published by the Free Software Foundation; - * version 3 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU GENERAL PUBLIC LICENSE for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. + * The MIT License (MIT) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -30,6 +37,17 @@ #include "glewlwyd_resource.h" /** + * Check if the result json object has a "result" element that is equal to value + */ +static int check_result_value(json_t * result, const int value) { + return (result != NULL && + json_is_object(result) && + json_object_get(result, "result") != NULL && + json_is_integer(json_object_get(result, "result")) && + json_integer_value(json_object_get(result, "result")) == value); +} + +/** * check if bearer token has some of the specified scope */ int callback_check_glewlwyd_access_token (const struct _u_request * request, struct _u_response * response, void * user_data) { @@ -42,9 +60,9 @@ if (config != NULL) { switch (config->method) { case G_METHOD_HEADER: - if (u_map_get(request->map_header, HEADER_AUTHORIZATION) != NULL) { - if (o_strstr(u_map_get(request->map_header, HEADER_AUTHORIZATION), HEADER_PREFIX_BEARER) == u_map_get(request->map_header, HEADER_AUTHORIZATION)) { - token_value = u_map_get(request->map_header, HEADER_AUTHORIZATION) + o_strlen(HEADER_PREFIX_BEARER); + if (u_map_get_case(request->map_header, HEADER_AUTHORIZATION) != NULL) { + if (o_strstr(u_map_get_case(request->map_header, HEADER_AUTHORIZATION), HEADER_PREFIX_BEARER) == u_map_get_case(request->map_header, HEADER_AUTHORIZATION)) { + token_value = u_map_get_case(request->map_header, HEADER_AUTHORIZATION) + o_strlen(HEADER_PREFIX_BEARER); } } break; @@ -59,15 +77,15 @@ } if (token_value != NULL) { j_access_token = access_token_check_signature(config, token_value); - if (check_result_value(j_access_token, G_OK)) { + if (check_result_value(j_access_token, G_TOKEN_OK)) { res_validity = access_token_check_validity(config, json_object_get(j_access_token, "grants")); - if (res_validity == G_OK) { + if (res_validity == G_TOKEN_OK) { j_res_scope = access_token_check_scope(config, json_object_get(j_access_token, "grants")); - if (check_result_value(j_res_scope, G_ERROR_INSUFFICIENT_SCOPE)) { + if (check_result_value(j_res_scope, G_TOKEN_ERROR_INSUFFICIENT_SCOPE)) { response_value = msprintf(HEADER_PREFIX_BEARER "%s%s%serror=\"insufficient_scope\",error_description=\"The scope is invalid\"", (config->realm!=NULL?"realm=":""), (config->realm!=NULL?config->realm:""), (config->realm!=NULL?",":"")); u_map_put(response->map_header, HEADER_RESPONSE, response_value); o_free(response_value); - } else if (!check_result_value(j_res_scope, G_OK)) { + } else if (!check_result_value(j_res_scope, G_TOKEN_OK)) { response_value = msprintf(HEADER_PREFIX_BEARER "%s%s%serror=\"invalid_request\",error_description=\"Internal server error\"", (config->realm!=NULL?"realm=":""), (config->realm!=NULL?config->realm:""), (config->realm!=NULL?",":"")); u_map_put(response->map_header, HEADER_RESPONSE, response_value); o_free(response_value); @@ -79,7 +97,7 @@ } } json_decref(j_res_scope); - } else if (res_validity == G_ERROR_INVALID_TOKEN) { + } else if (res_validity == G_TOKEN_ERROR_INVALID_TOKEN) { response_value = msprintf(HEADER_PREFIX_BEARER "%s%s%serror=\"invalid_request\",error_description=\"The access token is invalid\"", (config->realm!=NULL?"realm=":""), (config->realm!=NULL?config->realm:""), (config->realm!=NULL?",":"")); u_map_put(response->map_header, HEADER_RESPONSE, response_value); o_free(response_value); @@ -115,28 +133,32 @@ if (j_scope_final_list != NULL) { if (j_access_token != NULL) { scope_count_token = split_string(json_string_value(json_object_get(j_access_token, "scope")), " ", &scope_list_token); - scope_count_expected = split_string(config->oauth_scope, " ", &scope_list_expected); - if (scope_count_token > 0 && scope_count_expected > 0) { - for (i=0; scope_count_expected > 0 && scope_list_expected[i] != NULL; i++) { - if (string_array_has_value((const char **)scope_list_token, scope_list_expected[i])) { - json_array_append_new(j_scope_final_list, json_string(scope_list_expected[i])); + if (o_strlen(config->oauth_scope)) { + scope_count_expected = split_string(config->oauth_scope, " ", &scope_list_expected); + if (scope_count_token > 0 && scope_count_expected > 0) { + for (i=0; scope_count_expected > 0 && scope_list_expected[i] != NULL; i++) { + if (string_array_has_value((const char **)scope_list_token, scope_list_expected[i])) { + json_array_append_new(j_scope_final_list, json_string(scope_list_expected[i])); + } + } + if (json_array_size(j_scope_final_list) > 0) { + j_res = json_pack("{sisO}", "result", G_TOKEN_OK, "scope", j_scope_final_list); + } else { + j_res = json_pack("{si}", "result", G_TOKEN_ERROR_INSUFFICIENT_SCOPE); } - } - if (json_array_size(j_scope_final_list) > 0) { - j_res = json_pack("{sisO}", "result", G_OK, "scope", j_scope_final_list); } else { - j_res = json_pack("{si}", "result", G_ERROR_INSUFFICIENT_SCOPE); + j_res = json_pack("{si}", "result", G_TOKEN_ERROR_INTERNAL); } + free_string_array(scope_list_expected); } else { - j_res = json_pack("{si}", "result", G_ERROR_INTERNAL); + j_res = json_pack("{sis[]}", "result", G_TOKEN_OK, "scope"); } free_string_array(scope_list_token); - free_string_array(scope_list_expected); } else { - j_res = json_pack("{si}", "result", G_ERROR_INVALID_TOKEN); + j_res = json_pack("{si}", "result", G_TOKEN_ERROR_INVALID_TOKEN); } } else { - j_res = json_pack("{si}", "result", G_ERROR_INTERNAL); + j_res = json_pack("{si}", "result", G_TOKEN_ERROR_INTERNAL); } json_decref(j_scope_final_list); return j_res; @@ -157,19 +179,29 @@ // Token is valid, check type and expiration date time(&now); expiration = json_integer_value(json_object_get(j_access_token, "iat")) + json_integer_value(json_object_get(j_access_token, "expires_in")); - if (now < expiration && + if (now < expiration && json_object_get(j_access_token, "type") != NULL && - json_is_string(json_object_get(j_access_token, "type")) && + json_is_string(json_object_get(j_access_token, "type"))) { + if (config->accept_access_token && 0 == o_strcmp("access_token", json_string_value(json_object_get(j_access_token, "type"))) && json_object_get(j_access_token, "username") != NULL && json_is_string(json_object_get(j_access_token, "username")) && json_string_length(json_object_get(j_access_token, "username")) > 0) { - res = G_OK; + res = G_TOKEN_OK; + } else if (config->accept_client_token && + 0 == o_strcmp("client_token", json_string_value(json_object_get(j_access_token, "type"))) && + json_object_get(j_access_token, "client_id") != NULL && + json_is_string(json_object_get(j_access_token, "client_id")) && + json_string_length(json_object_get(j_access_token, "client_id")) > 0) { + res = G_TOKEN_OK; + } else { + res = G_TOKEN_ERROR_INVALID_REQUEST; + } } else { - res = G_ERROR_INVALID_REQUEST; + res = G_TOKEN_ERROR_INVALID_REQUEST; } } else { - res = G_ERROR_INVALID_TOKEN; + res = G_TOKEN_ERROR_INVALID_TOKEN; } return res; } @@ -187,23 +219,23 @@ grants = jwt_get_grants_json(jwt, NULL); j_grants = json_loads(grants, JSON_DECODE_ANY, NULL); if (j_grants != NULL) { - j_return = json_pack("{siso}", "result", G_OK, "grants", j_grants); + j_return = json_pack("{siso}", "result", G_TOKEN_OK, "grants", j_grants); } else { - j_return = json_pack("{si}", "result", G_ERROR); + j_return = json_pack("{si}", "result", G_TOKEN_ERROR); } o_free(grants); } else { - j_return = json_pack("{si}", "result", G_ERROR_INVALID_TOKEN); + j_return = json_pack("{si}", "result", G_TOKEN_ERROR_INVALID_TOKEN); } jwt_free(jwt); } else { - j_return = json_pack("{si}", "result", G_ERROR_INVALID_TOKEN); + j_return = json_pack("{si}", "result", G_TOKEN_ERROR_INVALID_TOKEN); } return j_return; } /** - * Return the ayload of an access token + * Return the payload of an access token */ json_t * access_token_get_payload(const char * token_value) { json_t * j_return, * j_grants; @@ -215,17 +247,17 @@ grants = jwt_get_grants_json(jwt, NULL); j_grants = json_loads(grants, JSON_DECODE_ANY, NULL); if (j_grants != NULL) { - j_return = json_pack("{siso}", "result", G_OK, "grants", j_grants); + j_return = json_pack("{siso}", "result", G_TOKEN_OK, "grants", j_grants); } else { - j_return = json_pack("{si}", "result", G_ERROR); + j_return = json_pack("{si}", "result", G_TOKEN_ERROR); } o_free(grants); } else { - j_return = json_pack("{si}", "result", G_ERROR_INVALID_TOKEN); + j_return = json_pack("{si}", "result", G_TOKEN_ERROR_INVALID_TOKEN); } jwt_free(jwt); } else { - j_return = json_pack("{si}", "result", G_ERROR_INVALID_TOKEN); + j_return = json_pack("{si}", "result", G_TOKEN_ERROR_INVALID_TOKEN); } return j_return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.6.3/example_callbacks/oauth2_bearer/glewlwyd_resource.h new/ulfius-2.6.4/example_callbacks/oauth2_bearer/glewlwyd_resource.h --- old/ulfius-2.6.3/example_callbacks/oauth2_bearer/glewlwyd_resource.h 2019-07-31 01:31:43.000000000 +0200 +++ new/ulfius-2.6.4/example_callbacks/oauth2_bearer/glewlwyd_resource.h 2019-10-05 19:25:34.000000000 +0200 @@ -1,33 +1,40 @@ /** * - * Glewlwyd OAuth2 Authorization token check + * Glewlwyd SSO Access Token token check * - * Copyright 2016-2018 Nicolas Mora <[email protected]> + * Copyright 2016-2019 Nicolas Mora <[email protected]> * - * Version 20180607 + * Version 20190810 * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * License as published by the Free Software Foundation; - * version 3 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU GENERAL PUBLIC LICENSE for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. + * The MIT License (MIT) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include <jwt.h> -#define G_OK 0 -#define G_ERROR 1 -#define G_ERROR_INTERNAL 2 -#define G_ERROR_INVALID_REQUEST 3 -#define G_ERROR_INVALID_TOKEN 4 -#define G_ERROR_INSUFFICIENT_SCOPE 5 +#define G_TOKEN_OK 0 +#define G_TOKEN_ERROR 1 +#define G_TOKEN_ERROR_INTERNAL 2 +#define G_TOKEN_ERROR_INVALID_REQUEST 3 +#define G_TOKEN_ERROR_INVALID_TOKEN 4 +#define G_TOKEN_ERROR_INSUFFICIENT_SCOPE 5 #define G_METHOD_HEADER 0 #define G_METHOD_BODY 1 @@ -44,10 +51,50 @@ char * jwt_decode_key; jwt_alg_t jwt_alg; char * realm; + unsigned short accept_access_token; + unsigned short accept_client_token; }; +/** + * + * check if bearer token has some of the specified scope + * Return G_TOKEN_OK on success + * or G_TOKEN_ERROR* on any other case + * + */ int callback_check_glewlwyd_access_token (const struct _u_request * request, struct _u_response * response, void * user_data); + +/** + * + * Validates if an access_token grants has a valid scope + * return the final scope list on success + * + */ +json_t * access_token_check_scope(struct _glewlwyd_resource_config * config, json_t * j_access_token); + +/** + * + * Validates if an access_token grants has valid parameters: + * - username: non empty string + * - type: match "access_token" + * - iat + expires_in < now + * + * Return G_TOKEN_OK on success + * or G_TOKEN_ERROR* on any other case + * + */ +int access_token_check_validity(struct _glewlwyd_resource_config * config, json_t * j_access_token); + +/** + * + * validates if the token value is a valid jwt and has a valid signature + * + */ json_t * access_token_check_signature(struct _glewlwyd_resource_config * config, const char * token_value); + +/** + * + * Return the payload of an access token + * + */ json_t * access_token_get_payload(const char * token_value); -int access_token_check_validity(struct _glewlwyd_resource_config * config, json_t * j_access_token); -json_t * access_token_check_scope(struct _glewlwyd_resource_config * config, json_t * j_access_token); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.6.3/example_programs/multiple_callbacks_example/README.md new/ulfius-2.6.4/example_programs/multiple_callbacks_example/README.md --- old/ulfius-2.6.3/example_programs/multiple_callbacks_example/README.md 2019-07-31 01:31:43.000000000 +0200 +++ new/ulfius-2.6.4/example_programs/multiple_callbacks_example/README.md 2019-10-05 19:25:34.000000000 +0200 @@ -24,5 +24,8 @@ ### Hello World with authentication +username: `test` +password: `testpassword` + - `GET http://localhost:6875/multiple/auth/data`: Send "Hello World!" response if authentication is correct (status 200), otherwise status 401 with realm "default_realm" - `PUT http://localhost:6875/multiple/auth/data`: Send "Hello World!" response if authentication is correct (status 200), otherwise status 401 with realm "specific_realm" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.6.3/include/ulfius.h new/ulfius-2.6.4/include/ulfius.h --- old/ulfius-2.6.3/include/ulfius.h 2019-07-31 01:31:43.000000000 +0200 +++ new/ulfius-2.6.4/include/ulfius.h 2019-10-05 19:25:34.000000000 +0200 @@ -169,8 +169,8 @@ * ca_path specify a path to CA certificates instead of system path, used by ulfius_send_http_request * timeout connection timeout used by ulfius_send_http_request, default is 0 * client_address: IP address of the client - * auth_basic_user: basic authtication username - * auth_basic_password: basic authtication password + * auth_basic_user: basic authentication username + * auth_basic_password: basic authentication password * map_url: map containing the url variables, both from the route and the ?key=value variables * map_header: map containing the header variables * map_cookie: map containing the cookie variables diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.6.3/src/Makefile new/ulfius-2.6.4/src/Makefile --- old/ulfius-2.6.3/src/Makefile 2019-07-31 01:31:43.000000000 +0200 +++ new/ulfius-2.6.4/src/Makefile 2019-10-05 19:25:34.000000000 +0200 @@ -38,7 +38,7 @@ endif OBJECTS=ulfius.o u_map.o u_request.o u_response.o u_send_request.o u_websocket.o yuarel.o OUTPUT=libulfius.so -VERSION=2.6.3 +VERSION=2.6.4 ifndef JANSSONFLAG DISABLE_JANSSON=0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.6.3/src/u_request.c new/ulfius-2.6.4/src/u_request.c --- old/ulfius-2.6.3/src/u_request.c 2019-07-31 01:31:43.000000000 +0200 +++ new/ulfius-2.6.4/src/u_request.c 2019-10-05 19:25:34.000000000 +0200 @@ -676,13 +676,14 @@ char * ulfius_export_client_certificate_pem(const struct _u_request * request) { char * str_cert = NULL; gnutls_datum_t g_cert; + int ret = 0; if (request != NULL && request->client_cert != NULL) { - if (gnutls_x509_crt_export2(request->client_cert, GNUTLS_X509_FMT_PEM, &g_cert) == 0) { + if ((ret = gnutls_x509_crt_export2(request->client_cert, GNUTLS_X509_FMT_PEM, &g_cert)) >= 0) { str_cert = o_strndup((const char *)g_cert.data, g_cert.size); gnutls_free(g_cert.data); } else { - y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error gnutls_x509_crt_export2"); + y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error gnutls_x509_crt_export2: %s", gnutls_strerror(ret)); } } @@ -697,19 +698,19 @@ * return U_OK on success; */ int ulfius_import_client_certificate_pem(struct _u_request * request, const char * str_cert) { - int ret; + int ret, res; gnutls_datum_t g_cert; if (request != NULL && str_cert != NULL) { g_cert.data = (unsigned char *)str_cert; g_cert.size = o_strlen(str_cert); - if (gnutls_x509_crt_init(&request->client_cert)) { - y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error gnutls_x509_crt_init"); + if ((res = gnutls_x509_crt_init(&request->client_cert))) { + y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error gnutls_x509_crt_init: %s", gnutls_strerror(res)); ret = U_ERROR; - } else if (gnutls_x509_crt_import(request->client_cert, &g_cert, GNUTLS_X509_FMT_PEM) == 0) { + } else if ((res = gnutls_x509_crt_import(request->client_cert, &g_cert, GNUTLS_X509_FMT_PEM)) >= 0) { ret = U_OK; } else { - y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error gnutls_x509_crt_import"); + y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error gnutls_x509_crt_import: %s", gnutls_strerror(res)); ret = U_ERROR; } } else {
