Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package orcania for openSUSE:Factory checked in at 2021-03-30 21:09:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/orcania (Old) and /work/SRC/openSUSE:Factory/.orcania.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "orcania" Tue Mar 30 21:09:55 2021 rev:8 rq:876393 version:2.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/orcania/orcania.changes 2020-07-05 01:20:22.293405800 +0200 +++ /work/SRC/openSUSE:Factory/.orcania.new.2401/orcania.changes 2021-03-30 21:18:36.945837879 +0200 @@ -1,0 +2,7 @@ +Sun Feb 28 12:12:07 UTC 2021 - Martin Hauke <[email protected]> + +- Update to version 2.2.0 + * Add command-line tool `base64url` which is similar to + GNU `base64` tool but for `base64url` format. + +------------------------------------------------------------------- Old: ---- orcania-2.1.1.tar.gz New: ---- orcania-2.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ orcania.spec ++++++ --- /var/tmp/diff_new_pack.S2lbbl/_old 2021-03-30 21:18:37.625838377 +0200 +++ /var/tmp/diff_new_pack.S2lbbl/_new 2021-03-30 21:18:37.625838377 +0200 @@ -1,8 +1,8 @@ # # spec file for package orcania # -# Copyright (c) 2020 SUSE LLC -# Copyright (c) 2018, Martin Hauke <[email protected]> +# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2018-2021, Martin Hauke <[email protected]> # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,9 +17,9 @@ # -%define sover 2_1 +%define sover 2_2 Name: orcania -Version: 2.1.1 +Version: 2.2.0 Release: 0 Summary: MISC function Library License: LGPL-2.1-or-later @@ -69,6 +69,8 @@ %{_libdir}/liborcania.so.* %files devel +%{_bindir}/base64url +%{_mandir}/man1/base64url.1.gz %{_includedir}/orcania.h %{_includedir}/orcania-cfg.h %{_libdir}/liborcania.so ++++++ orcania-2.1.1.tar.gz -> orcania-2.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orcania-2.1.1/.github/workflows/ccpp.yml new/orcania-2.2.0/.github/workflows/ccpp.yml --- old/orcania-2.1.1/.github/workflows/ccpp.yml 2020-06-30 02:06:50.000000000 +0200 +++ new/orcania-2.2.0/.github/workflows/ccpp.yml 2021-02-27 19:14:14.000000000 +0100 @@ -10,7 +10,7 @@ - name: install dependencies run: | sudo apt-get update - sudo apt-get install -y cmake pkg-config check libsubunit-dev cppcheck doxygen + sudo apt-get install -y cmake pkg-config check libsubunit-dev cppcheck doxygen valgrind - name: cppcheck run: cppcheck --force --enable=warning,missingInclude --error-exitcode=1 . - name: build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orcania-2.1.1/.github/workflows/codeql-analysis.yml new/orcania-2.2.0/.github/workflows/codeql-analysis.yml --- old/orcania-2.1.1/.github/workflows/codeql-analysis.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/orcania-2.2.0/.github/workflows/codeql-analysis.yml 2021-02-27 19:14:14.000000000 +0100 @@ -0,0 +1,60 @@ +name: "CodeQL" + +on: + push: + branches: [master, ] + pull_request: + # The branches below must be a subset of the branches above + branches: [master] + schedule: + - cron: '0 20 * * 2' + +jobs: + analyse: + name: Analyse + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 + + # If this run was triggered by a pull request event, then checkout + # the head of the pull request instead of the merge commit. + - run: git checkout HEAD^2 + if: ${{ github.event_name == 'pull_request' }} + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + # Override language selection by uncommenting this and choosing your languages + # with: + # languages: go, javascript, csharp, python, cpp, java + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + #- name: Autobuild + # uses: github/codeql-action/autobuild@v1 + + # ?????? Command-line programs to run using the OS shell. + # ???? https://git.io/JvXDl + + # ?????? If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + - run: | + sudo apt-get update + sudo apt-get install -y cmake pkg-config doxygen + mkdir build + cd build + cmake -DBUILD_ORCANIA_DOCUMENTATION=on .. + make + make doc + sudo make install + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orcania-2.1.1/.gitignore new/orcania-2.2.0/.gitignore --- old/orcania-2.1.1/.gitignore 2020-06-30 02:06:50.000000000 +0200 +++ new/orcania-2.2.0/.gitignore 2021-02-27 19:14:14.000000000 +0100 @@ -9,3 +9,4 @@ pointer_list_test orcania-cfg.h valgrind*.txt +tools/base64url/base64url diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orcania-2.1.1/.travis.yml new/orcania-2.2.0/.travis.yml --- old/orcania-2.1.1/.travis.yml 2020-06-30 02:06:50.000000000 +0200 +++ new/orcania-2.2.0/.travis.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,43 +0,0 @@ -# travis configuration file -# Copyright 2018 Ilya Shipitsin <[email protected]> -# 2018-2020 Nicolas Mora <[email protected]> -language: c - -os: linux -dist: bionic - -addons: - apt: - packages: [ check, libsubunit-dev, cppcheck, pkg-config, doxygen ] -jobs: - include: - - env: LABEL=linux-gcc - compiler: gcc - - env: LABEL=lnux-clang - compiler: clang - - env: LABEL=osx - os: osx - addons: - homebrew: - packages: - - check - - pkg-config - update: true - script: - - mkdir build && cd build - - cmake -DBUILD_ORCANIA_TESTING=on .. - - make test - - env: LABEL=cppcheck - script: - - cppcheck --force --enable=warning,missingInclude --error-exitcode=1 . -script: - - pushd test - - make test - - popd - - mkdir build && cd build - - cmake -DBUILD_ORCANIA_TESTING=on -DBUILD_ORCANIA_DOCUMENTATION=on .. - - make test package doc - - sudo make install - - cd ../ - - make - - make clean check diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orcania-2.1.1/CHANGELOG.md new/orcania-2.2.0/CHANGELOG.md --- old/orcania-2.1.1/CHANGELOG.md 2020-06-30 02:06:50.000000000 +0200 +++ new/orcania-2.2.0/CHANGELOG.md 2021-02-27 19:14:14.000000000 +0100 @@ -1,5 +1,9 @@ # Orcania Changelog +## 2.2.0 + +- Add command-line tool `base64url` which is similar to GNU `base64` tool but for `base64url` format + ## 2.1.1 - Harmonize and fix license diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orcania-2.1.1/CMakeLists.txt new/orcania-2.2.0/CMakeLists.txt --- old/orcania-2.1.1/CMakeLists.txt 2020-06-30 02:06:50.000000000 +0200 +++ new/orcania-2.2.0/CMakeLists.txt 2021-02-27 19:14:14.000000000 +0100 @@ -29,8 +29,8 @@ set(PROJECT_HOMEPAGE_URL "https://github.com/babelouest/orcania/") set(PROJECT_BUGREPORT_PATH "https://github.com/babelouest/orcania/issues") set(LIBRARY_VERSION_MAJOR "2") -set(LIBRARY_VERSION_MINOR "1") -set(LIBRARY_VERSION_PATCH "1") +set(LIBRARY_VERSION_MINOR "2") +set(LIBRARY_VERSION_PATCH "0") set(LIBS "-lm") set(PROJECT_VERSION "${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH}") @@ -84,6 +84,7 @@ set(INC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src) +set(BASE64URL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tools/base64url) include_directories(${INC_DIR}) @@ -156,6 +157,19 @@ endif () endif () +# build base64url + +option(BUILD_BASE64URL "Build base64url application." ON) + +if (BUILD_BASE64URL) + add_executable(base64url ${BASE64URL_DIR}/base64url.c ${INC_DIR}/orcania.h ${PROJECT_BINARY_DIR}/orcania-cfg.h) + set_target_properties(base64url PROPERTIES SKIP_BUILD_RPATH TRUE) + add_dependencies(base64url orcania) + target_link_libraries(base64url orcania ${LIBS}) + install(TARGETS base64url RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(FILES ${BASE64URL_DIR}/base64url.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT runtime) +endif () + # tests option(BUILD_ORCANIA_TESTING "Build the testing tree." OFF) # because we do not use include(CTest) @@ -293,8 +307,9 @@ COMMAND ${CMAKE_MAKE_PROGRAM} package_source) message(STATUS "Force inline implementation of strstr: ${WITH_STRSTR}") -message(STATUS "Build static library: ${BUILD_STATIC}") -message(STATUS "Build testing tree: ${BUILD_ULFIUS_TESTING}") -message(STATUS "Install the header files: ${INSTALL_HEADER}") -message(STATUS "Build RPM package: ${BUILD_RPM}") -message(STATUS "Build documentation: ${BUILD_ORCANIA_DOCUMENTATION}") +message(STATUS "Build static library: ${BUILD_STATIC}") +message(STATUS "Build testing tree: ${BUILD_ORCANIA_TESTING}") +message(STATUS "Install the header files: ${INSTALL_HEADER}") +message(STATUS "Build RPM package: ${BUILD_RPM}") +message(STATUS "Build documentation: ${BUILD_ORCANIA_DOCUMENTATION}") +message(STATUS "Build base64url application: ${BUILD_BASE64URL}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orcania-2.1.1/Makefile new/orcania-2.2.0/Makefile --- old/orcania-2.1.1/Makefile 2020-06-30 02:06:50.000000000 +0200 +++ new/orcania-2.2.0/Makefile 2021-02-27 19:14:14.000000000 +0100 @@ -21,29 +21,36 @@ LIBORCANIA_LOCATION=./src TESTS_LOCATION=./test +BASE64URL_LOCATION=./tools/base64url/ all: target target: cd $(LIBORCANIA_LOCATION) && $(MAKE) $* + cd $(BASE64URL_LOCATION) && $(MAKE) $* debug: cd $(LIBORCANIA_LOCATION) && $(MAKE) debug $* + cd $(BASE64URL_LOCATION) && $(MAKE) debug $* clean: cd $(LIBORCANIA_LOCATION) && $(MAKE) clean cd $(TESTS_LOCATION) && $(MAKE) clean + cd $(BASE64URL_LOCATION) && $(MAKE) clean rm -rf doc/html/ doc/man/ check: cd $(LIBORCANIA_LOCATION) && $(MAKE) debug $* cd $(TESTS_LOCATION) && $(MAKE) test $* + cd $(BASE64URL_LOCATION) && $(MAKE) test $* install: cd $(LIBORCANIA_LOCATION) && $(MAKE) install $* + cd $(BASE64URL_LOCATION) && $(MAKE) install $* uninstall: cd $(LIBORCANIA_LOCATION) && $(MAKE) uninstall $* + cd $(BASE64URL_LOCATION) && $(MAKE) uninstall $* doxygen: doxygen doc/doxygen.cfg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orcania-2.1.1/README.md new/orcania-2.2.0/README.md --- old/orcania-2.1.1/README.md 2020-06-30 02:06:50.000000000 +0200 +++ new/orcania-2.2.0/README.md 2021-02-27 19:14:14.000000000 +0100 @@ -2,7 +2,6 @@ Potluck with different functions for different purposes that can be shared among C programs. -[](https://travis-ci.com/babelouest/orcania)  ## Documentation @@ -23,7 +22,7 @@ ### Build from source -Download Orcania source code from Github: +Download Orcania source code from GitHub: ```shell $ git clone https://github.com/babelouest/orcania.git @@ -34,7 +33,7 @@ [CMake](https://cmake.org/download/) minimum 3.5 is required. -Run the cmake script in a subdirectory, example: +Run the CMake script in a sub-directory, example: ```shell $ git clone https://github.com/babelouest/orcania.git @@ -45,7 +44,7 @@ $ make && sudo make install ``` -The available options for cmake are: +The available options for CMake are: - `-DBUILD_STATIC=[on|off]` (default `off`): Build the static archive in addition to the shared library - `-DWITH_STRSTR=[on|off]` (default `off`): Force using inline implementation of strstr - `-DBUILD_ORCANIA_TESTING=[on|off]` (default `off`): Build unit tests @@ -65,7 +64,7 @@ This will install Orcania's files under `/usr/local/` DESTDIR. -If you want to force using inline implementation of `strstr`, you can append the build option `STRSTRFLAG=1`. This is useful if your systemdoesn't have an implementation of the function `strstr` but isn't listed as one in Orcania. Like FreeRTOS. +If you want to force using inline implementation of `strstr`, you can append the build option `STRSTRFLAG=1`. This is useful if your system doesn't have an implementation of the function `strstr` but isn't listed as one in Orcania. Like FreeRTOS. ``` $ cd src diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orcania-2.1.1/doc/doxygen.cfg new/orcania-2.2.0/doc/doxygen.cfg --- old/orcania-2.1.1/doc/doxygen.cfg 2020-06-30 02:06:50.000000000 +0200 +++ new/orcania-2.2.0/doc/doxygen.cfg 2021-02-27 19:14:14.000000000 +0100 @@ -790,7 +790,7 @@ # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = API.md ./src/ ./include/ +INPUT = API.md ./src/ ./include/ tools/base64url/README.md # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orcania-2.1.1/src/Makefile new/orcania-2.2.0/src/Makefile --- old/orcania-2.1.1/src/Makefile 2020-06-30 02:06:50.000000000 +0200 +++ new/orcania-2.2.0/src/Makefile 2021-02-27 19:14:14.000000000 +0100 @@ -33,8 +33,8 @@ CFLAGS+=-c -fPIC -Wall -Werror -Wextra -I$(ORCANIA_INCLUDE) -D_REENTRANT $(ADDITIONALFLAGS) $(CPPFLAGS) OUTPUT=liborcania.so VERSION_MAJOR=2 -VERSION_MINOR=1 -VERSION_PATCH=1 +VERSION_MINOR=2 +VERSION_PATCH=0 OBJECTS=orcania.o memory.o base64.o LIBS=-lc -lm @@ -95,7 +95,7 @@ install: all $(PKGCONFIG_FILE) install $(OUTPUT).$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) $(DESTDIR)/lib - mkdir -p $(DESTDIR)/lib/pkgconfig/ + mkdir -p $(DESTDIR)/lib/pkgconfig/ $(DESTDIR)/include install -m644 $(PKGCONFIG_FILE) $(DESTDIR)/lib/pkgconfig/ install -m644 ../include/orcania.h $(DESTDIR)/include install -m644 $(CONFIG_FILE) $(DESTDIR)/include @@ -103,6 +103,7 @@ static-install: static install liborcania.a $(DESTDIR)/lib + mkdir -p $(DESTDIR)/lib/pkgconfig/ $(DESTDIR)/include install -m644 $(PKGCONFIG_FILE) $(DESTDIR)/lib/pkgconfig install -m644 ../include/orcania.h $(DESTDIR)/include install -m644 $(CONFIG_FILE) $(DESTDIR)/include diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orcania-2.1.1/tools/base64url/Makefile new/orcania-2.2.0/tools/base64url/Makefile --- old/orcania-2.1.1/tools/base64url/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ new/orcania-2.2.0/tools/base64url/Makefile 2021-02-27 19:14:14.000000000 +0100 @@ -0,0 +1,66 @@ +# +# base64url: Base64Url encode or decode FILE, or standard input, to standard output. +# +# Makefile used to build the software +# +# Copyright 2021 Nicolas Mora <[email protected]> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU 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 General Public +# License along with this program. If not, see <http://www.gnu.org/licenses/>. +# +CC=gcc +ORCANIA_INCLUDE=../../include +ORCANIA_LOCATION=../../src +DESTDIR=/usr/local + +CFLAGS+=-Wall -I$(ORCANIA_INCLUDE) $(ADDITIONALFLAGS) $(CPPFLAGS) +LIBS=-lc -lorcania -L$(ORCANIA_LOCATION) +ORCANIA_LIBRARY=../../src/librhonabwy.so +VALGRIND_COMMAND=valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes + +all: base64url + +all: ADDITIONALFLAGS= -O3 + +clean: + rm -f *.o base64url *.b64 + +debug: base64url + +debug: ADDITIONALFLAGS=-DDEBUG -g -O0 + +$(ORCANIA_LIBRARY): + cd $(ORCANIA_LOCATION) && $(MAKE) debug + +base64url: $(ORCANIA_LIBRARY) base64url.c + $(CC) -o base64url $(CFLAGS) base64url.c $(LIBS) + +install: base64url + mkdir -p $(DESTDIR)/bin $(DESTDIR)/man/man1/ + install -m755 base64url $(DESTDIR)/bin + install -m644 base64url.1 $(DESTDIR)/man/man1/ + +uninstall: + rm -f $(DESTDIR)/bin/base64url + +manpage: base64url + help2man ./base64url -s 1 -n "Base64Url encode or decode FILE, or standard input, to standard output." > base64url.1 + +test: base64url + echo plop | LD_LIBRARY_PATH=$(ORCANIA_LOCATION) $(VALGRIND_COMMAND) ./base64url + LD_LIBRARY_PATH=$(ORCANIA_LOCATION) $(VALGRIND_COMMAND) ./base64url -f README.md + LD_LIBRARY_PATH=$(ORCANIA_LOCATION) $(VALGRIND_COMMAND) ./base64url -f error || true + echo ";error;" | LD_LIBRARY_PATH=$(ORCANIA_LOCATION) $(VALGRIND_COMMAND) ./base64url -d || true + echo Z3J1dAo | LD_LIBRARY_PATH=$(ORCANIA_LOCATION) $(VALGRIND_COMMAND) ./base64url -d + echo ZuJ1dAo | LD_LIBRARY_PATH=$(ORCANIA_LOCATION) $(VALGRIND_COMMAND) ./base64url -d -i + echo plop | LD_LIBRARY_PATH=$(ORCANIA_LOCATION) $(VALGRIND_COMMAND) ./base64url -w 2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orcania-2.1.1/tools/base64url/README.md new/orcania-2.2.0/tools/base64url/README.md --- old/orcania-2.1.1/tools/base64url/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/orcania-2.2.0/tools/base64url/README.md 2021-02-27 19:14:14.000000000 +0100 @@ -0,0 +1,24 @@ +# base64url: Base64Url encode or decode FILE, or standard input, to standard output. + +Copyright 2021 Nicolas Mora <[email protected]> + +This program is free software; you can redistribute it and/or modify it under the terms of the GPL3 License. + +## Options + +Options available: + +```shell +-d, --decode + Decode data +-i, --ignore-garbage + when decoding, ignore non-alphabet characters +-w, --wrap <COLS> + wrap encoded lines after COLS character (default 76). Use 0 to disable line wrapping +-f, --file <FILE_NAME> + Encode or decode FILE_NAME content - if this option is missing, red from stdin +-h, --help + display this help and exit +-v, --version + output version information and exit +``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orcania-2.1.1/tools/base64url/base64url.1 new/orcania-2.2.0/tools/base64url/base64url.1 --- old/orcania-2.1.1/tools/base64url/base64url.1 1970-01-01 01:00:00.000000000 +0100 +++ new/orcania-2.2.0/tools/base64url/base64url.1 2021-02-27 19:14:14.000000000 +0100 @@ -0,0 +1,60 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.8. +.TH BASE64URL "1" "February 2021" "base64url 0.7" "User Commands" +.SH NAME +base64url \- Base64Url encode or decode FILE, or standard input, to standard output. +.SH SYNOPSIS +.B base64url +[\fI\,OPTIONS\/\fR] +.SH DESCRIPTION +base64url \- Base64Url encode or decode FILE, or standard input, to standard output. +.PP +Version 0.7 +.SH COPYRIGHT +Copyright 2021 Nicolas Mora <[email protected]> +.PP +This program is free software; you can redistribute it and/or +modify it under the terms of the GPL 3 +.PP +Command\-line options: +.PP +\fB\-d\fR, \fB\-\-decode\fR +.IP +Decode data +.PP +\fB\-i\fR, \fB\-\-ignore\-garbage\fR +.IP +when decoding, ignore non\-alphabet characters +.PP +\fB\-w\fR, \fB\-\-wrap\fR <COLS> +.TP +wrap encoded lines after COLS character (default 76). +Use 0 to disable line wrapping +.PP +\fB\-f\fR, \fB\-\-file\fR <FILE_NAME> +.IP +Encode or decode FILE_NAME content \- if this option is missing, red from stdin +.PP +\fB\-h\fR, \fB\-\-help\fR +.IP +display this help and exit +.PP +\fB\-v\fR, \fB\-\-version\fR +.IP +output version information and exit +.PP +.br +Copyright 2021 Nicolas Mora <[email protected]> +This program is free software; you can redistribute it and/or +modify it under the terms of the GPL 3 +.SH "SEE ALSO" +The full documentation for +.B base64url +is maintained as a Texinfo manual. If the +.B info +and +.B base64url +programs are properly installed at your site, the command +.IP +.B info base64url +.PP +should give you access to the complete manual. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/orcania-2.1.1/tools/base64url/base64url.c new/orcania-2.2.0/tools/base64url/base64url.c --- old/orcania-2.1.1/tools/base64url/base64url.c 1970-01-01 01:00:00.000000000 +0100 +++ new/orcania-2.2.0/tools/base64url/base64url.c 2021-02-27 19:14:14.000000000 +0100 @@ -0,0 +1,252 @@ +/** + * + * base64url: Base64Url encode or decode FILE, or standard input, to standard output. + * + * Copyright 2021 Nicolas Mora <[email protected]> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU 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 General Public + * License along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include <unistd.h> +#include <stdio.h> +#include <string.h> +#include <getopt.h> +#include <ctype.h> +#include <orcania.h> + +#define _BASE64URL_VERSION "0.7" + +#define ACTION_ENCODE 0 +#define ACTION_DECODE 1 + +#define DEFAULT_WRAP 76 + +static void print_output(const unsigned char * output, size_t output_len, unsigned long int wrap, short int ignore) { + size_t i; + for (i=0; i<output_len; i++) { + if (i && wrap && !(i%wrap)) { + fputs("\n", stdout); + } + if (!ignore || isprint(output[i])) { + fputc(output[i], stdout); + } + } +} + +static void print_help(FILE * output, const char * command) { + fprintf(output, "base64url - Base64Url encode or decode FILE, or standard input, to standard output.\n"); + fprintf(output, "\nUsage: %s [OPTIONS]", command); + fprintf(output, "\n"); + fprintf(output, "Version %s\n", _BASE64URL_VERSION); + fprintf(output, "\n"); + fprintf(output, "Copyright 2021 Nicolas Mora <[email protected]>\n"); + fprintf(output, "\n"); + fprintf(output, "This program is free software; you can redistribute it and/or\n"); + fprintf(output, "modify it under the terms of the GPL 3\n"); + fprintf(output, "\n"); + fprintf(output, "Command-line options:\n"); + fprintf(output, "\n"); + fprintf(output, "-d, --decode\n"); + fprintf(output, "\tDecode data\n"); + fprintf(output, "-i, --ignore-garbage\n"); + fprintf(output, "\twhen decoding, ignore non-alphabet characters\n"); + fprintf(output, "-w, --wrap <COLS>\n"); + fprintf(output, "\twrap encoded lines after COLS character (default 76). Use 0 to disable line wrapping\n"); + fprintf(output, "-f, --file <FILE_NAME>\n"); + fprintf(output, "\tEncode or decode FILE_NAME content - if this option is missing, red from stdin\n"); + fprintf(output, "-h, --help\n"); + fprintf(output, "\tdisplay this help and exit\n"); + fprintf(output, "-v, --version\n"); + fprintf(output, "\toutput version information and exit\n"); +} + +static unsigned char * get_file_content(const char * file_path, size_t * length) { + unsigned char * buffer = NULL; + size_t res; + FILE * f; + + f = fopen (file_path, "rb"); + if (f) { + fseek (f, 0, SEEK_END); + *length = ftell (f); + fseek (f, 0, SEEK_SET); + buffer = o_malloc(((*length)+1)*sizeof(char)); + if (buffer) { + res = fread (buffer, 1, *length, f); + if (res != *length) { + fprintf(stderr, "fread warning, reading %zu while expecting %zu", res, *length); + } + } + fclose (f); + } else { + fprintf(stderr, "error opening file %s\n", file_path); + } + + return buffer; +} + +static unsigned char * get_stdin_content(size_t * length) { + int size = 100; + unsigned char * out = NULL, buffer[size]; + ssize_t read_length; + + *length = 0; + while ((read_length = read(0, buffer, size)) > 0) { + out = o_realloc(out, (*length)+read_length+1); + memcpy(out+(*length), buffer, read_length); + (*length) += read_length; + out[(*length)] = '\0'; + } + return out; +} + +int main(int argc, char ** argv) { + short int action = ACTION_ENCODE, ignore = 0; + unsigned long int wrap = DEFAULT_WRAP; + long int s_wrap = 0; + const char * short_options = "d::i::w:f:v::h"; + int next_option, ret = 0, exit_loop = 0; + char * file = NULL, * endptr = NULL, * tmp = NULL; + unsigned char * input = NULL, * output = NULL; + size_t input_len = 0, output_len = 0; + static const struct option long_options[]= { + {"decode", no_argument, NULL, 'd'}, + {"ignore-garbage", no_argument, NULL, 'i'}, + {"wrap", required_argument, NULL, 'w'}, + {"file", required_argument, NULL, 'f'}, + {"version", no_argument, NULL, 'v'}, + {"help", no_argument, NULL, 'h'}, + {NULL, 0, NULL, 0} + }; + + do { + next_option = getopt_long(argc, argv, short_options, long_options, NULL); + + switch (next_option) { + case 'd': + action = ACTION_DECODE; + break; + case 'i': + ignore = 1; + break; + case 'w': + s_wrap = strtoul(optarg, &endptr, 10); + if (*endptr == '\0' && s_wrap >= 0) { + wrap = (unsigned long int)s_wrap; + } else { + print_help(stderr, argv[0]); + exit_loop = 1; + ret = 1; + } + break; + case 'f': + o_free(file); + file = o_strdup(optarg); + break; + case 'v': + fprintf(stdout, "%s %s\n", argv[0], _BASE64URL_VERSION); + fprintf(stdout, "Copyright 2021 Nicolas Mora <[email protected]>\n"); + fprintf(stdout, "This program is free software; you can redistribute it and/or\n"); + fprintf(stdout, "modify it under the terms of the GPL 3\n"); + exit_loop = 1; + break; + case 'h': + print_help(stdout, argv[0]); + exit_loop = 1; + break; + default: + break; + } + } while (next_option != -1 && !exit_loop); + + if (!exit_loop) { + if (file != NULL) { + input = get_file_content(file, &input_len); + } else { + input = get_stdin_content(&input_len); + } + + if (input != NULL && input_len) { + if (action == ACTION_ENCODE) { + if (o_base64url_encode(input, input_len, NULL, &output_len)) { + if (output_len) { + if ((output = o_malloc(output_len+4)) != NULL) { + if (o_base64url_encode(input, input_len, output, &output_len)) { + print_output(output, output_len, wrap, ignore); + } else { + fprintf(stderr, "%s: Error encoding\n", argv[0]); + } + } else { + fprintf(stderr, "%s: Error encoding\n", argv[0]); + } + } else { + fprintf(stderr, "%s: Error encoding\n", argv[0]); + } + } else { + fprintf(stderr, "%s: Error encoding\n", argv[0]); + } + } else { + tmp = str_replace((const char *)input, " ", ""); + o_free(input); + input = (unsigned char *)tmp; + tmp = str_replace((const char *)input, "\n", ""); + o_free(input); + input = (unsigned char *)tmp; + tmp = str_replace((const char *)input, "\t", ""); + o_free(input); + input = (unsigned char *)tmp; + tmp = str_replace((const char *)input, "\v", ""); + o_free(input); + input = (unsigned char *)tmp; + tmp = str_replace((const char *)input, "\f", ""); + o_free(input); + input = (unsigned char *)tmp; + tmp = str_replace((const char *)input, "\r", ""); + o_free(input); + input = (unsigned char *)tmp; + input_len = o_strlen((const char *)input); + if (o_base64url_decode(input, input_len, NULL, &output_len)) { + if (output_len) { + if ((output = o_malloc(output_len+4)) != NULL) { + if (o_base64url_decode(input, input_len, output, &output_len)) { + print_output(output, output_len, 0, ignore); + } else { + fprintf(stderr, "%s: invalid input\n", argv[0]); + ret = 1; + } + } else { + fprintf(stderr, "%s: Error decoding\n", argv[0]); + ret = 1; + } + } else { + fprintf(stderr, "%s: invalid input\n", argv[0]); + ret = 1; + } + } else { + fprintf(stderr, "%s: invalid input\n", argv[0]); + ret = 1; + } + } + } else { + fprintf(stderr, "-- Error no input --\n"); + print_help(stderr, argv[0]); + ret = 1; + } + o_free(input); + o_free(output); + } + o_free(file); + return ret; +}
