diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-06-11 14:32:42 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-06-11 14:32:42 +0200 |
commit | 28218030cf48c2a577755c01208fae5f4abe57a4 (patch) | |
tree | 9dd1298175dc4ff920c9a0c3a58484d7c37d4645 | |
parent | c6aa8ad5a37e4070387c32b684e5174612a03163 (diff) | |
parent | 32525f1769d07260102de6b483641bb106ffbd26 (diff) | |
download | remote-logon-service-28218030cf48c2a577755c01208fae5f4abe57a4.tar.gz remote-logon-service-28218030cf48c2a577755c01208fae5f4abe57a4.tar.bz2 remote-logon-service-28218030cf48c2a577755c01208fae5f4abe57a4.zip |
Merge branch 'sunweaver-pr/travis-ci'
Attributes GH PR #3: https://github.com/ArcticaProject/remote-logon-service/pull/3
-rw-r--r-- | .build.yml | 121 | ||||
-rw-r--r-- | .travis.yml | 43 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/crypt.c | 2 | ||||
-rw-r--r-- | src/defines.h | 2 | ||||
-rw-r--r-- | src/main.c | 18 | ||||
-rw-r--r-- | src/uccs-server.c | 10 | ||||
-rw-r--r-- | tests/Makefile.am | 2 |
9 files changed, 188 insertions, 16 deletions
diff --git a/.build.yml b/.build.yml new file mode 100644 index 0000000..95af08e --- /dev/null +++ b/.build.yml @@ -0,0 +1,121 @@ +######################################################### +# THE FOLLOWING LINES IS USED BY docker-build +########################################################## +requires: + archlinux: + # Useful URL: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=remote-logon-service + - clang + - gcc + - git + - make + - startup-notification + - which + - # FIXME: add missing build-dependencies + + debian: + # Useful URL: https://salsa.debian.org/debian-remote-team/remote-logon-service + - autopoint + - clang + - clang-tools + - g++ + - cppcheck + - git + - make + - libtool + - intltool + - libdbus-1-dev + - libdbustest1-dev + - libgcrypt20-dev + - libglib2.0-dev + - libjson-glib-dev + - libnm-dev + - libsoup2.4-dev + - libgtest-dev + - dbus-test-runner + - python3 + + ubuntu: + - autopoint + - clang + - clang-tools + - g++ + - git + - make + - intltool + - libtool + - libdbus-1-dev + - libdbustest1-dev + - libgcrypt20-dev + - libglib2.0-dev + - libjson-glib-dev + - libnm-dev + - libsoup2.4-dev + - libgtest-dev + - dbus-test-runner + - python3 + +variables: + - 'CHECKERS=" + -enable-checker deadcode.DeadStores + -enable-checker alpha.deadcode.UnreachableCode + -enable-checker alpha.core.CastSize + -enable-checker alpha.core.CastToStruct + -enable-checker alpha.core.IdenticalExpr + -enable-checker alpha.core.SizeofPtr + -enable-checker alpha.security.ArrayBoundV2 + -enable-checker alpha.security.MallocOverflow + -enable-checker alpha.security.ReturnPtrRange + -enable-checker alpha.unix.SimpleStream + -enable-checker alpha.unix.cstring.BufferOverlap + -enable-checker alpha.unix.cstring.NotNullTerminated + -enable-checker alpha.unix.cstring.OutOfBounds + -enable-checker alpha.core.FixedAddr + -enable-checker security.insecureAPI.strcpy"' + +build_scripts: + - if [ ${DISTRO_NAME} == "debian" ];then + - export CFLAGS+=" -Wsign-compare -Wunused-parameter" + - cppcheck --enable=warning,style,performance,portability,information,missingInclude . + - fi + - + - if [ -e ./autogen.sh ]; then + - NOCONFIGURE=1 ./autogen.sh + - scan-build $CHECKERS ./configure --prefix=/usr --enable-gtk-doc --enable-compile-warnings=maximum + - elif [ -e ./CMakeLists.txt ]; then + - if [ ${DISTRO_NAME} == "debian" ];then + - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTS=ON + - else + - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON + - fi + - elif [ -e ./configure.ac ]; then + - autoreconf -vfi + - scan-build $CHECKERS ./configure --prefix=/usr --enable-gtk-doc --enable-compile-warnings=maximum + - else + - exit 1 + - fi + - + - if [ $CPU_COUNT -gt 1 ]; then + - if [ ${DISTRO_NAME} == "debian" ];then + - scan-build $CHECKERS --keep-cc --use-cc=clang --use-c++=clang++ -o html-report make -j $CPU_COUNT + - make clean + - fi + - scan-build $CHECKERS --keep-cc -o html-report make -j $CPU_COUNT + - else + - if [ ${DISTRO_NAME} == "debian" ];then + - scan-build $CHECKERS --keep-cc --use-cc=clang --use-c++=clang++ -o html-report make + - make clean + - fi + - scan-build $CHECKERS --keep-cc -o html-report make + - fi + +after_scripts: + - if [ ${BUILD_TYPE} == "scripts" ];then + - XVFB_RUN="$(which xvfb-run || true)" + - if [ ${DISTRO_NAME} == "debian" ];then + - if [ -e ./autogen.sh ]; then + - ${XVFB_RUN} make check + - elif [ -e ./CMakeLists.txt ]; then + - ${XVFB_RUN} env CTEST_OUTPUT_ON_FAILURE=1 make test + - fi + - fi + - fi diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6ebac89 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,43 @@ +# vim: set ts=2 sts=2 sw=2 expandtab : +dist: bionic +language: shell +os: linux + +arch: + - amd64 + - ppc64le + +services: + - docker + +addons: + apt: + packages: + - python3-pip + - python3-setuptools + +before_install: + # let's use the Ayatana Indicators project's docker build script... + - curl -Ls -o docker-build https://github.com/AyatanaIndicators/ayatana-dev-scripts/raw/master/travis/docker-build + - chmod +x docker-build + +install: + - pip3 install wheel + - pip3 install PyGithub + - ./docker-build --name ${DISTRO} --config .build.yml --install + +script: + - ./docker-build --name ${DISTRO} --verbose --config .build.yml --build scripts + +env: +# temp disable of archlinux builds, see https://gitlab.archlinux.org/archlinux/archlinux-docker/-/issues/56 +# - DISTRO="archlinux:latest" + - DISTRO="debian:testing" + - DISTRO="debian:stable" +# - DISTRO="ubuntu:rolling" + - DISTRO="ubuntu:focal" + +jobs: + exclude: + - env: DISTRO="archlinux:latest" + arch: ppc64le diff --git a/configure.ac b/configure.ac index 6e03318..1c42a98 100644 --- a/configure.ac +++ b/configure.ac @@ -98,7 +98,7 @@ AM_GLIB_GNU_GETTEXT # Flags ########################### -AC_SUBST(AM_CFLAGS, "-Wall -Werror") +AC_SUBST(AM_CFLAGS, "-Wall") AC_SUBST(AM_CPPFLAGS, $AM_CFLAGS) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index 6270105..d09828a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -22,6 +22,8 @@ libgenerated_la_SOURCES = \ remote-logon.h \ $(NULL) +# no -Werror here... +# The generation tools might lag behind the GNU C compiler's sensitivity libgenerated_la_CFLAGS = \ $(SERVICE_CFLAGS) \ $(NULL) @@ -57,6 +59,7 @@ libservers_la_SOURCES = \ libservers_la_CFLAGS = \ -DUCCS_QUERY_TOOL="\"remote-logon-config-agent\"" \ + -Werror \ $(SERVICE_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(NULL) @@ -71,6 +74,7 @@ libservers_la_LDFLAGS = \ remote_logon_service_CFLAGS = \ -DDEFAULT_CONFIG_FILE="\"$(sysconfdir)/remote-logon-service.conf\"" \ + -Werror \ $(SERVICE_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(NULL) diff --git a/src/crypt.c b/src/crypt.c index 146aa7e..defc958 100644 --- a/src/crypt.c +++ b/src/crypt.c @@ -91,7 +91,7 @@ do_aes_encrypt(const gchar *origBuffer, const gchar * password, size_t *outBuffe const size_t bufferLength = ceil((double)origBufferLength / blkLength) * blkLength; gchar *buffer = malloc(bufferLength); memcpy(buffer, origBuffer, origBufferLength); - int i; + size_t i; for (i = origBufferLength; i < bufferLength; ++i) buffer[i] = 0; diff --git a/src/defines.h b/src/defines.h index 08314e3..0008acc 100644 --- a/src/defines.h +++ b/src/defines.h @@ -21,6 +21,8 @@ #ifndef __DEFINES_H__ #define __DEFINES_H__ +#define RLS_UNUSED __attribute__((unused)) + /* required UCCS API version */ #define UCCS_API_VERSION "5" @@ -63,7 +63,7 @@ error_domain (void) /* When one of the state changes on the server emit that so that everone knows there might be a new server available. */ static void -server_status_updated (Server * server, ServerState newstate, RemoteLogon * rl) +server_status_updated (Server RLS_UNUSED *server, ServerState newstate, RemoteLogon *rl) { GVariant * array = NULL; @@ -88,7 +88,7 @@ server_status_updated (Server * server, ServerState newstate, RemoteLogon * rl) /* Looks for the config file and does some basic parsing to pull out the UCCS servers that are configured in it */ static void -find_config_file (GKeyFile * parsed, const gchar * cmnd_line, RemoteLogon * rl) +find_config_file (GKeyFile *parsed, const gchar *cmnd_line, RemoteLogon *rl) { GError * error = NULL; const gchar * file = DEFAULT_CONFIG_FILE; @@ -138,7 +138,7 @@ find_config_file (GKeyFile * parsed, const gchar * cmnd_line, RemoteLogon * rl) } gint -server_list_to_array (GVariantBuilder * builder, GList * items) +server_list_to_array (GVariantBuilder *builder, GList *items) { gint servercnt = 0; GList * head = NULL; @@ -159,7 +159,7 @@ server_list_to_array (GVariantBuilder * builder, GList * items) } static gboolean -handle_get_servers (RemoteLogon * rl, GDBusMethodInvocation * invocation, gpointer user_data) +handle_get_servers (RemoteLogon RLS_UNUSED *rl, GDBusMethodInvocation * invocation, gpointer RLS_UNUSED user_data) { GVariant * array = NULL; @@ -207,7 +207,7 @@ handle_get_servers_login_cb (UccsServer * server, gboolean unlocked, gpointer us /* Handle the GetServerForLogin DBus call */ static gboolean -handle_get_servers_login (RemoteLogon * rl, GDBusMethodInvocation * invocation, gpointer user_data) +handle_get_servers_login (RemoteLogon RLS_UNUSED *rl, GDBusMethodInvocation *invocation, gpointer RLS_UNUSED user_data) { GVariant * params = g_dbus_method_invocation_get_parameters(invocation); const gchar * sender = g_dbus_method_invocation_get_sender(invocation); @@ -272,7 +272,7 @@ handle_get_servers_login (RemoteLogon * rl, GDBusMethodInvocation * invocation, /* Look through a list of servers to see if one matches a URL */ static Server * -handle_get_domains_list_helper (GList * list, const gchar * uri) +handle_get_domains_list_helper (GList *list, const gchar *uri) { if (list == NULL) return NULL; @@ -293,7 +293,7 @@ handle_get_domains_list_helper (GList * list, const gchar * uri) /* Get the cached domains for a server */ static gboolean -handle_get_domains (RemoteLogon * rl, GDBusMethodInvocation * invocation, gpointer user_data) +handle_get_domains (RemoteLogon RLS_UNUSED *rl, GDBusMethodInvocation *invocation, gpointer RLS_UNUSED user_data) { GVariant * params = g_dbus_method_invocation_get_parameters(invocation); @@ -331,7 +331,7 @@ handle_get_domains (RemoteLogon * rl, GDBusMethodInvocation * invocation, gpoint /* Set a given server as last used */ static gboolean -handle_set_last_used_server (RemoteLogon * rl, GDBusMethodInvocation * invocation, gpointer user_data) +handle_set_last_used_server (RemoteLogon RLS_UNUSED * rl, GDBusMethodInvocation * invocation, gpointer RLS_UNUSED user_data) { GVariant * params = g_dbus_method_invocation_get_parameters(invocation); @@ -376,7 +376,7 @@ handle_set_last_used_server (RemoteLogon * rl, GDBusMethodInvocation * invocatio /* If we loose the name, tell the world and there's not much we can do */ static void -name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data) +name_lost (GDBusConnection RLS_UNUSED * connection, const gchar * name, gpointer user_data) { GMainLoop * mainloop = (GMainLoop *)user_data; diff --git a/src/uccs-server.c b/src/uccs-server.c index fda6494..8f8a795 100644 --- a/src/uccs-server.c +++ b/src/uccs-server.c @@ -174,7 +174,7 @@ struct _hash_helper { /* GHashTable foreach item */ static gboolean -clear_hash_helper (gpointer key, gpointer value, gpointer user_data) +clear_hash_helper (gpointer key, gpointer RLS_UNUSED value, gpointer user_data) { struct _hash_helper * helper = (struct _hash_helper *)user_data; GError * error = NULL; @@ -303,7 +303,7 @@ uccs_server_finalize (GObject *object) /* Callback from the message getting complete */ static void -verify_server_cb (SoupSession * session, SoupMessage * message, gpointer user_data) +verify_server_cb (SoupSession RLS_UNUSED *session, SoupMessage *message, gpointer user_data) { UccsServer * server = UCCS_SERVER(user_data); guint statuscode = 404; @@ -341,7 +341,7 @@ verify_server (UccsServer * server) /* Callback for when the Network Manger state changes */ static void -nm_state_changed (NMClient *client, const GParamSpec *pspec, gpointer user_data) +nm_state_changed (NMClient RLS_UNUSED *client, const GParamSpec RLS_UNUSED *pspec, gpointer user_data) { g_return_if_fail(IS_UCCS_SERVER(user_data)); UccsServer * server = UCCS_SERVER(user_data); @@ -368,7 +368,7 @@ nm_state_changed (NMClient *client, const GParamSpec *pspec, gpointer user_data) /* Get the properties that can be sent by the greeter for this server */ static GVariant * -get_properties (Server * server) +get_properties (Server RLS_UNUSED *server) { GVariantBuilder propbuilder; g_variant_builder_init(&propbuilder, G_VARIANT_TYPE_ARRAY); @@ -472,7 +472,7 @@ parse_rds_array (UccsServer * server, JsonArray * array) g_list_free_full(server->subservers, g_object_unref); server->subservers = NULL; - int i; + guint i; for (i = 0; i < json_array_get_length(array); i++) { JsonNode * node = json_array_get_element(array, i); diff --git a/tests/Makefile.am b/tests/Makefile.am index a165072..61be169 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -33,6 +33,7 @@ server_test_SOURCES = \ server_test_CFLAGS = \ -I$(top_srcdir)/src \ -I$(top_builddir)/src \ + -Werror \ $(SERVICE_CFLAGS) \ $(NULL) @@ -78,6 +79,7 @@ dbus_interface_CFLAGS = \ -DUCCS_CONFIG_FILE="\"$(abs_srcdir)/uccs-config.conf\"" \ -DSLMOCK_CONFIG_FILE="\"$(abs_builddir)/slmock-config.conf\"" \ -DNULL_CONFIG_FILE="\"$(abs_srcdir)/null-config.conf\"" \ + -Werror \ $(SERVICE_CFLAGS) \ $(TEST_CFLAGS) \ $(NULL) |