Merge pull request #1383 from gradido/remove-login_server

feat: Remove Login Server
This commit is contained in:
Moriz Wahl 2022-02-02 14:29:04 +01:00 committed by GitHub
commit 2bf0573b67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
355 changed files with 1 additions and 43552 deletions

View File

@ -106,45 +106,6 @@ jobs:
name: docker-database-production_up
path: /tmp/database_up.tar
##############################################################################
# JOB: DOCKER BUILD PRODUCTION LOGIN SERVER ##################################
##############################################################################
build_production_login_server:
name: Docker Build Production - Login Server
runs-on: ubuntu-latest
#needs: [nothing]
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
##########################################################################
# SET ENVS ###############################################################
##########################################################################
- name: ENV - VERSION
run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
- name: ENV - BUILD_DATE
run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
- name: ENV - BUILD_VERSION
run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: ENV - BUILD_COMMIT
run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
##########################################################################
# LOGIN SERVER ###########################################################
##########################################################################
- name: Login Server | Build `production` image
run: |
docker build -t "gradido/login_server:latest" -t "gradido/login_server:production" -t "gradido/login_server:${VERSION}" -t "gradido/login_server:${BUILD_VERSION}" login_server/
docker save "gradido/login_server" > /tmp/login_server.tar
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: docker-login-server-production
path: /tmp/login_server.tar
##############################################################################
# JOB: DOCKER BUILD PRODUCTION COMMUNITY SERVER ##############################
##############################################################################
@ -262,7 +223,7 @@ jobs:
upload_to_dockerhub:
name: Upload to Dockerhub
runs-on: ubuntu-latest
needs: [build_production_frontend, build_production_backend, build_production_database_up, build_production_login_server, build_production_community_server, build_production_mariadb, build_production_nginx]
needs: [build_production_frontend, build_production_backend, build_production_database_up, build_production_community_server, build_production_mariadb, build_production_nginx]
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
@ -296,13 +257,6 @@ jobs:
path: /tmp
- name: Load Docker Image
run: docker load < /tmp/database_up.tar
- name: Download Docker Image (Login Server)
uses: actions/download-artifact@v2
with:
name: docker-login-server-production
path: /tmp
- name: Load Docker Image
run: docker load < /tmp/login_server.tar
- name: Download Docker Image (Community Server)
uses: actions/download-artifact@v2
with:
@ -335,8 +289,6 @@ jobs:
run: docker push --all-tags gradido/backend
- name: Push database
run: docker push --all-tags gradido/database
- name: Push login_server
run: docker push --all-tags gradido/login_server
- name: Push community_server
run: docker push --all-tags gradido/community_server
- name: Push MariaDB

View File

@ -107,28 +107,6 @@ jobs:
name: docker-database-test_up
path: /tmp/database_up.tar
##############################################################################
# JOB: DOCKER BUILD TEST LOGIN SERVER ########################################
##############################################################################
build_test_login_server:
name: Docker Build Test - Login Server
runs-on: ubuntu-latest
#needs: [nothing]
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true
##########################################################################
# BUILD LOGIN SERVER DOCKER IMAGE ########################################
##########################################################################
- name: login server | Build `release` image
run: |
docker build -t "gradido/login_server:release" -f ./login_server/Dockerfile login_server/
##############################################################################
# JOB: DOCKER BUILD TEST COMMUNITY SERVER ####################################
##############################################################################
@ -531,73 +509,6 @@ jobs:
min_coverage: 38
token: ${{ github.token }}
##############################################################################
# JOB: UNIT TEST LOGIN-SERVER ###############################################
##############################################################################
unit_test_login_server:
name: Unit tests - Login-Server
runs-on: ubuntu-latest
needs: []
services:
mariadb:
image: gradido/mariadb:test
env:
MARIADB_ALLOW_EMPTY_PASSWORD: 1
MARIADB_USER: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping"
--health-interval=6s
--health-timeout=3s
--health-retries=4
steps:
# - name: Debug service
# run: echo "$(docker ps)"
#- name: Debug container choosing script
# run: echo "$(docker container ls | grep mariadb | awk '{ print $1 }')"
- name: get mariadb container id
run: echo "::set-output name=id::$(docker container ls | grep mariadb | awk '{ print $1 }')"
id: mariadb_container
- name: get automatic created network
run: echo "::set-output name=id::$(docker network ls | grep github_network | awk '{ print $1 }')"
id: network
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true
# Database migration
- name: Start database migration
run: |
docker build --target production_up -t "gradido/database:production_up" database/
docker run --network ${{ steps.network.outputs.id }} --name=database --env NODE_ENV=production --env DB_HOST=mariadb --env DB_DATABASE=gradido_community_test -d gradido/database:production_up
##########################################################################
# Build Login-Server Test Docker image ###################################
##########################################################################
- name: login server | Build `test` image
run: |
docker build -t "gradido/login_server:test" -f ./login_server/Dockerfiles/ubuntu/Dockerfile.test login_server/
##########################################################################
# UNIT TESTS BACKEND LOGIN-SERVER #######################################
##########################################################################
- name: Login-Server | Unit tests
run: |
docker run --network container:$(docker container ls | grep mariadb | awk '{ print $1 }') -v ~/coverage:/code/build_cov/coverage -v $(pwd)/configs/login_server:/etc/grd_login gradido/login_server:test
cp -r ~/coverage ./coverage
##########################################################################
# COVERAGE CHECK BACKEND LOGIN-SERVER ####################################
##########################################################################
- name: backend login | Coverage check
uses: webcraftmedia/coverage-check-action@master
with:
report_name: Coverage Backend Login
type: lcov
result_path: ./coverage/coverage.info
min_coverage: 34
token: ${{ github.token }}
##############################################################################
# JOB: UNIT TEST COMMUNITY-SERVER ###########################################
##############################################################################
@ -627,11 +538,6 @@ jobs:
- name: get database migration container id
run: echo "::set-output name=id::$(docker container ls | grep database | awk '{ print $1 }')"
id: database_container
- name: Start Login-Server
run: docker run --network ${{ steps.network.outputs.id }} --name=login-server -d gradido/login_server:with-config
- name: get login-server container id
run: echo "::set-output name=id::$(docker container ls | grep login_server | awk '{ print $1 }')"
id: login_server_container
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
@ -647,9 +553,6 @@ jobs:
path: /tmp
- name: Load Docker Image
run: docker load < /tmp/community_server.tar
# for debugging login-server
- name: check login-server
run: docker logs ${{ steps.login_server_container.outputs.id }}
- name: check mariadb
run: docker logs ${{ steps.mariadb_container.outputs.id }}
- name: check migration

28
.gitmodules vendored
View File

@ -3,34 +3,6 @@
url = https://github.com/gradido/gn.git
branch = master
[submodule "login_server/dependencies/tinf"]
path = login_server/dependencies/tinf
url = https://github.com/jibsen/tinf.git
[submodule "login_server/dependencies/mariadb-connector-c"]
path = login_server/dependencies/mariadb-connector-c
url = https://github.com/MariaDB/mariadb-connector-c.git
[submodule "login_server/src/proto"]
path = login_server/src/proto
url = https://github.com/gradido/gradido_protocol.git
[submodule "login_server/dependencies/spirit-po"]
path = login_server/dependencies/spirit-po
url = https://github.com/cbeck88/spirit-po.git
[submodule "login_server/dependencies/poco"]
path = login_server/dependencies/poco
url = https://github.com/pocoproject/poco.git
[submodule "login_server/dependencies/cmake-modules"]
path = login_server/dependencies/cmake-modules
url = https://github.com/viaduck/cmake-modules.git
[submodule "community_server/src/protobuf"]
path = community_server/src/protobuf
url = https://github.com/gradido/gradido_protocol.git
[submodule "login_server/dependencies/libsodium"]
path = login_server/dependencies/libsodium
url = https://github.com/jedisct1/libsodium.git
[submodule "login_server/src/proto"]
path = login_server/src/proto
url = https://github.com/gradido/gradido_protocol.git
[submodule "login_server/dependencies/protobuf"]
path = login_server/dependencies/protobuf
url = https://github.com/protocolbuffers/protobuf.git

View File

@ -60,7 +60,6 @@ docker-compose -f docker-compose.yml up
- [frontend](./frontend) Wallet frontend
- [backend](./backend) GraphQL & Business logic backend
- [mariadb](./mariadb) Database backend
- [login_server](./login_server) User credential storage & business logic backend (will be removed)
- [community_server](./community_server/) Business logic backend
We are currently restructuring the service to reduce dependencies and unify business logic into one place. Furthermore the databases defined for each service will be unified into one.

Binary file not shown.

View File

@ -1,515 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-21 13:37+0200\n"
"PO-Revision-Date: 2021-06-21 13:38+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.0\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: build/http_pages/LoginPage.cpp:196 build/http_pages/LoginPage.cpp:275
msgid "Login"
msgstr "Anmeldung"
#: build/http_pages/LoginPage.cpp:196
msgid "E-Mail or password isn't right, please try again!"
msgstr ""
"E-Mail und Passwort Kombination stimmen nicht, bitte versuche es erneut. "
#: build/http_pages/LoginPage.cpp:205
msgid "Passwort"
msgstr "Passwort"
#: build/http_pages/LoginPage.cpp:205
msgid ""
"Passwort wird noch berechnet, bitte versuche es in etwa 1 Minute erneut."
msgstr ""
#: build/http_pages/LoginPage.cpp:208 build/http_pages/LoginPage.cpp:211
msgid "User"
msgstr ""
#: build/http_pages/LoginPage.cpp:208
msgid "Error in saved data, the server admin will look at it."
msgstr ""
#: build/http_pages/LoginPage.cpp:211
msgid "Benutzer ist deaktiviert, kein Login möglich!"
msgstr ""
#: build/http_pages/LoginPage.cpp:275
msgid "Username and password are needed!"
msgstr "E-Mail und Passwort werden benötigt!"
#: build/http_pages/LoginPage.cpp:376 src/cpp/model/Session.cpp:161
#: src/cpp/model/Session.cpp:168 src/cpp/model/Session.cpp:220
#: src/cpp/model/Session.cpp:231
msgid "E-Mail"
msgstr ""
#: build/http_pages/LoginPage.cpp:381
#: src/cpp/SingletonManager/SessionManager.cpp:603
#: src/cpp/SingletonManager/SessionManager.cpp:609
#: src/cpp/SingletonManager/SessionManager.cpp:614
#: src/cpp/SingletonManager/SessionManager.cpp:619
#: src/cpp/SingletonManager/SessionManager.cpp:624
#: src/cpp/SingletonManager/SessionManager.cpp:629
msgid "Password"
msgstr "Passwort"
#: build/http_pages/LoginPage.cpp:384
msgid " Login "
msgstr "Anmeldung"
#: build/http_pages/LoginPage.cpp:391
msgid "You haven't any account yet? Please follow the link to create one."
msgstr "Du hast noch kein Gradido-Konto?"
#: build/http_pages/LoginPage.cpp:395
msgid "Create New Account"
msgstr "Neues Konto erstellen"
#: build/http_pages/LoginPage.cpp:403
msgid "Passwort vergessen"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:155
msgid "E-Mail verifizieren"
msgstr "E-Mail überprüfen"
#: build/http_pages/CheckEmailPage.cpp:165
msgid ""
"Deine E-Mail wurde erfolgreich bestätigt. Du kannst nun Gradidos versenden."
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:170
msgid "Zur Startseite"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:175
msgid "Bitte gib deinen E-Mail Verification Code ein:"
msgstr "Bitte gib deinen E-Mail Verification Code ein:"
#: build/http_pages/CheckEmailPage.cpp:178 src/cpp/model/Session.cpp:184
msgid "Email Verification Code"
msgstr "Email Verification Code"
#: build/http_pages/CheckEmailPage.cpp:185
msgid "&Uuml;berpr&uuml;fe Code"
msgstr "&Uuml;berpr&uuml;fe Code"
#: build/http_pages/CheckEmailPage.cpp:190
msgid "Du hast bisher keinen Code erhalten?"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:193
msgid "E-Mail erneut zuschicken (in Arbeit)"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:198
msgid "Funktioniert dein E-Mail Verification Code nicht?"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:201
msgid "Schicke uns eine E-Mail und wir k&uuml;mmern uns darum: "
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:208
#: build/http_pages/ResetPasswordPage.cpp:273
msgid "E-Mail an Support schicken"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:174
#: build/http_pages/ResetPasswordPage.cpp:217
msgid "Gib bitte hier deine E-Mail Adresse an:"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:183
msgid "Bestätigen"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:225
msgid "Hast du dir deine Passphrase notiert oder gemerkt?"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:234
#: build/http_pages/PassphrasePage.cpp:373
msgid "Ja"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:241
msgid "Nein"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:247
msgid "Absenden"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:255
msgid "Dir wird eine E-Mail zugeschickt um dein Passwort zur&uuml;ckzusetzen."
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:260
msgid "Der Admin hat eine E-Mail bekommen und wird sich bei dir melden."
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:265
msgid ""
"Du hast bereits eine E-Mail bekommen. Bitte schau auch in dein Spam-"
"Verzeichnis nach. "
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:268
msgid ""
"Du hast wirklich keine E-Mail erhalten und auch schon ein paar Minuten "
"gewartet?"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:41
#: build/http_pages/PassphrasePage.cpp:111
#: build/http_pages/PassphrasePage.cpp:132 src/cpp/model/Session.cpp:465
#: src/cpp/model/Session.cpp:477 src/cpp/model/Session.cpp:491
msgid "Passphrase"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:42
#: build/http_pages/PassphrasePage.cpp:451
msgid "Neues Konto anlegen"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:43
msgid "2/3"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:111
msgid ""
"Diese Passphrase ist ung&uuml;ltig, bitte &uuml;berpr&uuml;fen oder neu "
"generieren (lassen)."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:132
msgid "intern error please try again later"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:147
msgid "3/3"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:150
#: build/http_pages/PassphrasePage.cpp:153
msgid "1/3"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:152
msgid "Neues Passwort anlegen"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:270
msgid "Passphrase abschreiben"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:287
msgid "Was ist eine Passphrase?"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:290
msgid "Deine Passphrase besteht aus den im grünen Feld angezeigten Wörtern."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:293
msgid "Sie dient deiner Sicherheit."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:296
msgid ""
"Du brauchst deine Passphrase um dein Konto wiederherzustellen, wenn du mal "
"dein Passwort vergessen haben solltest."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:300
msgid "Deine Passphrase (Groß/Kleinschreibung beachten)"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:309
#: build/http_pages/PassphrasePage.cpp:352
msgid "Was zu tun ist:"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:312
msgid ""
"Schreibe dir die obenstehende Passphrase <b>von Hand</b> auf ein Blatt "
"Papier!"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:315
msgid "Speichere sie auf keinen Fall auf deinem Rechner oder Mobilgerät!!"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:318
msgid "Bewahre sie an einem sicheren Ort auf!"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:322
#: build/http_pages/PassphrasePage.cpp:478
#: build/http_pages/PassphrasePage.cpp:487
#: build/http_pages/PassphrasePage.cpp:511
msgid "Weiter"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:355
msgid "Hast du dir deine Passphrase gemerkt?"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:358
msgid ""
"Dann zeig es mir. Zur Unterstützung gebe ich dir deine Wörter aber in "
"anderer Reihenfolge."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:361
msgid "Klicke sie an um sie einzusetzen."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:364
msgid "Überprüfe dabei, ob du alle Wörter richtig geschrieben hast!"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:370
msgid ""
"Weil du kein Javascript verwendest geht es direkt weiter. Hast du dir deine "
"Passphrase gemerkt oder aufgeschrieben?"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:429
msgid "Deine E-Mail Adresse wurde erfolgreich bestätigt."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:437
msgid "Neue Gradido Adresse anlegen / wiederherstellen"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:440
msgid ""
"Möchtest du ein neues Gradido-Konto anlegen oder ein bestehendes "
"wiederherstellen?"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:460
msgid "Bestehendes Konto wiederherstellen"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:469
msgid ""
"Falls du ein bestehendes Konto wiederherstellen willst, gib hier deine "
"Passphrase ein:"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:497
msgid "Konto wiederherstellen / Neues Passwort anlegen"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:501
msgid ""
"Um dein Konto wiederherzustellen und dir ein Neues Passwort auswählen zu "
"können, tippe hier bitte die Wörter deiner Passphrase in der richtigen "
"Reihenfolge ein, welche du dir aufgeschrieben hast."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:524
msgid "Fehler"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:527
msgid ""
"Ungültige Seite, wenn du das siehst stimmt hier etwas nicht. Bitte wende "
"dich an den Server-Admin."
msgstr ""
#: src/cpp/model/Session.cpp:147 src/cpp/model/Session.cpp:177
#: src/cpp/model/Session.cpp:645 src/cpp/model/Session.cpp:651
#: src/cpp/model/Session.cpp:937 src/cpp/model/Session.cpp:953
msgid "Benutzer"
msgstr ""
#: src/cpp/model/Session.cpp:147
msgid "Eingeloggter Benutzer ist kein Admin"
msgstr ""
#: src/cpp/model/Session.cpp:153 src/cpp/model/Session.cpp:212
msgid "Vorname"
msgstr ""
#: src/cpp/model/Session.cpp:153 src/cpp/model/Session.cpp:157
#: src/cpp/model/Session.cpp:212 src/cpp/model/Session.cpp:216
msgid ""
"Bitte gebe einen Namen an. Mindestens 3 Zeichen, keines folgender Zeichen "
"<>&;"
msgstr ""
#: src/cpp/model/Session.cpp:157 src/cpp/model/Session.cpp:216
msgid "Nachname"
msgstr ""
#: src/cpp/model/Session.cpp:161 src/cpp/model/Session.cpp:220
msgid "Bitte gebe eine g&uuml;ltige E-Mail Adresse an."
msgstr ""
#: src/cpp/model/Session.cpp:168
msgid "F&uuml;r diese E-Mail Adresse gibt es bereits einen Account"
msgstr ""
#: src/cpp/model/Session.cpp:177 src/cpp/model/Session.cpp:184
msgid "Fehler beim speichern!"
msgstr ""
#: src/cpp/model/Session.cpp:231
msgid "F&uuml;r diese E-Mail Adresse gibt es bereits ein Konto"
msgstr ""
#: src/cpp/model/Session.cpp:255
msgid "Server"
msgstr ""
#: src/cpp/model/Session.cpp:255
msgid "Fehler beim speichen des Kontos bitte versuche es später noch einmal"
msgstr ""
#: src/cpp/model/Session.cpp:350 src/cpp/model/Session.cpp:390
#: src/cpp/model/Session.cpp:832 src/cpp/model/Session.cpp:841
msgid "E-Mail Verification"
msgstr "E-Mail Überprüfung"
#: src/cpp/model/Session.cpp:350
msgid "Du hast dein Konto bereits aktiviert!"
msgstr ""
#: src/cpp/model/Session.cpp:390
msgid "Falscher Code f&uuml;r aktiven Login"
msgstr ""
#: src/cpp/model/Session.cpp:465
msgid "Deine Passphrase ist ung&uuml;tig"
msgstr ""
#: src/cpp/model/Session.cpp:477
msgid "Ein Fehler trat auf, bitte versuche es erneut"
msgstr ""
#: src/cpp/model/Session.cpp:491
msgid "Das ist nicht die richtige Passphrase."
msgstr ""
#: src/cpp/model/Session.cpp:645
msgid "Konnte Community Server nicht erreichen. E-Mail an den Admin ist raus."
msgstr ""
#: src/cpp/model/Session.cpp:651
msgid ""
"Fehler beim L&ouml;schen des Accounts. Bitte logge dich erneut ein und "
"versuche es nochmal."
msgstr ""
#: src/cpp/model/Session.cpp:832
msgid "Konnte kein passendes Konto finden."
msgstr ""
#: src/cpp/model/Session.cpp:841
msgid "Fehler beim laden des Benutzers."
msgstr ""
#: src/cpp/model/Session.cpp:937
msgid "Kein g&uuml;ltiger Benutzer, bitte logge dich erneut ein."
msgstr ""
#: src/cpp/model/Session.cpp:953
msgid "Fehler beim generieren der Passphrase, der Admin bekommt eine E-Mail. "
msgstr ""
#: src/cpp/model/email/Email.cpp:174
msgid "Default Email Subject"
msgstr ""
#: src/cpp/model/email/Email.cpp:180
msgid "Error from Gradido Login Server"
msgstr "Fehler auf dem Gradido Login Server"
#: src/cpp/model/email/Email.cpp:200
msgid "Gradido: E-Mail Verification"
msgstr "Gradido: E-Mail Überprüfung"
#: src/cpp/model/email/Email.cpp:246
msgid "Gradido: Reset Password"
msgstr "Gradido: Passwort zurücksetzen"
#: src/cpp/SingletonManager/SessionManager.cpp:604
msgid ""
"Please enter a valid password with at least 8 characters, upper and lower "
"case letters, at least one number and one special character (@$!%*?&+-_)!"
msgstr ""
"Bitte gebe ein gültiges Password ein mit mindestens 8 Zeichen, Groß- und "
"Kleinbuchstaben, mindestens einer Zahl und einem Sonderzeichen (@$!%*?&+-_) "
"ein!"
#: src/cpp/SingletonManager/SessionManager.cpp:610
msgid "Your password is to short!"
msgstr "Dein Passwort ist zu kurz!"
#: src/cpp/SingletonManager/SessionManager.cpp:615
msgid "Your password does not contain lowercase letters!"
msgstr "Dein Passwort enthält keine Kleinbuchstaben!"
#: src/cpp/SingletonManager/SessionManager.cpp:620
msgid "Your password does not contain any capital letters!"
msgstr " Dein Passwort enthält keine Großbuchstaben!"
#: src/cpp/SingletonManager/SessionManager.cpp:625
msgid "Your password does not contain any number!"
msgstr "Dein Passwort enthält keine Zahlen!"
#: src/cpp/SingletonManager/SessionManager.cpp:630
msgid "Your password does not contain special characters (@$!%*?&+-)!"
msgstr "Dein Passwort enthält keine Sonderzeichen (@$!%*?&+-)!"
#~ msgid "Account"
#~ msgstr "Konto"
#~ msgid "E-Mail Address not checked, do you already get one?"
#~ msgstr ""
#~ "E-Mail Adresse wurde noch nicht überprüft. Hast du schon in deine E-Mails "
#~ "geschaut? Bitte schau auch in dein Spam-Verzeichnis nach."
#~ msgid ""
#~ "Schreibe dir deine Passphrase auf und packe sie gut weg. Du brauchst sie "
#~ "um deine Adresse wiederherzustellen. Wenn du sie verlierst, sind auch "
#~ "deine Gradidos verloren."
#~ msgstr ""
#~ "Schreibe dir deine Passphrase auf oder drucke sie aus und bewahre sie "
#~ "<b>in Papier-Form</b> an einem sicheren Ort auf (speichere sie nicht auf "
#~ "deinem Rechner oder Mobilgerät)! Du brauchst deine Passphrase um dein "
#~ "Konto wiederherzustellen, wenn du mal dein Passort vergessen haben "
#~ "solltest. "
#~ msgid ""
#~ "Der neue Gradido basiert technisch auf einer Kryptowährung (wie z.B. "
#~ "Bitcoin) um maximale Sicherheit zu erreichen."
#~ msgstr ""
#~ "Der neue Gradido basiert technisch auf einer Kryptowährung (wie z.B. "
#~ "Bitcoin) um für dich die maximale Sicherheit zu gewährleisten."
#~ msgid ""
#~ "Der Code stimmt nicht, bitte &uuml;berpr&uuml;fe ihn nochmal oder "
#~ "registriere dich erneut oder wende dich an den Server-Admin"
#~ msgstr ""
#~ "Der Code stimmt nicht, bitte &uuml;berpr&uuml;fe ihn nochmal oder "
#~ "schreibe mir eine E-Mail an: coin@gradido.net."

Binary file not shown.

View File

@ -1,428 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-28 10:50+0200\n"
"PO-Revision-Date: 2020-05-28 10:53+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: en_GB\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.3.1\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:85
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:124
msgid "Login"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:85
msgid "E-Mail or password isn't right, please try again!"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:88
msgid "Passwort"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:88
msgid ""
"Passwort wird noch berechnet, bitte versuche es in etwa 1 Minute erneut."
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:91
msgid "Account"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:91
msgid "E-Mail Address not checked, do you already get one?"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:124
msgid "Username and password are needed!"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:175
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:50
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:54
#: model/Session.cpp:163 model/Session.cpp:170 model/Session.cpp:209
#: model/Session.cpp:234
msgid "E-Mail"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:178
msgid "Password"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:180
msgid " Login "
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:182
msgid "You haven't any account yet? Please follow the link to create one."
msgstr "Don't have an Gradido-account yet?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:183
msgid "Create New Account"
msgstr "Sign Up"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:186
msgid "Passwort vergessen"
msgstr "Reset Password"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:97
msgid "Bitte gebe deinen E-Mail Verification Code ein:"
msgstr "Please enter your E-Mail Verification Code:"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:98
#: model/Session.cpp:186
msgid "Email Verification Code"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:100
msgid "&Uuml;berpr&uuml;fe Code"
msgstr "Check Code"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:104
msgid "Du hast bisher keinen Code erhalten?"
msgstr "You didn't get a code yet?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:105
msgid "E-Mail erneut zuschicken (in Arbeit)"
msgstr "Re-Send E-Mail (work in progress)"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:108
msgid "Funktioniert dein E-Mail Verification Code nicht?"
msgstr "Your E-Mail Verfication Code doesn't work?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:109
msgid "Schicke uns eine E-Mail und wir k&uuml;mmern uns darum: "
msgstr "Send us a E-Mail and we take care of it:"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:110
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:133
msgid "E-Mail an Support schicken"
msgstr "Send E-Mail to support"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:50
msgid "E-Mail Adresse konnte nicht gefunden werden oder ist nicht aktiviert."
msgstr "E-Mail not found or not activated."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:54
msgid "E-Mail Adresse nicht angegeben."
msgstr "Please give your E-Mail Address."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:59
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:74
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:26
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:94
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:114
#: model/Session.cpp:495 model/Session.cpp:507 model/Session.cpp:515
msgid "Passphrase"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:59
msgid "Bitte w&auml;hle eine Option aus."
msgstr "Please choose one Option."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:74
msgid "Ung&uuml;ltige Option"
msgstr "Invalid option"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:107
msgid "Gebe bitte hier deine E-Mail Adresse an:"
msgstr "Please enter a valid email."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:109
msgid "Hast du dir deine Passphrase notiert oder gemerkt?"
msgstr "Do you memorized your passphrase?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:113
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:196
msgid "Ja"
msgstr "Yes"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:118
msgid "Nein"
msgstr "No"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:123
msgid "Absenden"
msgstr "Send"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:127
msgid "Dir wird eine E-Mail zugeschickt um dein Passwort zur&uuml;ckzusetzen."
msgstr "You get an E-Mail to reset your password."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:129
msgid "Der Admin hat eine E-Mail bekommen und wird sich bei dir melden."
msgstr "The Admin get an E-Mail, wait on his replay."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:131
msgid ""
"Du hast bereits eine E-Mail bekommen. Bitte schau auch in dein Spam-"
"Verzeichnis nach. "
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:132
msgid ""
"Du hast wirklich keine E-Mail erhalten und auch schon ein paar Minuten "
"gewartet?"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:27
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:256
msgid "Neues Konto anlegen"
msgstr "Create new Account"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:28
msgid "2/3"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:94
msgid ""
"Diese Passphrase ist ung&uuml;ltig, bitte &uuml;berpr&uuml;fen oder neu "
"generieren (lassen)."
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:114
msgid "intern error please try again later"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:129
msgid "3/3"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:132
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:135
msgid "1/3"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:134
msgid "Neues Passwort anlegen"
msgstr "Create new Password"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:153
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:188
msgid "Was zu tun ist:"
msgstr "What to do:"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:154
msgid ""
"Schreibe dir deine Passphrase auf und packe sie gut weg. Du brauchst sie um "
"deine Adresse wiederherzustellen. Wenn du sie verlierst, sind auch deine "
"Gradidos verloren."
msgstr ""
"Write down your passphrase and put it away well. You need it to restore your "
"address. If you lose them, your Gradidos are lost too."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:157
msgid "Deine Passphrase (Groß/Kleinschreibung beachten)"
msgstr "Your Passphrase"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:161
msgid "Was ist eine Passphrase?"
msgstr "What is a passphrase?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:162
msgid ""
"Die Passphrase kommt aus dem Crypto-Bereich und ist ein Weg einen "
"komplizierte kryptografischen Schlüssel in einer lesbaren Form darzustellen."
msgstr ""
"The passphrase comes from the crypto area and is a way to represent a "
"complicated cryptographic key in a legible form."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:163
msgid ""
"Der neue Gradido basiert technisch auf einer Kryptowährung (wie z.B. "
"Bitcoin) um maximale Sicherheit zu erreichen."
msgstr ""
"The new Gradido is technically based on a cryptocurrency (such as Bitcoin) "
"to achieve maximum security for you."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:165
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:275
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:280
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:293
msgid "Weiter"
msgstr "Next"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:189
msgid "Hast du dir deine Passphrase gemerkt?"
msgstr "Do you memorized your passphrase?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:190
msgid ""
"Dann zeig es mir. Zur Unterstützung gebe ich dir deine Wörter aber in "
"anderer Reihenfolge."
msgstr ""
"Then show me. I will give you your words in a different order as support."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:191
msgid "Klicke sie an um sie einzusetzen."
msgstr "Click on it to use it."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:195
msgid ""
"Weil du kein Javascript verwendest geht es direkt weiter. Hast du dir deine "
"Passphrase gemerkt oder aufgeschrieben?"
msgstr ""
"Because you don't use javascript it goes straight on. Did you remember or "
"write down your passphrase?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:242
msgid "Deine E-Mail Adresse wurde erfolgreich bestätigt."
msgstr "Your email address has been successfully confirmed."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:246
msgid "Neue Gradido Adresse anlegen / wiederherstellen"
msgstr "Create / restore new Gradido address"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:247
msgid ""
"Möchtest du ein neues Gradido-Konto anlegen oder ein bestehendes "
"wiederherstellen?"
msgstr ""
"Do you want to restore an existing Gradido account or create a new one?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:263
msgid "Bestehendes Konto wiederherstellen"
msgstr "Restore existing Account"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:270
msgid ""
"Falls du ein bestehendes Konto wiederherstellen willst, gib hier deine "
"Passphrase ein:"
msgstr ""
"If you want to restore an existing account, enter your passphrase here:"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:288
msgid "Konto wiederherstellen / Neues Passwort anlegen"
msgstr "Restore account / create new password"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:289
msgid ""
"Um dein Konto wiederherzustellen, dir ein Neues Passwort auswählen zu "
"können, tippe hier bitte die Wörter deiner Passphrase in der richtigen "
"Reihenfolge ein, welche du dir aufgeschrieben hast."
msgstr ""
"To restore your account and to be able to choose a new password, please type "
"in the words of your passphrase in the correct order, which you have written "
"down."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:303
msgid "Fehler"
msgstr "Erro"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:304
msgid ""
"Ungültige Seite, wenn du das siehst stimmt hier etwas nicht. Bitte wende "
"dich an den Server-Admin."
msgstr ""
"Invalid page, if you see that something is wrong here. Please contact the "
"server admin."
#: model/Session.cpp:149 model/Session.cpp:180 model/Session.cpp:700
#: model/Session.cpp:706 model/Session.cpp:1005
msgid "Benutzer"
msgstr "User"
#: model/Session.cpp:149
msgid "Eingeloggter Benutzer ist kein Admin"
msgstr "Logged in user is not admin"
#: model/Session.cpp:155 model/Session.cpp:201
msgid "Vorname"
msgstr "Firstname"
#: model/Session.cpp:155 model/Session.cpp:159 model/Session.cpp:201
#: model/Session.cpp:205
msgid ""
"Bitte gebe einen Namen an. Mindestens 3 Zeichen, keines folgender Zeichen "
"<>&;"
msgstr "Please enter your Name. At least 3 Character, without <>& and ;"
#: model/Session.cpp:159 model/Session.cpp:205
msgid "Nachname"
msgstr "Lastname"
#: model/Session.cpp:163 model/Session.cpp:209
msgid "Bitte gebe eine g&uuml;ltige E-Mail Adresse an."
msgstr "Please enter a valid email."
#: model/Session.cpp:170 model/Session.cpp:234
msgid "F&uuml;r diese E-Mail Adresse gibt es bereits einen Account"
msgstr "This email has an account already."
#: model/Session.cpp:180 model/Session.cpp:186
msgid "Fehler beim speichern!"
msgstr "Error while saving!"
#: model/Session.cpp:379 model/Session.cpp:438 model/Session.cpp:881
#: model/Session.cpp:889
msgid "E-Mail Verification"
msgstr ""
#: model/Session.cpp:379
msgid "Du hast dein Konto bereits aktiviert!"
msgstr "You already activated your account!"
#: model/Session.cpp:438
msgid "Falscher Code f&uuml;r aktiven Login"
msgstr "Wrong Code for active Login."
#: model/Session.cpp:495
msgid "Deine Passphrase ist ung&uuml;tig"
msgstr "Your passphrase is invalid"
#: model/Session.cpp:507
msgid "Ein Fehler trat auf, bitte versuche es erneut"
msgstr "An error occurred, please try again"
#: model/Session.cpp:515
msgid "Das ist nicht die richtige Passphrase."
msgstr "This is not the correct passphrase."
#: model/Session.cpp:700
msgid "Konnte Community Server nicht erreichen. E-Mail an den Admin ist raus."
msgstr "Couldn't connect to the community server, send E-Mail to admin."
#: model/Session.cpp:706
msgid ""
"Fehler beim L&ouml;schen des Accounts. Bitte logge dich erneut ein und "
"versuche es nochmal."
msgstr "Error by deleting the account. Please re-login and try again."
#: model/Session.cpp:881
msgid "Konnte kein passendes Konto finden."
msgstr "This Account didn't seem to exist."
#: model/Session.cpp:889
msgid "Fehler beim laden des Benutzers."
msgstr ""
#: model/Session.cpp:1005
msgid "Kein g&uuml;ltiger Benutzer, bitte logge dich erneut ein."
msgstr "Invalid User, please re-login."
#~ msgid "*Das Konto muss nach dem 01.09.2019 angelegt worden sein."
#~ msgstr "* The account must have been created after September 1st, 2019."
#~ msgid "Nein, bitte ein neues erstellen!"
#~ msgstr "No, please create a new one!"
#~ msgid "Deine Passphrase"
#~ msgstr "Your passphrase"
#~ msgid ""
#~ "Der Code stimmt nicht, bitte &uuml;berpr&uuml;fe ihn nochmal oder "
#~ "registriere dich erneut oder wende dich an den Server-Admin"
#~ msgstr ""
#~ "The email verification code isn't correct. Please check at spell errors "
#~ "and try again or ask the server admin."

View File

@ -1,477 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-21 13:37+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: build/http_pages/LoginPage.cpp:196 build/http_pages/LoginPage.cpp:275
msgid "Login"
msgstr ""
#: build/http_pages/LoginPage.cpp:196
msgid "E-Mail or password isn't right, please try again!"
msgstr ""
#: build/http_pages/LoginPage.cpp:205
msgid "Passwort"
msgstr ""
#: build/http_pages/LoginPage.cpp:205
msgid ""
"Passwort wird noch berechnet, bitte versuche es in etwa 1 Minute erneut."
msgstr ""
#: build/http_pages/LoginPage.cpp:208 build/http_pages/LoginPage.cpp:211
msgid "User"
msgstr ""
#: build/http_pages/LoginPage.cpp:208
msgid "Error in saved data, the server admin will look at it."
msgstr ""
#: build/http_pages/LoginPage.cpp:211
msgid "Benutzer ist deaktiviert, kein Login möglich!"
msgstr ""
#: build/http_pages/LoginPage.cpp:275
msgid "Username and password are needed!"
msgstr ""
#: build/http_pages/LoginPage.cpp:376 src/cpp/model/Session.cpp:161
#: src/cpp/model/Session.cpp:168 src/cpp/model/Session.cpp:220
#: src/cpp/model/Session.cpp:231
msgid "E-Mail"
msgstr ""
#: build/http_pages/LoginPage.cpp:381
#: src/cpp/SingletonManager/SessionManager.cpp:603
#: src/cpp/SingletonManager/SessionManager.cpp:609
#: src/cpp/SingletonManager/SessionManager.cpp:614
#: src/cpp/SingletonManager/SessionManager.cpp:619
#: src/cpp/SingletonManager/SessionManager.cpp:624
#: src/cpp/SingletonManager/SessionManager.cpp:629
msgid "Password"
msgstr ""
#: build/http_pages/LoginPage.cpp:384
msgid " Login "
msgstr ""
#: build/http_pages/LoginPage.cpp:391
msgid "You haven't any account yet? Please follow the link to create one."
msgstr ""
#: build/http_pages/LoginPage.cpp:395
msgid "Create New Account"
msgstr ""
#: build/http_pages/LoginPage.cpp:403
msgid "Passwort vergessen"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:155
msgid "E-Mail verifizieren"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:165
msgid ""
"Deine E-Mail wurde erfolgreich bestätigt. Du kannst nun Gradidos versenden."
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:170
msgid "Zur Startseite"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:175
msgid "Bitte gib deinen E-Mail Verification Code ein:"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:178 src/cpp/model/Session.cpp:184
msgid "Email Verification Code"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:185
msgid "&Uuml;berpr&uuml;fe Code"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:190
msgid "Du hast bisher keinen Code erhalten?"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:193
msgid "E-Mail erneut zuschicken (in Arbeit)"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:198
msgid "Funktioniert dein E-Mail Verification Code nicht?"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:201
msgid "Schicke uns eine E-Mail und wir k&uuml;mmern uns darum: "
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:208
#: build/http_pages/ResetPasswordPage.cpp:273
msgid "E-Mail an Support schicken"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:174
#: build/http_pages/ResetPasswordPage.cpp:217
msgid "Gib bitte hier deine E-Mail Adresse an:"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:183
msgid "Bestätigen"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:225
msgid "Hast du dir deine Passphrase notiert oder gemerkt?"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:234
#: build/http_pages/PassphrasePage.cpp:373
msgid "Ja"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:241
msgid "Nein"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:247
msgid "Absenden"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:255
msgid "Dir wird eine E-Mail zugeschickt um dein Passwort zur&uuml;ckzusetzen."
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:260
msgid "Der Admin hat eine E-Mail bekommen und wird sich bei dir melden."
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:265
msgid ""
"Du hast bereits eine E-Mail bekommen. Bitte schau auch in dein Spam-"
"Verzeichnis nach. "
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:268
msgid ""
"Du hast wirklich keine E-Mail erhalten und auch schon ein paar Minuten "
"gewartet?"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:41
#: build/http_pages/PassphrasePage.cpp:111
#: build/http_pages/PassphrasePage.cpp:132 src/cpp/model/Session.cpp:465
#: src/cpp/model/Session.cpp:477 src/cpp/model/Session.cpp:491
msgid "Passphrase"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:42
#: build/http_pages/PassphrasePage.cpp:451
msgid "Neues Konto anlegen"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:43
msgid "2/3"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:111
msgid ""
"Diese Passphrase ist ung&uuml;ltig, bitte &uuml;berpr&uuml;fen oder neu "
"generieren (lassen)."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:132
msgid "intern error please try again later"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:147
msgid "3/3"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:150
#: build/http_pages/PassphrasePage.cpp:153
msgid "1/3"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:152
msgid "Neues Passwort anlegen"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:270
msgid "Passphrase abschreiben"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:287
msgid "Was ist eine Passphrase?"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:290
msgid "Deine Passphrase besteht aus den im grünen Feld angezeigten Wörtern."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:293
msgid "Sie dient deiner Sicherheit."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:296
msgid ""
"Du brauchst deine Passphrase um dein Konto wiederherzustellen, wenn du mal "
"dein Passwort vergessen haben solltest."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:300
msgid "Deine Passphrase (Groß/Kleinschreibung beachten)"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:309
#: build/http_pages/PassphrasePage.cpp:352
msgid "Was zu tun ist:"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:312
msgid ""
"Schreibe dir die obenstehende Passphrase <b>von Hand</b> auf ein Blatt "
"Papier!"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:315
msgid "Speichere sie auf keinen Fall auf deinem Rechner oder Mobilgerät!!"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:318
msgid "Bewahre sie an einem sicheren Ort auf!"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:322
#: build/http_pages/PassphrasePage.cpp:478
#: build/http_pages/PassphrasePage.cpp:487
#: build/http_pages/PassphrasePage.cpp:511
msgid "Weiter"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:355
msgid "Hast du dir deine Passphrase gemerkt?"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:358
msgid ""
"Dann zeig es mir. Zur Unterstützung gebe ich dir deine Wörter aber in "
"anderer Reihenfolge."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:361
msgid "Klicke sie an um sie einzusetzen."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:364
msgid "Überprüfe dabei, ob du alle Wörter richtig geschrieben hast!"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:370
msgid ""
"Weil du kein Javascript verwendest geht es direkt weiter. Hast du dir deine "
"Passphrase gemerkt oder aufgeschrieben?"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:429
msgid "Deine E-Mail Adresse wurde erfolgreich bestätigt."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:437
msgid "Neue Gradido Adresse anlegen / wiederherstellen"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:440
msgid ""
"Möchtest du ein neues Gradido-Konto anlegen oder ein bestehendes "
"wiederherstellen?"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:460
msgid "Bestehendes Konto wiederherstellen"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:469
msgid ""
"Falls du ein bestehendes Konto wiederherstellen willst, gib hier deine "
"Passphrase ein:"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:497
msgid "Konto wiederherstellen / Neues Passwort anlegen"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:501
msgid ""
"Um dein Konto wiederherzustellen und dir ein Neues Passwort auswählen zu "
"können, tippe hier bitte die Wörter deiner Passphrase in der richtigen "
"Reihenfolge ein, welche du dir aufgeschrieben hast."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:524
msgid "Fehler"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:527
msgid ""
"Ungültige Seite, wenn du das siehst stimmt hier etwas nicht. Bitte wende "
"dich an den Server-Admin."
msgstr ""
#: src/cpp/model/Session.cpp:147 src/cpp/model/Session.cpp:177
#: src/cpp/model/Session.cpp:645 src/cpp/model/Session.cpp:651
#: src/cpp/model/Session.cpp:937 src/cpp/model/Session.cpp:953
msgid "Benutzer"
msgstr ""
#: src/cpp/model/Session.cpp:147
msgid "Eingeloggter Benutzer ist kein Admin"
msgstr ""
#: src/cpp/model/Session.cpp:153 src/cpp/model/Session.cpp:212
msgid "Vorname"
msgstr ""
#: src/cpp/model/Session.cpp:153 src/cpp/model/Session.cpp:157
#: src/cpp/model/Session.cpp:212 src/cpp/model/Session.cpp:216
msgid ""
"Bitte gebe einen Namen an. Mindestens 3 Zeichen, keines folgender Zeichen "
"<>&;"
msgstr ""
#: src/cpp/model/Session.cpp:157 src/cpp/model/Session.cpp:216
msgid "Nachname"
msgstr ""
#: src/cpp/model/Session.cpp:161 src/cpp/model/Session.cpp:220
msgid "Bitte gebe eine g&uuml;ltige E-Mail Adresse an."
msgstr ""
#: src/cpp/model/Session.cpp:168
msgid "F&uuml;r diese E-Mail Adresse gibt es bereits einen Account"
msgstr ""
#: src/cpp/model/Session.cpp:177 src/cpp/model/Session.cpp:184
msgid "Fehler beim speichern!"
msgstr ""
#: src/cpp/model/Session.cpp:231
msgid "F&uuml;r diese E-Mail Adresse gibt es bereits ein Konto"
msgstr ""
#: src/cpp/model/Session.cpp:255
msgid "Server"
msgstr ""
#: src/cpp/model/Session.cpp:255
msgid "Fehler beim speichen des Kontos bitte versuche es später noch einmal"
msgstr ""
#: src/cpp/model/Session.cpp:350 src/cpp/model/Session.cpp:390
#: src/cpp/model/Session.cpp:832 src/cpp/model/Session.cpp:841
msgid "E-Mail Verification"
msgstr ""
#: src/cpp/model/Session.cpp:350
msgid "Du hast dein Konto bereits aktiviert!"
msgstr ""
#: src/cpp/model/Session.cpp:390
msgid "Falscher Code f&uuml;r aktiven Login"
msgstr ""
#: src/cpp/model/Session.cpp:465
msgid "Deine Passphrase ist ung&uuml;tig"
msgstr ""
#: src/cpp/model/Session.cpp:477
msgid "Ein Fehler trat auf, bitte versuche es erneut"
msgstr ""
#: src/cpp/model/Session.cpp:491
msgid "Das ist nicht die richtige Passphrase."
msgstr ""
#: src/cpp/model/Session.cpp:645
msgid "Konnte Community Server nicht erreichen. E-Mail an den Admin ist raus."
msgstr ""
#: src/cpp/model/Session.cpp:651
msgid ""
"Fehler beim L&ouml;schen des Accounts. Bitte logge dich erneut ein und "
"versuche es nochmal."
msgstr ""
#: src/cpp/model/Session.cpp:832
msgid "Konnte kein passendes Konto finden."
msgstr ""
#: src/cpp/model/Session.cpp:841
msgid "Fehler beim laden des Benutzers."
msgstr ""
#: src/cpp/model/Session.cpp:937
msgid "Kein g&uuml;ltiger Benutzer, bitte logge dich erneut ein."
msgstr ""
#: src/cpp/model/Session.cpp:953
msgid "Fehler beim generieren der Passphrase, der Admin bekommt eine E-Mail. "
msgstr ""
#: src/cpp/model/email/Email.cpp:174
msgid "Default Email Subject"
msgstr ""
#: src/cpp/model/email/Email.cpp:180
msgid "Error from Gradido Login Server"
msgstr ""
#: src/cpp/model/email/Email.cpp:200
msgid "Gradido: E-Mail Verification"
msgstr ""
#: src/cpp/model/email/Email.cpp:246
msgid "Gradido: Reset Password"
msgstr ""
#: src/cpp/SingletonManager/SessionManager.cpp:604
msgid ""
"Please enter a valid password with at least 8 characters, upper and lower "
"case letters, at least one number and one special character (@$!%*?&+-_)!"
msgstr ""
#: src/cpp/SingletonManager/SessionManager.cpp:610
msgid "Your password is to short!"
msgstr ""
#: src/cpp/SingletonManager/SessionManager.cpp:615
msgid "Your password does not contain lowercase letters!"
msgstr ""
#: src/cpp/SingletonManager/SessionManager.cpp:620
msgid "Your password does not contain any capital letters!"
msgstr ""
#: src/cpp/SingletonManager/SessionManager.cpp:625
msgid "Your password does not contain any number!"
msgstr ""
#: src/cpp/SingletonManager/SessionManager.cpp:630
msgid "Your password does not contain special characters (@$!%*?&+-)!"
msgstr ""

File diff suppressed because it is too large Load Diff

View File

@ -1,58 +0,0 @@
HTTPServer.port = 1200
JSONServer.port = 1201
Gradido.group_id = 1
crypto.server_admin_public = f909a866baec97c5460b8d7a93b72d3d4d20cc45d9f15d78bd83944eb9286b7f
crypto.server_key = a51ef8ac7ef1abf162fb7a65261acd7a
# TODO auto-generate in docker build step
crypto.app_secret = 21ffbbc616fe
# Server admin Passphrase
# nerve execute merit pool talk hockey basic win cargo spin disagree ethics swear price purchase say clutch decrease slow half forest reform cheese able
#
phpServer.url = http://localhost/
phpServer.host = nginx
loginServer.path = http://localhost/account
loginServer.default_locale = de
loginServer.db.host = mariadb
loginServer.db.name = gradido_community
loginServer.db.user = root
loginServer.db.password =
loginServer.db.port = 3306
frontend.checkEmailPath = vue/checkEmail
frontend.resetPasswordPath = vue/reset
email.disable = true
#email.username =
#email.sender =
#email.admin_receiver =
#email.password =
#email.smtp.url =
#email.smtp.port =
# binary is default, for debugging also json is possible
#hedera.consensus.message_format = json
# TESTNET or MAINNET, TESTNET is default
hedera.nettype = TESTNET
# server setup types: test, staging or production
ServerSetupType=test
dev.default_group = docker
# Session timeout in minutes
#
session.timeout = 15
# Disabling security features for faster develop and testing
unsecure.allow_passwort_via_json_request = 1
unsecure.allow_auto_sign_transactions = 1
unsecure.allow_cors_all = 1
# default disable, passwords must contain a number, a lower character, a high character, special character, and be at least 8 characters long
unsecure.allow_all_passwords = 1

View File

@ -1,57 +0,0 @@
HTTPServer.port = 1200
JSONServer.port = 1201
Gradido.group_id = 1
crypto.server_admin_public = f909a866baec97c5460b8d7a93b72d3d4d20cc45d9f15d78bd83944eb9286b7f
crypto.server_key = a51ef8ac7ef1abf162fb7a65261acd7a
# TODO auto-generate in docker build step
crypto.app_secret = 21ffbbc616fe
# Server admin Passphrase
# nerve execute merit pool talk hockey basic win cargo spin disagree ethics swear price purchase say clutch decrease slow half forest reform cheese able
#
phpServer.url = http://localhost/
phpServer.host = nginx
loginServer.path = http://localhost/account
loginServer.default_locale = de
loginServer.db.host = mariadb
loginServer.db.name = gradido_community_test
loginServer.db.user = root
loginServer.db.password =
loginServer.db.port = 3306
frontend.checkEmailPath = http://localhost/reset
email.disable = true
#email.username =
#email.sender =
#email.admin_receiver =
#email.password =
#email.smtp.url =
#email.smtp.port =
# binary is default, for debugging also json is possible
#hedera.consensus.message_format = json
# TESTNET or MAINNET, TESTNET is default
hedera.nettype = TESTNET
# server setup types: test, staging or production
ServerSetupType=test
dev.default_group = docker
# Session timeout in minutes
#
session.timeout = 15
# Disabling security features for faster develop and testing
unsecure.allow_passwort_via_json_request = 1
unsecure.allow_auto_sign_transactions = 1
unsecure.allow_cors_all = 1
# default disable, passwords must contain a number, a lower character, a high character, special character, and be at least 8 characters long
unsecure.allow_all_passwords = 1

View File

@ -78,28 +78,6 @@ services:
# bind the local folder to the docker to allow live reload
- ./database:/app
#########################################################
## LOGIN SERVER #########################################
#########################################################
login-server:
build:
dockerfile: Dockerfiles/ubuntu/Dockerfile.debug
networks:
- external-net
- internal-net
security_opt:
- seccomp:unconfined
cap_add:
- SYS_PTRACE
volumes:
- ./logs:/var/log/grd_login
- ./login_server/src:/code/src
- ./login_server/dependencies:/code/dependencies
- ./login_server/scripts:/code/scripts
- ./configs/login_server:/etc/grd_login
- login_build_ubuntu_3.1:/code/build
#########################################################
## COMMUNITY SERVER (cakephp with php-fpm) ##############
#########################################################
@ -156,4 +134,3 @@ volumes:
backend_database_build:
database_node_modules:
database_build:
login_build_ubuntu_3.1:

View File

@ -35,28 +35,6 @@ services:
volumes:
- db_test_vol:/var/lib/mysql
#########################################################
## LOGIN SERVER #########################################
#########################################################
login-server:
build:
context: ./login_server/
dockerfile: Dockerfiles/ubuntu/Dockerfile.test
security_opt:
- seccomp:unconfined
cap_add:
- SYS_PTRACE
depends_on:
- mariadb
networks:
- internal-net
volumes:
- ./logs:/var/log/grd_login
- ./login_server/src:/code/src
- ./configs/login_server:/etc/grd_login
- login_build_cov:/code/build_cov
- ./coverage/login:/code/build_cov/coverage_html
#########################################################
## COMMUNITY SERVER (cakephp with php-fpm) ##############
#########################################################
@ -98,4 +76,3 @@ networks:
volumes:
db_test_vol:
login_build_cov:

View File

@ -129,26 +129,9 @@ services:
#env_file:
# - ./frontend/.env
#########################################################
## LOGIN SERVER #########################################
#########################################################
login-server:
build:
context: ./login_server/
depends_on:
- mariadb
networks:
- internal-net
ports:
- 1200:1200
- 1201:1201
volumes:
- ./configs/login_server:/etc/grd_login
#########################################################
## NGINX ################################################
#########################################################
## nginx, connect login-server and community-server together (and php-fpm to community-server)
nginx:
build:
context: ./nginx/

View File

@ -1,9 +0,0 @@
src/cpsp/lib*
src/cpsp/cpspc
src/cpsp/compile_unix.sh
src/cpsp/*.h
src/cpsp/*.cpp
src/cpp/proto/
build*/
src/LOCALE/messages.pot

View File

@ -1,24 +0,0 @@
[submodule "dependencies/tinf"]
path = dependencies/tinf
url = https://github.com/jibsen/tinf.git
[submodule "dependencies/mariadb-connector-c"]
path = dependencies/mariadb-connector-c
url = https://github.com/MariaDB/mariadb-connector-c.git
[submodule "src/proto"]
path = src/proto
url = https://github.com/gradido/gradido_protocol.git
[submodule "dependencies/iroha-ed25519"]
path = dependencies/iroha-ed25519
url = https://github.com/gradido/iroha-ed25519.git
[submodule "dependencies/spirit-po"]
path = dependencies/spirit-po
url = https://github.com/cbeck88/spirit-po.git
[submodule "dependencies/grpc"]
path = dependencies/grpc
url = https://github.com/grpc/grpc.git
[submodule "dependencies/poco"]
path = dependencies/poco
url = https://github.com/pocoproject/poco.git
[submodule "dependencies/cmake-modules"]
path = dependencies/cmake-modules
url = https://github.com/viaduck/cmake-modules.git

View File

@ -1,354 +0,0 @@
cmake_minimum_required(VERSION 3.18.2)
project(Gradido_LoginServer C CXX)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin" )
SET(CMAKE_CXX_FLAGS "-std=c++17" )
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
IF(WIN32)
set(CMAKE_CXX_FLAGS "/MP /EHsc")
ENDIF()
set(INSTALL_BINDIR "bin")
set(INSTALL_PLUGINDIR "bin")
include_directories(
"dependencies"
"dependencies/tinf/src/"
"dependencies/mariadb-connector-c/include"
"dependencies/mariadb-connector-c/build/include"
"dependencies/spirit-po/include"
"dependencies/protobuf/src"
"build"
"build/proto"
"build/http_pages"
"src/cpp"
)
IF(UNIX)
include_directories(
"dependencies/poco/Crypto/include"
"dependencies/poco/Data/include"
"dependencies/poco/Util/include"
"dependencies/poco/Foundation/include"
"dependencies/poco/JSON/include"
"dependencies/poco/Net/include"
"dependencies/poco/NetSSL_OpenSSL/include"
)
ENDIF()
############################## find protobuf #########################################
add_subdirectory(dependencies/protobuf/cmake)
############################## parse protobuf files ###################################
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/proto GRADIDO_PROTO_MODEL_PATH)
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build/proto PROTOBINDING_PATH)
file(MAKE_DIRECTORY ${PROTOBINDING_PATH})
file(MAKE_DIRECTORY ${PROTOBINDING_PATH}/gradido)
FILE(GLOB DATAMODEL_GRADIDO_PROTOS "${GRADIDO_PROTO_MODEL_PATH}/gradido/*.proto")
IF(WIN32)
set(PROTOC_BIN_PATH "build/dependencies/protobuf/cmake/bin")
find_program(PROTOBUF_PROTOC_EXECUTABLE protoc PATHS "${PROTOC_BIN_PATH}/Debug" )
find_program(PROTOBUF_PROTOC_EXECUTABLE protoc PATHS "${PROTOC_BIN_PATH}/Release" )
ELSE()
find_program(PROTOBUF_PROTOC_EXECUTABLE protoc PATHS "build/dependencies/protobuf/cmake/bin" )
ENDIF()
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/protobuf/src GOOGLE_PROTOBUF_INCLUDES)
MESSAGE("protoc: ${PROTOBUF_PROTOC_EXECUTABLE} in build/dependencies/protobuf/bin/${CMAKE_BUILD_TYPE}")
FOREACH(proto ${DATAMODEL_GRADIDO_PROTOS})
FILE(TO_NATIVE_PATH ${proto} proto_native)
get_filename_component(proto_parsed ${proto} NAME_WLE)
FILE(TO_NATIVE_PATH ${PROTOBINDING_PATH}/gradido/${proto_parsed}.pb.h proto_parsed_native)
IF(${proto_native} IS_NEWER_THAN ${proto_parsed_native})
EXECUTE_PROCESS(
COMMAND
${PROTOBUF_PROTOC_EXECUTABLE}
--proto_path=${GRADIDO_PROTO_MODEL_PATH}
--cpp_out=${PROTOBINDING_PATH}
${proto_native}
RESULT_VARIABLE rv
)
# Optional, but that can show the user if something have gone wrong with the proto generation
IF(${rv})
MESSAGE("Generation of data model returned ${rv} for proto ${proto_native}")
ELSE()
MESSAGE("Parsed: src/proto/gradido/${proto_parsed}.proto")
ENDIF()
ENDIF()
ENDFOREACH(proto)
############################## parse cpsp Files ####################################
IF(WIN32)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
#add_compile_definitions(POCO_NETSSL_WIN)
ENDIF()
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/cpsp GRADIDO_CPSP_PAGE_SRC_PATH)
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build/http_pages GRADIDO_HTTP_PAGES_PATH)
file(MAKE_DIRECTORY ${GRADIDO_HTTP_PAGES_PATH})
FILE(GLOB GRADIDO_HTTP_PAGES_SRC "${GRADIDO_CPSP_PAGE_SRC_PATH}/*.cpsp")
IF(WIN32)
string(REGEX REPLACE "(.*)package/([a-f0-9]*)" "\\1build/\\2/build/bin" POCO_BUILD_BIN "${CONAN_POCO_ROOT}")
find_program(POCO_PAGE_COMPILER cpspc.exe PATHS "${CONAN_POCO_ROOT}")
find_program(POCO_PAGE_COMPILER cpspc.exe PATHS "${POCO_BUILD_BIN}")
ELSE()
find_program(POCO_PAGE_COMPILER cpspc PATHS "${CMAKE_CURRENT_SOURCE_DIR}/build/bin")
ENDIF()
MESSAGE("Poco Page Compiler: ${POCO_PAGE_COMPILER}")
FOREACH(cpsp_file ${GRADIDO_HTTP_PAGES_SRC})
FILE(TO_NATIVE_PATH ${cpsp_file} cpsp_file_native)
get_filename_component(cpsp_file_parsed ${cpsp_file} NAME_WLE)
FILE(TO_NATIVE_PATH ${GRADIDO_HTTP_PAGES_PATH}/${cpsp_file_parsed}Page.cpp cpsp_file_parsed_native)
IF(${cpsp_file_native} IS_NEWER_THAN ${cpsp_file_parsed_native})
IF(WIN32)
EXECUTE_PROCESS(
COMMAND
${POCO_PAGE_COMPILER}
/output-dir=${GRADIDO_HTTP_PAGES_PATH}
/header-output-dir=${GRADIDO_HTTP_PAGES_PATH}
/noline
${cpsp_file_native}
RESULT_VARIABLE rv
)
ELSE()
EXECUTE_PROCESS(
COMMAND
${POCO_PAGE_COMPILER}
--output-dir=${GRADIDO_HTTP_PAGES_PATH}
--header-output-dir=${GRADIDO_HTTP_PAGES_PATH}
--noline
${cpsp_file_native}
RESULT_VARIABLE rv
)
ENDIF()
# Optional, but that can show the user if something have gone wrong with the proto generation
IF(${rv})
MESSAGE("Generation of HTTP Page return ${rv} for cpsp ${cpsp_file_native}")
ELSE()
MESSAGE("Parsed: src/cpsp/${cpsp_file_parsed}.cpsp")
ENDIF()
ENDIF()
ENDFOREACH(cpsp_file)
############################## bind source files ###################################
FILE(GLOB CONTROLLER "src/cpp/controller/*.cpp" "src/cpp/controller/*.h")
FILE(GLOB TINF "dependencies/tinf/src/*.c" "dependencies/tinf/src/*.h")
FILE(GLOB HTTPInterface "src/cpp/HTTPInterface/*.h" "src/cpp/HTTPInterface/*.cpp")
FILE(GLOB COMPILED_PAGES "build/http_pages/*.h" "build/http_pages/*.cpp")
FILE(GLOB JSONInterface "src/cpp/JSONInterface/*.h" "src/cpp/JSONInterface/*.cpp")
FILE(GLOB TASKS "src/cpp/tasks/*.cpp" "src/cpp/tasks/*.h")
FILE(GLOB SINGLETON_MANAGER "src/cpp/SingletonManager/*.h" "src/cpp/SingletonManager/*.cpp")
FILE(GLOB LIB_SRC "src/cpp/lib/*.h" "src/cpp/lib/*.cpp")
FILE(GLOB MODEL "src/cpp/model/*.h" "src/cpp/model/*.cpp")
FILE(GLOB MODEL_TABLE "src/cpp/model/table/*.h" "src/cpp/model/table/*.cpp")
FILE(GLOB MODEL_EMAIL "src/cpp/model/email/*.h" "src/cpp/model/email/*.cpp")
FILE(GLOB MODEL_GRADIDO "src/cpp/model/gradido/*.h" "src/cpp/model/gradido/*.cpp")
FILE(GLOB CRYPTO "src/cpp/Crypto/*.h" "src/cpp/Crypto/*.cpp")
FILE(GLOB MAIN "src/cpp/*.cpp" "src/cpp/*.c" "src/cpp/*.h")
FILE(GLOB MYSQL "src/cpp/MySQL/*.cpp" "src/cpp/MySQL/*.h" "src/cpp/MySQL/Poco/*.h")
FILE(GLOB PROTO_GRADIDO "build/proto/gradido/*.cc" "build/proto/gradido/*.h")
# used only for test project
FILE(GLOB TEST "src/cpp/test/*.cpp" "src/cpp/test/*.h")
FILE(GLOB TEST_CRYPTO "src/cpp/test/crypto/*.cpp" "src/cpp/test/crypto/*.h")
FILE(GLOB TEST_MODEL "src/cpp/test/model/*.cpp" "src/cpp/test/model/*.h")
FILE(GLOB TEST_MODEL_TABLE "src/cpp/test/model/table/*.cpp" "src/cpp/test/model/table/*.h")
FILE(GLOB TEST_CONTROLLER "src/cpp/test/controller/*.cpp" "src/cpp/test/controller/*.h")
FILE(GLOB TEST_JSON_INTERFACE "src/cpp/test/JSONInterface/*.cpp" "src/cpp/test/JSONInterface/*.h")
SET(LOCAL_SRCS
${CONTROLLER} ${TINF} ${MAIN} ${HTTPInterface} ${COMPILED_PAGES}
${JSONInterface} ${CRYPTO}
${MODEL} ${MODEL_TABLE} ${MODEL_EMAIL} ${MODEL_GRADIDO}
${SINGLETON_MANAGER} ${LIB_SRC} ${MYSQL} ${TASKS}
${PROTO_GRADIDO}
)
SET(LOCAL_TEST_SRC
${TEST} ${TEST_CRYPTO} ${TEST_MODEL} ${TEST_MODEL_TABLE} ${TEST_CONTROLLER} ${TEST_JSON_INTERFACE}
)
aux_source_directory("src/cpp" LOCAL_SRCS)
if(MSVC)
# src
source_group("controller" FILES ${CONTROLLER})
source_group("proto\\gradido" FILES ${PROTO_GRADIDO})
source_group("tinf" FILES ${TINF})
source_group("Crypto" FILES ${CRYPTO})
source_group("tasks" FILES ${TASKS})
source_group("model\\table" FILES ${MODEL_TABLE})
source_group("model\\email" FILES ${MODEL_EMAIL})
source_group("model\\gradido" FILES ${MODEL_GRADIDO})
source_group("model" FILES ${MODEL})
source_group("mysql" FILES ${MYSQL})
source_group("SingletonManager" FILES ${SINGLETON_MANAGER})
source_group("lib" FILES ${LIB_SRC})
source_group("HTTP-Interface\\pages" FILES ${COMPILED_PAGES})
source_group("HTTP-Interface" FILES ${HTTPInterface})
source_group("Json-Interface" FILES ${JSONInterface})
source_group("Test\\crypto" FILES ${TEST_CRYPTO})
source_group("Test\\model\\table" FILES ${TEST_MODEL_TABLE})
source_group("Test\\model" FILES ${TEST_MODEL})
source_group("Test\\controller" FILES ${TEST_CONTROLLER})
source_group("Test\\Json-Interface" FILES ${TEST_JSON_INTERFACE})
source_group("Test" FILES ${TEST})
endif()
add_executable(Gradido_LoginServer ${LOCAL_SRCS})
############################## config and add mariadb ###################################
set(CLIENT_PLUGIN_DIALOG OFF)
set(CLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD OFF)
set(CLIENT_PLUGIN_REMOTE_IO OFF)
IF(WIN32)
#set(CLIENT_PLUGIN_caching_sha2_password OFF)
set(CLIENT_PLUGIN_CACHING_SHA2_PASSWORD OFF)
set(CLIENT_PLUGIN_SHA256_PASSWORD OFF)
set(CLIENT_PLUGIN_AUTH_GSSAPI_CLIENT OFF)
set(CLIENT_PLUGIN_PVIO_NPIPE STATIC)
set(CLIENT_PLUGIN_PVIO_SHMEM STATIC)
set(CLIENT_PLUGIN_CLIENT_ED25519 OFF)
ELSEIF()
set(CLIENT_PLUGIN_client_ed25519 OFF)
ENDIF()
set(WITH_SSL OFF)
add_subdirectory("dependencies/mariadb-connector-c")
set(DEP_PATH "dependencies")
set(MARIADB_CONNECTOR_PATH "${DEP_PATH}/mariadb-connector-c/build/libmariadb")
#if(WIN32)
#find_library(MYSQL_LIBRARIES mariadbclient PATHS "${MARIADB_CONNECTOR_PATH}/Release" REQUIRED)
#find_library(COMPILED_MARIADB_CLIENT_DEBUG mariadbclient PATHS "${MARIADB_CONNECTOR_PATH}/Debug" REQUIRED)
#endif()
############################## config and add poco ###################################
#SET(SOME_EXPAT_OPTION OFF CACHE BOOL "Use some expat option")
IF(UNIX)
SET(ENABLE_MONGODB OFF CACHE BOOL "" FORCE)
SET(ENABLE_DATA_SQLITE OFF CACHE BOOL "" FORCE)
SET(ENABLE_REDIS OFF CACHE BOOL "" FORCE)
SET(ENABLE_PAGECOMPILER_FILE2PAGE OFF CACHE BOOL "" FORCE)
add_subdirectory("dependencies/poco")
set(POCO_LIBS PocoFoundation PocoUtil PocoNet PocoNetSSL PocoData)
ENDIF()
############################## build login server ###################################
target_link_libraries(Gradido_LoginServer ${GRPC_LIBS})
if(WIN32)
target_link_libraries(Gradido_LoginServer mariadbclient libprotobuf ${CONAN_LIBS})
#TARGET_LINK_LIBRARIES(Gradido_LoginServer optimized ${MYSQL_LIBRARIES} Shlwapi)
#TARGET_LINK_LIBRARIES(Gradido_LoginServer debug ${COMPILED_MARIADB_CLIENT_DEBUG} Shlwapi)
else() # unix
target_link_libraries(Gradido_LoginServer ${POCO_LIBS} libmariadb sodium libprotobuf)
endif()
# install
if(UNIX)
install(TARGETS Gradido_LoginServer RUNTIME DESTINATION /usr/local/bin)
#install(LIBRARYS DESTINATION /usr/local/lib)
#install(FILES lib/libmariadb /usr/local/lib)
install(FILES DESTINATION lib COMPONENT libmariadb)
install(DIRECTORY src/LOCALE DESTINATION /etc/grd_login/
FILES_MATCHING PATTERN "*.po(t)")
endif(UNIX)
# ---------------------- Test -----------------------------------------
enable_testing()
option(COLLECT_COVERAGE_DATA "Use cov to collect coverage informations" OFF)
set(COVERAGE_TOOL "Coverage Tool (gcovr|lcov|fastcov)" CACHE STRING "gcovr")
if(COLLECT_COVERAGE_DATA)
include(cmake/CodeCoverage.cmake)
append_coverage_compiler_flags()
set(EXCLUDE_FOR_HTML_COV
"${CMAKE_CURRENT_SOURCE_DIR}/build/proto/*"
"${CMAKE_CURRENT_SOURCE_DIR}/dependencies/*"
"${CMAKE_CURRENT_SOURCE_DIR}/src/cpp/test/*"
"${CMAKE_CURRENT_SOURCE_DIR}/googletest/googletest/include/gtest/internal/*"
"${CMAKE_CURRENT_SOURCE_DIR}/googletest/googletest/src/"
)
if("${COVERAGE_TOOL}" STREQUAL "gcovr")
setup_target_for_coverage_gcovr_html(
NAME coverage
EXECUTABLE Gradido_LoginServer_Test
EXCLUDE ${EXCLUDE_FOR_HTML_COV}
GCOVR_ADDITIONAL_ARGS "--txt "
#DEPENDENCIES lib/libmariadb.so.3
)
endif()
set(EXCLUDE_FOR_COV
${EXCLUDE_FOR_HTML_COV}
"/usr/include/*"
)
if("${COVERAGE_TOOL}" STREQUAL "lcov")
setup_target_for_coverage_lcov(
NAME coverage
EXECUTABLE Gradido_LoginServer_Test
EXCLUDE "${EXCLUDE_FOR_COV}"
#DEPENDENCIES lib/libmariadb.so.3
)
endif()
if("${COVERAGE_TOOL}" STREQUAL "fastcov")
setup_target_for_coverage_fastcov(
NAME coverage # New target name
EXECUTABLE Gradido_LoginServer_Test -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
#BASE_DIRECTORY "../" # Base directory for report
# (defaults to PROJECT_SOURCE_DIR)
EXCLUDE "${EXCLUDE_FOR_COV}" # Patterns to exclude.
NO_DEMANGLE # Don't demangle C++ symbols
# even if c++filt is found
SKIP_HTML # Don't create html report
)
endif()
endif()
project(Gradido_LoginServer_Test C CXX)
#_TEST_BUILD
#find_package(GTest CONFIG REQUIRED)
#add_subdirectory("dependencies/protobuf/third_party/googletest")
add_executable(Gradido_LoginServer_Test ${LOCAL_SRCS} ${LOCAL_TEST_SRC})
target_compile_definitions(Gradido_LoginServer_Test PUBLIC "_TEST_BUILD")
target_link_libraries(Gradido_LoginServer_Test ${GRPC_LIBS} )
if(WIN32)
target_link_libraries(Gradido_LoginServer_Test ${CONAN_LIBS} libmariadb libprotobuf)
#TARGET_LINK_LIBRARIES(Gradido_LoginServer_Test optimized ${MYSQL_LIBRARIES} Shlwapi)
#TARGET_LINK_LIBRARIES(Gradido_LoginServer_Test debug ${COMPILED_MARIADB_CLIENT_DEBUG} Shlwapi)
#TARGET_LINK_LIBRARIES(Gradido_LoginServer_Test debug ${GRPC_LIBS} ${PROTOBUF_DEBUG_LIBS})
else()
target_link_libraries(Gradido_LoginServer_Test ${POCO_LIBS} libmariadb sodium gtest)
endif()
add_test(NAME main COMMAND Gradido_LoginServer_Test)

View File

@ -1,255 +0,0 @@
cmake_minimum_required(VERSION 3.18.2)
project(Gradido_LoginServer C CXX)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin" )
SET ( CMAKE_CXX_FLAGS "-std=c++17" )
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(CMAKE_CXX_FLAGS "/MP /EHsc")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
else()
set(INSTALL_BINDIR "bin")
set(INSTALL_PLUGINDIR "bin")
endif()
include_directories(
"dependencies"
"dependencies/tinf/src"
"dependencies/spirit-po/include"
"/usr/local/include/mariadb"
"build"
"build/proto"
"build/http_pages"
"src/cpp"
)
############################## config and add grpc ###################################
find_package(Protobuf REQUIRED)
include_directories(${Protobuf_INCLUDE_DIRS})
set(PROTOBUF_LIBS protobuf::libprotobuf protobuf::libprotobuf-lite protobuf::libprotoc)
############################## parse proto files ###################################
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/proto GRADIDO_PROTO_MODEL_PATH)
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build/proto PROTOBINDING_PATH)
file(MAKE_DIRECTORY ${PROTOBINDING_PATH})
file(MAKE_DIRECTORY ${PROTOBINDING_PATH}/gradido)
FILE(GLOB DATAMODEL_GRADIDO_PROTOS "${GRADIDO_PROTO_MODEL_PATH}/gradido/*.proto")
FOREACH(proto ${DATAMODEL_GRADIDO_PROTOS})
FILE(TO_NATIVE_PATH ${proto} proto_native)
get_filename_component(proto_parsed ${proto} NAME_WLE)
FILE(TO_NATIVE_PATH ${PROTOBINDING_PATH}/gradido/${proto_parsed}.pb.h proto_parsed_native)
IF(${proto_native} IS_NEWER_THAN ${proto_parsed_native})
EXECUTE_PROCESS(
COMMAND
${PROTOBUF_PROTOC_EXECUTABLE}
--proto_path=${GRADIDO_PROTO_MODEL_PATH}
--cpp_out=${PROTOBINDING_PATH}
${proto_native}
RESULT_VARIABLE rv
)
# Optional, but that can show the user if something have gone wrong with the proto generation
IF(${rv})
MESSAGE("Generation of data model returned ${rv} for proto ${proto_native}")
ELSE()
MESSAGE("Parsed: src/proto/gradido/${proto_parsed}.proto")
ENDIF()
ENDIF()
ENDFOREACH(proto)
############################## parse cpsp Files ####################################
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/cpsp GRADIDO_CPSP_PAGE_SRC_PATH)
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build/http_pages GRADIDO_HTTP_PAGES_PATH)
file(MAKE_DIRECTORY ${GRADIDO_HTTP_PAGES_PATH})
FILE(GLOB GRADIDO_HTTP_PAGES_SRC "${GRADIDO_CPSP_PAGE_SRC_PATH}/*.cpsp")
find_program(POCO_PAGE_COMPILER cpspc)
MESSAGE("Poco Page Compiler: ${POCO_PAGE_COMPILER}")
FOREACH(cpsp_file ${GRADIDO_HTTP_PAGES_SRC})
FILE(TO_NATIVE_PATH ${cpsp_file} cpsp_file_native)
get_filename_component(cpsp_file_parsed ${cpsp_file} NAME_WLE)
FILE(TO_NATIVE_PATH ${GRADIDO_HTTP_PAGES_PATH}/${cpsp_file_parsed}Page.cpp cpsp_file_parsed_native)
IF(${cpsp_file_native} IS_NEWER_THAN ${cpsp_file_parsed_native})
EXECUTE_PROCESS(
COMMAND
${POCO_PAGE_COMPILER}
--output-dir=${GRADIDO_HTTP_PAGES_PATH}
--header-output-dir=${GRADIDO_HTTP_PAGES_PATH}
--noline
${cpsp_file_native}
RESULT_VARIABLE rv
)
# Optional, but that can show the user if something have gone wrong with the proto generation
IF(${rv})
MESSAGE("Generation of HTTP Page return ${rv} for cpsp ${cpsp_file_native}")
ELSE()
MESSAGE("Parsed: src/cpsp/${cpsp_file_parsed}.cpsp")
ENDIF()
ENDIF()
ENDFOREACH(cpsp_file)
############################## include src files ###################################
#set(MYSQL_INCLUDE_DIR "dependencies/mariadb-connector-c/include")
FILE(GLOB CONTROLLER "src/cpp/controller/*.cpp" "src/cpp/controller/*.h")
FILE(GLOB TINF "dependencies/tinf/src/*.c" "dependencies/tinf/src/*.h")
FILE(GLOB HTTPInterface "src/cpp/HTTPInterface/*.h" "src/cpp/HTTPInterface/*.cpp")
FILE(GLOB COMPILED_PAGES "build/http_pages/*.h" "build/http_pages/*.cpp")
FILE(GLOB JSONInterface "src/cpp/JSONInterface/*.h" "src/cpp/JSONInterface/*.cpp")
FILE(GLOB TASKS "src/cpp/tasks/*.cpp" "src/cpp/tasks/*.h")
FILE(GLOB SINGLETON_MANAGER "src/cpp/SingletonManager/*.h" "src/cpp/SingletonManager/*.cpp")
FILE(GLOB LIB_SRC "src/cpp/lib/*.h" "src/cpp/lib/*.cpp")
FILE(GLOB MODEL "src/cpp/model/*.h" "src/cpp/model/*.cpp")
FILE(GLOB MODEL_TABLE "src/cpp/model/table/*.h" "src/cpp/model/table/*.cpp")
FILE(GLOB MODEL_EMAIL "src/cpp/model/email/*.h" "src/cpp/model/email/*.cpp")
FILE(GLOB MODEL_HEDERA "src/cpp/model/hedera/*.h" "src/cpp/model/hedera/*.cpp")
FILE(GLOB MODEL_GRADIDO "src/cpp/model/gradido/*.h" "src/cpp/model/gradido/*.cpp")
FILE(GLOB CRYPTO "src/cpp/Crypto/*.h" "src/cpp/Crypto/*.cpp")
FILE(GLOB MAIN "src/cpp/*.cpp" "src/cpp/*.c" "src/cpp/*.h")
FILE(GLOB MYSQL "src/cpp/MySQL/*.cpp" "src/cpp/MySQL/*.h" "src/cpp/MySQL/Poco/*.h")
FILE(GLOB PROTO_GRADIDO "${PROTOBINDING_PATH}/gradido/*.cc" "${PROTOBINDING_PATH}/gradido/*.h")
# used only for test project
FILE(GLOB TEST "src/cpp/test/*.cpp" "src/cpp/test/*.h")
FILE(GLOB TEST_CRYPTO "src/cpp/test/crypto/*.cpp" "src/cpp/test/crypto/*.h")
FILE(GLOB TEST_MODEL "src/cpp/test/model/*.cpp" "src/cpp/test/model/*.h")
FILE(GLOB TEST_MODEL_TABLE "src/cpp/test/model/table/*.cpp" "src/cpp/test/model/table/*.h")
FILE(GLOB TEST_CONTROLLER "src/cpp/test/controller/*.cpp" "src/cpp/test/controller/*.h")
FILE(GLOB TEST_JSON_INTERFACE "src/cpp/test/JSONInterface/*.cpp" "src/cpp/test/JSONInterface/*.h")
SET(LOCAL_SRCS
${CONTROLLER} ${TINF} ${MAIN} ${HTTPInterface} ${COMPILED_PAGES}
${JSONInterface} ${CRYPTO}
${MODEL} ${MODEL_TABLE} ${MODEL_EMAIL} ${MODEL_HEDERA} ${MODEL_GRADIDO}
${SINGLETON_MANAGER} ${LIB_SRC} ${MYSQL} ${TASKS}
${PROTO_GRADIDO} ${PROTO_HEDERA}
)
SET(LOCAL_TEST_SRC
${TEST} ${TEST_CRYPTO} ${TEST_MODEL} ${TEST_MODEL_TABLE} ${TEST_CONTROLLER} ${TEST_JSON_INTERFACE}
)
aux_source_directory("src/cpp" LOCAL_SRCS)
add_executable(Gradido_LoginServer ${LOCAL_SRCS})
############################## find mariadb ###################################
find_library(MYSQL_LIBRARIES mariadb PATHS "/usr/local/lib/mariadb" REQUIRED)
############################## config and add poco ###################################
set(BUILD_LIB_PATH "(/usr/local/lib")
IF(CMAKE_BUILD_TYPE MATCHES Debug)
find_library(POCO_FOUNDATION_LIB PocoFoundationd PATHS ${BUILD_LIB_PATH} REQUIRED)
find_library(POCO_UTIL_LIB PocoUtild PATHS ${BUILD_LIB_PATH} REQUIRED)
find_library(POCO_NET_SSL_LIB PocoNetSSLd PATHS ${BUILD_LIB_PATH} REQUIRED)
find_library(POCO_DATA_LIB PocoDatad PATHS ${BUILD_LIB_PATH} REQUIRED)
find_library(POCO_JSON_LIB PocoJSONd PATHS ${BUILD_LIB_PATH} REQUIRED)
find_library(POCO_NET_LIB PocoNetd PATHS ${BUILD_LIB_PATH} REQUIRED)
message("use Poco Debug libs")
ELSE()
find_library(POCO_FOUNDATION_LIB PocoFoundation PATHS ${BUILD_LIB_PATH} REQUIRED)
find_library(POCO_UTIL_LIB PocoUtil PATHS ${BUILD_LIB_PATH} REQUIRED)
find_library(POCO_NET_SSL_LIB PocoNetSSL PATHS ${BUILD_LIB_PATH} REQUIRED)
find_library(POCO_DATA_LIB PocoData PATHS ${BUILD_LIB_PATH} REQUIRED)
find_library(POCO_JSON_LIB PocoJSON PATHS ${BUILD_LIB_PATH} REQUIRED)
find_library(POCO_NET_LIB PocoNet PATHS ${BUILD_LIB_PATH} REQUIRED)
message("use Poco Release libs")
ENDIF()
set(POCO_LIBS ${POCO_FOUNDATION_LIB} ${POCO_UTIL_LIB} ${POCO_NET_SSL_LIB} ${POCO_DATA_LIB} ${POCO_JSON_LIB} ${POCO_NET_LIB})
############################## build login server ###################################
target_link_libraries(Gradido_LoginServer ${PROTOBUF_LIBS} ${MYSQL_LIBRARIES} ${POCO_LIBS} sodium pthread)
############################## build login server test ###################################
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
project(Gradido_LoginServer_Test C CXX)
enable_testing()
option(COLLECT_COVERAGE_DATA "Use cov to collect coverage informations" OFF)
set(COVERAGE_TOOL "Coverage Tool (gcovr|lcov|fastcov)" CACHE STRING "gcovr")
if(COLLECT_COVERAGE_DATA)
include(cmake/CodeCoverage.cmake)
append_coverage_compiler_flags()
set(EXCLUDE_FOR_HTML_COV
"${CMAKE_CURRENT_SOURCE_DIR}/build/proto/*"
"${CMAKE_CURRENT_SOURCE_DIR}/dependencies/*"
"${CMAKE_CURRENT_SOURCE_DIR}/src/cpp/test/*"
"${CMAKE_CURRENT_SOURCE_DIR}/googletest/googletest/include/gtest/internal/*"
"${CMAKE_CURRENT_SOURCE_DIR}/googletest/googletest/src/"
)
if("${COVERAGE_TOOL}" STREQUAL "gcovr")
setup_target_for_coverage_gcovr_html(
NAME coverage
EXECUTABLE Gradido_LoginServer_Test
EXCLUDE ${EXCLUDE_FOR_HTML_COV}
GCOVR_ADDITIONAL_ARGS "--txt "
#DEPENDENCIES lib/libmariadb.so.3
)
endif()
set(EXCLUDE_FOR_COV
${EXCLUDE_FOR_HTML_COV}
"/usr/include/*"
)
if("${COVERAGE_TOOL}" STREQUAL "lcov")
setup_target_for_coverage_lcov(
NAME coverage
EXECUTABLE Gradido_LoginServer_Test
EXCLUDE "${EXCLUDE_FOR_COV}"
#DEPENDENCIES lib/libmariadb.so.3
)
endif()
if("${COVERAGE_TOOL}" STREQUAL "fastcov")
setup_target_for_coverage_fastcov(
NAME coverage # New target name
EXECUTABLE Gradido_LoginServer_Test -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
#BASE_DIRECTORY "coverage" # Base directory for report
# (defaults to PROJECT_SOURCE_DIR)
EXCLUDE "${EXCLUDE_FOR_COV}" # Patterns to exclude.
NO_DEMANGLE # Don't demangle C++ symbols
# even if c++filt is found
SKIP_HTML # Don't create html report
)
endif()
endif()
#_TEST_BUILD
add_subdirectory("googletest")
add_executable(Gradido_LoginServer_Test ${LOCAL_SRCS} ${LOCAL_TEST_SRC})
target_compile_definitions(Gradido_LoginServer_Test PUBLIC "_TEST_BUILD")
target_link_libraries(Gradido_LoginServer_Test ${GRPC_LIBS} )
if(WIN32)
target_link_libraries(Gradido_LoginServer_Test ${CONAN_LIBS} )
#TARGET_LINK_LIBRARIES(Gradido_LoginServer_Test optimized ${MYSQL_LIBRARIES} Shlwapi)
#TARGET_LINK_LIBRARIES(Gradido_LoginServer_Test debug ${COMPILED_MARIADB_CLIENT_DEBUG} Shlwapi)
#TARGET_LINK_LIBRARIES(Gradido_LoginServer_Test debug ${GRPC_LIBS} ${PROTOBUF_DEBUG_LIBS})
else()
target_link_libraries(Gradido_LoginServer_Test ${PROTOBUF_LIBS} ${MYSQL_LIBRARIES} ${POCO_LIBS} sodium pthread gtest)
endif()
add_test(NAME main COMMAND Gradido_LoginServer_Test)
ENDIF()

View File

@ -1,49 +0,0 @@
#########################################################################################################
# Build release
#########################################################################################################
FROM gradido/login_dependencies:alpine-release-3 as release
ENV DOCKER_WORKDIR="/code"
WORKDIR ${DOCKER_WORKDIR}
COPY ./CMakeLists.txt.lib ./CMakeLists.txt
COPY ./src ./src
RUN ln -s /usr/local/googletest ./googletest
COPY ./dependencies/cmake-modules ./dependencies/cmake-modules
COPY ./dependencies/spirit-po ./dependencies/spirit-po
COPY ./dependencies/tinf ./dependencies/tinf
COPY ./scripts ./scripts
RUN mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make -j$(nproc) Gradido_LoginServer
RUN cd scripts && \
chmod +x compile_pot.sh && \
./compile_pot.sh
#########################################################################################################
# run release
#########################################################################################################
#From alpine:latest as login_server
FROM alpine:3.13.5 as login_server
USER root
WORKDIR "/usr/bin"
COPY --from=release /code/build/bin/Gradido_LoginServer /usr/bin/
COPY --from=release /usr/local/lib/mariadb/libmariadb.so.3 /usr/local/lib/
COPY --from=release /usr/local/lib/libPoco* /usr/local/lib/
COPY --from=release /usr/local/lib/libproto* /usr/local/lib/
COPY --from=release /usr/lib/libsodium.so.23 /usr/lib/
COPY --from=release /usr/lib/libstdc++.so.6 /usr/lib/
COPY --from=release /usr/lib/libgcc_s.so.1 /usr/lib/
RUN chmod +x /usr/bin/Gradido_LoginServer
ENTRYPOINT ["/usr/bin/Gradido_LoginServer"]
#CMD Gradido_LoginServer

View File

@ -1,16 +0,0 @@
FROM gradido/login_dependencies:alpine-debug-3 as login_server_alpine_debug
ENV DOCKER_WORKDIR="/code"
EXPOSE 1200
EXPOSE 1201
WORKDIR ${DOCKER_WORKDIR}
COPY ./CMakeLists.txt.lib ./CMakeLists.txt
COPY ./scripts ./scripts
COPY ./cmake ./cmake
RUN ln -s /usr/local/googletest ./googletest
CMD cd scripts; ./build_debug.sh; cd ..; ./build/bin/Gradido_LoginServer

View File

@ -1,95 +0,0 @@
# Login-Server Build dependencies for alpine
# Uploaded to hub.docker.com with the tag:
# gradido/login_dependencies:alpine-debug-3 for debug build
# and
# gradido/login_dependencies:alpine-release-3 for release build
# Update tag when dependencies are added or removed
# Control Build Type with ARG BUILD_TYPE
# Valid values do you find here: https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
# Default is set to Debug
##### BUILD-ENV #####
FROM alpine:3.13.5 as alpine-build
RUN apk add --update --no-cache icu-dev
RUN apk add --no-cache git openssl-dev make gcc musl-dev g++ linux-headers libintl gettext-dev boost-dev libsodium-dev
##### CMAKE #####
FROM alpine-build as alpine-gxx-cmake
RUN git clone https://github.com/Kitware/CMake.git --branch=v3.19.8 && \
cd CMake && \
./bootstrap --parallel=$(nproc) && \
make -j$(nproc) && \
make install
######### BUILD grpc ##############
FROM alpine-gxx-cmake as alpine-gxx-protobuf
ARG BUILD_TYPE=Debug
RUN apk add --no-cache autoconf automake libtool curl unzip
RUN git clone https://github.com/protocolbuffers/protobuf.git --recursive -j4 && \
cd protobuf && \
./autogen.sh && \
./configure && \
make -j$(nproc) && \
make install
# protobuf libs missing after make install
#RUN cp grpc/build/third_party/protobuf/*.a /usr/local/lib/
######### BUILD poco ##############
FROM alpine-gxx-cmake as alpine-gxx-poco
ARG BUILD_TYPE=Debug
RUN git clone https://github.com/pocoproject/poco.git --recursive && \
cd poco && \
git checkout poco-1.9.4-release && \
mkdir cmake-build && cd cmake-build && \
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. && make -j$(nproc) && \
make install
######### BUILD mariadb ###########
FROM alpine-gxx-cmake as alpine-gxx-mariadb-connector
ARG BUILD_TYPE=Debug
RUN git clone https://github.com/mariadb-corporation/mariadb-connector-c.git && \
cd mariadb-connector-c && \
git checkout 159540f && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. && make -j$(nproc) && \
make install
#########################################################################################################
# builded libs and binaries
#########################################################################################################
FROM alpine-build as alpine-libs
# copy CMake from cmake stage
COPY --from=alpine-gxx-cmake /usr/local/bin/cmake /usr/local/bin/cmake
COPY --from=alpine-gxx-cmake /usr/local/share/cmake-3.19/Modules /usr/local/share/cmake-3.19/Modules
COPY --from=alpine-gxx-cmake /usr/local/share/cmake-3.19/Templates /usr/local/share/cmake-3.19/Templates
# copy from grpc
COPY --from=alpine-gxx-protobuf /usr/local /usr/local
# COPY from poco
COPY --from=alpine-gxx-poco /usr/local /usr/local
# COPY from mariadb
COPY --from=alpine-gxx-mariadb-connector /usr/local /usr/local
#########################################################################################################
# COPY Things only needed for testing
#########################################################################################################
FROM alpine-libs as alpine-libs-test
COPY --from=alpine-gxx-protobuf /protobuf/third_party/googletest /usr/local/googletest

View File

@ -1,49 +0,0 @@
#########################################################################################################
# Build release
#########################################################################################################
FROM gradido/login_dependencies:alpine-release-3 as release
ENV DOCKER_WORKDIR="/code"
WORKDIR ${DOCKER_WORKDIR}
COPY ./CMakeLists.txt.lib ./CMakeLists.txt
COPY ./src ./src
RUN ln -s /usr/local/googletest ./googletest
COPY ./dependencies/cmake-modules ./dependencies/cmake-modules
COPY ./dependencies/spirit-po ./dependencies/spirit-po
COPY ./dependencies/tinf ./dependencies/tinf
COPY ./scripts ./scripts
RUN mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make -j$(nproc) Gradido_LoginServer
RUN cd scripts && \
chmod +x compile_pot.sh && \
./compile_pot.sh
#########################################################################################################
# run release
#########################################################################################################
#From alpine:latest as login_server
FROM alpine:3.13.5 as login_server
USER root
WORKDIR "/usr/bin"
COPY --from=release /code/build/bin/Gradido_LoginServer /usr/bin/
COPY --from=release /usr/local/lib/mariadb/libmariadb.so.3 /usr/local/lib/
COPY --from=release /usr/local/lib/libPoco* /usr/local/lib/
COPY --from=release /usr/local/lib/libproto* /usr/local/lib/
COPY --from=release /usr/lib/libsodium.so.23 /usr/lib/
COPY --from=release /usr/lib/libstdc++.so.6 /usr/lib/
COPY --from=release /usr/lib/libgcc_s.so.1 /usr/lib/
RUN chmod +x /usr/bin/Gradido_LoginServer
ENTRYPOINT ["/usr/bin/Gradido_LoginServer"]
#CMD Gradido_LoginServer

View File

@ -1,63 +0,0 @@
# Login Server build which contain the config file, found on docker hub with tag:
# gradido/login_server:with-config
# Used for community-server tests on staging
#########################################################################################################
# Build release
#########################################################################################################
FROM gradido/login_dependencies:alpine-release-3 as release_default
ENV DOCKER_WORKDIR="/code"
WORKDIR ${DOCKER_WORKDIR}
COPY ./login_server/CMakeLists.txt.lib ./CMakeLists.txt
COPY ./login_server/src ./src
COPY ./login_server/dependencies/cmake-modules ./dependencies/cmake-modules
COPY ./login_server/dependencies/spirit-po ./dependencies/spirit-po
COPY ./login_server/dependencies/tinf ./dependencies/tinf
COPY ./login_server/scripts ./scripts
RUN mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make -j$(nproc) Gradido_LoginServer
RUN cd scripts && \
chmod +x compile_pot.sh && \
./compile_pot.sh
#########################################################################################################
# run release with docker default config
#########################################################################################################
#From alpine:latest as login_server
FROM alpine:3.13.5 as login_server_default
USER root
WORKDIR "/usr/bin"
COPY --from=release_default /code/build/bin/Gradido_LoginServer /usr/bin/
COPY --from=release_default /usr/local/lib/mariadb/libmariadb.so.3 /usr/local/lib/
COPY --from=release_default /usr/local/lib/libPoco* /usr/local/lib/
COPY --from=release_default /usr/lib/libsodium.so.23 /usr/lib/
COPY --from=release_default /usr/lib/libstdc++.so.6 /usr/lib/
COPY --from=release_default /usr/lib/libgcc_s.so.1 /usr/lib/
COPY ./configs/login_server/grd_login.properties /etc/grd_login/
COPY ./configs/login_server/cacert.pem /etc/grd_login/
COPY ./configs/login_server/LOCALE /etc/grd_login/
EXPOSE 1200
EXPOSE 1201
RUN chmod +x /usr/bin/Gradido_LoginServer
ENTRYPOINT ["/usr/bin/Gradido_LoginServer"]
#CMD Gradido_LoginServer

View File

@ -1,38 +0,0 @@
#########################################################################################################
# Prepare debug
#########################################################################################################
FROM gradido/login_dependencies:gcc9-debug-3 as prepare_debug
ENV DOCKER_WORKDIR="/code"
WORKDIR ${DOCKER_WORKDIR}
RUN echo '/usr/local/lib' >> /etc/ld.so.conf && ldconfig
COPY ./CMakeLists.txt.lib ./CMakeLists.txt
RUN ln -s /usr/local/googletest ./googletest
COPY ./src ./src
COPY ./dependencies/cmake-modules ./dependencies/cmake-modules
COPY ./dependencies/spirit-po ./dependencies/spirit-po
COPY ./dependencies/tinf ./dependencies/tinf
COPY ./scripts ./scripts
#########################################################################################################
# Build debug
#########################################################################################################
FROM prepare_debug as debug
ENV DOCKER_WORKDIR="/code"
WORKDIR ${DOCKER_WORKDIR}
RUN mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Debug ..
RUN cd scripts && \
chmod +x compile_pot.sh && \
./compile_pot.sh
CMD cd build && cmake .. -DCMAKE_BUILD_TYPE=Debug && make -j$(nproc) Gradido_LoginServer && ./bin/Gradido_LoginServer

View File

@ -1,93 +0,0 @@
# Login-Server Build dependencies for ubuntu
# Uploaded to hub.docker.com with the tag:
# gradido/login_dependencies:gcc9-debug-3 for debug build
# Update tag when dependencies are added or removed
# Control Build Type with ARG BUILD_TYPE
# Valid values do you find here: https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
# Default is set to Debug
##### BUILD-ENV #####
FROM gcc:9 as gcc9_build
RUN apt-get update && \
apt-get install -y --no-install-recommends libssl-dev libboost-dev gettext libsodium-dev lcov && \
apt-get autoclean && \
apt-get autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
#########################################################################################################
# gcc 9 cmake
#########################################################################################################
FROM gcc9_build as gcc_9_cmake
RUN git clone https://github.com/Kitware/CMake.git --branch=v3.19.8 && \
cd CMake && \
./bootstrap --parallel=$(nproc) && \
make -j$(nproc) && \
make install
######### BUILD grpc ##############
FROM gcc_9_cmake as gcc_9_protobuf
ARG BUILD_TYPE=Debug
RUN git clone https://github.com/protocolbuffers/protobuf.git --recursive -j4 && \
cd protobuf && \
./autogen.sh && \
./configure && \
make -j$(nproc) && \
make install && \
ldconfig
# protobuf libs missing after make install
#RUN cp grpc/build/third_party/protobuf/*.a /usr/local/lib/
######### BUILD poco ##############
FROM gcc_9_cmake as gcc_9_poco
ARG BUILD_TYPE=Debug
RUN git clone https://github.com/pocoproject/poco.git --recursive && \
cd poco && \
git checkout poco-1.9.4-release && \
mkdir cmake-build && cd cmake-build && \
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. && make -j$(nproc) && \
make install
######### BUILD mariadb ###########
FROM gcc_9_cmake as gcc_9_mariadb-connector
ARG BUILD_TYPE=Debug
RUN git clone https://github.com/mariadb-corporation/mariadb-connector-c.git && \
cd mariadb-connector-c && \
git checkout 159540f && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. && make -j$(nproc) && \
make install
#########################################################################################################
# builded libs and binaries
#########################################################################################################
FROM gcc9_build as gcc9_libs
RUN echo '/usr/local/lib' >> /etc/ld.so.conf && ldconfig
# copy CMake from cmake stage
COPY --from=gcc_9_cmake /usr/local/bin/cmake /usr/local/bin/cmake
COPY --from=gcc_9_cmake /usr/local/share/cmake-3.19/Modules /usr/local/share/cmake-3.19/Modules
COPY --from=gcc_9_cmake /usr/local/share/cmake-3.19/Templates /usr/local/share/cmake-3.19/Templates
# copy from grpc
COPY --from=gcc_9_protobuf /usr/local /usr/local
COPY --from=gcc_9_protobuf /protobuf/third_party/googletest /usr/local/googletest
# COPY from poco
COPY --from=gcc_9_poco /usr/local /usr/local
# COPY from mariadb
COPY --from=gcc_9_mariadb-connector /usr/local /usr/local

View File

@ -1,49 +0,0 @@
#########################################################################################################
# Build release
#########################################################################################################
FROM gradido/login_dependencies:ubuntu-release-3 as release
ENV DOCKER_WORKDIR="/code"
WORKDIR ${DOCKER_WORKDIR}
COPY ./CMakeLists.txt.lib ./CMakeLists.txt
COPY ./src ./src
RUN ln -s /usr/local/googletest ./googletest
COPY ./dependencies/cmake-modules ./dependencies/cmake-modules
COPY ./dependencies/spirit-po ./dependencies/spirit-po
COPY ./dependencies/tinf ./dependencies/tinf
COPY ./scripts ./scripts
RUN mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make -j$(nproc) Gradido_LoginServer
RUN cd scripts && \
chmod +x compile_pot.sh && \
./compile_pot.sh
#########################################################################################################
# run release
#########################################################################################################
#From alpine:latest as login_server
FROM ubuntu:latest as login_server
USER root
WORKDIR "/usr/bin"
COPY --from=release /code/build/bin/Gradido_LoginServer /usr/bin/
COPY --from=release /usr/local/lib/mariadb/libmariadb.so.3 /usr/local/lib/
COPY --from=release /usr/local/lib/libPoco* /usr/local/lib/
COPY --from=release /usr/local/lib/libproto* /usr/local/lib/
COPY --from=release /usr/lib/libsodium.so.23 /usr/lib/
COPY --from=release /usr/lib/libstdc++.so.6 /usr/lib/
COPY --from=release /usr/lib/libgcc_s.so.1 /usr/lib/
RUN chmod +x /usr/bin/Gradido_LoginServer
ENTRYPOINT ["/usr/bin/Gradido_LoginServer"]
#CMD Gradido_LoginServer

View File

@ -1,58 +0,0 @@
#########################################################################################################
# Prepare debug
#########################################################################################################
FROM gradido/login_dependencies:gcc9-debug-3 as prepare_debug
ENV DOCKER_WORKDIR="/code"
WORKDIR ${DOCKER_WORKDIR}
RUN echo '/usr/local/lib' >> /etc/ld.so.conf && ldconfig
COPY ./CMakeLists.txt.lib ./CMakeLists.txt
RUN ln -s /usr/local/googletest ./googletest
COPY ./src ./src
COPY ./cmake/CodeCoverage.cmake ./cmake/CodeCoverage.cmake
COPY ./dependencies/cmake-modules ./dependencies/cmake-modules
COPY ./dependencies/spirit-po ./dependencies/spirit-po
COPY ./dependencies/tinf ./dependencies/tinf
COPY ./scripts ./scripts
#########################################################################################################
# Install Coverage tool
#########################################################################################################
FROM prepare_debug as coverage
RUN apt-get update && \
apt-get install -y --no-install-recommends python3-pip && \
apt-get autoclean && \
apt-get autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# fastcov need gcovr to work
RUN pip3 install gcovr setuptools wheel && \
pip3 install fastcov
#########################################################################################################
# Build test
#########################################################################################################
FROM coverage as test
ENV DOCKER_WORKDIR="/code"
WORKDIR ${DOCKER_WORKDIR}
RUN if [ ! -d "./build_cov" ] ; then mkdir build_cov; fi
RUN cd build_cov && \
cmake -DCMAKE_BUILD_TYPE=Debug -DCOLLECT_COVERAGE_DATA=ON -DCOVERAGE_TOOL=fastcov .. && \
make -j$(nproc) Gradido_LoginServer_Test
#ENTRYPOINT make -C build_cov coverage
CMD cd build_cov && make coverage && \
if [ ! -d "./coverage" ] ; then mkdir coverage; fi && \
cp coverage.info ./coverage/

File diff suppressed because it is too large Load Diff

View File

@ -1,111 +0,0 @@
function(conan_message MESSAGE_OUTPUT)
if(NOT CONAN_CMAKE_SILENT_OUTPUT)
message(${ARGV${0}})
endif()
endfunction()
include(FindPackageHandleStandardArgs)
conan_message(STATUS "Conan: Using autogenerated FindOpenSSL.cmake")
# Global approach
set(OpenSSL_FOUND 1)
set(OpenSSL_VERSION "1.0.2o")
find_package_handle_standard_args(OpenSSL REQUIRED_VARS
OpenSSL_VERSION VERSION_VAR OpenSSL_VERSION)
mark_as_advanced(OpenSSL_FOUND OpenSSL_VERSION)
set(OpenSSL_INCLUDE_DIRS "${CONAN_INCLUDE_DIRS_OPENSSL}")
set(OpenSSL_INCLUDE_DIR "${CONAN_INCLUDE_DIRS_OPENSSL}")
set(OpenSSL_INCLUDES "${CONAN_INCLUDE_DIRS_OPENSSL}")
set(OpenSSL_RES_DIRS "${CONAN_RES_DIRS_OPENSSL}")
set(OPENSSL_ROOT_DIR "${CONAN_OPENSSL_ROOT}")
set(OPENSSL_DIR "${CONAN_OPENSSL_ROOT}")
set(OpenSSL_DEFINITIONS )
set(OpenSSL_LINKER_FLAGS_LIST
"$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:>"
"$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:>"
"$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:>"
)
set(OpenSSL_COMPILE_DEFINITIONS )
set(OpenSSL_COMPILE_OPTIONS_LIST "" "")
set(OpenSSL_COMPILE_OPTIONS_C "")
set(OpenSSL_COMPILE_OPTIONS_CXX "")
set(OpenSSL_LIBRARIES_TARGETS "") # Will be filled later, if CMake 3
set(OpenSSL_LIBRARIES "") # Will be filled later
set(OpenSSL_LIBS "") # Same as OpenSSL_LIBRARIES
set(OpenSSL_FRAMEWORKS_FOUND "") # Will be filled later
set(OpenSSL_BUILD_MODULES_PATHS )
mark_as_advanced(OpenSSL_INCLUDE_DIRS
OpenSSL_INCLUDE_DIR
OpenSSL_INCLUDES
OpenSSL_DEFINITIONS
OpenSSL_LINKER_FLAGS_LIST
OpenSSL_COMPILE_DEFINITIONS
OpenSSL_COMPILE_OPTIONS_LIST
OpenSSL_LIBRARIES
OpenSSL_LIBS
OpenSSL_LIBRARIES_TARGETS)
# Find the real .lib/.a and add them to OpenSSL_LIBS and OpenSSL_LIBRARY_LIST
set(OpenSSL_LIBRARY_LIST ssl crypto dl pthread)
set(OpenSSL_LIB_DIRS "${CONAN_LIB_DIRS_OPENSSL}")
# Gather all the libraries that should be linked to the targets (do not touch existing variables):
set(_OpenSSL_DEPENDENCIES "zlib::zlib")
conan_package_library_targets("${OpenSSL_LIBRARY_LIST}" # libraries
"${OpenSSL_LIB_DIRS}" # package_libdir
"${_OpenSSL_DEPENDENCIES}" # deps
OpenSSL_LIBRARIES # out_libraries
OpenSSL_LIBRARIES_TARGETS # out_libraries_targets
"" # build_type
"OpenSSL") # package_name
set(OpenSSL_LIBS ${OpenSSL_LIBRARIES})
# We need to add our requirements too
set(OpenSSL_LIBRARIES_TARGETS "${OpenSSL_LIBRARIES_TARGETS};zlib::zlib")
set(OpenSSL_LIBRARIES "${OpenSSL_LIBRARIES};zlib::zlib")
set(CMAKE_MODULE_PATH "/home/dario/.conan/data/OpenSSL/1.0.2o/conan/stable/package/b781af3f476d0aa5070a0a35b544db7a3c193cc8/" ${CMAKE_MODULE_PATH})
set(CMAKE_PREFIX_PATH "/home/dario/.conan/data/OpenSSL/1.0.2o/conan/stable/package/b781af3f476d0aa5070a0a35b544db7a3c193cc8/" ${CMAKE_PREFIX_PATH})
foreach(_BUILD_MODULE_PATH ${OpenSSL_BUILD_MODULES_PATHS})
include(${_BUILD_MODULE_PATH})
endforeach()
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0")
# Target approach
if(NOT TARGET OpenSSL::OpenSSL)
add_library(OpenSSL::OpenSSL INTERFACE IMPORTED)
if(OpenSSL_INCLUDE_DIRS)
set_target_properties(OpenSSL::OpenSSL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${OpenSSL_INCLUDE_DIRS}")
endif()
set_property(TARGET OpenSSL::OpenSSL PROPERTY INTERFACE_LINK_LIBRARIES
"${OpenSSL_LIBRARIES_TARGETS};${OpenSSL_LINKER_FLAGS_LIST}")
set_property(TARGET OpenSSL::OpenSSL PROPERTY INTERFACE_COMPILE_DEFINITIONS
${OpenSSL_COMPILE_DEFINITIONS})
set_property(TARGET OpenSSL::OpenSSL PROPERTY INTERFACE_COMPILE_OPTIONS
"${OpenSSL_COMPILE_OPTIONS_LIST}")
# Library dependencies
include(CMakeFindDependencyMacro)
if(NOT zlib_FOUND)
find_dependency(zlib REQUIRED)
else()
message(STATUS "Dependency zlib already found")
endif()
endif()
endif()

View File

@ -1,146 +0,0 @@
# Build Login-Server yourself
## Linux (Ubuntu) Packets
install build essentials
```bash
sudo apt install -y gcovr build-essential gettext libcurl4-openssl-dev libssl-dev libsodium-dev libboost-dev
```
## CMake
CMake is used for build file generation and the Login-Server needs at least version v3.18.2
You can build and install it from source.
The Version in apt is sadly to old.
```bash
git clone https://github.com/Kitware/CMake.git --branch v3.18.2
cd CMake
./bootstrap --parallel=$(nproc) && make -j$(nproc) && sudo make install
```
## dependencies
load git submodules if you haven't done it yet
```bash
git submodule update --init --recursive
```
## build tools
build protoc and page compiler needed for generating some additional code
```bash
cd scripts
./prepare_build.sh
```
## build
build login-server in debug mode
```bash
cd scripts
./build_debug.sh
```
## multilanguage text
Login-Server uses gettext translations found after build in src/LOCALE
On Linux Login-Server expect the *.po files in folder /etc/grd_login/LOCALE
on windows next to Binary in Folder LOCALE.
So please copy them over by yourself on first run or after change.
If you like to update some translations your find a messages.pot in src/LOCALE.
Use it together with poedit and don't forget to copy over *.po files after change to /etc/grd_login/LOCALE
To update messages.pot run
```bash
./scripts/compile_pot.sh
```
This will be also called by ./scripts/build_debug.sh
## database
Login-Server needs a db to run, it is tested with mariadb.
Currently at least one group must be present in table groups.
For example:
```sql
INSERT INTO `groups` (`id`, `alias`, `name`, `url`, `host`, `home`, `description`) VALUES
(1, 'docker', 'docker gradido group', 'localhost', 'localhost', '/', 'gradido test group for docker with blockchain db');
```
## configuration
Login-Server needs a configuration file to able to run.
On Linux it expect it to find the file /etc/grd_login/grd_login.properties
and /etc/grd_login/grd_login_test.properties for unittest
Example configuration (ini-format)
```ini
# Port for Web-Interface
HTTPServer.port = 1200
# Port for json-Interface (used by new backend)
JSONServer.port = 1201
# default group id for new users, if no group was choosen
Gradido.group_id = 1
# currently not used
crypto.server_admin_public = f909a866baec97c5460b8d7a93b72d3d4d20cc45d9f15d78bd83944eb9286b7f
# Server admin Passphrase
# nerve execute merit pool talk hockey basic win cargo spin disagree ethics swear price purchase say clutch decrease slow half forest reform cheese able
#
# TODO: auto-generate in docker build step
# expect valid hex 32 character long (16 Byte)
# salt for hashing user password, should be moved into db generated and saved per user, used for hardening against hash-tables
crypto.server_key = a51ef8ac7ef1abf162fb7a65261acd7a
# TODO: auto-generate in docker build step
# salt for hashing user encryption key, expect valid hex, as long as you like, used in sha512
crypto.app_secret = 21ffbbc616fe
# for url forwarding to old frontend, path of community server
phpServer.url = http://localhost/
# host for community server api calls
phpServer.host = localhost
# port for community server api calls
phpServer.port = 80
# Path for Login-Server Web-Interface used for link-generation
loginServer.path = http://localhost/account
# default language for new users and if no one is logged in
loginServer.default_locale = de
# db setup tested with mariadb, should also work with mysql
loginServer.db.host = localhost
loginServer.db.name = gradido_login
loginServer.db.user = root
loginServer.db.password =
loginServer.db.port = 3306
# check email path for new frontend for link generation in emails
frontend.checkEmailPath = http://localhost/reset
# disable email all together
email.disable = true
# setup email smtp server for sending emails
#email.username =
#email.sender =
#email.admin_receiver =
#email.password =
#email.smtp.url =
#email.smtp.port =
# server setup types: test, staging or production
# used mainly to decide if using http or https for links
# test use http and staging and production uses https
ServerSetupType=test
dev.default_group = docker
# Session timeout in minutes
session.timeout = 15
# Disabling security features for faster develop and testing
unsecure.allow_passwort_via_json_request = 1
unsecure.allow_auto_sign_transactions = 1
unsecure.allow_cors_all = 1
# default disable, passwords must contain a number, a lower character, a high character, special character, and be at least 8 characters long
unsecure.allow_all_passwords = 1
```

View File

@ -1,682 +0,0 @@
# Copyright (c) 2012 - 2017, Lars Bilke
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# CHANGES:
#
# 2012-01-31, Lars Bilke
# - Enable Code Coverage
#
# 2013-09-17, Joakim Söderberg
# - Added support for Clang.
# - Some additional usage instructions.
#
# 2016-02-03, Lars Bilke
# - Refactored functions to use named parameters
#
# 2017-06-02, Lars Bilke
# - Merged with modified version from github.com/ufz/ogs
#
# 2019-05-06, Anatolii Kurotych
# - Remove unnecessary --coverage flag
#
# 2019-12-13, FeRD (Frank Dana)
# - Deprecate COVERAGE_LCOVR_EXCLUDES and COVERAGE_GCOVR_EXCLUDES lists in favor
# of tool-agnostic COVERAGE_EXCLUDES variable, or EXCLUDE setup arguments.
# - CMake 3.4+: All excludes can be specified relative to BASE_DIRECTORY
# - All setup functions: accept BASE_DIRECTORY, EXCLUDE list
# - Set lcov basedir with -b argument
# - Add automatic --demangle-cpp in lcovr, if 'c++filt' is available (can be
# overridden with NO_DEMANGLE option in setup_target_for_coverage_lcovr().)
# - Delete output dir, .info file on 'make clean'
# - Remove Python detection, since version mismatches will break gcovr
# - Minor cleanup (lowercase function names, update examples...)
#
# 2019-12-19, FeRD (Frank Dana)
# - Rename Lcov outputs, make filtered file canonical, fix cleanup for targets
#
# 2020-01-19, Bob Apthorpe
# - Added gfortran support
#
# 2020-02-17, FeRD (Frank Dana)
# - Make all add_custom_target()s VERBATIM to auto-escape wildcard characters
# in EXCLUDEs, and remove manual escaping from gcovr targets
#
# 2021-01-19, Robin Mueller
# - Add CODE_COVERAGE_VERBOSE option which will allow to print out commands which are run
# - Added the option for users to set the GCOVR_ADDITIONAL_ARGS variable to supply additional
# flags to the gcovr command
#
# 2020-05-04, Mihchael Davis
# - Add -fprofile-abs-path to make gcno files contain absolute paths
# - Fix BASE_DIRECTORY not working when defined
# - Change BYPRODUCT from folder to index.html to stop ninja from complaining about double defines
# USAGE:
#
# 1. Copy this file into your cmake modules path.
#
# 2. Add the following line to your CMakeLists.txt (best inside an if-condition
# using a CMake option() to enable it just optionally):
# include(CodeCoverage)
#
# 3. Append necessary compiler flags:
# append_coverage_compiler_flags()
#
# 3.a (OPTIONAL) Set appropriate optimization flags, e.g. -O0, -O1 or -Og
#
# 4. If you need to exclude additional directories from the report, specify them
# using full paths in the COVERAGE_EXCLUDES variable before calling
# setup_target_for_coverage_*().
# Example:
# set(COVERAGE_EXCLUDES
# '${PROJECT_SOURCE_DIR}/src/dir1/*'
# '/path/to/my/src/dir2/*')
# Or, use the EXCLUDE argument to setup_target_for_coverage_*().
# Example:
# setup_target_for_coverage_lcov(
# NAME coverage
# EXECUTABLE testrunner
# EXCLUDE "${PROJECT_SOURCE_DIR}/src/dir1/*" "/path/to/my/src/dir2/*")
#
# 4.a NOTE: With CMake 3.4+, COVERAGE_EXCLUDES or EXCLUDE can also be set
# relative to the BASE_DIRECTORY (default: PROJECT_SOURCE_DIR)
# Example:
# set(COVERAGE_EXCLUDES "dir1/*")
# setup_target_for_coverage_gcovr_html(
# NAME coverage
# EXECUTABLE testrunner
# BASE_DIRECTORY "${PROJECT_SOURCE_DIR}/src"
# EXCLUDE "dir2/*")
#
# 5. Use the functions described below to create a custom make target which
# runs your test executable and produces a code coverage report.
#
# 6. Build a Debug build:
# cmake -DCMAKE_BUILD_TYPE=Debug ..
# make
# make my_coverage_target
#
include(CMakeParseArguments)
option(CODE_COVERAGE_VERBOSE "Verbose information" FALSE)
# Check prereqs
find_program( GCOV_PATH gcov )
find_program( LCOV_PATH NAMES lcov lcov.bat lcov.exe lcov.perl)
find_program( FASTCOV_PATH NAMES fastcov fastcov.py )
find_program( GENHTML_PATH NAMES genhtml genhtml.perl genhtml.bat )
find_program( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test)
find_program( CPPFILT_PATH NAMES c++filt )
if(NOT GCOV_PATH)
message(FATAL_ERROR "gcov not found! Aborting...")
endif() # NOT GCOV_PATH
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
list(GET LANGUAGES 0 LANG)
if("${CMAKE_${LANG}_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
if("${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS 3)
message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...")
endif()
elseif(NOT CMAKE_COMPILER_IS_GNUCXX)
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "[Ff]lang")
# Do nothing; exit conditional without error if true
elseif("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
# Do nothing; exit conditional without error if true
else()
message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
endif()
endif()
set(COVERAGE_COMPILER_FLAGS "-g -fprofile-arcs -ftest-coverage"
CACHE INTERNAL "")
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fprofile-abs-path HAVE_fprofile_abs_path)
if(HAVE_fprofile_abs_path)
set(COVERAGE_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-abs-path")
endif()
endif()
set(CMAKE_Fortran_FLAGS_COVERAGE
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the Fortran compiler during coverage builds."
FORCE )
set(CMAKE_CXX_FLAGS_COVERAGE
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the C++ compiler during coverage builds."
FORCE )
set(CMAKE_C_FLAGS_COVERAGE
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the C compiler during coverage builds."
FORCE )
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
""
CACHE STRING "Flags used for linking binaries during coverage builds."
FORCE )
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
""
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
FORCE )
mark_as_advanced(
CMAKE_Fortran_FLAGS_COVERAGE
CMAKE_CXX_FLAGS_COVERAGE
CMAKE_C_FLAGS_COVERAGE
CMAKE_EXE_LINKER_FLAGS_COVERAGE
CMAKE_SHARED_LINKER_FLAGS_COVERAGE )
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading")
endif() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
link_libraries(gcov)
endif()
# Defines a target for running and collection code coverage information
# Builds dependencies, runs the given executable and outputs reports.
# NOTE! The executable should always have a ZERO as exit code otherwise
# the coverage generation will not complete.
#
# setup_target_for_coverage_lcov(
# NAME testrunner_coverage # New target name
# EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
# DEPENDENCIES testrunner # Dependencies to build first
# BASE_DIRECTORY "../" # Base directory for report
# # (defaults to PROJECT_SOURCE_DIR)
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
# # to BASE_DIRECTORY, with CMake 3.4+)
# NO_DEMANGLE # Don't demangle C++ symbols
# # even if c++filt is found
# )
function(setup_target_for_coverage_lcov)
set(options NO_DEMANGLE)
set(oneValueArgs BASE_DIRECTORY NAME)
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES LCOV_ARGS GENHTML_ARGS)
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT LCOV_PATH)
message(FATAL_ERROR "lcov not found! Aborting...")
endif() # NOT LCOV_PATH
if(NOT GENHTML_PATH)
message(FATAL_ERROR "genhtml not found! Aborting...")
endif() # NOT GENHTML_PATH
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
if(DEFINED Coverage_BASE_DIRECTORY)
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
else()
set(BASEDIR ${PROJECT_SOURCE_DIR})
endif()
# Collect excludes (CMake 3.4+: Also compute absolute paths)
set(LCOV_EXCLUDES "")
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_LCOV_EXCLUDES})
if(CMAKE_VERSION VERSION_GREATER 3.4)
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
endif()
list(APPEND LCOV_EXCLUDES "${EXCLUDE}")
endforeach()
list(REMOVE_DUPLICATES LCOV_EXCLUDES)
# Conditional arguments
if(CPPFILT_PATH AND NOT ${Coverage_NO_DEMANGLE})
set(GENHTML_EXTRA_ARGS "--demangle-cpp")
endif()
# Setting up commands which will be run to generate coverage data.
# Cleanup lcov
set(LCOV_CLEAN_CMD
${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -directory .
-b ${BASEDIR} --zerocounters
)
# Create baseline to make sure untouched files show up in the report
set(LCOV_BASELINE_CMD
${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -c -i -d . -b
${BASEDIR} -o ${Coverage_NAME}.base
)
# Run tests
set(LCOV_EXEC_TESTS_CMD
${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
)
# Capturing lcov counters and generating report
set(LCOV_CAPTURE_CMD
${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --directory . -b
${BASEDIR} --capture --output-file ${Coverage_NAME}.capture
)
# add baseline counters
set(LCOV_BASELINE_COUNT_CMD
${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -a ${Coverage_NAME}.base
-a ${Coverage_NAME}.capture --output-file ${Coverage_NAME}.total
)
# filter collected data to final coverage report
set(LCOV_FILTER_CMD
${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --remove
${Coverage_NAME}.total ${LCOV_EXCLUDES} --output-file ${Coverage_NAME}.info
)
# Generate HTML output
set(LCOV_GEN_HTML_CMD
${GENHTML_PATH} ${GENHTML_EXTRA_ARGS} ${Coverage_GENHTML_ARGS} -o
${Coverage_NAME} ${Coverage_NAME}.info
)
if(CODE_COVERAGE_VERBOSE)
message(STATUS "Executed command report")
message(STATUS "Command to clean up lcov: ")
string(REPLACE ";" " " LCOV_CLEAN_CMD_SPACED "${LCOV_CLEAN_CMD}")
message(STATUS "${LCOV_CLEAN_CMD_SPACED}")
message(STATUS "Command to create baseline: ")
string(REPLACE ";" " " LCOV_BASELINE_CMD_SPACED "${LCOV_BASELINE_CMD}")
message(STATUS "${LCOV_BASELINE_CMD_SPACED}")
message(STATUS "Command to run the tests: ")
string(REPLACE ";" " " LCOV_EXEC_TESTS_CMD_SPACED "${LCOV_EXEC_TESTS_CMD}")
message(STATUS "${LCOV_EXEC_TESTS_CMD_SPACED}")
message(STATUS "Command to capture counters and generate report: ")
string(REPLACE ";" " " LCOV_CAPTURE_CMD_SPACED "${LCOV_CAPTURE_CMD}")
message(STATUS "${LCOV_CAPTURE_CMD_SPACED}")
message(STATUS "Command to add baseline counters: ")
string(REPLACE ";" " " LCOV_BASELINE_COUNT_CMD_SPACED "${LCOV_BASELINE_COUNT_CMD}")
message(STATUS "${LCOV_BASELINE_COUNT_CMD_SPACED}")
message(STATUS "Command to filter collected data: ")
string(REPLACE ";" " " LCOV_FILTER_CMD_SPACED "${LCOV_FILTER_CMD}")
message(STATUS "${LCOV_FILTER_CMD_SPACED}")
message(STATUS "Command to generate lcov HTML output: ")
string(REPLACE ";" " " LCOV_GEN_HTML_CMD_SPACED "${LCOV_GEN_HTML_CMD}")
message(STATUS "${LCOV_GEN_HTML_CMD_SPACED}")
endif()
# Setup target
add_custom_target(${Coverage_NAME}
COMMAND ${LCOV_CLEAN_CMD}
COMMAND ${LCOV_BASELINE_CMD}
COMMAND ${LCOV_EXEC_TESTS_CMD}
COMMAND ${LCOV_CAPTURE_CMD}
COMMAND ${LCOV_BASELINE_COUNT_CMD}
COMMAND ${LCOV_FILTER_CMD}
COMMAND ${LCOV_GEN_HTML_CMD}
# Set output files as GENERATED (will be removed on 'make clean')
BYPRODUCTS
${Coverage_NAME}.base
${Coverage_NAME}.capture
${Coverage_NAME}.total
${Coverage_NAME}.info
${Coverage_NAME}/index.html
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
)
# Show where to find the lcov info report
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
COMMAND ;
COMMENT "Lcov code coverage info report saved in ${Coverage_NAME}.info."
)
# Show info where to find the report
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
COMMAND ;
COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report."
)
endfunction() # setup_target_for_coverage_lcov
# Defines a target for running and collection code coverage information
# Builds dependencies, runs the given executable and outputs reports.
# NOTE! The executable should always have a ZERO as exit code otherwise
# the coverage generation will not complete.
#
# setup_target_for_coverage_gcovr_xml(
# NAME ctest_coverage # New target name
# EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
# DEPENDENCIES executable_target # Dependencies to build first
# BASE_DIRECTORY "../" # Base directory for report
# # (defaults to PROJECT_SOURCE_DIR)
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
# # to BASE_DIRECTORY, with CMake 3.4+)
# )
# The user can set the variable GCOVR_ADDITIONAL_ARGS to supply additional flags to the
# GCVOR command.
function(setup_target_for_coverage_gcovr_xml)
set(options NONE)
set(oneValueArgs BASE_DIRECTORY NAME)
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT GCOVR_PATH)
message(FATAL_ERROR "gcovr not found! Aborting...")
endif() # NOT GCOVR_PATH
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
if(DEFINED Coverage_BASE_DIRECTORY)
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
else()
set(BASEDIR ${PROJECT_SOURCE_DIR})
endif()
# Collect excludes (CMake 3.4+: Also compute absolute paths)
set(GCOVR_EXCLUDES "")
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_GCOVR_EXCLUDES})
if(CMAKE_VERSION VERSION_GREATER 3.4)
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
endif()
list(APPEND GCOVR_EXCLUDES "${EXCLUDE}")
endforeach()
list(REMOVE_DUPLICATES GCOVR_EXCLUDES)
# Combine excludes to several -e arguments
set(GCOVR_EXCLUDE_ARGS "")
foreach(EXCLUDE ${GCOVR_EXCLUDES})
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
endforeach()
# Set up commands which will be run to generate coverage data
# Run tests
set(GCOVR_XML_EXEC_TESTS_CMD
${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
)
# Running gcovr
set(GCOVR_XML_CMD
${GCOVR_PATH} --xml -r ${BASEDIR} ${GCOVR_ADDITIONAL_ARGS} ${GCOVR_EXCLUDE_ARGS}
--object-directory=${PROJECT_BINARY_DIR} -o ${Coverage_NAME}.xml
)
if(CODE_COVERAGE_VERBOSE)
message(STATUS "Executed command report")
message(STATUS "Command to run tests: ")
string(REPLACE ";" " " GCOVR_XML_EXEC_TESTS_CMD_SPACED "${GCOVR_XML_EXEC_TESTS_CMD}")
message(STATUS "${GCOVR_XML_EXEC_TESTS_CMD_SPACED}")
message(STATUS "Command to generate gcovr XML coverage data: ")
string(REPLACE ";" " " GCOVR_XML_CMD_SPACED "${GCOVR_XML_CMD}")
message(STATUS "${GCOVR_XML_CMD_SPACED}")
endif()
add_custom_target(${Coverage_NAME}
COMMAND ${GCOVR_XML_EXEC_TESTS_CMD}
COMMAND ${GCOVR_XML_CMD}
BYPRODUCTS ${Coverage_NAME}.xml
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT "Running gcovr to produce Cobertura code coverage report."
)
# Show info where to find the report
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
COMMAND ;
COMMENT "Cobertura code coverage report saved in ${Coverage_NAME}.xml."
)
endfunction() # setup_target_for_coverage_gcovr_xml
# Defines a target for running and collection code coverage information
# Builds dependencies, runs the given executable and outputs reports.
# NOTE! The executable should always have a ZERO as exit code otherwise
# the coverage generation will not complete.
#
# setup_target_for_coverage_gcovr_html(
# NAME ctest_coverage # New target name
# EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
# DEPENDENCIES executable_target # Dependencies to build first
# BASE_DIRECTORY "../" # Base directory for report
# # (defaults to PROJECT_SOURCE_DIR)
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
# # to BASE_DIRECTORY, with CMake 3.4+)
# )
# The user can set the variable GCOVR_ADDITIONAL_ARGS to supply additional flags to the
# GCVOR command.
function(setup_target_for_coverage_gcovr_html)
set(options NONE)
set(oneValueArgs BASE_DIRECTORY NAME)
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT GCOVR_PATH)
message(FATAL_ERROR "gcovr not found! Aborting...")
endif() # NOT GCOVR_PATH
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
if(DEFINED Coverage_BASE_DIRECTORY)
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
else()
set(BASEDIR ${PROJECT_SOURCE_DIR})
endif()
# Collect excludes (CMake 3.4+: Also compute absolute paths)
set(GCOVR_EXCLUDES "")
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_GCOVR_EXCLUDES})
if(CMAKE_VERSION VERSION_GREATER 3.4)
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
endif()
list(APPEND GCOVR_EXCLUDES "${EXCLUDE}")
endforeach()
list(REMOVE_DUPLICATES GCOVR_EXCLUDES)
# Combine excludes to several -e arguments
set(GCOVR_EXCLUDE_ARGS "")
foreach(EXCLUDE ${GCOVR_EXCLUDES})
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
endforeach()
# Set up commands which will be run to generate coverage data
# Run tests
set(GCOVR_HTML_EXEC_TESTS_CMD
${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
)
# Create folder
set(GCOVR_HTML_FOLDER_CMD
${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/${Coverage_NAME}
)
# Running gcovr
set(GCOVR_HTML_CMD
${GCOVR_PATH} --html --html-details -r ${BASEDIR} ${GCOVR_ADDITIONAL_ARGS}
${GCOVR_EXCLUDE_ARGS} --object-directory=${PROJECT_BINARY_DIR}
-o ${Coverage_NAME}/index.html
)
if(CODE_COVERAGE_VERBOSE)
message(STATUS "Executed command report")
message(STATUS "Command to run tests: ")
string(REPLACE ";" " " GCOVR_HTML_EXEC_TESTS_CMD_SPACED "${GCOVR_HTML_EXEC_TESTS_CMD}")
message(STATUS "${GCOVR_HTML_EXEC_TESTS_CMD_SPACED}")
message(STATUS "Command to create a folder: ")
string(REPLACE ";" " " GCOVR_HTML_FOLDER_CMD_SPACED "${GCOVR_HTML_FOLDER_CMD}")
message(STATUS "${GCOVR_HTML_FOLDER_CMD_SPACED}")
message(STATUS "Command to generate gcovr HTML coverage data: ")
string(REPLACE ";" " " GCOVR_HTML_CMD_SPACED "${GCOVR_HTML_CMD}")
message(STATUS "${GCOVR_HTML_CMD_SPACED}")
endif()
add_custom_target(${Coverage_NAME}
COMMAND ${GCOVR_HTML_EXEC_TESTS_CMD}
COMMAND ${GCOVR_HTML_FOLDER_CMD}
COMMAND ${GCOVR_HTML_CMD}
BYPRODUCTS ${PROJECT_BINARY_DIR}/${Coverage_NAME}/index.html # report directory
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT "Running gcovr to produce HTML code coverage report."
)
# Show info where to find the report
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
COMMAND ;
COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report."
)
endfunction() # setup_target_for_coverage_gcovr_html
# Defines a target for running and collection code coverage information
# Builds dependencies, runs the given executable and outputs reports.
# NOTE! The executable should always have a ZERO as exit code otherwise
# the coverage generation will not complete.
#
# setup_target_for_coverage_fastcov(
# NAME testrunner_coverage # New target name
# EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
# DEPENDENCIES testrunner # Dependencies to build first
# BASE_DIRECTORY "../" # Base directory for report
# # (defaults to PROJECT_SOURCE_DIR)
# EXCLUDE "src/dir1/" "src/dir2/" # Patterns to exclude.
# NO_DEMANGLE # Don't demangle C++ symbols
# # even if c++filt is found
# SKIP_HTML # Don't create html report
# )
function(setup_target_for_coverage_fastcov)
set(options NO_DEMANGLE SKIP_HTML)
set(oneValueArgs BASE_DIRECTORY NAME)
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES FASTCOV_ARGS GENHTML_ARGS)
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT FASTCOV_PATH)
message(FATAL_ERROR "fastcov not found! Aborting...")
endif()
if(NOT GENHTML_PATH)
message(FATAL_ERROR "genhtml not found! Aborting...")
endif()
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
if(Coverage_BASE_DIRECTORY)
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
else()
set(BASEDIR ${PROJECT_SOURCE_DIR})
endif()
# Collect excludes (Patterns, not paths, for fastcov)
set(FASTCOV_EXCLUDES "")
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_FASTCOV_EXCLUDES})
list(APPEND FASTCOV_EXCLUDES "${EXCLUDE}")
endforeach()
list(REMOVE_DUPLICATES FASTCOV_EXCLUDES)
# Conditional arguments
if(CPPFILT_PATH AND NOT ${Coverage_NO_DEMANGLE})
set(GENHTML_EXTRA_ARGS "--demangle-cpp")
endif()
# Set up commands which will be run to generate coverage data
set(FASTCOV_EXEC_TESTS_CMD ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS})
set(FASTCOV_CAPTURE_CMD ${FASTCOV_PATH} ${Coverage_FASTCOV_ARGS} --gcov ${GCOV_PATH}
--search-directory ${BASEDIR}
--process-gcno
--lcov
--output ${Coverage_NAME}.info
--exclude ${FASTCOV_EXCLUDES}
--exclude ${FASTCOV_EXCLUDES}
)
if(Coverage_SKIP_HTML)
set(FASTCOV_HTML_CMD ";")
else()
set(FASTCOV_HTML_CMD ${GENHTML_PATH} ${GENHTML_EXTRA_ARGS} ${Coverage_GENHTML_ARGS}
-o ${Coverage_NAME} ${Coverage_NAME}.info
)
endif()
if(CODE_COVERAGE_VERBOSE)
message(STATUS "Code coverage commands for target ${Coverage_NAME} (fastcov):")
message(" Running tests:")
string(REPLACE ";" " " FASTCOV_EXEC_TESTS_CMD_SPACED "${FASTCOV_EXEC_TESTS_CMD}")
message(" ${FASTCOV_EXEC_TESTS_CMD_SPACED}")
message(" Capturing fastcov counters and generating report:")
string(REPLACE ";" " " FASTCOV_CAPTURE_CMD_SPACED "${FASTCOV_CAPTURE_CMD}")
message(" ${FASTCOV_CAPTURE_CMD_SPACED}")
if(NOT Coverage_SKIP_HTML)
message(" Generating HTML report: ")
string(REPLACE ";" " " FASTCOV_HTML_CMD_SPACED "${FASTCOV_HTML_CMD}")
message(" ${FASTCOV_HTML_CMD_SPACED}")
endif()
endif()
# Setup target
add_custom_target(${Coverage_NAME}
# Cleanup fastcov
COMMAND ${FASTCOV_PATH} ${Coverage_FASTCOV_ARGS} --gcov ${GCOV_PATH}
--search-directory ${BASEDIR}
--zerocounters
COMMAND ${FASTCOV_EXEC_TESTS_CMD}
COMMAND ${FASTCOV_CAPTURE_CMD}
COMMAND ${FASTCOV_HTML_CMD}
# Set output files as GENERATED (will be removed on 'make clean')
BYPRODUCTS
${Coverage_NAME}.info
${Coverage_NAME}/index.html # report directory
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT "Resetting code coverage counters to zero. Processing code coverage counters and generating report."
)
set(INFO_MSG "fastcov code coverage info report saved in ${Coverage_NAME}.info.")
if(NOT Coverage_SKIP_HTML)
string(APPEND INFO_MSG " Open ${PROJECT_BINARY_DIR}/${Coverage_NAME}/index.html in your browser to view the coverage report.")
endif()
# Show where to find the fastcov info report
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo ${INFO_MSG}
)
endfunction() # setup_target_for_coverage_fastcov
function(append_coverage_compiler_flags)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}")
endfunction() # append_coverage_compiler_flags

View File

@ -1,141 +0,0 @@
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
function(get_git_head_revision _refspecvar _hashvar)
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
# We have reached the root directory, we are not in git
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
return()
endif()
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
endwhile()
# check if this is a submodule
if(NOT IS_DIRECTORY ${GIT_DIR})
file(READ ${GIT_DIR} submodule)
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
if (IS_ABSOLUTE ${GIT_DIR_RELATIVE})
set(GIT_DIR ${GIT_DIR_RELATIVE})
else()
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
endif()
endif()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")
endif()
if(NOT EXISTS "${GIT_DIR}/HEAD")
return()
endif()
set(HEAD_FILE "${GIT_DATA}/HEAD")
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
"${GIT_DATA}/grabRef.cmake"
@ONLY)
include("${GIT_DATA}/grabRef.cmake")
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
endfunction()
function(git_describe _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
# TODO sanitize
#if((${ARGN}" MATCHES "&&") OR
# (ARGN MATCHES "||") OR
# (ARGN MATCHES "\\;"))
# message("Please report the following error to the project!")
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
#endif()
#message(STATUS "Arguments to execute_process: ${ARGN}")
execute_process(COMMAND
${GIT_EXECUTABLE}
describe
${hash}
${ARGN}
WORKING_DIRECTORY
"${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_get_tag _var)
git_describe(out --tags ${ARGN})
set(${_var} "${out}" PARENT_SCOPE)
endfunction()

View File

@ -1,23 +0,0 @@
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View File

@ -1,72 +0,0 @@
Additional CMake Modules
========================
Introduction
------------
This is a collection of additional CMake modules.
Most of them are from Ryan Pavlik (<http://academic.cleardefinition.com>).
How to Integrate
----------------
These modules are probably best placed wholesale into a "cmake" subdirectory
of your project source.
If you use Git, try installing [git-subtree][1],
so you can easily use this repository for subtree merges, updating simply.
For the initial checkout:
cd projectdir
git subtree add --squash --prefix=cmake git@github.com:bilke/cmake-modules.git master
For updates:
cd projectdir
git subtree pull --squash --prefix=cmake git@github.com:bilke/cmake-modules.git master
For pushing to upstream:
cd projectdir
git subtree push --prefix=cmake git@github.com:bilke/cmake-modules.git master
How to Use
----------
At the minimum, all you have to do is add a line like this near the top
of your root CMakeLists.txt file (but not before your project() call):
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
Licenses
--------
The modules that are written by Ryan Pavlik are all subject to this license:
> Copyright Iowa State University 2009-2011
>
> Distributed under the Boost Software License, Version 1.0.
>
> (See accompanying file `LICENSE_1_0.txt` or copy at
> <http://www.boost.org/LICENSE_1_0.txt>)
Modules based on those included with CMake as well as modules added by me (Lars
Bilke) are under the OSI-approved **BSD** license, which is included in each of
those modules. A few other modules are modified from other sources - when in
doubt, look at the .cmake.
Important License Note!
-----------------------
If you find this file inside of another project, rather at the top-level
directory, you're in a separate project that is making use of these modules.
That separate project can (and probably does) have its own license specifics.
[1]: http://github.com/apenwarr/git-subtree "Git Subtree master"

View File

@ -1,11 +0,0 @@
[requires]
Poco/1.9.4@pocoproject/stable
libsodium/1.0.18@bincrafters/stable
boost/1.71.0@conan/stable
gtest/1.10.0
[options]
Poco:enable_pagecompiler=True
[generators]
cmake

@ -1 +0,0 @@
Subproject commit 7304f680be32915e772466ebddc5b7d3b453abd9

@ -1 +0,0 @@
Subproject commit 8aedf4733884a25434b5c17c79c7e7dee27e6eb0

@ -1 +0,0 @@
Subproject commit 159540fe8c8f30b281748fe8a1b79e8b17993a67

@ -1 +0,0 @@
Subproject commit b95393dcc3640807838e8323b4e600e54d2e8116

@ -1 +0,0 @@
Subproject commit 0b8d13a1d4cd9be16ed8a2230577aa9c296aa1ca

@ -1 +0,0 @@
Subproject commit 336789e62363357d87894983e6cbdd6da6c838ea

@ -1 +0,0 @@
Subproject commit 9929246b87f0946b124cfa2a89894b8943b0b072

View File

@ -1 +0,0 @@
html

View File

@ -1,9 +0,0 @@
#!/bin/sh
chmod +x compile_pot.sh
./compile_pot.sh
cd ../build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make -j$(nproc) Gradido_LoginServer
chmod +x ./bin/Gradido_LoginServer

View File

@ -1,3 +0,0 @@
#!/bin/sh
xgettext -D ../ -p ../src/LOCALE -o messages.pot --from-code=UTF-8 --files-from=files_to_translate.txt

View File

@ -1,10 +0,0 @@
build/http_pages/LoginPage.cpp
build/http_pages/CheckEmailPage.cpp
build/http_pages/ResetPasswordPage.cpp
build/http_pages/PassphrasePage.cpp
src/cpp/model/Session.cpp
src/cpp/model/email/Email.cpp
src/cpp/model/email/EmailCustomReply.cpp
src/cpp/model/email/EmailNotificationCreation.cpp
src/cpp/model/email/EmailNotificationTransfer.cpp
src/cpp/SingletonManager/SessionManager.cpp

View File

@ -1,20 +0,0 @@
#!/bin/sh
# generate version for mariadb connector
cd ../dependencies/mariadb-connector-c
if [ -d "./build" ] ; then
rm -rf ./build
fi
mkdir build
cd build
cmake -DWITH_SSL=OFF ..
cd ../../../
if [ ! -d "./build" ] ; then
mkdir build
fi
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make -j$(nproc) protoc PageCompiler
cmake ..

View File

@ -1,8 +0,0 @@
#!/bin/bash
cd ../build
cmake -DCMAKE_BUILD_TYPE=Debug -DCOLLECT_COVERAGE_DATA=ON -DCOVERAGE_TOOL=gcovr .. && \
make -j$(nproc) Gradido_LoginServer_Test
make coverage

View File

@ -1,19 +0,0 @@
#!/bin/sh
if [ ! -d "../src/cpp/proto" ] ; then
mkdir ../src/cpp/proto
fi
if [ ! -d "../src/cpp/proto/gradido" ] ; then
mkdir ../src/cpp/proto/gradido
fi
PROTOC_PATH=../build/bin
CPP_PLUGIN_PATH=../build/bin
$PROTOC_PATH/protoc --cpp_out=../src/cpp/proto --proto_path=../src/proto ../src/proto/gradido/*.proto
if [ ! -d "../src/cpp/proto/hedera" ] ; then
mkdir ../src/cpp/proto/hedera
fi
GOOGLE_PROTOBUF_INCLUDES=../dependencies/grpc/third_party/protobuf/src
$PROTOC_PATH/protoc --plugin=protoc-gen-grpc=$CPP_PLUGIN_PATH/grpc_cpp_plugin --cpp_out=../src/cpp/proto/hedera --grpc_out=../src/cpp/proto/hedera --proto_path=$GOOGLE_PROTOBUF_INCLUDES --proto_path=../src/proto/hedera/hedera-protobuf/src/main/proto ../src/proto/hedera/hedera-protobuf/src/main/proto/*.proto

View File

@ -1,13 +0,0 @@
#!/bin/bash
if [ ! -d "../src/cpp/proto" ] ; then
mkdir ../src/cpp/proto
fi
if [ ! -d "../src/cpp/proto/gradido" ] ; then
mkdir ../src/cpp/proto/gradido
fi
PROTOC_PATH=../build/dependencies/protobuf/cmake/bin/Debug
$PROTOC_PATH/protoc.exe --cpp_out=../build/proto/gradido --proto_path=../src/proto ../src/proto/gradido/*.proto

Binary file not shown.

View File

@ -1,514 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-09-23 17:56+0200\n"
"PO-Revision-Date: 2021-09-27 13:31+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.0\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: build/http_pages/LoginPage.cpp:196 build/http_pages/LoginPage.cpp:275
msgid "Login"
msgstr "Anmeldung"
#: build/http_pages/LoginPage.cpp:196
msgid "E-Mail or password isn't right, please try again!"
msgstr ""
"E-Mail und Passwort Kombination stimmen nicht, bitte versuche es erneut. "
#: build/http_pages/LoginPage.cpp:205
msgid "Passwort"
msgstr "Passwort"
#: build/http_pages/LoginPage.cpp:205
msgid ""
"Passwort wird noch berechnet, bitte versuche es in etwa 1 Minute erneut."
msgstr ""
#: build/http_pages/LoginPage.cpp:208 build/http_pages/LoginPage.cpp:211
msgid "User"
msgstr ""
#: build/http_pages/LoginPage.cpp:208
msgid "Error in saved data, the server admin will look at it."
msgstr ""
#: build/http_pages/LoginPage.cpp:211
msgid "Benutzer ist deaktiviert, kein Login möglich!"
msgstr ""
#: build/http_pages/LoginPage.cpp:275
msgid "Username and password are needed!"
msgstr "E-Mail und Passwort werden benötigt!"
#: build/http_pages/LoginPage.cpp:376 src/cpp/model/Session.cpp:161
#: src/cpp/model/Session.cpp:168 src/cpp/model/Session.cpp:220
#: src/cpp/model/Session.cpp:231
msgid "E-Mail"
msgstr ""
#: build/http_pages/LoginPage.cpp:381
#: src/cpp/SingletonManager/SessionManager.cpp:603
#: src/cpp/SingletonManager/SessionManager.cpp:609
#: src/cpp/SingletonManager/SessionManager.cpp:614
#: src/cpp/SingletonManager/SessionManager.cpp:619
#: src/cpp/SingletonManager/SessionManager.cpp:624
#: src/cpp/SingletonManager/SessionManager.cpp:629
msgid "Password"
msgstr "Passwort"
#: build/http_pages/LoginPage.cpp:384
msgid " Login "
msgstr "Anmeldung"
#: build/http_pages/LoginPage.cpp:391
msgid "You haven't any account yet? Please follow the link to create one."
msgstr "Du hast noch kein Gradido-Konto?"
#: build/http_pages/LoginPage.cpp:395
msgid "Create New Account"
msgstr "Neues Konto erstellen"
#: build/http_pages/LoginPage.cpp:403
msgid "Passwort vergessen"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:155
msgid "E-Mail verifizieren"
msgstr "E-Mail überprüfen"
#: build/http_pages/CheckEmailPage.cpp:165
msgid ""
"Deine E-Mail wurde erfolgreich bestätigt. Du kannst nun Gradidos versenden."
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:170
msgid "Zur Startseite"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:175
msgid "Bitte gib deinen E-Mail Verification Code ein:"
msgstr "Bitte gib deinen E-Mail Verification Code ein:"
#: build/http_pages/CheckEmailPage.cpp:178 src/cpp/model/Session.cpp:184
msgid "Email Verification Code"
msgstr "Email Verification Code"
#: build/http_pages/CheckEmailPage.cpp:185
msgid "&Uuml;berpr&uuml;fe Code"
msgstr "&Uuml;berpr&uuml;fe Code"
#: build/http_pages/CheckEmailPage.cpp:190
msgid "Du hast bisher keinen Code erhalten?"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:193
msgid "E-Mail erneut zuschicken (in Arbeit)"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:198
msgid "Funktioniert dein E-Mail Verification Code nicht?"
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:201
msgid "Schicke uns eine E-Mail und wir k&uuml;mmern uns darum: "
msgstr ""
#: build/http_pages/CheckEmailPage.cpp:208
#: build/http_pages/ResetPasswordPage.cpp:273
msgid "E-Mail an Support schicken"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:174
#: build/http_pages/ResetPasswordPage.cpp:217
msgid "Gib bitte hier deine E-Mail Adresse an:"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:183
msgid "Bestätigen"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:225
msgid "Hast du dir deine Passphrase notiert oder gemerkt?"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:234
#: build/http_pages/PassphrasePage.cpp:373
msgid "Ja"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:241
msgid "Nein"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:247
msgid "Absenden"
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:255
msgid "Dir wird eine E-Mail zugeschickt um dein Passwort zur&uuml;ckzusetzen."
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:260
msgid "Der Admin hat eine E-Mail bekommen und wird sich bei dir melden."
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:265
msgid ""
"Du hast bereits eine E-Mail bekommen. Bitte schau auch in dein Spam-"
"Verzeichnis nach. "
msgstr ""
#: build/http_pages/ResetPasswordPage.cpp:268
msgid ""
"Du hast wirklich keine E-Mail erhalten und auch schon ein paar Minuten "
"gewartet?"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:41
#: build/http_pages/PassphrasePage.cpp:111
#: build/http_pages/PassphrasePage.cpp:132 src/cpp/model/Session.cpp:465
#: src/cpp/model/Session.cpp:477 src/cpp/model/Session.cpp:491
msgid "Passphrase"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:42
#: build/http_pages/PassphrasePage.cpp:451
msgid "Neues Konto anlegen"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:43
msgid "2/3"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:111
msgid ""
"Diese Passphrase ist ung&uuml;ltig, bitte &uuml;berpr&uuml;fen oder neu "
"generieren (lassen)."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:132
msgid "intern error please try again later"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:147
msgid "3/3"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:150
#: build/http_pages/PassphrasePage.cpp:153
msgid "1/3"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:152
msgid "Neues Passwort anlegen"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:270
msgid "Passphrase abschreiben"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:287
msgid "Was ist eine Passphrase?"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:290
msgid "Deine Passphrase besteht aus den im grünen Feld angezeigten Wörtern."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:293
msgid "Sie dient deiner Sicherheit."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:296
msgid ""
"Du brauchst deine Passphrase um dein Konto wiederherzustellen, wenn du mal "
"dein Passwort vergessen haben solltest."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:300
msgid "Deine Passphrase (Groß/Kleinschreibung beachten)"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:309
#: build/http_pages/PassphrasePage.cpp:352
msgid "Was zu tun ist:"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:312
msgid ""
"Schreibe dir die obenstehende Passphrase <b>von Hand</b> auf ein Blatt "
"Papier!"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:315
msgid "Speichere sie auf keinen Fall auf deinem Rechner oder Mobilgerät!!"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:318
msgid "Bewahre sie an einem sicheren Ort auf!"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:322
#: build/http_pages/PassphrasePage.cpp:478
#: build/http_pages/PassphrasePage.cpp:487
#: build/http_pages/PassphrasePage.cpp:511
msgid "Weiter"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:355
msgid "Hast du dir deine Passphrase gemerkt?"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:358
msgid ""
"Dann zeig es mir. Zur Unterstützung gebe ich dir deine Wörter aber in "
"anderer Reihenfolge."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:361
msgid "Klicke sie an um sie einzusetzen."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:364
msgid "Überprüfe dabei, ob du alle Wörter richtig geschrieben hast!"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:370
msgid ""
"Weil du kein Javascript verwendest geht es direkt weiter. Hast du dir deine "
"Passphrase gemerkt oder aufgeschrieben?"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:429
msgid "Deine E-Mail Adresse wurde erfolgreich bestätigt."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:437
msgid "Neue Gradido Adresse anlegen / wiederherstellen"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:440
msgid ""
"Möchtest du ein neues Gradido-Konto anlegen oder ein bestehendes "
"wiederherstellen?"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:460
msgid "Bestehendes Konto wiederherstellen"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:469
msgid ""
"Falls du ein bestehendes Konto wiederherstellen willst, gib hier deine "
"Passphrase ein:"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:497
msgid "Konto wiederherstellen / Neues Passwort anlegen"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:501
msgid ""
"Um dein Konto wiederherzustellen und dir ein Neues Passwort auswählen zu "
"können, tippe hier bitte die Wörter deiner Passphrase in der richtigen "
"Reihenfolge ein, welche du dir aufgeschrieben hast."
msgstr ""
#: build/http_pages/PassphrasePage.cpp:524
msgid "Fehler"
msgstr ""
#: build/http_pages/PassphrasePage.cpp:527
msgid ""
"Ungültige Seite, wenn du das siehst stimmt hier etwas nicht. Bitte wende "
"dich an den Server-Admin."
msgstr ""
#: src/cpp/model/Session.cpp:147 src/cpp/model/Session.cpp:177
#: src/cpp/model/Session.cpp:645 src/cpp/model/Session.cpp:651
#: src/cpp/model/Session.cpp:937 src/cpp/model/Session.cpp:953
msgid "Benutzer"
msgstr ""
#: src/cpp/model/Session.cpp:147
msgid "Eingeloggter Benutzer ist kein Admin"
msgstr ""
#: src/cpp/model/Session.cpp:153 src/cpp/model/Session.cpp:212
msgid "Vorname"
msgstr ""
#: src/cpp/model/Session.cpp:153 src/cpp/model/Session.cpp:157
#: src/cpp/model/Session.cpp:212 src/cpp/model/Session.cpp:216
msgid ""
"Bitte gebe einen Namen an. Mindestens 3 Zeichen, keines folgender Zeichen "
"<>&;"
msgstr ""
#: src/cpp/model/Session.cpp:157 src/cpp/model/Session.cpp:216
msgid "Nachname"
msgstr ""
#: src/cpp/model/Session.cpp:161 src/cpp/model/Session.cpp:220
msgid "Bitte gebe eine g&uuml;ltige E-Mail Adresse an."
msgstr ""
#: src/cpp/model/Session.cpp:168
msgid "F&uuml;r diese E-Mail Adresse gibt es bereits einen Account"
msgstr ""
#: src/cpp/model/Session.cpp:177 src/cpp/model/Session.cpp:184
msgid "Fehler beim speichern!"
msgstr ""
#: src/cpp/model/Session.cpp:231
msgid "F&uuml;r diese E-Mail Adresse gibt es bereits ein Konto"
msgstr ""
#: src/cpp/model/Session.cpp:255
msgid "Server"
msgstr ""
#: src/cpp/model/Session.cpp:255
msgid "Fehler beim speichen des Kontos bitte versuche es später noch einmal"
msgstr ""
#: src/cpp/model/Session.cpp:350 src/cpp/model/Session.cpp:390
#: src/cpp/model/Session.cpp:832 src/cpp/model/Session.cpp:841
msgid "E-Mail Verification"
msgstr "E-Mail Überprüfung"
#: src/cpp/model/Session.cpp:350
msgid "Du hast dein Konto bereits aktiviert!"
msgstr ""
#: src/cpp/model/Session.cpp:390
msgid "Falscher Code f&uuml;r aktiven Login"
msgstr ""
#: src/cpp/model/Session.cpp:465
msgid "Deine Passphrase ist ung&uuml;tig"
msgstr ""
#: src/cpp/model/Session.cpp:477
msgid "Ein Fehler trat auf, bitte versuche es erneut"
msgstr ""
#: src/cpp/model/Session.cpp:491
msgid "Das ist nicht die richtige Passphrase."
msgstr ""
#: src/cpp/model/Session.cpp:645
msgid "Konnte Community Server nicht erreichen. E-Mail an den Admin ist raus."
msgstr ""
#: src/cpp/model/Session.cpp:651
msgid ""
"Fehler beim L&ouml;schen des Accounts. Bitte logge dich erneut ein und "
"versuche es nochmal."
msgstr ""
#: src/cpp/model/Session.cpp:832
msgid "Konnte kein passendes Konto finden."
msgstr ""
#: src/cpp/model/Session.cpp:841
msgid "Fehler beim laden des Benutzers."
msgstr ""
#: src/cpp/model/Session.cpp:937
msgid "Kein g&uuml;ltiger Benutzer, bitte logge dich erneut ein."
msgstr ""
#: src/cpp/model/Session.cpp:953
msgid "Fehler beim generieren der Passphrase, der Admin bekommt eine E-Mail. "
msgstr ""
#: src/cpp/model/email/Email.cpp:174
msgid "Default Email Subject"
msgstr ""
#: src/cpp/model/email/Email.cpp:180
msgid "Error from Gradido Login Server"
msgstr "Fehler auf dem Gradido Login Server"
#: src/cpp/model/email/Email.cpp:200
msgid "Gradido: E-Mail Verification"
msgstr "Gradido: E-Mail Überprüfung"
#: src/cpp/model/email/Email.cpp:246
msgid "Gradido: Reset Password"
msgstr "Gradido: Passwort zurücksetzen"
#: src/cpp/SingletonManager/SessionManager.cpp:604
msgid ""
"Please enter a valid password with at least 8 characters, upper and lower "
"case letters, at least one number and one special character!"
msgstr ""
"Bitte gebe ein gültiges Password ein mit mindestens 8 Zeichen, Groß- und "
"Kleinbuchstaben, mindestens einer Zahl und einem Sonderzeichen!"
#: src/cpp/SingletonManager/SessionManager.cpp:610
msgid "Your password is to short!"
msgstr "Dein Passwort ist zu kurz!"
#: src/cpp/SingletonManager/SessionManager.cpp:615
msgid "Your password does not contain lowercase letters!"
msgstr "Dein Passwort enthält keine Kleinbuchstaben!"
#: src/cpp/SingletonManager/SessionManager.cpp:620
msgid "Your password does not contain any capital letters!"
msgstr " Dein Passwort enthält keine Großbuchstaben!"
#: src/cpp/SingletonManager/SessionManager.cpp:625
msgid "Your password does not contain any number!"
msgstr "Dein Passwort enthält keine Zahlen!"
#: src/cpp/SingletonManager/SessionManager.cpp:630
msgid "Your password does not contain special characters!"
msgstr "Dein Passwort enthält keine Sonderzeichen!"
#~ msgid "Account"
#~ msgstr "Konto"
#~ msgid "E-Mail Address not checked, do you already get one?"
#~ msgstr ""
#~ "E-Mail Adresse wurde noch nicht überprüft. Hast du schon in deine E-Mails "
#~ "geschaut? Bitte schau auch in dein Spam-Verzeichnis nach."
#~ msgid ""
#~ "Schreibe dir deine Passphrase auf und packe sie gut weg. Du brauchst sie "
#~ "um deine Adresse wiederherzustellen. Wenn du sie verlierst, sind auch "
#~ "deine Gradidos verloren."
#~ msgstr ""
#~ "Schreibe dir deine Passphrase auf oder drucke sie aus und bewahre sie "
#~ "<b>in Papier-Form</b> an einem sicheren Ort auf (speichere sie nicht auf "
#~ "deinem Rechner oder Mobilgerät)! Du brauchst deine Passphrase um dein "
#~ "Konto wiederherzustellen, wenn du mal dein Passort vergessen haben "
#~ "solltest. "
#~ msgid ""
#~ "Der neue Gradido basiert technisch auf einer Kryptowährung (wie z.B. "
#~ "Bitcoin) um maximale Sicherheit zu erreichen."
#~ msgstr ""
#~ "Der neue Gradido basiert technisch auf einer Kryptowährung (wie z.B. "
#~ "Bitcoin) um für dich die maximale Sicherheit zu gewährleisten."
#~ msgid ""
#~ "Der Code stimmt nicht, bitte &uuml;berpr&uuml;fe ihn nochmal oder "
#~ "registriere dich erneut oder wende dich an den Server-Admin"
#~ msgstr ""
#~ "Der Code stimmt nicht, bitte &uuml;berpr&uuml;fe ihn nochmal oder "
#~ "schreibe mir eine E-Mail an: coin@gradido.net."

Binary file not shown.

View File

@ -1,428 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-28 10:50+0200\n"
"PO-Revision-Date: 2020-05-28 10:53+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: en_GB\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.3.1\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:85
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:124
msgid "Login"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:85
msgid "E-Mail or password isn't right, please try again!"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:88
msgid "Passwort"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:88
msgid ""
"Passwort wird noch berechnet, bitte versuche es in etwa 1 Minute erneut."
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:91
msgid "Account"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:91
msgid "E-Mail Address not checked, do you already get one?"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:124
msgid "Username and password are needed!"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:175
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:50
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:54
#: model/Session.cpp:163 model/Session.cpp:170 model/Session.cpp:209
#: model/Session.cpp:234
msgid "E-Mail"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:178
msgid "Password"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:180
msgid " Login "
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:182
msgid "You haven't any account yet? Please follow the link to create one."
msgstr "Don't have an Gradido-account yet?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:183
msgid "Create New Account"
msgstr "Sign Up"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\login.cpsp:186
msgid "Passwort vergessen"
msgstr "Reset Password"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:97
msgid "Bitte gebe deinen E-Mail Verification Code ein:"
msgstr "Please enter your E-Mail Verification Code:"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:98
#: model/Session.cpp:186
msgid "Email Verification Code"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:100
msgid "&Uuml;berpr&uuml;fe Code"
msgstr "Check Code"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:104
msgid "Du hast bisher keinen Code erhalten?"
msgstr "You didn't get a code yet?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:105
msgid "E-Mail erneut zuschicken (in Arbeit)"
msgstr "Re-Send E-Mail (work in progress)"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:108
msgid "Funktioniert dein E-Mail Verification Code nicht?"
msgstr "Your E-Mail Verfication Code doesn't work?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:109
msgid "Schicke uns eine E-Mail und wir k&uuml;mmern uns darum: "
msgstr "Send us a E-Mail and we take care of it:"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\checkEmail.cpsp:110
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:133
msgid "E-Mail an Support schicken"
msgstr "Send E-Mail to support"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:50
msgid "E-Mail Adresse konnte nicht gefunden werden oder ist nicht aktiviert."
msgstr "E-Mail not found or not activated."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:54
msgid "E-Mail Adresse nicht angegeben."
msgstr "Please give your E-Mail Address."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:59
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:74
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:26
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:94
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:114
#: model/Session.cpp:495 model/Session.cpp:507 model/Session.cpp:515
msgid "Passphrase"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:59
msgid "Bitte w&auml;hle eine Option aus."
msgstr "Please choose one Option."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:74
msgid "Ung&uuml;ltige Option"
msgstr "Invalid option"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:107
msgid "Gebe bitte hier deine E-Mail Adresse an:"
msgstr "Please enter a valid email."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:109
msgid "Hast du dir deine Passphrase notiert oder gemerkt?"
msgstr "Do you memorized your passphrase?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:113
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:196
msgid "Ja"
msgstr "Yes"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:118
msgid "Nein"
msgstr "No"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:123
msgid "Absenden"
msgstr "Send"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:127
msgid "Dir wird eine E-Mail zugeschickt um dein Passwort zur&uuml;ckzusetzen."
msgstr "You get an E-Mail to reset your password."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:129
msgid "Der Admin hat eine E-Mail bekommen und wird sich bei dir melden."
msgstr "The Admin get an E-Mail, wait on his replay."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:131
msgid ""
"Du hast bereits eine E-Mail bekommen. Bitte schau auch in dein Spam-"
"Verzeichnis nach. "
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\resetPassword.cpsp:132
msgid ""
"Du hast wirklich keine E-Mail erhalten und auch schon ein paar Minuten "
"gewartet?"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:27
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:256
msgid "Neues Konto anlegen"
msgstr "Create new Account"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:28
msgid "2/3"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:94
msgid ""
"Diese Passphrase ist ung&uuml;ltig, bitte &uuml;berpr&uuml;fen oder neu "
"generieren (lassen)."
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:114
msgid "intern error please try again later"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:129
msgid "3/3"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:132
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:135
msgid "1/3"
msgstr ""
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:134
msgid "Neues Passwort anlegen"
msgstr "Create new Password"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:153
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:188
msgid "Was zu tun ist:"
msgstr "What to do:"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:154
msgid ""
"Schreibe dir deine Passphrase auf und packe sie gut weg. Du brauchst sie um "
"deine Adresse wiederherzustellen. Wenn du sie verlierst, sind auch deine "
"Gradidos verloren."
msgstr ""
"Write down your passphrase and put it away well. You need it to restore your "
"address. If you lose them, your Gradidos are lost too."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:157
msgid "Deine Passphrase (Groß/Kleinschreibung beachten)"
msgstr "Your Passphrase"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:161
msgid "Was ist eine Passphrase?"
msgstr "What is a passphrase?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:162
msgid ""
"Die Passphrase kommt aus dem Crypto-Bereich und ist ein Weg einen "
"komplizierte kryptografischen Schlüssel in einer lesbaren Form darzustellen."
msgstr ""
"The passphrase comes from the crypto area and is a way to represent a "
"complicated cryptographic key in a legible form."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:163
msgid ""
"Der neue Gradido basiert technisch auf einer Kryptowährung (wie z.B. "
"Bitcoin) um maximale Sicherheit zu erreichen."
msgstr ""
"The new Gradido is technically based on a cryptocurrency (such as Bitcoin) "
"to achieve maximum security for you."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:165
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:275
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:280
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:293
msgid "Weiter"
msgstr "Next"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:189
msgid "Hast du dir deine Passphrase gemerkt?"
msgstr "Do you memorized your passphrase?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:190
msgid ""
"Dann zeig es mir. Zur Unterstützung gebe ich dir deine Wörter aber in "
"anderer Reihenfolge."
msgstr ""
"Then show me. I will give you your words in a different order as support."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:191
msgid "Klicke sie an um sie einzusetzen."
msgstr "Click on it to use it."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:195
msgid ""
"Weil du kein Javascript verwendest geht es direkt weiter. Hast du dir deine "
"Passphrase gemerkt oder aufgeschrieben?"
msgstr ""
"Because you don't use javascript it goes straight on. Did you remember or "
"write down your passphrase?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:242
msgid "Deine E-Mail Adresse wurde erfolgreich bestätigt."
msgstr "Your email address has been successfully confirmed."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:246
msgid "Neue Gradido Adresse anlegen / wiederherstellen"
msgstr "Create / restore new Gradido address"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:247
msgid ""
"Möchtest du ein neues Gradido-Konto anlegen oder ein bestehendes "
"wiederherstellen?"
msgstr ""
"Do you want to restore an existing Gradido account or create a new one?"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:263
msgid "Bestehendes Konto wiederherstellen"
msgstr "Restore existing Account"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:270
msgid ""
"Falls du ein bestehendes Konto wiederherstellen willst, gib hier deine "
"Passphrase ein:"
msgstr ""
"If you want to restore an existing account, enter your passphrase here:"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:288
msgid "Konto wiederherstellen / Neues Passwort anlegen"
msgstr "Restore account / create new password"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:289
msgid ""
"Um dein Konto wiederherzustellen, dir ein Neues Passwort auswählen zu "
"können, tippe hier bitte die Wörter deiner Passphrase in der richtigen "
"Reihenfolge ein, welche du dir aufgeschrieben hast."
msgstr ""
"To restore your account and to be able to choose a new password, please type "
"in the words of your passphrase in the correct order, which you have written "
"down."
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:303
msgid "Fehler"
msgstr "Erro"
#: F:\\Gradido\\gradido_login_server\\src\\cpsp\\passphrase.cpsp:304
msgid ""
"Ungültige Seite, wenn du das siehst stimmt hier etwas nicht. Bitte wende "
"dich an den Server-Admin."
msgstr ""
"Invalid page, if you see that something is wrong here. Please contact the "
"server admin."
#: model/Session.cpp:149 model/Session.cpp:180 model/Session.cpp:700
#: model/Session.cpp:706 model/Session.cpp:1005
msgid "Benutzer"
msgstr "User"
#: model/Session.cpp:149
msgid "Eingeloggter Benutzer ist kein Admin"
msgstr "Logged in user is not admin"
#: model/Session.cpp:155 model/Session.cpp:201
msgid "Vorname"
msgstr "Firstname"
#: model/Session.cpp:155 model/Session.cpp:159 model/Session.cpp:201
#: model/Session.cpp:205
msgid ""
"Bitte gebe einen Namen an. Mindestens 3 Zeichen, keines folgender Zeichen "
"<>&;"
msgstr "Please enter your Name. At least 3 Character, without <>& and ;"
#: model/Session.cpp:159 model/Session.cpp:205
msgid "Nachname"
msgstr "Lastname"
#: model/Session.cpp:163 model/Session.cpp:209
msgid "Bitte gebe eine g&uuml;ltige E-Mail Adresse an."
msgstr "Please enter a valid email."
#: model/Session.cpp:170 model/Session.cpp:234
msgid "F&uuml;r diese E-Mail Adresse gibt es bereits einen Account"
msgstr "This email has an account already."
#: model/Session.cpp:180 model/Session.cpp:186
msgid "Fehler beim speichern!"
msgstr "Error while saving!"
#: model/Session.cpp:379 model/Session.cpp:438 model/Session.cpp:881
#: model/Session.cpp:889
msgid "E-Mail Verification"
msgstr ""
#: model/Session.cpp:379
msgid "Du hast dein Konto bereits aktiviert!"
msgstr "You already activated your account!"
#: model/Session.cpp:438
msgid "Falscher Code f&uuml;r aktiven Login"
msgstr "Wrong Code for active Login."
#: model/Session.cpp:495
msgid "Deine Passphrase ist ung&uuml;tig"
msgstr "Your passphrase is invalid"
#: model/Session.cpp:507
msgid "Ein Fehler trat auf, bitte versuche es erneut"
msgstr "An error occurred, please try again"
#: model/Session.cpp:515
msgid "Das ist nicht die richtige Passphrase."
msgstr "This is not the correct passphrase."
#: model/Session.cpp:700
msgid "Konnte Community Server nicht erreichen. E-Mail an den Admin ist raus."
msgstr "Couldn't connect to the community server, send E-Mail to admin."
#: model/Session.cpp:706
msgid ""
"Fehler beim L&ouml;schen des Accounts. Bitte logge dich erneut ein und "
"versuche es nochmal."
msgstr "Error by deleting the account. Please re-login and try again."
#: model/Session.cpp:881
msgid "Konnte kein passendes Konto finden."
msgstr "This Account didn't seem to exist."
#: model/Session.cpp:889
msgid "Fehler beim laden des Benutzers."
msgstr ""
#: model/Session.cpp:1005
msgid "Kein g&uuml;ltiger Benutzer, bitte logge dich erneut ein."
msgstr "Invalid User, please re-login."
#~ msgid "*Das Konto muss nach dem 01.09.2019 angelegt worden sein."
#~ msgstr "* The account must have been created after September 1st, 2019."
#~ msgid "Nein, bitte ein neues erstellen!"
#~ msgstr "No, please create a new one!"
#~ msgid "Deine Passphrase"
#~ msgstr "Your passphrase"
#~ msgid ""
#~ "Der Code stimmt nicht, bitte &uuml;berpr&uuml;fe ihn nochmal oder "
#~ "registriere dich erneut oder wende dich an den Server-Admin"
#~ msgstr ""
#~ "The email verification code isn't correct. Please check at spell errors "
#~ "and try again or ask the server admin."

View File

@ -1,286 +0,0 @@
#include "DRRandom.h"
#include "Obfus_array.h"
/* This program by D E Knuth is in the public domain and freely copyable.
* It is explained in Seminumerical Algorithms, 3rd edition, Section 3.6
* (or in the errata to the 2nd edition --- see
* http://www-cs-faculty.stanford.edu/~knuth/taocp.html
* in the changes to Volume 2 on pages 171 and following). */
/* N.B. The MODIFICATIONS introduced in the 9th printing (2002) are
included here; there's no backwards compatibility with the original. */
/* This version also adopts Brendan McKay's suggestion to
accommodate naive users who forget to call ran_start(seed). */
/* If you find any bugs, please report them immediately to
* taocp@cs.stanford.edu
* (and you will be rewarded if the bug is genuine). Thanks! */
/************ see the book for explanations and caveats! *******************/
/************ in particular, you need two's complement arithmetic **********/
// Random-Array
#define KK 100 /* the long lag */
#define LL 37 /* the short lag */
#define MM (1L<<30) /* the modulus */
#define mod_diff(x,y) (((x)-(y))&(MM-1)) /* subtraction mod MM */
#define mod_sum(x,y) (((x)+(y))-(int)((x)+(y))) /* (x+y) mod 1.0 */
#ifndef __STDC__
#define __STDC__
#endif
long ran_x[KK]; /* the generator state */
double ran_u[KK]; /* the generator state */
#ifdef __STDC__
void ran_array(long aa[],int n)
#else
void ran_array(aa,n) /* put n new random numbers in aa */
long *aa; /* destination */
int n; /* array length (must be at least KK) */
#endif
{
register int i,j;
DISASM_MISALIGN;
for (j=0;j<KK;j++) aa[j]=ran_x[j];
for (;j<n;j++) aa[j]=mod_diff(aa[j-KK],aa[j-LL]);
for (i=0;i<LL;i++,j++) ran_x[i]=mod_diff(aa[j-KK],aa[j-LL]);
for (;i<KK;i++,j++) ran_x[i]=mod_diff(aa[j-KK],ran_x[i-LL]);
}
/* the following routines are from exercise 3.6--15 */
/* after calling ran_start, get new randoms by, e.g., "x=ran_arr_next()" */
#define QUALITY 1009 /* recommended quality level for high-res use */
long ran_arr_buf[QUALITY];
long ran_arr_dummy=-1, ran_arr_started=-1;
long *ran_arr_ptr=&ran_arr_dummy; /* the next random number, or -1 */
#define TT 70 /* guaranteed separation between streams */
#define is_odd(x) ((x)&1) /* units bit of x */
#ifdef __STDC__
void ran_start(long seed)
#else
void ran_start(seed) /* do this before using ran_array */
long seed; /* selector for different streams */
#endif
{
register int t,j;
long x[KK+KK-1]; /* the preparation buffer */
register long ss=(seed+2)&(MM-2);
for (j=0;j<KK;j++) {
x[j]=ss; /* bootstrap the buffer */
ss<<=1; if (ss>=MM) ss-=MM-2; /* cyclic shift 29 bits */
}
x[1]++; /* make x[1] (and only x[1]) odd */
for (ss=seed&(MM-1),t=TT-1; t; ) {
for (j=KK-1;j>0;j--) x[j+j]=x[j], x[j+j-1]=0; /* "square" */
for (j=KK+KK-2;j>=KK;j--)
x[j-(KK-LL)]=mod_diff(x[j-(KK-LL)],x[j]),
x[j-KK]=mod_diff(x[j-KK],x[j]);
if (is_odd(ss)) { /* "multiply by z" */
for (j=KK;j>0;j--) x[j]=x[j-1];
x[0]=x[KK]; /* shift the buffer cyclically */
x[LL]=mod_diff(x[LL],x[KK]);
}
if (ss) ss>>=1; else t--;
}
DISASM_MISALIGN;
for (j=0;j<LL;j++) ran_x[j+KK-LL]=x[j];
for (;j<KK;j++) ran_x[j-LL]=x[j];
for (j=0;j<10;j++) ran_array(x,KK+KK-1); /* warm things up */
ran_arr_ptr=&ran_arr_started;
}
#define ran_arr_next() (*ran_arr_ptr>=0? *ran_arr_ptr++: ran_arr_cycle())
long ran_arr_cycle()
{
if (ran_arr_ptr==&ran_arr_dummy)
ran_start(314159L); /* the user forgot to initialize */
ran_array(ran_arr_buf,QUALITY);
ran_arr_buf[KK]=-1;
ran_arr_ptr=ran_arr_buf+1;
return ran_arr_buf[0];
}
// **************************************************************************************************************
// **************************************************************************************************************
// Random-Float Array
#ifdef __STDC__
void ranf_array(double aa[], int n)
#else
void ranf_array(aa,n) /* put n new random fractions in aa */
double *aa; /* destination */
int n; /* array length (must be at least KK) */
#endif
{
register int i,j;
DISASM_MISALIGN;
for (j=0;j<KK;j++) aa[j]=ran_u[j];
for (;j<n;j++) aa[j]=mod_sum(aa[j-KK],aa[j-LL]);
for (i=0;i<LL;i++,j++) ran_u[i]=mod_sum(aa[j-KK],aa[j-LL]);
for (;i<KK;i++,j++) ran_u[i]=mod_sum(aa[j-KK],ran_u[i-LL]);
}
/* the following routines are adapted from exercise 3.6--15 */
/* after calling ranf_start, get new randoms by, e.g., "x=ranf_arr_next()" */
//#define QUALITY 1009 /* recommended quality level for high-res use */
double ranf_arr_buf[QUALITY];
double ranf_arr_dummy=-1.0, ranf_arr_started=-1.0;
double *ranf_arr_ptr=&ranf_arr_dummy; /* the next random fraction, or -1 */
//#define TT 70 /* guaranteed separation between streams */
//#define is_odd(s) ((s)&1)
#ifdef __STDC__
void ranf_start(long seed)
#else
void ranf_start(seed) /* do this before using ranf_array */
long seed; /* selector for different streams */
#endif
{
register int t,s,j;
double u[KK+KK-1];
double ulp=(1.0/(1L<<30))/(1L<<22); /* 2 to the -52 */
double ss=2.0*ulp*((seed&0x3fffffff)+2);
for (j=0;j<KK;j++) {
u[j]=ss; /* bootstrap the buffer */
ss+=ss; if (ss>=1.0) ss-=1.0-2*ulp; /* cyclic shift of 51 bits */
}
u[1]+=ulp; /* make u[1] (and only u[1]) "odd" */
for (s=seed&0x3fffffff,t=TT-1; t; ) {
for (j=KK-1;j>0;j--)
u[j+j]=u[j],u[j+j-1]=0.0; /* "square" */
for (j=KK+KK-2;j>=KK;j--) {
u[j-(KK-LL)]=mod_sum(u[j-(KK-LL)],u[j]);
u[j-KK]=mod_sum(u[j-KK],u[j]);
}
if (is_odd(s)) { /* "multiply by z" */
for (j=KK;j>0;j--) u[j]=u[j-1];
u[0]=u[KK]; /* shift the buffer cyclically */
u[LL]=mod_sum(u[LL],u[KK]);
}
if (s) s>>=1; else t--;
}
for (j=0;j<LL;j++) ran_u[j+KK-LL]=u[j];
for (;j<KK;j++) ran_u[j-LL]=u[j];
for (j=0;j<10;j++) ranf_array(u,KK+KK-1); /* warm things up */
ranf_arr_ptr=&ranf_arr_started;
}
#define ranf_arr_next() (*ranf_arr_ptr>=0? *ranf_arr_ptr++: ranf_arr_cycle())
double ranf_arr_cycle()
{
if (ranf_arr_ptr==&ranf_arr_dummy)
ranf_start(314159L); /* the user forgot to initialize */
ranf_array(ranf_arr_buf,QUALITY);
ranf_arr_buf[KK]=-1;
ranf_arr_ptr=ranf_arr_buf+1;
return ranf_arr_buf[0];
}
// **************************************************************************************************************
// **************************************************************************************************************
#ifndef u32
typedef Poco::UInt32 u32;
typedef Poco::UInt32 uint;
#endif
// XORshift Quelle: http://de.wikipedia.org/wiki/Xorshift
u32 xorshift_x = 123456789;
u32 xorshift_y = 362436069;
u32 xorshift_z = 521288629;
u32 xorshift_w = 88675123;
u32 xorshift()
{
/* 32 Bit periodenlänge
xorshiftSeed ^= xorshiftSeed << 13;
xorshiftSeed ^= xorshiftSeed >> 17;
xorshiftSeed ^= xorshiftSeed << 5;
return xorshiftSeed;
* */
u32 t = xorshift_x ^ (xorshift_x << 11);
xorshift_x = xorshift_y; xorshift_y = xorshift_z; xorshift_z = xorshift_w;
xorshift_w ^= (xorshift_w >> 19) ^ t ^ (t >> 8);
return xorshift_w;
}
void xorshift_seed(u32 seed)
{
xorshift_x = seed;
xorshift();
}
// **************************************************************************************************************
// **************************************************************************************************************
// static vars
long random_buffer[KK];
uint rand_buffer_cursor = KK;
double randomf_buffer[KK];
uint randf_buffer_cursor = KK;
//***************************************************************************************************************
void DRRandom::seed(long seed)
{
//DRLog.writeToLog("[DRRandom::seed] seed reinit: %d\n", seed);
ran_start(seed);
xorshift_seed(seed);
DISASM_FALSERET;
rand_buffer_cursor = KK;
seedf(seed);
}
void DRRandom::seedf(long seed)
{
ranf_start(seed);
randf_buffer_cursor = KK;
}
long DRRandom::core2_rand()
{
// return xorshift();
if(rand_buffer_cursor >= KK)
{
rand_buffer_cursor = 0;
ran_array(random_buffer, KK);
}
NULLPAD_10;
return random_buffer[rand_buffer_cursor++];
}
double DRRandom::core2_randf()
{
if(randf_buffer_cursor >= KK)
{
randf_buffer_cursor = 0;
ranf_array(randomf_buffer, KK);
}
return randomf_buffer[randf_buffer_cursor++];
}
Poco::Int64 DRRandom::r64()
{
Poco::Int64 r1 = core2_rand();
Poco::Int64 r2 = core2_rand();///*0x00000000ffffffff &*/ (core2_rand() << 8);
//u64 r12 = r1 | (r2 << 8);
//printf("r1: %lld, %llx, r2: %lld, %llx, r1|2: %lld, %llx\n", r1, r1, r2, r2, r12, r12);
DISASM_FALSERET;
return r1 | (r2 << 8);
}
double DRRandom::rDouble(double max, double min)
{
double value = core2_randf();
//printf("rDouble: %f\n", value);
return min + (max - min) * value;
}
int DRRandom::rInt(int max, int min)
{
return min + (core2_rand() % (max-min+1));
}

View File

@ -1,58 +0,0 @@
/*/*************************************************************************
* *
* Core, Core-Lib for my programs, Core doesn't need any libraries *
* Copyright (C) 2012, 2013, 2014 Dario Rekowski *
* Email: ***REMOVED*** Web: ***REMOVED*** *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* any later version. *
* *
* 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/>. *
* *
***************************************************************************/
/*
* File: DRRandom.h
* Author: dario
*
* Created on 25. August 2011, 13:28
*/
#ifndef __DR_CORE2_RANDOM__
#define __DR_CORE2_RANDOM__
#include "Poco/Types.h"
class DRRandom
{
public:
DRRandom() {}
static long core2_rand();
static double core2_randf();
static Poco::Int64 r64();
static double rDouble(double max, double min);
static float rReal(float fMax, float fMin)
{
return static_cast<float>(rDouble(fMax, fMin));
}
static int rInt(int max, int min);
static void seed(long seed);
static void seedf(long seed);
private:
};
#endif /* __DR_CORE2_RANDOM__ */

View File

@ -1,25 +0,0 @@
#ifndef __GRADIDO_LOGIN_SERVER_CRYPTO_I_KEY_PAIR_H
#define __GRADIDO_LOGIN_SERVER_CRYPTO_I_KEY_PAIR_H
/*!
*
* \author: Dario Rekowski
*
* \date: 2020-06-04
*
* \brief: Interface for Key Pair classes, generate key pair from passphrase
*
*/
#include "../SingletonManager/MemoryManager.h"
class IKeyPair
{
public:
//! \return caller take ownership of return value
virtual MemoryBin* sign(const MemoryBin* message) const = 0 ;
};
#endif //__GRADIDO_LOGIN_SERVER_CRYPTO_I_KEY_PAIR_H

View File

@ -1,176 +0,0 @@
#include "KeyPairEd25519.h"
#include <assert.h>
#include "../SingletonManager/ErrorManager.h"
#include "../lib/DataTypeConverter.h"
KeyPairEd25519::KeyPairEd25519(MemoryBin* privateKey)
: mSodiumSecret(privateKey)
{
//memcpy(mSodiumPublic, publicKey, crypto_sign_PUBLICKEYBYTES);
// read pubkey from private key, so we are sure it is the correct pubkey for the private key
crypto_sign_ed25519_sk_to_pk(mSodiumPublic, *privateKey);
}
KeyPairEd25519::KeyPairEd25519(const unsigned char* publicKey)
: mSodiumSecret(nullptr)
{
memcpy(mSodiumPublic, publicKey, crypto_sign_PUBLICKEYBYTES);
}
KeyPairEd25519::KeyPairEd25519()
: mSodiumSecret(nullptr)
{
memset(mSodiumPublic, 0, crypto_sign_PUBLICKEYBYTES);
}
KeyPairEd25519::~KeyPairEd25519()
{
if (mSodiumSecret) {
MemoryManager::getInstance()->releaseMemory(mSodiumSecret);
mSodiumSecret = nullptr;
}
}
KeyPairEd25519* KeyPairEd25519::create(const Poco::AutoPtr<Passphrase> passphrase)
{
//auto er = ErrorManager::getInstance();
auto mm = MemoryManager::getInstance();
assert(!passphrase.isNull());
// libsodium doc: https://libsodium.gitbook.io/doc/advanced/hmac-sha2
// https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
auto word_indices = passphrase->getWordIndices();
if (!word_indices || (!word_indices[0] && !word_indices[1] && !word_indices[2] && !word_indices[3])) {
return nullptr;
}
std::string clear_passphrase = passphrase->createClearPassphrase();
unsigned char hash[crypto_hash_sha512_BYTES];
crypto_hash_sha512_state state;
crypto_hash_sha512_init(&state);
// **** convert word indices into uint64 ****
// To prevent breaking existing passphrase-hash combinations word indices will be put into 64 Bit Variable to mimic first implementation of algorithms
auto valueSize = sizeof(Poco::UInt64);
Poco::UInt64 value = 0;
for (int i = 0; i < PHRASE_WORD_COUNT; i++) {
value = word_indices[i];
crypto_hash_sha512_update(&state, (const unsigned char*)&value, valueSize);
}
// **** end converting into uint64 *****
crypto_hash_sha512_update(&state, (unsigned char*)clear_passphrase.data(), clear_passphrase.size());
crypto_hash_sha512_final(&state, hash);
/*
// debug passphrase
printf("\passsphrase: <%s>\n", passphrase);
printf("size word indices: %u\n", word_indices->size());
std::string word_indicesHex = getHex(*word_indices, word_indices->size());
printf("word_indices: \n%s\n", word_indicesHex.data());
printf("word_indices: \n");
Poco::UInt64* word_indices_p = (Poco::UInt64*)(word_indices->data());
for (int i = 0; i < PHRASE_WORD_COUNT; i++) {
if (i > 0) printf(" ");
printf("%4hu", word_indices_p[i]);
}
printf("\n");
printf("\nclear passphrase: \n%s\n", clearPassphrase.data());
std::string hex_clearPassphrase = getHex((const unsigned char*)clearPassphrase.data(), clearPassphrase.size());
printf("passphrase bin: \n%s\n\n", hex_clearPassphrase.data());
//*/
KeyPairEd25519* key_pair = new KeyPairEd25519;
if (!key_pair->mSodiumSecret) {
key_pair->mSodiumSecret = mm->getFreeMemory(crypto_sign_SECRETKEYBYTES);
}
crypto_sign_seed_keypair(key_pair->mSodiumPublic, *key_pair->mSodiumSecret, hash);
return key_pair;
// print hex for all keys for debugging
/* printf("// ********** Keys ************* //\n");
printf("Sodium Public: \t%s\n", getHex(mSodiumPublic, crypto_sign_PUBLICKEYBYTES).data());
printf("Sodium Private: \t%s\n", getHex(*mSodiumSecret, mSodiumSecret->size()).data());
printf("// ********* Keys End ************ //\n");
*/
//printf("[KeyPair::generateFromPassphrase] finished!\n");
// using
}
MemoryBin* KeyPairEd25519::sign(const unsigned char* message, size_t messageSize) const
//MemoryBin* KeyPairEd25519::sign(const MemoryBin* message) const
{
if (!message || !messageSize) return nullptr;
if (!mSodiumSecret) return nullptr;
auto mm = MemoryManager::getInstance();
auto em = ErrorManager::getInstance();
const static char functionName[] = "KeyPairEd25519::sign";
auto signBinBuffer = mm->getFreeMemory(crypto_sign_BYTES);
unsigned long long actualSignLength = 0;
if (crypto_sign_detached(*signBinBuffer, &actualSignLength, message, messageSize, *mSodiumSecret)) {
em->addError(new Error(functionName, "sign failed"));
auto messageHex = DataTypeConverter::binToHex(message, messageSize);
em->addError(new ParamError(functionName, "message as hex", messageHex));
mm->releaseMemory(signBinBuffer);
return nullptr;
}
if (crypto_sign_verify_detached(*signBinBuffer, message, messageSize, mSodiumPublic) != 0) {
// Incorrect signature!
//printf("c[KeyBuffer::%s] sign verify failed\n", __FUNCTION__);
em->addError(new Error(functionName, "sign verify failed"));
auto messageHex = DataTypeConverter::binToHex(message, messageSize);
em->addError(new ParamError(functionName, "message as hex", messageHex));
mm->releaseMemory(signBinBuffer);
return nullptr;
}
// debug
/*const size_t hex_sig_size = crypto_sign_BYTES * 2 + 1;
char sig_hex[hex_sig_size];
sodium_bin2hex(sig_hex, hex_sig_size, *signBinBuffer, crypto_sign_BYTES);
printf("[User::sign] signature hex: %s\n", sig_hex);
*/
return signBinBuffer;
}
bool KeyPairEd25519::verify(const std::string& message, const std::string& signature) const
{
if (message == "" || signature == "") return false;
if (crypto_sign_verify_detached((const unsigned char*)signature.data(), (const unsigned char*)message.data(), message.size(), mSodiumPublic) != 0) {
return false;
}
return true;
}
MemoryBin* KeyPairEd25519::getCryptedPrivKey(const Poco::AutoPtr<SecretKeyCryptography> password) const
{
if (password.isNull()) return nullptr;
if (!mSodiumSecret) return nullptr;
MemoryBin* encryptedKey = nullptr;
if (SecretKeyCryptography::AUTH_ENCRYPT_OK == password->encrypt(mSodiumSecret, &encryptedKey)) {
return encryptedKey;
}
else {
return nullptr;
}
}

View File

@ -1,95 +0,0 @@
#ifndef __GRADIDO_LOGIN_SERVER_CRYPTO_ED25519_H
#define __GRADIDO_LOGIN_SERVER_CRYPTO_ED25519_H
#include "IKeyPair.h"
/*!
* \author: Dario Rekowski
*
* \date: 2020-06-04
*
* \brief: Key Pairs class for ed25519 keys, used for default gradido transactions
* TODO: add verify method
*/
#include "sodium.h"
#include "SecretKeyCryptography.h"
#include "Passphrase.h"
#include "../lib/DataTypeConverter.h"
class KeyPairEd25519 : public IKeyPair
{
public:
//! \param privateKey: take ownership, release after object destruction
//! \param publicKey: copy
KeyPairEd25519(MemoryBin* privateKey);
KeyPairEd25519(const unsigned char* publicKey);
~KeyPairEd25519();
//! \param passphrase must contain word indices
//! \return create KeyPairEd25519, caller muss call delete at return after finish
static KeyPairEd25519* create(const Poco::AutoPtr<Passphrase> passphrase);
//! \return caller take ownership of return value
MemoryBin* sign(const MemoryBin* message) const { return sign(message->data(), message->size()); }
inline MemoryBin* sign(const std::string& bodyBytes) const { return sign((const unsigned char*)bodyBytes.data(), bodyBytes.size()); }
MemoryBin* sign(const unsigned char* message, size_t messageSize) const;
bool verify(const std::string& message, const std::string& signature) const;
inline const unsigned char* getPublicKey() const { return mSodiumPublic; }
inline std::string getPublicKeyHex() const { return DataTypeConverter::binToHex(mSodiumPublic, getPublicKeySize()); }
const static size_t getPublicKeySize() { return crypto_sign_PUBLICKEYBYTES; }
inline bool isTheSame(const KeyPairEd25519& b) const {
return 0 == sodium_memcmp(mSodiumPublic, b.mSodiumPublic, crypto_sign_PUBLICKEYBYTES);
}
inline bool isTheSame(const unsigned char* pubkey) const {
if (!pubkey)
return false;
return 0 == sodium_memcmp(mSodiumPublic, pubkey, crypto_sign_PUBLICKEYBYTES);
}
//! \return 0 if the same
//! \return -1 if not the same
//! \return 1 if hasn't private key
inline int isTheSame(const MemoryBin* privkey) const {
if (!mSodiumSecret) return 1;
if (privkey->size() != mSodiumSecret->size()) return -1;
return sodium_memcmp(*mSodiumSecret, *privkey, privkey->size());
}
inline bool operator == (const KeyPairEd25519& b) const { return isTheSame(b); }
inline bool operator != (const KeyPairEd25519& b) const { return !isTheSame(b); }
inline bool operator == (const unsigned char* b) const { return isTheSame(b); }
inline bool operator != (const unsigned char* b) const { return !isTheSame(b); }
inline bool hasPrivateKey() const { return mSodiumSecret != nullptr; }
//! \brief only way to get a private key.. encrypted
MemoryBin* getCryptedPrivKey(const Poco::AutoPtr<SecretKeyCryptography> password) const;
protected:
KeyPairEd25519();
private:
// 64 Byte
//! \brief ed25519 libsodium private key
//!
//! Why it is a pointer and the public is an array?
//! Because MemoryBin should be replaced by a memory obfuscation class which make it harder to steal the private key from computer memory
//! And because private key can be nullptr for example to verify a signed message
//! TODO: replace MemoryBin by a memory obfuscation class which make it hard to steal the private key from memory
MemoryBin* mSodiumSecret;
// 32 Byte
//! \brief ed25519 libsodium public key
unsigned char mSodiumPublic[crypto_sign_PUBLICKEYBYTES];
};
#endif //__GRADIDO_LOGIN_SERVER_CRYPTO_ED25519_H

View File

@ -1,221 +0,0 @@
#include "KeyPairHedera.h"
#include "../lib/DataTypeConverter.h"
#include <assert.h>
#include "../SingletonManager/ErrorManager.h"
KeyPairHedera::KeyPairHedera()
: mPrivateKey(nullptr)
{
}
KeyPairHedera::KeyPairHedera(const unsigned char* privateKey, size_t privateKeySize, const unsigned char* publicKey/* = nullptr*/, size_t publicKeySize/* = 0*/)
: mPrivateKey(nullptr)
{
auto derPrefixPriv = DataTypeConverter::hexToBin("302e020100300506032b657004220420");
auto derPrefixPub = DataTypeConverter::hexToBin("302a300506032b6570032100");
auto mm = MemoryManager::getInstance();
if (privateKey) {
switch (privateKeySize) {
case 48:
// key with prefix
if (0 == sodium_memcmp(privateKey, *derPrefixPriv, derPrefixPriv->size())) {
//int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk, const unsigned char *seed);
auto seed = mm->getFreeMemory(crypto_sign_ed25519_SEEDBYTES);
memcpy(*seed, &privateKey[derPrefixPriv->size()], crypto_sign_ed25519_SEEDBYTES);
createKeyFromSeed(seed->data(), seed->size());
mm->releaseMemory(seed);
break;
}
case 32:
createKeyFromSeed(privateKey, privateKeySize);
break;
case 64:
//mPrivateKey = privateKey;
if (!mPrivateKey || mPrivateKey->size() != privateKeySize) {
if (mPrivateKey) {
mm->releaseMemory(mPrivateKey);
}
mPrivateKey = mm->getFreeMemory(privateKeySize);
memcpy(*mPrivateKey, privateKey, privateKeySize);
}
break;
default:
throw Poco::Exception("[KeyPairHedera] invalid private key");
}
// check public
}
if (publicKey) {
switch (publicKeySize)
{
case 32: { // raw public key
memcpy(mPublicKey, publicKey, publicKeySize);
break;
}
case 44: // DER encoded public key
if (0 == sodium_memcmp(publicKey, *derPrefixPub, derPrefixPub->size())) {
memcpy(mPublicKey, &publicKey[derPrefixPub->size()], crypto_sign_PUBLICKEYBYTES);
}
break;
default:
throw Poco::Exception("[KeyPairHedera] invalid public key");
}
}
auto public_key_2 = mm->getFreeMemory(crypto_sign_PUBLICKEYBYTES);
crypto_sign_ed25519_sk_to_pk(*public_key_2, *mPrivateKey);
if (sodium_memcmp(*public_key_2, mPublicKey, crypto_sign_PUBLICKEYBYTES) != 0) {
throw "public keys not match";
}
mm->releaseMemory(public_key_2);
mm->releaseMemory(derPrefixPriv);
mm->releaseMemory(derPrefixPub);
}
KeyPairHedera::KeyPairHedera(const MemoryBin* privateKey, const MemoryBin* publicKey /* = nullptr*/)
: KeyPairHedera(privateKey->data(), privateKey->size(), publicKey->data(), publicKey->size())
{
}
KeyPairHedera::KeyPairHedera(const std::vector<unsigned char>& privateKey, const unsigned char* publicKey/* = nullptr*/, size_t publicKeySize/* = 0*/)
: KeyPairHedera(privateKey.data(), privateKey.size(), publicKey, publicKeySize)
{
}
KeyPairHedera::~KeyPairHedera()
{
auto mm = MemoryManager::getInstance();
if (mPrivateKey) {
mm->releaseMemory(mPrivateKey);
mPrivateKey = nullptr;
}
}
KeyPairHedera* KeyPairHedera::create()
{
/*
The crypto_sign_keypair() function randomly generates a secret key and a corresponding public key.
The public key is put into pk (crypto_sign_PUBLICKEYBYTES bytes)
and the secret key into sk (crypto_sign_SECRETKEYBYTES bytes).
*/
assert(getPublicKeySize() == crypto_sign_PUBLICKEYBYTES);
auto mm = MemoryManager::getInstance();
auto private_key = mm->getFreeMemory(crypto_sign_SECRETKEYBYTES);
auto public_key = mm->getFreeMemory(getPublicKeySize());
crypto_sign_keypair(*public_key, *private_key);
return new KeyPairHedera(private_key, public_key);
}
void KeyPairHedera::createKeyFromSeed(const unsigned char* seed, size_t seedSize)
{
assert(seed && seedSize == crypto_sign_ed25519_SEEDBYTES);
auto mm = MemoryManager::getInstance();
auto secret_key = mm->getFreeMemory(crypto_sign_SECRETKEYBYTES);
crypto_sign_seed_keypair(mPublicKey, *secret_key, seed);
if (mPrivateKey) {
mm->releaseMemory(mPrivateKey);
}
mPrivateKey = secret_key;
// iroha
//ed25519_privkey_SIZE
//ed25519_derive_public_key(const private_key_t* sk,public_key_t* pk);
}
MemoryBin* KeyPairHedera::sign(const unsigned char* message, size_t messageSize) const
{
if (!message || !messageSize) return nullptr;
if (!mPrivateKey) return nullptr;
auto mm = MemoryManager::getInstance();
auto em = ErrorManager::getInstance();
const static char functionName[] = "KeyPairHedera::sign";
auto signBinBuffer = mm->getFreeMemory(crypto_sign_BYTES);
unsigned long long actualSignLength = 0;
if (crypto_sign_detached(*signBinBuffer, &actualSignLength, message, messageSize, *mPrivateKey)) {
em->addError(new Error(functionName, "sign failed"));
auto messageHex = DataTypeConverter::binToHex(message, messageSize);
em->addError(new ParamError(functionName, "message as hex", messageHex));
mm->releaseMemory(signBinBuffer);
return nullptr;
}
if (crypto_sign_verify_detached(*signBinBuffer, message, messageSize, mPublicKey) != 0) {
// Incorrect signature!
//printf("c[KeyBuffer::%s] sign verify failed\n", __FUNCTION__);
em->addError(new Error(functionName, "sign verify failed"));
auto messageHex = DataTypeConverter::binToHex(message, messageSize);
em->addError(new ParamError(functionName, "message as hex", messageHex));
mm->releaseMemory(signBinBuffer);
return nullptr;
}
// debug
/*const size_t hex_sig_size = crypto_sign_BYTES * 2 + 1;
char sig_hex[hex_sig_size];
sodium_bin2hex(sig_hex, hex_sig_size, *signBinBuffer, crypto_sign_BYTES);
printf("[User::sign] signature hex: %s\n", sig_hex);
*/
return signBinBuffer;
}
bool KeyPairHedera::verify(const unsigned char* message, size_t messageSize, MemoryBin* signature) const
{
if (crypto_sign_verify_detached(*signature, message, messageSize, mPublicKey) != 0) {
return false;
}
return true;
}
MemoryBin* KeyPairHedera::getCryptedPrivKey(const Poco::AutoPtr<SecretKeyCryptography> password) const
{
if (password.isNull()) return nullptr;
if (!mPrivateKey) return nullptr;
auto private_key_hex_string = DataTypeConverter::binToHex(mPrivateKey);
printf("[KeyPairHedera::getCryptedPrivKey] private key hex: %s\n", private_key_hex_string.data());
MemoryBin* encryptedKey = nullptr;
if (SecretKeyCryptography::AUTH_ENCRYPT_OK == password->encrypt(mPrivateKey, &encryptedKey)) {
auto encrypted_private_key_hex_string = DataTypeConverter::binToHex(encryptedKey);
printf("[KeyPairHedera::getCryptedPrivKey] encryptet private key hex: %s\n", encrypted_private_key_hex_string.data());
return encryptedKey;
}
else {
return nullptr;
}
}
MemoryBin* KeyPairHedera::getPrivateKeyCopy() const
{
if (!mPrivateKey) return nullptr;
auto mm = MemoryManager::getInstance();
MemoryBin* private_key_copy = mm->getFreeMemory(mPrivateKey->size());
memcpy(*private_key_copy, *mPrivateKey, mPrivateKey->size());
return private_key_copy;
}
MemoryBin* KeyPairHedera::getPublicKeyCopy() const
{
auto mm = MemoryManager::getInstance();
auto public_key = mm->getFreeMemory(crypto_sign_PUBLICKEYBYTES);
memcpy(*public_key, mPublicKey, crypto_sign_PUBLICKEYBYTES);
return public_key;
}

View File

@ -1,95 +0,0 @@
#ifndef __GRADIDO_LOGIN_SERVER_CRYPTO_HEDERA_KEYS_H
#define __GRADIDO_LOGIN_SERVER_CRYPTO_HEDERA_KEYS_H
#include "IKeyPair.h"
/*!
* \author: Dario Rekowski
*
* \date: 2020-08-28
*
* \brief: Key Pairs class for ed25519 keys, used by hedera for transaction sign
*/
#include "sodium.h"
#include "SecretKeyCryptography.h"
#include "../lib/DataTypeConverter.h"
class KeyPairHedera : public IKeyPair
{
public:
//! \param privateKey: copy
//! \param publicKey: copy
//!
KeyPairHedera(const unsigned char* privateKey, size_t privateKeySize, const unsigned char* publicKey = nullptr, size_t publicKeySize = 0);
KeyPairHedera(const MemoryBin* privateKey, const MemoryBin* publicKey = nullptr);
KeyPairHedera(const std::vector<unsigned char>& privateKey, const unsigned char* publicKey = nullptr, size_t publicKeySize = 0);
static KeyPairHedera* create();
~KeyPairHedera();
//! \return caller take ownership of return value
MemoryBin* sign(const MemoryBin* message) const { return sign(message->data(), message->size()); }
inline MemoryBin* sign(const std::string& bodyBytes) const { return sign((const unsigned char*)bodyBytes.data(), bodyBytes.size()); }
MemoryBin* sign(const unsigned char* message, size_t messageSize) const;
bool verify(const unsigned char* message, size_t messageSize, MemoryBin* signature) const;
inline const unsigned char* getPublicKey() const { return mPublicKey; }
MemoryBin* getPublicKeyCopy() const;
inline std::string getPublicKeyHex() const { return DataTypeConverter::binToHex(mPublicKey, getPublicKeySize()); }
const static size_t getPublicKeySize() {return crypto_sign_PUBLICKEYBYTES;}
inline bool isTheSame(const KeyPairHedera& b) const {
return 0 == sodium_memcmp(mPublicKey, b.mPublicKey, getPublicKeySize());
}
inline bool isTheSame(const unsigned char* pubkey) const {
if (!pubkey)
return false;
return 0 == sodium_memcmp(mPublicKey, pubkey, getPublicKeySize());
}
//! \return 0 if the same
//! \return -1 if not the same
//! \return 1 if hasn't private key
inline int isTheSame(const MemoryBin* privkey) const {
if (!mPrivateKey) return 1;
if (privkey->size() != mPrivateKey->size()) return -1;
return sodium_memcmp(*mPrivateKey, *privkey, privkey->size());
}
inline bool operator == (const KeyPairHedera& b) const { return isTheSame(b); }
inline bool operator != (const KeyPairHedera& b) const { return !isTheSame(b); }
inline bool operator == (const unsigned char* b) const { return isTheSame(b); }
inline bool operator != (const unsigned char* b) const { return !isTheSame(b); }
inline bool hasPrivateKey() const { return mPrivateKey != nullptr; }
//! \brief
MemoryBin* getCryptedPrivKey(const Poco::AutoPtr<SecretKeyCryptography> password) const;
MemoryBin* getPrivateKeyCopy() const;
inline std::string getPrivateKeyHex(const Poco::AutoPtr<SecretKeyCryptography> password) const { if (!mPrivateKey) return "0x0"; return DataTypeConverter::binToHex(mPrivateKey); }
protected:
KeyPairHedera();
void createKeyFromSeed(const unsigned char* seed, size_t seedSize);
private:
// 64 Byte
//! \brief ed25519 libsodium private key
//!
//! TODO: replace MemoryBin by a memory obfuscation class which make it hard to steal the private key from memory
MemoryBin* mPrivateKey;
// 32 Byte
//! \brief ed25519 libsodium public key
unsigned char mPublicKey[crypto_sign_PUBLICKEYBYTES];
};
#endif //__GRADIDO_LOGIN_SERVER_CRYPTO_HEDERA_KEYS_H

View File

@ -1,97 +0,0 @@
#include "Obfus_array.h"
#include <sodium.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
ObfusArray::ObfusArray(size_t size, const unsigned char * data)
: m_arraySize(0), m_offsetSize(0), m_dataSize(size), m_Data(nullptr)
{
m_arraySize = size + 2 + randombytes_random() % (int)roundf(size*0.25f);
m_Data = (unsigned char*)malloc(m_arraySize);
m_offsetSize = randombytes_random() % (int)roundf((m_arraySize - m_dataSize) * 0.8f);
//printf("[ObfusArray::ObfusArray] array_size: %d, start by: %lld, size: %u, offset: %u\n",
//m_arraySize, m_Data, size, m_offsetSize);
assert(m_arraySize - m_offsetSize >= size);
uint32_t* d = (uint32_t*)m_Data;
size_t dMax = (size_t)floorf(m_arraySize / 4.0f);
//printf("d start by: %lld, dMax: %u\n", d, dMax);
size_t i = 0;
DISASM_MISALIGN;
for (size_t i = 0; i < dMax; i++) {
d[i] = randombytes_random();
}
for (size_t i = m_arraySize - 4; i < m_arraySize; i++) {
m_Data[i] = (unsigned char)randombytes_random();
}
//d[m_arraySize - 4] = randombytes_random();
DISASM_FALSERET;
/* other stuff can be done here that won't be disassembled */
memcpy(&m_Data[m_offsetSize], data, size);
//printf("[ObfusArray] data: %lld\n", (int64_t)m_Data);
}
ObfusArray::ObfusArray(size_t size)
: m_arraySize(0), m_offsetSize(0), m_dataSize(size), m_Data(nullptr)
{
m_arraySize = size + 2 + randombytes_random() % (int)roundf(size*0.25f);
m_Data = (unsigned char*)malloc(m_arraySize);
m_offsetSize = randombytes_random() % (int)roundf((m_arraySize - m_dataSize) * 0.8f);
//printf("[ObfusArray::ObfusArray] array_size: %d, start by: %lld, size: %u, offset: %u\n",
//m_arraySize, m_Data, size, m_offsetSize);
assert(m_arraySize - m_offsetSize >= size);
uint32_t* d = (uint32_t*)m_Data;
size_t dMax = (size_t)floorf(m_arraySize / 4.0f);
//printf("d start by: %lld, dMax: %u\n", d, dMax);
size_t i = 0;
DISASM_MISALIGN;
for (size_t i = 0; i < dMax; i++) {
d[i] = randombytes_random();
}
DISASM_FALSERET;
for (size_t i = m_arraySize - 4; i < m_arraySize; i++) {
m_Data[i] = (unsigned char)randombytes_random();
}
//d[m_arraySize - 4] = randombytes_random();
}
/*
ObfusArray::ObfusArray(size_t size, const unsigned char * data)
: m_arraySize(64), m_offsetSize(0), m_dataSize(size)
{
memset(m_Data, 0, m_arraySize);
memcpy(m_Data, data, size);
//printf("[ObfusArray] data: %lld\n", (int64_t)m_Data);
}
*/
ObfusArray::~ObfusArray()
{
//printf("[ObfusArray::~ObfusArray] data: %lld\n", (int64_t)m_Data);
if (m_Data) {
free(m_Data);
m_Data = nullptr;
}
//printf("[ObfusArray::~ObfusArray] finish\n");
}
void ObfusArray::put(size_t i, Poco::UInt64 value)
{
if ((i + 1) * 8 >= m_dataSize) return;
DISASM_FALSERET;
unsigned char* p = &m_Data[m_offsetSize + (i * 8)];
memcpy(p, &value, sizeof(Poco::UInt64));
}

View File

@ -1,78 +0,0 @@
#ifndef GRADIDO_LOGIN_SERVER_CRYPTO_OBFUS_ARRAY
#define GRADIDO_LOGIN_SERVER_CRYPTO_OBFUS_ARRAY
#include <stdio.h>
#include "Poco/Types.h"
#ifdef _ENABLE_ASSEMBLER_OBFUS //_MSC_VER
// Quelle: https://mycomputersciencebooks.files.wordpress.com/2017/08/secure-programming-in-c-and-c.pdf
// Kapitel 12.16
#define NULLPAD_START __asm {
pushl %eax
movl %esp, %eax
}
#define NULLPAD __asm {
addb %al, (%eax)
}
#define NULLPAD_END __asm {
popl %eax
}
#define NULLPAD_10 NULLPAD_START; NULLPAD; NULLPAD; NULLPAD; NULLPAD; NULLPAD; NULLPAD_END
#define DISASM_MISALIGN __asm __volatile ( \
" pushl %eax \n" \
" cmpl %eax, %eax \n" \
" jz 0f \n" \
" .byte 0x0F \n" \
"0: \n" \
" popl %eax \n")
#define DISASM_FALSERET __asm __volatile ( \
" pushl %ecx /* save registers */\n" \
" pushl %ebx \n" \
" pushl %edx \n" \
" movl %esp, %ebx /* save ebp, esp */\n" \
" movl %ebp, %esp \n" \
" popl %ebp /* save old %ebp */\n" \
" popl %ecx /* save return addr */\n" \
" lea 0f, %edx /* edx = addr of 0: */\n" \
" pushl %edx /* return addr = edx */\n" \
" ret \n" \
" .byte 0x0F /* off-by-one byte */\n" \
"0: \n" \
" pushl %ecx /* restore ret addr */\n" \
" pushl %ebp /* restore old &ebp */\n" \
" movl %esp, %ebp /* restore ebp, esp */\n" \
" movl %ebx, %esp \n" \
" popl %ebx \n" \
" popl %ecx \n")
#else
#define NULLPAD_10
#define DISASM_MISALIGN
#define DISASM_FALSERET
#endif
class ObfusArray
{
public:
ObfusArray(size_t size, const unsigned char * data);
ObfusArray(size_t size);
~ObfusArray();
inline operator const unsigned char*() const {return &m_Data[m_offsetSize];}
inline operator unsigned char*() { return &m_Data[m_offsetSize]; }
inline size_t size() const { return m_dataSize;}
void put(size_t i, Poco::UInt64 value);
private:
size_t m_arraySize;
size_t m_offsetSize;
size_t m_dataSize;
unsigned char* m_Data;
//unsigned char m_Data[64];
};
#endif //GRADIDO_LOGIN_SERVER_CRYPTO_OBFUS_ARRAY

View File

@ -1,400 +0,0 @@
#include "Passphrase.h"
#include "Poco/Types.h"
#include "Poco/Tuple.h"
#include "../SingletonManager/ErrorManager.h"
#include "KeyPairEd25519.h"
#include "../ServerConfig.h"
#include "../lib/DataTypeConverter.h"
#define STR_BUFFER_SIZE 25
static std::vector<Poco::Tuple<int, std::string>> g_specialChars = {
{ 0xa4, "auml" },{ 0x84, "Auml" },
{ 0xbc, "uuml" },{ 0x9c, "Uuml" },
{ 0xb6, "ouml" },{ 0x96, "Ouml" },
{ 0x9f, "szlig" }
};
Passphrase::Passphrase(const std::string& passphrase, const Mnemonic* wordSource)
: mPassphraseString(filter(passphrase)), mWordSource(wordSource)
{
memset(mWordIndices, 0, PHRASE_WORD_COUNT * sizeof(Poco::UInt16));
getWordIndices();
}
std::string Passphrase::filter(const std::string& passphrase)
{
std::string filteredPassphrase;
auto passphrase_size = passphrase.size();
for (int i = 0; i < passphrase_size; i++) {
unsigned char c = passphrase.data()[i];
// asci 128 even by utf8 (hex)
// 0000 0000 0000 007F
// utf8
if (c > 0x0000007F) {
int additionalUtfByteCount = 0;
//filteredPassphrase += c;
if ((c & 0x00000080) == 0x00000080) {
// c3 a4 => ä
// c3 bc => ü
// c3 b6 => ö
// c3 84 => Ä
// c3 96 => Ö
// c3 9c => Ü
// c3 9f => ß
unsigned char c2 = passphrase.data()[i + 1];
bool insertedHtmlEntitie = false;
for (auto it = g_specialChars.begin(); it != g_specialChars.end(); it++) {
if (c2 == it->get<0>()) {
auto htmlEntitie = it->get<1>();
filteredPassphrase += "&";
filteredPassphrase += htmlEntitie;
filteredPassphrase += ";";
i++;
insertedHtmlEntitie = true;
break;
}
}
if (insertedHtmlEntitie) continue;
additionalUtfByteCount = 1;
}
else if ((c & 0x00000800) == 0x00000800) {
additionalUtfByteCount = 2;
}
else if ((c & 0x00010000) == 0x00010000) {
additionalUtfByteCount = 3;
}
for (int j = 0; j <= additionalUtfByteCount; j++) {
filteredPassphrase += passphrase.data()[i + j];
i++;
}
}
else {
// 32 = Space
// 65 = A
// 90 = Z
// 97 = a
// 122 = z
// 59 = ;
// 38 = &
if (c == 32 || c == 59 || c == 38 ||
(c >= 65 && c <= 90) ||
(c >= 97 && c <= 122)) {
filteredPassphrase += c;
}
else if (c == '\n' || c == '\r') {
filteredPassphrase += ' ';
}
}
}
return filteredPassphrase;
}
Poco::AutoPtr<Passphrase> Passphrase::transform(const Mnemonic* targetWordSource)
{
/*
if (!currentWordSource || !targetWordSource) {
return "";
}
if (targetWordSource == currentWordSource) {
return passphrase;
}
auto word_indices = createWordIndices(passphrase, currentWordSource);
if (!word_indices) {
return "";
}
return createClearPassphraseFromWordIndices(word_indices, targetWordSource);*/
// Poco::SharedPtr<Passphrase> transformedPassphrase = new Passphrase()
if (!targetWordSource || !mWordSource) {
return nullptr;
}
if (targetWordSource == mWordSource) {
duplicate();
return this;
}
if (createWordIndices()) {
return create(mWordIndices, targetWordSource);
}
return nullptr;
}
Poco::AutoPtr<Passphrase> Passphrase::create(const std::string& passphrase, const Mnemonic* wordSource)
{
return new Passphrase(passphrase, wordSource);
}
Poco::AutoPtr<Passphrase> Passphrase::create(const MemoryBin* wordIndices, const Mnemonic* wordSource)
{
if (PHRASE_WORD_COUNT * sizeof(Poco::UInt16) >= wordIndices->size()) {
return nullptr;
}
const Poco::UInt16* word_indices_p = (const Poco::UInt16*)wordIndices->data();
return create(word_indices_p, wordSource);
}
std::string Passphrase::createClearPassphrase() const
{
auto word_indices = getWordIndices();
std::string clear_passphrase;
auto word_source = &ServerConfig::g_Mnemonic_WordLists[ServerConfig::MNEMONIC_BIP0039_SORTED_ORDER];
for (int i = 0; i < PHRASE_WORD_COUNT; i++) {
auto word = word_source->getWord(word_indices[i]);
if (word) {
clear_passphrase += word;
clear_passphrase += " ";
}
}
return clear_passphrase;
}
Poco::AutoPtr<Passphrase> Passphrase::create(const Poco::UInt16 wordIndices[PHRASE_WORD_COUNT], const Mnemonic* wordSource)
{
std::string clearPassphrase;
for (int i = 0; i < PHRASE_WORD_COUNT; i++) {
auto word = wordSource->getWord(wordIndices[i]);
if (word) {
clearPassphrase += word;
clearPassphrase += " ";
}
else {
return nullptr;
}
}
return new Passphrase(clearPassphrase, wordSource);
}
Poco::AutoPtr<Passphrase> Passphrase::generate(const Mnemonic* wordSource)
{
auto em = ErrorManager::getInstance();
auto mm = MemoryManager::getInstance();
auto word_indices = mm->getFreeMemory(PHRASE_WORD_COUNT * sizeof(Poco::UInt16));
Poco::UInt16* word_indices_p = (Poco::UInt16*)word_indices->data();
for (int i = 0; i < PHRASE_WORD_COUNT; i++) {
word_indices_p[i] = randombytes_random() % 2048;
}
auto result_passphrase = create(word_indices_p, wordSource);
mm->releaseMemory(word_indices);
return result_passphrase;
/*
unsigned int random_indices[PHRASE_WORD_COUNT];
unsigned int str_sizes[PHRASE_WORD_COUNT];
unsigned int phrase_buffer_size = 0;
static const char* function_name = "Passphrase::generate";
bool error_reloading_mnemonic_word_list = false;
int loop_trys = 0;
Poco::RegularExpression check_valid_word("^[a-zA-ZÄÖÜäöüß&;]*$");
// TODO: make sure words didn't double
for (int i = 0; i < PHRASE_WORD_COUNT; i++) {
random_indices[i] = randombytes_random() % 2048;
auto word = wordSource->getWord(random_indices[i]);
if (loop_trys > 10 || error_reloading_mnemonic_word_list) {
return nullptr;
}
if (!word) {
em->addError(new ParamError(function_name, "empty word get for index", random_indices[i]));
em->sendErrorsAsEmail();
random_indices[i] = randombytes_random() % 2048;
word = wordSource->getWord(random_indices[i]);
if (!word) return nullptr;
}
else {
if (!check_valid_word.match(word, 0, Poco::RegularExpression::RE_NOTEMPTY)) {
em->addError(new ParamError(function_name, "invalid word", word));
em->addError(new Error(function_name, "try to reload mnemonic word list, but this error is maybe evidence for a serious memory problem!!!"));
if (!ServerConfig::loadMnemonicWordLists()) {
em->addError(new Error(function_name, "error reloading mnemonic word lists"));
error_reloading_mnemonic_word_list = true;
}
else {
i = 0;
loop_trys++;
}
em->sendErrorsAsEmail();
}
}
str_sizes[i] = strlen(word);
phrase_buffer_size += str_sizes[i];
}
phrase_buffer_size += PHRASE_WORD_COUNT + 1;
std::string phrase_buffer(phrase_buffer_size, '\0');
int phrase_buffer_cursor = 0;
for (int i = 0; i < PHRASE_WORD_COUNT; i++) {
memcpy(&phrase_buffer[phrase_buffer_cursor], wordSource->getWord(random_indices[i]), str_sizes[i]);
phrase_buffer_cursor += str_sizes[i];
phrase_buffer[phrase_buffer_cursor++] = ' ';
}
return create(;
*/
}
bool Passphrase::createWordIndices()
{
auto er = ErrorManager::getInstance();
auto mm = MemoryManager::getInstance();
const char* functionName = "Passphrase::createWordIndices";
if (!mWordSource) {
er->addError(new Error(functionName, "word source is empty"));
return false;
}
//DHASH key = DRMakeStringHash(passphrase);
size_t pass_phrase_size = mPassphraseString.size();
char acBuffer[STR_BUFFER_SIZE]; memset(acBuffer, 0, STR_BUFFER_SIZE);
size_t buffer_cursor = 0;
// get word indices for hmac key
unsigned char word_cursor = 0;
for (auto it = mPassphraseString.begin(); it != mPassphraseString.end(); it++)
{
if (*it == ' ') {
if (buffer_cursor < 3) {
continue;
}
if (PHRASE_WORD_COUNT > word_cursor && mWordSource->isWordExist(acBuffer)) {
mWordIndices[word_cursor] = mWordSource->getWordIndex(acBuffer);
//word_indices_old[word_cursor] = word_source->getWordIndex(acBuffer);
}
else {
er->addError(new ParamError(functionName, "word didn't exist", acBuffer));
er->sendErrorsAsEmail();
return false;
}
word_cursor++;
memset(acBuffer, 0, STR_BUFFER_SIZE);
buffer_cursor = 0;
}
else {
acBuffer[buffer_cursor++] = *it;
}
}
if (PHRASE_WORD_COUNT > word_cursor && mWordSource->isWordExist(acBuffer)) {
mWordIndices[word_cursor] = mWordSource->getWordIndex(acBuffer);
//word_indices_old[word_cursor] = word_source->getWordIndex(acBuffer);
word_cursor++;
}
//printf("word cursor: %d\n", word_cursor);
/*if (memcmp(word_indices_p, word_indices_old, word_indices->size()) != 0) {
printf("not identical\n");
memcpy(word_indices_p, word_indices_old, word_indices->size());
}*/
return true;
}
const Poco::UInt16* Passphrase::getWordIndices()
{
if (!(mWordIndices[0] | mWordIndices[1] | mWordIndices[2] | mWordIndices[3])) {
if (createWordIndices()) return mWordIndices;
}
return mWordIndices;
}
const Poco::UInt16* Passphrase::getWordIndices() const
{
return mWordIndices;
}
bool Passphrase::checkIfValid()
{
if (!mWordSource) return false;
std::istringstream iss(mPassphraseString);
std::vector<std::string> results(std::istream_iterator<std::string>{iss},
std::istream_iterator<std::string>());
bool existAll = true;
for (auto it = results.begin(); it != results.end(); it++) {
if (*it == "\0" || *it == "" || it->size() < 3) continue;
if (!mWordSource->isWordExist(*it)) {
return false;
}
}
return true;
}
const Mnemonic* Passphrase::detectMnemonic(const std::string& passphrase, const KeyPairEd25519* keyPair /* = nullptr*/)
{
std::istringstream iss(passphrase);
std::vector<std::string> results(std::istream_iterator<std::string>{iss},
std::istream_iterator<std::string>());
std::string user_public_key_hex;
if (keyPair) {
user_public_key_hex = DataTypeConverter::pubkeyToHex(keyPair->getPublicKey());
//printf("user public key hex: %s\n", user_public_key_hex.data());
}
std::string last_words_not_found[ServerConfig::Mnemonic_Types::MNEMONIC_MAX];
for (int i = 0; i < ServerConfig::Mnemonic_Types::MNEMONIC_MAX; i++) {
Mnemonic& m = ServerConfig::g_Mnemonic_WordLists[i];
bool existAll = true;
for (auto it = results.begin(); it != results.end(); it++) {
if (*it == "\0" || *it == "" || it->size() < 3) continue;
if (!m.isWordExist(*it)) {
existAll = false;
//printf("couldn't find word: %s\n", (*it).data());
last_words_not_found[i] = (*it);
// leave inner for-loop
break;
}
}
if (existAll) {
if (keyPair) {
Poco::AutoPtr<Passphrase> test_passphrase = new Passphrase(passphrase, &m);
test_passphrase->createWordIndices();
auto key_pair = KeyPairEd25519::create(test_passphrase);
if (key_pair) {
if (*key_pair != *keyPair) {
#ifdef _TEST_BUILD // additional infos for debugging if error occure in test
printf("public key mismatch\n");
std::string generated_key_pair_hex = DataTypeConverter::pubkeyToHex(key_pair->getPublicKey());
std::string parameter_key_pair_hex = DataTypeConverter::pubkeyToHex(keyPair->getPublicKey());
printf("parameter: %s, generated: %s\n", parameter_key_pair_hex.data(), generated_key_pair_hex.data());
#endif
delete key_pair;
continue;
}
else {
delete key_pair;
}
}
}
return &ServerConfig::g_Mnemonic_WordLists[i];
}
//printf("last word not found: %s in %s\n", last_words_not_found[i].data(), ServerConfig::mnemonicTypeToString((ServerConfig::Mnemonic_Types)i));
}
return nullptr;
}

View File

@ -1,60 +0,0 @@
#ifndef __GRADIDO_LOGIN_SERVER_CRYPTO_PASSPHRASE_H
#define __GRADIDO_LOGIN_SERVER_CRYPTO_PASSPHRASE_H
//#include <string>
#include "mnemonic.h"
#include "../SingletonManager/MemoryManager.h"
#include "../lib/AutoPtrContainer.h"
#include "Poco/AutoPtr.h"
class KeyPairEd25519;
class Passphrase : public AutoPtrContainer
{
public:
Passphrase(const std::string& passphrase, const Mnemonic* wordSource);
static Poco::AutoPtr<Passphrase> create(const Poco::UInt16 wordIndices[PHRASE_WORD_COUNT], const Mnemonic* wordSource);
static Poco::AutoPtr<Passphrase> create(const MemoryBin* wordIndices, const Mnemonic* wordSource);
static Poco::AutoPtr<Passphrase> create(const std::string& passphrase, const Mnemonic* wordSource);
//! \brief generate new passphrase with random
static Poco::AutoPtr<Passphrase> generate(const Mnemonic* wordSource);
static const Mnemonic* detectMnemonic(const std::string& passphrase, const KeyPairEd25519* keyPair = nullptr);
//! \brief transform passphrase into another language/mnemonic source
//! \return this if targetWordSource is the same as mWordSource
Poco::AutoPtr<Passphrase> transform(const Mnemonic* targetWordSource);
//! \brief create clear passphrase from word indices from bitcoin word list (bip0039)
//!
//! Used by hashing function to get really the same string,
//! even user has typed in some not filtered character
std::string createClearPassphrase() const;
//! \brief replace utf8 characters with html special character encoding
//!
//! TODO: add more utf8 chars for other languages as they needed
static std::string filter(const std::string& passphrase);
//! \return true if all words in passphrase existing in mWordSource
bool checkIfValid();
const Poco::UInt16* getWordIndices();
const Poco::UInt16* getWordIndices() const;
//! \return true if ok
bool createWordIndices();
//! \brief please handle with care! should be only seen by user and admin
const std::string& getString() const { return mPassphraseString; }
protected:
std::string mPassphraseString;
const Mnemonic* mWordSource;
Poco::UInt16 mWordIndices[PHRASE_WORD_COUNT];
};
#endif // __GRADIDO_LOGIN_SERVER_CRYPTO_PASSPHRASE

View File

@ -1,159 +0,0 @@
#include "SecretKeyCryptography.h"
#include "sodium.h"
#include "../ServerConfig.h"
#include <assert.h>
#include "../lib/Profiler.h"
SecretKeyCryptography::SecretKeyCryptography()
: mOpsLimit(10), mMemLimit(33554432), mAlgo(2), mEncryptionKey(nullptr), mEncryptionKeyHash(0)
{
}
SecretKeyCryptography::SecretKeyCryptography(unsigned long long opslimit, size_t memlimit, int algo)
: mOpsLimit(opslimit), mMemLimit(memlimit), mAlgo(algo), mEncryptionKey(nullptr), mEncryptionKeyHash(0)
{
}
SecretKeyCryptography::~SecretKeyCryptography()
{
if (mEncryptionKey) {
MemoryManager::getInstance()->releaseMemory(mEncryptionKey);
mEncryptionKey = nullptr;
}
}
SecretKeyCryptography::ResultType SecretKeyCryptography::createKey(const std::string& salt_parameter, const std::string& passwd)
{
assert(crypto_hash_sha512_BYTES >= crypto_pwhash_SALTBYTES);
auto mm = MemoryManager::getInstance();
auto app_secret = ServerConfig::g_CryptoAppSecret;
assert(app_secret);
Profiler timeUsed;
std::unique_lock<std::shared_mutex> _lock(mWorkingMutex);
#ifndef _TEST_BUILD
if (timeUsed.millis() > 10) {
printf("[SecretKeyCryptography::createKey] wait %s on getting lock\n", timeUsed.string().data());
timeUsed.reset();
}
#endif
// use hash512 because existing data where calculated with that, but could be also changed to hash256
auto hash512_salt = mm->getFreeMemory(crypto_hash_sha512_BYTES); // need at least crypto_pwhash_SALTBYTES 16U
crypto_hash_sha512_state state;
crypto_hash_sha512_init(&state);
//crypto_hash_sha512_update
crypto_hash_sha512_update(&state, (const unsigned char*)salt_parameter.data(), salt_parameter.size());
crypto_hash_sha512_update(&state, *app_secret, app_secret->size());
crypto_hash_sha512_final(&state, *hash512_salt);
#ifndef _TEST_BUILD
if (timeUsed.millis() > 200) {
printf("[SecretKeyCryptography::createKey] %s calculating sha512\n", timeUsed.string().data());
timeUsed.reset();
}
#endif
//unsigned char* key = (unsigned char *)malloc(crypto_box_SEEDBYTES); // 32U
//ObfusArray* key = new ObfusArray(crypto_box_SEEDBYTES);
if (!mEncryptionKey) {
mEncryptionKey = mm->getFreeMemory(crypto_box_SEEDBYTES);
}
//Bin32Bytes* key = mm->get32Bytes();
// generate encryption key, should take a bit longer to make brute force attacks hard
if (crypto_pwhash(*mEncryptionKey, mEncryptionKey->size(), passwd.data(), passwd.size(), *hash512_salt, mOpsLimit, mMemLimit, mAlgo) != 0) {
mm->releaseMemory(mEncryptionKey);
mEncryptionKey = nullptr;
return AUTH_CREATE_ENCRYPTION_KEY_FAILED;
}
#ifndef _TEST_BUILD
if (timeUsed.millis() > 400) {
printf("[SecretKeyCryptography::createKey] %s calculating pwd hash\n", timeUsed.string().data());
}
#endif
// generate hash from key for compare
assert(sizeof(KeyHashed) >= crypto_shorthash_BYTES);
assert(ServerConfig::g_ServerCryptoKey);
crypto_shorthash((unsigned char*)&mEncryptionKeyHash, *mEncryptionKey, crypto_box_SEEDBYTES, *ServerConfig::g_ServerCryptoKey);
return AUTH_CREATE_ENCRYPTION_KEY_SUCCEED;
}
SecretKeyCryptography::ResultType SecretKeyCryptography::encrypt(const MemoryBin* message, MemoryBin** encryptedMessage) const
{
assert(message && encryptedMessage);
std::shared_lock<std::shared_mutex> _lock(mWorkingMutex);
if (!mEncryptionKey) {
return AUTH_NO_KEY;
}
size_t message_len = message->size();
size_t ciphertext_len = crypto_secretbox_MACBYTES + message_len;
unsigned char nonce[crypto_secretbox_NONCEBYTES];
// we use a hardcoded value for nonce
// TODO: use a dynamic value, save it along with the other parameters
memset(nonce, 31, crypto_secretbox_NONCEBYTES);
auto mm = MemoryManager::getInstance();
auto ciphertext = mm->getFreeMemory(ciphertext_len);
memset(*ciphertext, 0, ciphertext_len);
if (0 != crypto_secretbox_easy(*ciphertext, *message, message_len, nonce, *mEncryptionKey)) {
mm->releaseMemory(ciphertext);
return AUTH_ENCRYPT_MESSAGE_FAILED;
}
*encryptedMessage = ciphertext;
return AUTH_ENCRYPT_OK;
}
SecretKeyCryptography::ResultType SecretKeyCryptography::decrypt(const unsigned char* encryptedMessage, size_t encryptedMessageSize, MemoryBin** message) const
{
assert(message);
std::shared_lock<std::shared_mutex> _lock(mWorkingMutex);
if (!mEncryptionKey) {
return AUTH_NO_KEY;
}
size_t decryptSize = encryptedMessageSize - crypto_secretbox_MACBYTES;
//unsigned char* decryptBuffer = (unsigned char*)malloc(decryptSize);
auto mm = MemoryManager::getInstance();
//ObfusArray* decryptedData = new ObfusArray(decryptSize);
auto decryptedData = mm->getFreeMemory(decryptSize);
unsigned char nonce[crypto_secretbox_NONCEBYTES];
// we use a hardcoded value for nonce
// TODO: use a dynamic value, save it along with the other parameters
memset(nonce, 31, crypto_secretbox_NONCEBYTES);
if (crypto_secretbox_open_easy(*decryptedData, encryptedMessage, encryptedMessageSize, nonce, *mEncryptionKey)) {
mm->releaseMemory(decryptedData);
return AUTH_DECRYPT_MESSAGE_FAILED;
}
*message = decryptedData;
return AUTH_DECRYPT_OK;
}
const char* SecretKeyCryptography::getErrorMessage(ResultType type)
{
switch (type) {
case AUTH_ENCRYPT_OK: return "everything is ok";
//case AUTH_ENCRYPT_SHA2_TO_SMALL: return "libsodium crypto_hash_sha512_BYTES is to small to use as crypto_pwhash_SALTBYTES";
case AUTH_CREATE_ENCRYPTION_KEY_FAILED: return "error creating encryption key, maybe to much memory requested?";
case AUTH_NO_KEY: return "no encryption key generated";
case AUTH_ENCRYPT_MESSAGE_FAILED: return "message encryption failed";
case AUTH_DECRYPT_MESSAGE_FAILED: return "message decryption failed";
}
return "<unknown>";
}

View File

@ -1,102 +0,0 @@
#ifndef __GRADIDO_LOGIN_SERVER_CRYPTO_AUTHENTICATED_ENCRYPTION_H
#define __GRADIDO_LOGIN_SERVER_CRYPTO_AUTHENTICATED_ENCRYPTION_H
#include "../SingletonManager/MemoryManager.h"
#include "../lib/AutoPtrContainer.h"
#include "Poco/AutoPtr.h"
#include <shared_mutex>
#include <vector>
/*!
*
* \author: Dario Rekowski
*
* \date: 07-06-2020
*
* \brief: Wrapper Class for make using libsodium secret key encryption easy, used for encrypt private keys for user with pwhash
*
*/
typedef Poco::UInt64 KeyHashed;
class SecretKeyCryptography : public AutoPtrContainer
{
public:
enum ResultType {
AUTH_ENCRYPT_OK,
AUTH_DECRYPT_OK,
AUTH_CREATE_ENCRYPTION_KEY_SUCCEED,
AUTH_CREATE_ENCRYPTION_KEY_FAILED,
AUTH_NO_KEY,
AUTH_ENCRYPT_MESSAGE_FAILED,
AUTH_DECRYPT_MESSAGE_FAILED
};
//! \brief init with default algorithms parameter
SecretKeyCryptography();
//! \brief init with custom algorithms parameter
//!
//! details see in libsodium crypto_pwhash
SecretKeyCryptography(unsigned long long opslimit, size_t memlimit, int algo);
~SecretKeyCryptography();
inline KeyHashed getKeyHashed() const { std::shared_lock<std::shared_mutex> _lock(mWorkingMutex); return mEncryptionKeyHash; }
inline bool operator == (const Poco::AutoPtr<SecretKeyCryptography>& b) const {
return isTheSame(b);
}
inline bool isTheSame(const Poco::AutoPtr<SecretKeyCryptography>& b) const {
std::shared_lock<std::shared_mutex> _lock(mWorkingMutex);
if (b.isNull()) return false;
return mEncryptionKeyHash == b->getKeyHashed();
}
inline bool operator == (const KeyHashed& hash) const {
return mEncryptionKeyHash == hash;
}
inline bool hasKey() const { std::shared_lock<std::shared_mutex> _lock(mWorkingMutex); return mEncryptionKey != nullptr; }
//! \brief generate encryption key, with default parameter use ca. 300 ms
//!
//! should be call from task, running in g_CryptoCPUScheduler, lock shared mutex for writing
//! \param salt_parameter for example email
//! \return AUTH_CREATE_ENCRYPTION_KEY_FAILED call strerror(errno) for more details
ResultType createKey(const std::string& salt_parameter, const std::string& passwd);
ResultType encrypt(const MemoryBin* message, MemoryBin** encryptedMessage) const;
inline ResultType decrypt(const MemoryBin* encryptedMessage, MemoryBin** message) const {
return decrypt(encryptedMessage->data(), encryptedMessage->size(), message);
}
//! \brief same as the other decrypt only in other format
//! \param encryptedMessage format from Poco Binary Data from DB, like returned from model/table/user for encrypted private key
inline ResultType decrypt(const std::vector<unsigned char>& encryptedMessage, MemoryBin** message) const {
return decrypt(encryptedMessage.data(), encryptedMessage.size(), message);
}
//! \brief raw decrypt function, actual implementation
ResultType decrypt(const unsigned char* encryptedMessage, size_t encryptedMessageSize, MemoryBin** message) const;
static const char* getErrorMessage(ResultType type);
protected:
// algorithms parameter
unsigned long long mOpsLimit;
size_t mMemLimit;
int mAlgo;
// encryption key and hash
MemoryBin* mEncryptionKey;
KeyHashed mEncryptionKeyHash;
mutable std::shared_mutex mWorkingMutex;
};
#endif //__GRADIDO_LOGIN_SERVER_CRYPTO_AUTHENTICATED_ENCRYPTION_H

View File

@ -1,9 +0,0 @@
#ifndef GRADIDO_LOGIN_SERVER_CRYPTO_SERVER_CRYPTO
#define GRADIDO_LOGIN_SERVER_CRYPTO_SERVER_CRYPTO
class ServerCrypto
{
};
#endif // GRADIDO_LOGIN_SERVER_CRYPTO_SERVER_CRYPTO

View File

@ -1,361 +0,0 @@
#include "mnemonic.h"
#include <memory>
#include <cstring>
#include <assert.h>
#include <mutex>
#include "../dependencies/tinf/src/tinf.h"
#include "DRRandom.h"
#include "../SingletonManager/ErrorManager.h"
#include "../ServerConfig.h"
#include "Poco/RegularExpression.h"
static Poco::RegularExpression g_checkValidWord("^[a-zA-ZÄÖÜäöüß&;]*$");
Mnemonic::Mnemonic()
{
memset(mWords, 0, 2048);
// mWordHashIndices.resize(2048);
}
Mnemonic::~Mnemonic()
{
clear();
}
int Mnemonic::init(void(*fill_words_func)(unsigned char*), unsigned int original_size, unsigned int compressed_size)
{
std::unique_lock<std::shared_mutex> _lock(mWorkingMutex);
clear();
unsigned char* buffer = (unsigned char*)malloc(compressed_size);
unsigned char* uncompressed_buffer = (unsigned char*)malloc(original_size + 1);
memset(uncompressed_buffer, 0, original_size + 1);
fill_words_func(buffer);
// uncompress
unsigned int original_size_cpy = original_size;
if (tinf_gzip_uncompress(uncompressed_buffer, &original_size_cpy, buffer, compressed_size) != TINF_OK) {
free(buffer);
free(uncompressed_buffer);
return -1;
}
if (original_size_cpy != original_size) {
free(buffer);
free(uncompressed_buffer);
return -2;
}
else {
free(buffer);
DRRandom::seed(compressed_size);
//printf("c[Mnemonic::%s] uncompressing success\n", __FUNCTION__);
// fill words in array and hashList
std::string uncompressed_file_name = "uncompressed_buffer";
uncompressed_file_name += std::to_string(original_size);
uncompressed_file_name += ".txt";
FILE* f = fopen(uncompressed_file_name.data(), "w");
if (f) {
fwrite(uncompressed_buffer, sizeof(char), original_size, f);
fclose(f);
}
unsigned short cursor = 0;
u32 word_begin = 0, word_end = 0;
for (unsigned int i = 0; i < original_size; i++) {
if (cursor >= 2048) {
return -3;
}
if (uncompressed_buffer[i] == ',' || i == original_size - 1) {
word_end = i;
u32 word_size = word_end - word_begin;
if (word_size < 3) {
printf("[%s] ERROR! word is smaller than 3, word size: %d, index: %d \n",
__FUNCTION__, word_size, cursor
);
char acBuffer[22]; memset(acBuffer, 0, 22);
int _start = word_end - 10;
if (_start < 0) {
_start = 0;
}
memcpy(acBuffer, &uncompressed_buffer[_start], 20);
printf("word_end: %d, word_begin: %d, part: %s\n", word_end, word_begin, acBuffer);
}
if (word_end < word_begin) {
printf("%c %c %c\n", uncompressed_buffer[i - 1], uncompressed_buffer[i], uncompressed_buffer[i + 1]);
printf("%s\n", uncompressed_buffer);
continue;
}
if (uncompressed_buffer[i] != ',') {
//printf("last char: %c\n", uncompressed_buffer[i]);
word_size++;
}
// + 1 for null terminating
mWords[cursor] = (char*)malloc(word_size + 1);
// fill hash list for fast reverse lookup
memset(mWords[cursor], 0, word_size + 1);
if (word_begin + word_size > original_size) {
printf("c[Mnemonic::%s] word goes out of array bounds\n", __FUNCTION__);
free(uncompressed_buffer);
return -4;
}
memcpy(mWords[cursor], &uncompressed_buffer[word_begin], word_size);
//printf("%d: %s\n", cursor, mWords[cursor]);
DHASH word_hash = DRMakeStringHash(mWords[cursor]);
//mWordHashIndices.addByHash(word_hash, (void*)cursor);
auto result = mWordHashIndices.insert(WordHashEntry(word_hash, cursor));
if (!result.second) {
// handle hash collision
auto it_collide = mHashCollisionWords.find(word_hash);
if (it_collide == mHashCollisionWords.end()) {
std::map<std::string, unsigned short> collidedWordsMap;
collidedWordsMap.insert(HashCollideWordEntry(mWords[result.first->second], result.first->second));
auto result2 = mHashCollisionWords.insert(std::pair<DHASH, std::map<std::string, unsigned short>>(word_hash, collidedWordsMap));
if (!result2.second) {
free(uncompressed_buffer);
printf("c[Mnemonc::%s] error inserting hash collided word map\n", __FUNCTION__);
return -6;
}
it_collide = result2.first;
}
assert(it_collide != mHashCollisionWords.end());
auto result3 = it_collide->second.insert(HashCollideWordEntry(mWords[cursor], cursor));
if (!result3.second) {
free(uncompressed_buffer);
printf("c[Mnemonc::%s] error inserting hash collided word entry\n", __FUNCTION__);
return -7;
}
//printf("c[Mnemonic::%s] error inserting word, hash collision?\n", __FUNCTION__);
//printf("current word: %s\n", mWords[cursor]);
//printf("existing word: %s\n", mWords[result.first->second]);
}
word_begin = i + 1;
cursor++;
}
}
//printf("c[Mnemonic::%s] before freeing uncompressed buffer \n", __FUNCTION__);
free(uncompressed_buffer);
// remove hash colliding entrys from regular map
for (auto it_collide = mHashCollisionWords.begin(); it_collide != mHashCollisionWords.end(); it_collide++) {
mWordHashIndices.erase(it_collide->first);
}
return 0;
}
//printf("c[Mnemonic::%s] before freeing buffer \n", __FUNCTION__);
free(buffer);
return -5;
}
short Mnemonic::getWordIndex(const char* word) const
{
std::shared_lock<std::shared_mutex> _lock(mWorkingMutex);
DHASH word_hash = DRMakeStringHash(word);
auto it = mWordHashIndices.find(word_hash);
if (it != mWordHashIndices.end()) {
return it->second;
}
auto it_collide = mHashCollisionWords.find(word_hash);
if (it_collide != mHashCollisionWords.end()) {
auto it_collided_word = it_collide->second.find(word);
if (it_collided_word != it_collide->second.end()) {
return it_collided_word->second;
}
}
return -1;
}
/*
bool Mnemonic::isWordExist(const std::string& word) const
{
return getWordIndex(word.data()) != -1;
//DHASH word_hash = DRMakeStringHash(word.data());
//return mWordHashIndices.find(word_hash) != mWordHashIndices.end();
}
*/
const char* Mnemonic::getWord(short index) const {
//std::shared_lock<std::shared_mutex> _lock(mWorkingMutex);
if (index < 2048 && index >= 0) {
std::string word;
{
std::shared_lock<std::shared_mutex> _lock(mWorkingMutex);
word = mWords[index];
}
if (!g_checkValidWord.match(word, 0, Poco::RegularExpression::RE_NOTEMPTY)) {
auto em = ErrorManager::getInstance();
const char* function_name = "Mnemonic::getWord";
em->addError(new ParamError(function_name, "invalid word", word));
em->addError(new Error(function_name, "try to reload mnemonic word list, but this error is maybe evidence for a serious memory problem!!!"));
if (!ServerConfig::loadMnemonicWordLists()) {
em->addError(new Error(function_name, "error reloading mnemonic word lists"));
em->sendErrorsAsEmail();
return nullptr;
}
{
std::shared_lock<std::shared_mutex> _lock(mWorkingMutex);
word = mWords[index];
}
if (!g_checkValidWord.match(word, 0, Poco::RegularExpression::RE_NOTEMPTY)) {
em->addError(new Error(function_name, "word invalid after reload mnemonic word lists"));
em->sendErrorsAsEmail();
return nullptr;
}
em->sendErrorsAsEmail();
}
{
std::shared_lock<std::shared_mutex> _lock(mWorkingMutex);
return mWords[index];
}
}
return nullptr;
}
void Mnemonic::clear()
{
//Poco::Mutex::ScopedLock _lock(mWorkingMutex, 500);
for (int i = 0; i < 2048; i++) {
if (mWords[i]) {
free(mWords[i]);
}
}
memset(mWords, 0, 2048);
mWordHashIndices.clear();
mHashCollisionWords.clear();
}
#include "Poco/RegularExpression.h"
std::string Mnemonic::getCompleteWordList()
{
std::shared_lock<std::shared_mutex> _lock(mWorkingMutex);
std::string result("");
//std::string toReplaced[] = { "auml", "ouml", "uuml", "Auml", "Ouml", "Uuml", "szlig" };
Poco::RegularExpression toReplaced[] = {
std::string("&auml;"),
std::string("&ouml;"),
std::string("&uuml;"),
std::string("&Auml;"),
std::string("&Ouml;"),
std::string("Uuml;"),
std::string("&szlig;")
};
std::string replaceStrings[] = { "ä", "ö", "ü", "Ä", "Ö", "Ü", "ß" };
for (int i = 0; i < 2048; i++) {
if (mWords[i]) {
std::string word = mWords[i];
for (int s = 0; s < 7; s++) {
toReplaced[s].subst(word, replaceStrings[s], Poco::RegularExpression::RE_GLOBAL);
}
result += std::to_string(i) + ": " + word + "\n";
}
else {
result += std::to_string(i) + ": <word empty>\n";
}
}
return result;
}
// comparison, not case sensitive.
bool compare_nocase(const std::string& first, const std::string& second)
{
unsigned int i = 0;
while ((i < first.length()) && (i < second.length()))
{
if (tolower(first[i]) < tolower(second[i])) return true;
else if (tolower(first[i]) > tolower(second[i])) return false;
++i;
}
return (first.length() < second.length());
}
std::string Mnemonic::getCompleteWordListSorted()
{
std::shared_lock<std::shared_mutex> _lock(mWorkingMutex);
std::string result("");
std::list<std::string> words;
for (int i = 0; i < 2048; i++) {
if (mWords[i]) {
words.push_back(mWords[i]);
}
else {
printf("missing word on %d\n", i);
}
}
words.sort(compare_nocase);
//std::string toReplaced[] = { "auml", "ouml", "uuml", "Auml", "Ouml", "Uuml", "szlig" };
Poco::RegularExpression toReplaced[] = {
std::string("&auml;"),
std::string("&ouml;"),
std::string("&uuml;"),
std::string("&Auml;"),
std::string("&Ouml;"),
std::string("Uuml;"),
std::string("&szlig;")
};
std::string replaceStrings[] = { "ä", "ö", "ü", "Ä", "Ö", "Ü", "ß" };
int i = 0;
for(auto it = words.begin(); it != words.end(); it++) {
std::string word = *it;
for (int s = 0; s < 7; s++) {
toReplaced[s].subst(word, replaceStrings[s], Poco::RegularExpression::RE_GLOBAL);
}
result += std::to_string(i) + ": " + word + "\n";
i++;
}
return result;
}
void Mnemonic::printToFile(const char* filename)
{
std::shared_lock<std::shared_mutex> _lock(mWorkingMutex);
FILE* f = fopen(filename, "wt");
if (f) {
auto words = getCompleteWordListSorted();
fwrite(words.data(), 1, words.size(), f);
fclose(f);
}
}
Poco::JSON::Array Mnemonic::getSortedWordList()
{
std::shared_lock<std::shared_mutex> _lock(mWorkingMutex);
std::list<std::string> words;
for (auto it = mWordHashIndices.begin(); it != mWordHashIndices.end(); it++) {
words.push_back(mWords[it->second]);
}
words.sort();
Poco::JSON::Array json;
for (auto it = words.begin(); it != words.end(); it++) {
json.add(*it);
}
// json.stringify()
return json;
}

View File

@ -1,67 +0,0 @@
#ifndef DR_MNEMONIC_H
#define DR_MNEMONIC_H
/*!
*
* @author: einhornimmond
*
* @date: 16.06.19
*
* @desc: Class for handling mnemonic word list, unpacking, reverse lookup
*
*/
#include "../lib/DRHashList.h"
#include <string>
#include <shared_mutex>
#include <map>
#include <list>
#include "Poco/JSON/Array.h"
#define PHRASE_WORD_COUNT 24
class Mnemonic
{
public:
Mnemonic();
~Mnemonic();
int init(void(*fill_words_func)(unsigned char*), unsigned int original_size, unsigned int compressed_size);
const char* getWord(short index) const;
short getWordIndex(const char* word) const;
inline bool isWordExist(const std::string& word) const {
std::shared_lock<std::shared_mutex> _lock(mWorkingMutex);
return getWordIndex(word.data()) != -1;
}
// using only for debugging
std::string getCompleteWordList();
std::string getCompleteWordListSorted();
Poco::JSON::Array getSortedWordList();
void printToFile(const char* filename);
protected:
void clear();
struct HashCollisionWords {
DHASH hash;
std::vector<std::string> words;
};
char* mWords[2048];
//DRHashList mWordHashIndices;
typedef std::pair<DHASH, unsigned short> WordHashEntry;
typedef std::pair<std::string, unsigned short> HashCollideWordEntry;
std::map<DHASH, unsigned short> mWordHashIndices;
std::map<DHASH, std::map<std::string, unsigned short>> mHashCollisionWords;
mutable std::shared_mutex mWorkingMutex;
};
#endif //DR_MNEMONIC_H

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,302 +0,0 @@
#include "Gradido_LoginServer.h"
#include "ServerConfig.h"
#include "HTTPInterface/PageRequestHandlerFactory.h"
#include "JSONInterface/JsonRequestHandlerFactory.h"
#include "lib/Profiler.h"
#include "SingletonManager/ConnectionManager.h"
#include "SingletonManager/SessionManager.h"
#include "SingletonManager/EmailManager.h"
#include "SingletonManager/PendingTasksManager.h"
#include "controller/User.h"
#include "Crypto/SecretKeyCryptography.h"
#include "Poco/Util/HelpFormatter.h"
#include "Poco/Net/ServerSocket.h"
#include "Poco/Net/HTTPServer.h"
#include "Poco/Net/SSLManager.h"
#include "Poco/Environment.h"
#include "Poco/Logger.h"
#include "Poco/Path.h"
#include "Poco/AsyncChannel.h"
#include "Poco/SimpleFileChannel.h"
#include "Poco/FileChannel.h"
#include "Poco/ConsoleChannel.h"
#include "Poco/SplitterChannel.h"
#include "MySQL/Poco/Connector.h"
#include <sodium.h>
Gradido_LoginServer::Gradido_LoginServer()
: _helpRequested(false)
{
}
Gradido_LoginServer::~Gradido_LoginServer()
{
}
void Gradido_LoginServer::initialize(Application& self)
{
loadConfiguration(); // load default configuration files, if present
ServerApplication::initialize(self);
}
void Gradido_LoginServer::uninitialize()
{
ServerApplication::uninitialize();
}
void Gradido_LoginServer::defineOptions(Poco::Util::OptionSet& options)
{
ServerApplication::defineOptions(options);
/*options.addOption(
Poco::Util::Option("help", "h", "display help information on command line arguments")
.required(false)
.repeatable(false));*/
options.addOption(
Poco::Util::Option("config", "c", "use non default config file (default is /etc/grd_login.properties)", false)
.repeatable(false)
.argument("Gradido_LoginServer.properties", true)
.callback(Poco::Util::OptionCallback<Gradido_LoginServer>(this, &Gradido_LoginServer::handleOption)));
}
void Gradido_LoginServer::handleOption(const std::string& name, const std::string& value)
{
//printf("handle option: %s with value: %s\n", name.data(), value.data());
if (name == "config") {
mConfigPath = value;
return;
}
ServerApplication::handleOption(name, value);
if (name == "help") _helpRequested = true;
}
void Gradido_LoginServer::displayHelp()
{
Poco::Util::HelpFormatter helpFormatter(options());
helpFormatter.setCommand(commandName());
helpFormatter.setUsage("OPTIONS");
helpFormatter.setHeader("Gradido Login Server");
helpFormatter.format(std::cout);
}
void Gradido_LoginServer::createConsoleFileAsyncLogger(std::string name, std::string filePath)
{
Poco::AutoPtr<Poco::ConsoleChannel> logConsoleChannel(new Poco::ConsoleChannel);
Poco::AutoPtr<Poco::FileChannel> logFileChannel(new Poco::FileChannel(filePath));
logFileChannel->setProperty("rotation", "500 K");
logFileChannel->setProperty("compress", "true");
logFileChannel->setProperty("archive", "timestamp");
Poco::AutoPtr<Poco::SplitterChannel> logSplitter(new Poco::SplitterChannel);
logSplitter->addChannel(logConsoleChannel);
logSplitter->addChannel(logFileChannel);
Poco::AutoPtr<Poco::AsyncChannel> logAsyncChannel(new Poco::AsyncChannel(logSplitter));
Poco::Logger& log = Poco::Logger::get(name);
log.setChannel(logAsyncChannel);
log.setLevel("information");
}
void Gradido_LoginServer::createFileLogger(std::string name, std::string filePath)
{
Poco::AutoPtr<Poco::FileChannel> logFileChannel(new Poco::FileChannel(filePath));
logFileChannel->setProperty("rotation", "500 K");
logFileChannel->setProperty("archive", "timestamp");
Poco::Logger& log = Poco::Logger::get(name);
log.setChannel(logFileChannel);
log.setLevel("information");
}
int Gradido_LoginServer::main(const std::vector<std::string>& args)
{
Profiler usedTime;
if (_helpRequested)
{
displayHelp();
}
else
{
// ********** logging ************************************
std::string log_Path = "/var/log/grd_login/";
//#ifdef _WIN32
#if defined(_WIN32) || defined(_WIN64)
log_Path = "./";
#endif
if (mConfigPath != "") {
log_Path = "./";
}
// init speed logger
Poco::AutoPtr<Poco::SimpleFileChannel> speedLogFileChannel(new Poco::SimpleFileChannel(log_Path + "speedLog.txt"));
/*
The optional log file rotation mode:
never: no rotation (default)
<n>: rotate if file size exceeds <n> bytes
<n> K: rotate if file size exceeds <n> Kilobytes
<n> M: rotate if file size exceeds <n> Megabytes
*/
speedLogFileChannel->setProperty("rotation", "500 K");
Poco::AutoPtr<Poco::AsyncChannel> speedLogAsyncChannel(new Poco::AsyncChannel(speedLogFileChannel));
Poco::Logger& speedLogger = Poco::Logger::get("SpeedLog");
speedLogger.setChannel(speedLogAsyncChannel);
speedLogger.setLevel("information");
// logging for request handling
createConsoleFileAsyncLogger("requestLog", log_Path + "requestLog.txt");
// logging for hedera request for debugging gradido node
createFileLogger("transactions_log", log_Path + "transactions_log.txt");
createFileLogger("transactions_log_base64", log_Path + "transactions_log_base64.txt");
// error logging
createConsoleFileAsyncLogger("errorLog", log_Path + "errorLog.txt");
Poco::Logger& errorLog = Poco::Logger::get("errorLog");
createConsoleFileAsyncLogger("emailLog", log_Path + "emailLog.txt");
// *************** load from config ********************************************
std::string cfg_Path = Poco::Path::config() + "grd_login/";
try {
if(mConfigPath != "") {
loadConfiguration(mConfigPath);
} else {
loadConfiguration(cfg_Path + "grd_login.properties");
}
}
catch (Poco::Exception& ex) {
errorLog.error("error loading config: %s", ex.displayText());
}
unsigned short port = (unsigned short)config().getInt("HTTPServer.port", 9980);
unsigned short json_port = (unsigned short)config().getInt("JSONServer.port", 1201);
//printf("show mnemonic list: \n");
//printf(ServerConfig::g_Mnemonic_WordLists[ServerConfig::MNEMONIC_BIP0039_SORTED_ORDER].getCompleteWordList().data());
if (!ServerConfig::initServerCrypto(config())) {
//printf("[Gradido_LoginServer::%s] error init server crypto\n", __FUNCTION__);
errorLog.error("[Gradido_LoginServer::main] error init server crypto");
return Application::EXIT_CONFIG;
}
// first check time for crypto
SecretKeyCryptography test_crypto;
Profiler timeUsed;
if (test_crypto.createKey("email@google.de", "haz27Newpassword") != SecretKeyCryptography::AUTH_CREATE_ENCRYPTION_KEY_SUCCEED) {
errorLog.error("[Gradido_LoginServer::main] error create secure pwd hash");
return Application::EXIT_SOFTWARE;
}
ServerConfig::g_FakeLoginSleepTime = (int)std::round(timeUsed.millis());
Poco::Int64 i1 = randombytes_random();
Poco::Int64 i2 = randombytes_random();
ServerConfig::g_ServerKeySeed->put(1, i1 | (i2 << 8));
ServerConfig::initEMailAccount(config());
EmailManager::getInstance()->init(config());
// start cpu scheduler
uint8_t worker_count = (uint8_t)config().getInt("cpu_worker", Poco::Environment::processorCount() * 2);
ServerConfig::g_CPUScheduler = new UniLib::controller::CPUSheduler(worker_count, "Default Worker");
ServerConfig::g_CryptoCPUScheduler = new UniLib::controller::CPUSheduler(2, "Crypto Worker");
// load up connection configs
// register MySQL connector
try {
Poco::Data::MySQL::Connector::registerConnector();
} catch(Poco::Exception& ex) {
errorLog.error("[Gradido_LoginServer::main] Poco Exception by register MySQL Connector: %s", ex.displayText());
return Application::EXIT_CONFIG;
}
auto conn = ConnectionManager::getInstance();
//conn->setConnection()
//printf("try connect login server mysql db\n");
try {
conn->setConnectionsFromConfig(config(), CONNECTION_MYSQL_LOGIN_SERVER);
}
catch (Poco::Exception& ex) {
// maybe we in docker environment and db needs some time to start up
// let's wait 10 seconds
int count = 10;
while (count > 0) {
printf("\rwait on mysql/mariadb %d seconds...", count);
count--;
Poco::Thread::sleep(1000);
}
conn->setConnectionsFromConfig(config(), CONNECTION_MYSQL_LOGIN_SERVER);
}
//printf("try connect php server mysql \n");
//conn->setConnectionsFromConfig(config(), CONNECTION_MYSQL_PHP_SERVER);
SessionManager::getInstance()->init();
// put urandom on linux servers
//srand();
Poco::Net::initializeSSL();
if(!ServerConfig::initSSLClientContext()) {
//printf("[Gradido_LoginServer::%s] error init server SSL Client\n", __FUNCTION__);
errorLog.error("[Gradido_LoginServer::main] error init server SSL Client");
return Application::EXIT_CONFIG;
}
// schedule email verification resend
controller::User::checkIfVerificationEmailsShouldBeResend(ServerConfig::g_CronJobsTimer);
controller::User::addMissingEmailHashes();
// HTTP Interface Server
// set-up a server socket
Poco::Net::ServerSocket svs(port);
// set-up a HTTPServer instance
Poco::ThreadPool& pool = Poco::ThreadPool::defaultPool();
Poco::Net::HTTPServer srv(new PageRequestHandlerFactory, svs, new Poco::Net::HTTPServerParams);
ServerConfig::g_ServerKeySeed->put(7, 918276611);
// start the HTTPServer
srv.start();
// JSON Interface Server
Poco::Net::ServerSocket json_svs(json_port);
Poco::Net::HTTPServer json_srv(new JsonRequestHandlerFactory, json_svs, new Poco::Net::HTTPServerParams);
// start the json server
json_srv.start();
// load pending tasks not finished in last session
PendingTasksManager::getInstance()->load();
int php_server_ping = config().getInt("phpServer.ping", 600000);
printf("[Gradido_LoginServer::main] started in %s\n", usedTime.string().data());
std::clog << "[Gradido_LoginServer::main] started in " << usedTime.string().data() << std::endl;
// wait for CTRL-C or kill
waitForTerminationRequest();
// Stop the HTTPServer
srv.stop();
// Stop the json server
json_srv.stop();
ServerConfig::unload();
Poco::Net::uninitializeSSL();
// Optional: Delete all global objects allocated by libprotobuf.
google::protobuf::ShutdownProtobufLibrary();
}
return Application::EXIT_OK;
}

View File

@ -1,43 +0,0 @@
#ifndef Gradido_LoginServer_INCLUDED
#define Gradido_LoginServer_INCLUDED
#include "Poco/Util/ServerApplication.h"
class Gradido_LoginServer : public Poco::Util::ServerApplication
{
/// The main application class.
///
/// This class handles command-line arguments and
/// configuration files.
/// Start the Gradido_LoginServer executable with the help
/// option (/help on Windows, --help on Unix) for
/// the available command line options.
///
public:
Gradido_LoginServer();
~Gradido_LoginServer();
protected:
void initialize(Application& self);
void uninitialize();
void defineOptions(Poco::Util::OptionSet& options);
void handleOption(const std::string& name, const std::string& value);
void displayHelp();
int main(const std::vector<std::string>& args);
void createConsoleFileAsyncLogger(std::string name, std::string filePath);
void createFileLogger(std::string name, std::string filePath);
private:
bool _helpRequested;
std::string mConfigPath;
};
#endif //Gradido_LoginServer_INCLUDED

View File

@ -1,402 +0,0 @@
#include "ElopageWebhook.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Net/HTTPServerResponse.h"
#include "Poco/URI.h"
#include "Poco/Logger.h"
#include "Poco/Data/Binding.h"
//#include "Poco/Data/MySQL/MySQLException.h"
using namespace Poco::Data::Keywords;
#include "../SingletonManager/ConnectionManager.h"
#include "../SingletonManager/ErrorManager.h"
#include "../SingletonManager/SessionManager.h"
#include "../SingletonManager/EmailManager.h"
#include "../ServerConfig.h"
#include "../controller/EmailVerificationCode.h"
#include "../model/table/ElopageBuy.h"
#include "../lib/DataTypeConverter.h"
void ElopageWebhook::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response)
{
// simply write request to file for later lookup
//ServerConfig::writeToFile(request.stream(), "elopage_webhook_requests.txt");
// empty response, we didn't need to set anything
//response.setStatus(Poco::Net::HTTPResponse::HTTP_NO_CONTENT);
std::ostream& _responseStream = response.send();
_responseStream << "200 OK";
// don't use it anymore, register now direct
// elopage request are only logged from gpt server
//return;
std::istream& stream = request.stream();
std::string completeRequest;
Poco::Net::NameValueCollection elopageRequestData;
int breakCount = 100;
while (stream.good() && breakCount > 0) {
// char dummy;
//char keyBuffer[30]; memset(keyBuffer, 0, 30);
//char valueBuffer[75]; memset(valueBuffer, 0, 75);
std::vector<char> keyBuffer(30);
std::vector<char> valueBuffer(75);
/*stream.get(keyBuffer, 30, '=').get(dummy)
.get(valueBuffer, 35, '&').get(dummy);*/
std::string line;
std::getline(stream, line);
int mode = 0;
for (int i = 0; i < line.size(); i++) {
char c = line.at(i);
completeRequest += c;
if (c == '\n') break;
if (c == '+') {
c = ' ';
}
if (c == '&') {
mode = 0;
valueBuffer.push_back('\0');
keyBuffer.push_back('\0');
std::string urlDecodedValue;
try {
Poco::URI::decode(valueBuffer.data(), urlDecodedValue);
}
catch (Poco::Exception& ex) {
Poco::Logger& logging(Poco::Logger::get("errorLog"));
logging.error("[ElopageWebhook::handleRequest] error decoding URI: %s, exception: %s", std::string(valueBuffer.data()), ex.displayText());
urlDecodedValue = valueBuffer.data();
}
elopageRequestData.set(keyBuffer.data(), urlDecodedValue);
valueBuffer.clear();
keyBuffer.clear();
continue;
}
switch (mode) {
case 0: // read key
if (c == '=') {
mode = 1;
continue;
}
keyBuffer.push_back(c);
break;
case 1: // read value
valueBuffer.push_back(c);
break;
}
}
valueBuffer.push_back('\0');
keyBuffer.push_back('\0');
// last key-value pair
std::string urlDecodedValue;
try {
Poco::URI::decode(valueBuffer.data(), urlDecodedValue);
}
catch (Poco::Exception& ex) {
Poco::Logger& logging(Poco::Logger::get("errorLog"));
logging.error("[ElopageWebhook::handleRequest] error decoding URI (last): %s, exception: %s", std::string(valueBuffer.data()), ex.displayText());
urlDecodedValue = valueBuffer.data();
}
if (strcmp(keyBuffer.data(), "")) {
elopageRequestData.set(keyBuffer.data(), urlDecodedValue);
}
//printf("[ElopageWebhook::handleRequest] key: %s, value: %s\n", keyBuffer, valueBuffer);
/// elopageRequestData.set(keyBuffer, valueBuffer);
stream.good();
breakCount--;
}
// check event type
std::string event = elopageRequestData.get("event", "");
if (event == "lesson.viewed") {
printf("elopage request was lesson viewed\n");
return;
}
// write stream result also to file
static Poco::Mutex mutex;
Profiler timeUsed;
mutex.lock();
Poco::FileOutputStream file("elopage_webhook_requests.txt", std::ios::out | std::ios::app);
if (!file.good()) {
Poco::Logger& logging(Poco::Logger::get("errorLog"));
logging.error("[ElopageWebhook::handleRequest] error creating file with name: elopage_webhook_requests.txt");
//printf("[ElopageWebhook::handleRequest] error creating file with name: elopage_webhook_requests.txt\n");
mutex.unlock();
return;
}
Poco::LocalDateTime now;
std::string dateTimeStr = Poco::DateTimeFormatter::format(now, Poco::DateTimeFormat::ISO8601_FORMAT);
file << dateTimeStr << std::endl;
file << completeRequest << std::endl;
file << std::endl;
file.close();
std::string timeUsedStr = timeUsed.string();
printf("[%s] time for elopage request write to file: %s\n", dateTimeStr.data(), timeUsedStr.data());
mutex.unlock();
UniLib::controller::TaskPtr handleElopageTask(new HandleElopageRequestTask(elopageRequestData));
handleElopageTask->scheduleTask(handleElopageTask);
}
// ****************************************************************************
HandleElopageRequestTask::HandleElopageRequestTask(Poco::Net::NameValueCollection& requestData)
: CPUTask(ServerConfig::g_CPUScheduler), mRequestData(requestData)
{
#ifdef _UNI_LIB_DEBUG
setName(mRequestData.get("order_id", "").data());
#endif
}
bool HandleElopageRequestTask::validateInput()
{
auto sm = SessionManager::getInstance();
if (mEmail == "" || !sm->isValid(mEmail, VALIDATE_EMAIL)) {
addError(new Error(__FUNCTION__, "email is invalid or empty"));
return false;
}
if (mFirstName == "" || !sm->isValid(mFirstName, VALIDATE_NAME)) {
addError(new Error(__FUNCTION__, "first name is invalid or empty"));
return false;
}
if (mLastName == "" || !sm->isValid(mLastName, VALIDATE_NAME)) {
addError(new Error(__FUNCTION__, "last name is invalid or empty"));
return false;
}
return true;
}
void HandleElopageRequestTask::writeUserIntoDB()
{
printf("HandleElopageRequestTask::writeUserIntoDB\n");
auto cm = ConnectionManager::getInstance();
auto session = cm->getConnection(CONNECTION_MYSQL_LOGIN_SERVER);
Poco::Data::Statement insert(session);
insert << "INSERT INTO users (email, first_name, last_name) VALUES(?, ?, ?);",
use(mEmail), use(mFirstName), use(mLastName);
try {
insert.execute();
//printf("user written into db\n");
}
catch (Poco::Exception& ex) {
addError(new ParamError(__FUNCTION__, "mysql error", ex.displayText().data()));
}
}
int HandleElopageRequestTask::getUserIdFromDB(bool checkEmail /* = false*/)
{
auto cm = ConnectionManager::getInstance();
auto session = cm->getConnection(CONNECTION_MYSQL_LOGIN_SERVER);
Poco::Data::Statement select(session);
std::vector<int> user_ids;
std::vector<bool> email_checked;
if (checkEmail) {
select << "SELECT id, email_checked from users where email = ?;",
into(user_ids), into(email_checked), use(mEmail);
}
else {
select << "SELECT id from users where email = ?;",
into(user_ids), use(mEmail);
}
try {
select.execute();
}
catch (Poco::Data::ConnectionFailedException& ex) {
addError(new ParamError(__FUNCTION__, "[ConnectionFailedException] mysql error selecting from db", ex.displayText().data()));
addError(new ParamError(__FUNCTION__, "email: ", mEmail.data()));
}
catch (Poco::Data::NotConnectedException& ex) {
addError(new ParamError(__FUNCTION__, "[NotConnectedException] mysql error selecting from db", ex.displayText().data()));
addError(new ParamError(__FUNCTION__, "email: ", mEmail.data()));
}
catch (Poco::Exception& ex) {
addError(new ParamError(__FUNCTION__, "mysql error selecting from db", ex.displayText().data()));
addError(new ParamError(__FUNCTION__, "email: ", mEmail.data()));
}
if (user_ids.size() > 1) {
std::string duplicateIds("duplicate user ids for email: ");
duplicateIds += mEmail;
duplicateIds += ": ";
for (int i = 0; i < user_ids.size(); i++) {
if (i > 0) {
duplicateIds += ", ";
}
duplicateIds += std::to_string(user_ids[i]);
}
addError(new Error("HandleElopageRequestTask::getUserIdFromDB", duplicateIds.data()));
sendErrorsAsEmail();
}
if (user_ids.size() >= 1) {
if (email_checked.size() >= 1 && email_checked[0]) {
addError(new Error("HandleElopageRequestTask::getUserIdFromDB", "user account already activated"));
return 0;
}
return user_ids[0];
}
return 0;
}
int HandleElopageRequestTask::run()
{
// get input data
// check event type
std::string event = mRequestData.get("event", "");
if (event == "lesson.viewed" || event == "lesson.completed" || event == "lesson.commented") {
return 0;
}
// elopage buy
Poco::AutoPtr<model::table::ElopageBuy> elopageBuy(new model::table::ElopageBuy(mRequestData));
if (elopageBuy->errorCount() > 0) {
getErrors(elopageBuy);
}
UniLib::controller::TaskPtr saveElopageBuy(new model::table::ModelInsertTask(elopageBuy, false));
saveElopageBuy->scheduleTask(saveElopageBuy);
// check product id
unsigned long long product_id = 0;
DataTypeConverter::strToInt(mRequestData.get("product[id]", "0"), product_id);
std::string order_id = mRequestData.get("order_id", "");
auto param_error_order_id = new ParamError("HandleElopageRequestTask", "order_id", order_id.data());
/*!
*
Registrierung Schritt 1 von 3, 36001
Gradido-Basis, 43741
Premium-Mitgliedschaft, 43870
Gold-Mitgliedschaft, 43944
Business-Mitgliedschaft, 43960
Förderbeitrag: 49106
*
*/
static const int valid_product_ids[] = { 36001, 43741, 43870, 43944, 43960, 49106 };
bool valid_product_id = false;
for (int i = 0; i < sizeof(valid_product_ids) / sizeof(int); i++) {
if (valid_product_ids[i] == product_id) {
valid_product_id = true;
break;
}
}
// only for product 36001 and 43741 create user accounts and send emails
if (valid_product_id) {
mEmail = mRequestData.get("payer[email]", "");
mFirstName = mRequestData.get("payer[first_name]", "");
mLastName = mRequestData.get("payer[last_name]", "");
int group_id = 0;
if (ServerConfig::g_devDefaultGroup != "") {
auto groups = controller::Group::load(ServerConfig::g_devDefaultGroup);
if (groups.size() == 1) {
group_id = groups[0]->getModel()->getID();
}
}
auto newUser = controller::User::create(mEmail, mFirstName, mLastName, group_id);
/* printf("LastName: %s\n", mLastName.data());
for (int i = 0; i < mLastName.size(); i++) {
char c = mLastName.data()[i];
printf("%d ", c);
}
printf("\n\n");
*/
// validate input
if (!validateInput()) {
// if input is invalid we can stop now
addError(param_error_order_id);
sendErrorsAsEmail();
return -1;
}
// if user exist we can stop now
if (getUserIdFromDB()) {
//addError(param_error_order_id);
//sendErrorsAsEmail();
return -2;
}
// if user with this email didn't exist
// we can create a new user and send a email to him
// prepare email in advance
// create connection to email server
// UniLib::controller::TaskPtr prepareEmail(new PrepareEmailTask(ServerConfig::g_CPUScheduler));
// prepareEmail->scheduleTask(prepareEmail);
// write user entry into db
//writeUserIntoDB();
newUser->getModel()->insertIntoDB(true);
// get user id from db
//int user_id = getUserIdFromDB(true);
int user_id = newUser->getModel()->getID();
// we didn't get a user_id, something went wrong
// maybe user already exist
if (!user_id) {
addError(new Error("User loadEntryDBId", "user_id is zero"));
addError(param_error_order_id);
sendErrorsAsEmail();
return -3;
}
// email verification code
auto emailVerification = controller::EmailVerificationCode::create(user_id, model::table::EMAIL_OPT_IN_REGISTER_DIRECT);
//Poco::AutoPtr<model::table::EmailOptIn> emailVerification(new model::table::EmailOptIn(user_id));
// create email verification code
if (!emailVerification->getModel()->getCode()) {
// exit if email verification code is empty
addError(new Error("Email verification", "code is empty, error in random?"));
addError(param_error_order_id);
sendErrorsAsEmail();
return -4;
}
auto em = EmailManager::getInstance();
if (emailVerification->getModel()->insertIntoDB(false)) {
int noEMail = 0;
DataTypeConverter::strToInt(mRequestData.get("noEmail", "0"), noEMail);
if (noEMail != 1) {
emailVerification->setBaseUrl(ServerConfig::g_serverPath + "/checkEmail");
em->addEmail(new model::Email(emailVerification, newUser, model::EMAIL_USER_VERIFICATION_CODE));
}
}
}
// if errors occured, send via email
if (errorCount() > 1) {
addError(param_error_order_id);
sendErrorsAsEmail();
}
else {
delete param_error_order_id;
}
return 0;
}

View File

@ -1,40 +0,0 @@
#ifndef Elopage_Webhook_INCLUDED
#define Elopage_Webhook_INCLUDED
#include "PageRequestMessagedHandler.h"
#include "../tasks/CPUTask.h"
#include "../lib/NotificationList.h"
#include "Poco/Net/NameValueCollection.h"
class ElopageWebhook : public PageRequestMessagedHandler
{
public:
void handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response);
};
class HandleElopageRequestTask : public UniLib::controller::CPUTask, protected NotificationList
{
public:
HandleElopageRequestTask(Poco::Net::NameValueCollection& requestData);
const char* getResourceType() const { return "HandleElopageRequestTask"; };
int run();
protected:
// return true if at least one entry in db with this email exist
bool validateInput();
void writeUserIntoDB();
int getUserIdFromDB(bool checkEmail = false);
Poco::Net::NameValueCollection mRequestData;
std::string mEmail;
std::string mFirstName;
std::string mLastName;
};
#endif // Elopage_Webhook_INCLUDED

View File

@ -1,67 +0,0 @@
#include "ElopageWebhookLight.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Net/HTTPServerResponse.h"
#include "Poco/URI.h"
#include "Poco/Logger.h"
#include "Poco/Data/Binding.h"
#include "Poco/FileStream.h"
void ElopageWebhookLight::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response)
{
// simply write request to file for later lookup
//ServerConfig::writeToFile(request.stream(), "elopage_webhook_requests.txt");
// empty response, we didn't need to set anything
//response.setStatus(Poco::Net::HTTPResponse::HTTP_NO_CONTENT);
std::ostream& _responseStream = response.send();
_responseStream << "200 OK";
// don't use it anymore, register now direct
// elopage request are only logged from gpt server
return;
std::istream& stream = request.stream();
std::string completeRequest;
Poco::Net::NameValueCollection elopageRequestData;
int breakCount = 100;
while (stream.good() && breakCount > 0) {
// char dummy;
std::string line;
std::getline(stream, line);
completeRequest += line;
stream.good();
breakCount--;
}
// write stream result also to file
static Poco::Mutex mutex;
Profiler timeUsed;
mutex.lock();
Poco::FileOutputStream file("elopage_webhook_requests_2.txt", std::ios::out | std::ios::app);
if (!file.good()) {
Poco::Logger& logging(Poco::Logger::get("errorLog"));
logging.error("[ElopageWebhookLight::handleRequest] error creating file with name: elopage_webhook_requests_2.txt");
//printf("[ElopageWebhook::handleRequest] error creating file with name: elopage_webhook_requests.txt\n");
mutex.unlock();
return;
}
Poco::LocalDateTime now;
std::string dateTimeStr = Poco::DateTimeFormatter::format(now, Poco::DateTimeFormat::ISO8601_FORMAT);
file << dateTimeStr << std::endl;
file << completeRequest << std::endl;
file << std::endl;
file.close();
std::string timeUsedStr = timeUsed.string();
printf("[%s] time for elopage request light write to file and maybe wait on lock: %s\n", dateTimeStr.data(), timeUsedStr.data());
mutex.unlock();
}

View File

@ -1,16 +0,0 @@
#ifndef Elopage_Webhook_LIGHT_INCLUDED
#define Elopage_Webhook_LIGHT_INCLUDED
#include "PageRequestMessagedHandler.h"
class ElopageWebhookLight : public PageRequestMessagedHandler
{
public:
void handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response);
};
#endif // Elopage_Webhook_LIGHT_INCLUDED

View File

@ -1,48 +0,0 @@
#include "HandleFileRequest.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Net/HTTPServerResponse.h"
#include "Poco/DeflatingStream.h"
#include "Poco/FileStream.h"
void HandleFileRequest::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response)
{
response.setChunkedTransferEncoding(true);
std::string uri = request.getURI();
// check endung
size_t last_point = uri.find_last_of('.');
std::string endung = uri.substr(last_point+1);
std::string mediaType;
//printf("endung: %s\n", endung.data());
if (endung == "css") {
mediaType = "text/css";
}
else if (endung == "js") {
mediaType = "text/javascript";
}
else if (endung == "ico") {
mediaType = "image/x-icon";
}
std::string path = "data" + uri;
printf("file path: %s\n", path.data());
try {
response.sendFile(path, mediaType);
}
catch (...) {
std::ostream& _responseStream = response.send();
_responseStream << "Error, file not found";
}
/*
bool _compressResponse(request.hasToken("Accept-Encoding", "gzip"));
if (_compressResponse) response.set("Content-Encoding", "gzip");
std::ostream& _responseStream = response.send();
Poco::DeflatingOutputStream _gzipStream(_responseStream, Poco::DeflatingStreamBuf::STREAM_GZIP, 1);
std::ostream& responseStream = _compressResponse ? _gzipStream : _responseStream;
responseStream << new Poco::FileInputStream("./data/" + uri);
if (_compressResponse) _gzipStream.close();
*/
}

View File

@ -1,18 +0,0 @@
#ifndef HandleFileRequest_INCLUDED
#define HandleFileRequest_INCLUDED
#include "Poco/Net/HTTPRequestHandler.h"
class HandleFileRequest : public Poco::Net::HTTPRequestHandler
{
public:
void handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response);
protected:
};
#endif // HandleFileRequest_INCLUDED

View File

@ -1,352 +0,0 @@
#include "PageRequestHandlerFactory.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Net/HTMLForm.h"
#include "Poco/DateTime.h"
#include "Poco/DateTimeFormatter.h"
#include "ConfigPage.h"
#include "LoginPage.h"
#include "HandleFileRequest.h"
#include "DashboardPage.h"
#include "CheckEmailPage.h"
#include "PassphrasePage.h"
#include "SaveKeysPage.h"
#include "TestUserGenerator.h"
#include "ElopageWebhook.h"
#include "ElopageWebhookLight.h"
#include "UserUpdatePasswordPage.h"
#include "UserUpdateGroupPage.h"
#include "Error500Page.h"
#include "CheckTransactionPage.h"
#include "ResetPasswordPage.h"
#include "RegisterAdminPage.h"
#include "DebugPassphrasePage.h"
#include "DebugMnemonicPage.h"
#include "AdminCheckUserBackupPage.h"
#include "TranslatePassphrasePage.h"
#include "AdminUserPasswordResetPage.h"
#include "RegisterDirectPage.h"
#include "AdminGroupsPage.h"
#include "DecodeTransactionPage.h"
#include "../SingletonManager/SessionManager.h"
#include "../lib/Profiler.h"
#include "../lib/DataTypeConverter.h"
#include "../ServerConfig.h"
#include "../Crypto/DRRandom.h"
PageRequestHandlerFactory::PageRequestHandlerFactory()
: mRemoveGETParameters("^/([a-zA-Z0-9_-]*)"), mLogging(Poco::Logger::get("requestLog"))
{
ServerConfig::g_ServerKeySeed->put(8, DRRandom::r64());
}
Poco::Net::HTTPRequestHandler* PageRequestHandlerFactory::basicSetup(PageRequestMessagedHandler* handler, const Poco::Net::HTTPServerRequest& request, Profiler profiler)
{
handler->setHost(request.getHost());
handler->setProfiler(profiler);
auto login_server_path = request.find("grd-login-server-path");
if (login_server_path != request.end()) {
handler->setLoginServerPath("/" + login_server_path->second);
}
return handler;
}
Poco::Net::HTTPRequestHandler* PageRequestHandlerFactory::createRequestHandler(const Poco::Net::HTTPServerRequest& request)
{
//printf("request uri: %s\n", request.getURI().data());
Profiler timeUsed;
std::string uri = request.getURI();
std::string url_first_part;
std::string dateTimeString = Poco::DateTimeFormatter::format(Poco::DateTime(), "%d.%m.%y %H:%M:%S");
mRemoveGETParameters.extract(uri, url_first_part);
std::string externReferer;
if (uri != "/favicon.ico") {
//printf("[PageRequestHandlerFactory] uri: %s, first part: %s\n", uri.data(), url_first_part.data());
auto referer = request.find("Referer");
auto host = request.find("Host");
if (referer != request.end() && host != request.end()) {
//printf("referer: %s\n", referer->second.data());
auto refererString = referer->second;
auto hostString = host->second;
if (refererString.find(hostString) == refererString.npos) {
externReferer = refererString;
}
}//*/
}
if (url_first_part == "/elopage_webhook_261") {
mLogging.information(dateTimeString + " call from elopage");
return basicSetup(new ElopageWebhook, request, timeUsed);
}
if (url_first_part == "/elopage_webhook_211") {
mLogging.information(dateTimeString + " call from elopage light");
return basicSetup(new ElopageWebhookLight, request, timeUsed);
}
// check if user has valid session
Poco::Net::NameValueCollection cookies;
request.getCookies(cookies);
int session_id = 0;
try {
session_id = atoi(cookies.get("GRADIDO_LOGIN").data());
} catch (...) {}
auto sm = SessionManager::getInstance();
auto s = sm->getSession(session_id);
// for debugging
std::stringstream logStream;
auto referer = request.find("Referer");
logStream << dateTimeString << " call " << uri;
if (s) {logStream << ", with session: " << std::to_string(s->getHandle()); }
if (referer != request.end()) { logStream << ", from: " << referer->second;}
mLogging.information(logStream.str());
// end debugging
// TODO: count invalid session requests from IP and block IP for some time to prevent brute force session hijacking
// or use log file and configure fail2ban for this to do
if (url_first_part == "/checkEmail") {
//return new CheckEmailPage(s);
//printf("url checkEmail\n");
// if (!s) {
return handleCheckEmail(s, uri, request, timeUsed);
// }
//printf("skip handleCheckEmail\n");
}
/*if (url_first_part == "/register") {
auto pageRequestHandler = new RegisterPage;
pageRequestHandler->setProfiler(timeUsed);
return pageRequestHandler;
}*/
if (url_first_part.size() >= 9 && url_first_part.substr(0,9) == "/register") {
//if (url_first_part == "/register" || url_first_part == "/registerDirect" ) {
return basicSetup(new RegisterDirectPage, request, timeUsed);
}
if (url_first_part == "/resetPassword") {
return basicSetup(new ResetPasswordPage, request, timeUsed);
}
if (url_first_part == "/decode_transaction") {
mLogging.information(dateTimeString + " decode");
return basicSetup(new DecodeTransactionPage(s), request, timeUsed);
}
if (s) {
if (externReferer != "") {
s->setLastReferer(externReferer);
}
model::table::User* userModel = nullptr;
auto newUser = s->getNewUser();
if (newUser) userModel = newUser->getModel();
if (s->errorCount() || (userModel && userModel->errorCount())) {
if (userModel && userModel->errorCount()) {
s->getErrors(userModel);
}
s->sendErrorsAsEmail();
return basicSetup(new Error500Page(s), request, timeUsed);
}
if (url_first_part == "/error500") {
return basicSetup(new Error500Page(s), request, timeUsed);
}
if (url_first_part == "/userUpdateGroup") {
return basicSetup(new UserUpdateGroupPage(s), request, timeUsed);
}
if (url_first_part == "/transform_passphrase") {
return basicSetup(new TranslatePassphrasePage(s), request, timeUsed);
}
if (userModel && userModel->getRole() == model::table::ROLE_ADMIN) {
if (url_first_part == "/adminRegister") {
return basicSetup(new RegisterAdminPage(s), request, timeUsed);
}
if (url_first_part == "/debugPassphrase") {
return basicSetup(new DebugPassphrasePage(s), request, timeUsed);
}
if (url_first_part == "/debugMnemonic") {
return basicSetup(new DebugMnemonicPage(s), request, timeUsed);
}
if (url_first_part == "/checkUserBackups") {
return basicSetup(new AdminCheckUserBackupPage(s), request, timeUsed);
}
if (url_first_part == "/adminUserPasswordReset") {
return basicSetup(new AdminUserPasswordResetPage(s), request, timeUsed);
}
if (url_first_part == "/groups") {
return basicSetup(new AdminGroupsPage(s), request, timeUsed);
}
}
if(url_first_part == "/logout") {
sm->releaseSession(s);
// remove cookie(s)
//printf("session released\n");
return basicSetup(new LoginPage(nullptr), request, timeUsed);
}
if(url_first_part == "/user_delete") {
if(s->deleteUser()) {
sm->releaseSession(s);
return basicSetup(new LoginPage(nullptr), request, timeUsed);
}
}
auto sessionState = s->getSessionState();
//printf("session state: %s\n", s->getSessionStateString());
if (url_first_part == "/updateUserPassword") {
return basicSetup(new UserUpdatePasswordPage(s), request, timeUsed);
}
if (url_first_part == "/checkTransactions") {
return basicSetup(new CheckTransactionPage(s), request, timeUsed);
}
if(s && newUser && newUser->hasPassword() && newUser->hasPublicKey()) {
//printf("[PageRequestHandlerFactory] go to dashboard page with user\n");
return basicSetup(new DashboardPage(s), request, timeUsed);
}
if (url_first_part == "/login" || url_first_part == "/") {
return basicSetup(new LoginPage(s), request, timeUsed);
}
} else {
if (url_first_part == "/config") {
return new ConfigPage;
}
else if (url_first_part == "/login") {
return basicSetup(new LoginPage(nullptr), request, timeUsed);
}
}
if (ServerConfig::g_ServerSetupType != ServerConfig::SERVER_TYPE_PRODUCTION) {
if (url_first_part == "/testUserGenerator") {
return basicSetup(new TestUserGenerator, request, timeUsed);
}
}
return basicSetup(new LoginPage(nullptr), request, timeUsed);
//return new HandleFileRequest;
//return new PageRequestHandlerFactory;
}
Poco::Net::HTTPRequestHandler* PageRequestHandlerFactory::handleCheckEmail(Session* session, const std::string uri, const Poco::Net::HTTPServerRequest& request, Profiler timeUsed)
{
Poco::Net::HTMLForm form(request);
unsigned long long verificationCode = 0;
Languages lang = LANG_DE;
// if verification code is valid, go to next page, passphrase
// login via verification code, if no session is active
// try to get code from form get parameter
if (!form.empty()) {
try {
verificationCode = stoull(form.get("email-verification-code", "0"));
} catch (...) {}
lang = LanguageManager::languageFromString(form.get("lang-btn", "de"));
}
// try to get code from uri parameter
if (!verificationCode) {
size_t pos = uri.find_last_of("/");
auto str = uri.substr(pos + 1);
DataTypeConverter::strToInt(str, verificationCode);
}
// if no verification code given or error with given code, show form
if (!verificationCode) {
return basicSetup(new CheckEmailPage(session), request, timeUsed);
}
// we have a verification code, now let's check that thing
auto sm = SessionManager::getInstance();
// no session or active session don't belong to verification code
if (!session || session->getEmailVerificationCode() != verificationCode) {
//sm->releaseSession(session);
//session = nullptr;
// it is maybe unsafe
session = sm->findByEmailVerificationCode(verificationCode);
}
// no suitable session in memory, try to create one from db data
if (!session) {
session = sm->getNewSession();
session->setLanguage(lang);
if (session->loadFromEmailVerificationCode(verificationCode)) {
// login not possible in this function, forwarded to PassphrasePage
/*auto cookie_id = session->getHandle();
auto user_host = request.clientAddress().host();
session->setClientIp(user_host);
response.addCookie(Poco::Net::HTTPCookie("user", std::to_string(cookie_id)));
*/
}
else {
//sm->releaseSession(session);
return basicSetup(new CheckEmailPage(session), request, timeUsed);
}
}
// suitable session found or created
if (session) {
auto user_host = request.clientAddress().host();
session->setClientIp(user_host);
assert(session->getNewUser());
if (!session->getNewUser()->getModel()->getPasswordHashed()) {
// user has no password, maybe account created from elopage webhook
return basicSetup(new UserUpdatePasswordPage(session), request, timeUsed);
}
/*
//! \return 1 = konto already exist
//! -1 = invalid code
//! -2 = critical error
//! 0 = ok
*/
// update session, mark as verified
int retUpdateEmailVerification = session->updateEmailVerification(verificationCode);
//printf("[%s] return from update email verification: %d\n", __FUNCTION__, retUpdateEmailVerification);
if (0 == retUpdateEmailVerification) {
//printf("[PageRequestHandlerFactory::handleCheckEmail] timeUsed: %s\n", timeUsed.string().data());
SessionHTTPRequestHandler* pageRequestHandler = nullptr;
if (model::table::EMAIL_OPT_IN_REGISTER_DIRECT == session->getEmailVerificationType() ||
model::table::EMAIL_OPT_IN_REGISTER == session->getEmailVerificationType()) {
//printf("return check email page\n");
pageRequestHandler = new CheckEmailPage(session);
} else if(SESSION_STATE_RESET_PASSWORD_REQUEST == session->getSessionState()) {
pageRequestHandler = new UserUpdatePasswordPage(session);
} else {
pageRequestHandler = new PassphrasePage(session);
}
return basicSetup(pageRequestHandler, request, timeUsed);
}
else if (1 == retUpdateEmailVerification) {
//auto user = session->getUser();
//LoginPage* loginPage = new LoginPage(session);
//loginPage->setProfiler(timeUsed);
return basicSetup(new CheckEmailPage(session), request, timeUsed);
}
else if (-1 == retUpdateEmailVerification) {
auto checkEmail = new CheckEmailPage(session);
checkEmail->getErrors(session);
sm->releaseSession(session);
return basicSetup(checkEmail, request, timeUsed);
}
else if (-2 == retUpdateEmailVerification) {
return basicSetup(new Error500Page(session), request, timeUsed);
}
}
if (session) {
sm->releaseSession(session);
}
return basicSetup(new CheckEmailPage(nullptr), request, timeUsed);
}

View File

@ -1,28 +0,0 @@
#ifndef __DR_PAGE_REQUEST_HANDLER_FACTORY_H
#define __DR_PAGE_REQUEST_HANDLER_FACTORY_H
#include "Poco/Net/HTTPRequestHandlerFactory.h"
#include "Poco/RegularExpression.h"
#include "Poco/Logger.h"
#include "../model/Session.h"
#include "../lib/Profiler.h"
#include "PageRequestMessagedHandler.h"
#define HTTP_PAGES_COUNT 1
class PageRequestHandlerFactory : public Poco::Net::HTTPRequestHandlerFactory
{
public:
PageRequestHandlerFactory();
Poco::Net::HTTPRequestHandler* createRequestHandler(const Poco::Net::HTTPServerRequest& request);
protected:
Poco::Net::HTTPRequestHandler* handleCheckEmail(Session* session, const std::string uri, const Poco::Net::HTTPServerRequest& request, Profiler timeUsed);
Poco::Net::HTTPRequestHandler* basicSetup(PageRequestMessagedHandler* handler, const Poco::Net::HTTPServerRequest& request, Profiler profiler);
Poco::RegularExpression mRemoveGETParameters;
Poco::Logger& mLogging;
};
#endif // __DR_PAGE_REQUEST_HANDLER_FACTORY_H

View File

@ -1,94 +0,0 @@
#include "PageRequestMessagedHandler.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "../ServerConfig.h"
//const Poco::RegularExpression PageRequestMessagedHandler::mDetectLanguageGET("^(?:/[a-zA-Z0-9_-]*)?/(en|de)");
// detect also lang field from form get
const Poco::RegularExpression PageRequestMessagedHandler::mDetectLanguageGET("^(?:/[a-zA-Z0-9/_-]*)?(?:/(en|de)|\\?.*lang=(en|de))");
PageRequestMessagedHandler::PageRequestMessagedHandler()
: mLoginServerPath("/account")
{
}
Languages PageRequestMessagedHandler::chooseLanguage(Poco::Net::HTTPServerRequest& request, std::string lang_btn /*= ""*/)
{
// from Form
Languages lang = LanguageManager::languageFromString(lang_btn);
if (lang == LANG_NULL) {
// from URL
std::string uri = request.getURI();
std::vector<std::string> matches;
//std::string lang_str;
mDetectLanguageGET.split(uri, matches);
if (matches.size() > 0) {
//for (auto it = matches.begin(); it != matches.end(); it++) {
// printf("Matches: %s\n", it->data());
//}
lang = LanguageManager::languageFromString(matches[matches.size()-1]);
}
else {
// from Header
/*
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
$acceptLang = ['fr', 'it', 'en'];
$lang = in_array($lang, $acceptLang) ? $lang : 'en';
*/
std::string accept_languages = request.get("HTTP_ACCEPT_LANGUAGE", "");
//printf("[PageRequestMessagedHandler::chooseLanguage] accept header: %s\n", accept_languages.data());
}
}
if (lang == LANG_NULL) {
//lang = ServerConfig::g_default_locale;
}
return lang;
}
unsigned long long PageRequestMessagedHandler::getLastGetAsU64(const std::string& uri)
{
unsigned long long result = 0;
size_t pos = uri.find_last_of("/");
try {
auto str = uri.substr(pos + 1);
result = stoull(uri.substr(pos + 1));
}
catch (const std::invalid_argument& ia) {
std::cerr << __FUNCTION__ << " Invalid argument: " << ia.what() << ", str: " << uri.substr(pos + 1) << '\n';
return 0;
}
catch (const std::out_of_range& oor) {
std::cerr << __FUNCTION__ << " Out of Range error: " << oor.what() << '\n';
return 0;
}
catch (const std::logic_error & ler) {
std::cerr << __FUNCTION__ << " Logical error: " << ler.what() << '\n';
return 0;
}
catch (...) {
std::cerr << __FUNCTION__ << " Unknown error" << '\n';
return 0;
}
return result;
}
std::string PageRequestMessagedHandler::getBaseUrl()
{
if (ServerConfig::g_ServerSetupType == ServerConfig::SERVER_TYPE_TEST) {
return "http://" + mHost + mLoginServerPath;
}
return "https://" + mHost + mLoginServerPath;
}
std::string PageRequestMessagedHandler::getHost()
{
if (ServerConfig::g_ServerSetupType == ServerConfig::SERVER_TYPE_TEST) {
return "http://" + mHost;
}
return "https://" + mHost;
}

View File

@ -1,41 +0,0 @@
#ifndef PAGE_REQUEST_MESSAGE_HANDLER_INCLUDED
#define PAGE_REQUEST_MESSAGE_HANDLER_INCLUDED
#include "../model/Session.h"
#include "../lib/NotificationList.h"
#include "../lib/Profiler.h"
#include "../SingletonManager/LanguageManager.h"
#include "Poco/Net/HTTPRequestHandler.h"
#include "Poco/Net/HTMLForm.h"
#include "Poco/RegularExpression.h"
class PageRequestMessagedHandler : public Poco::Net::HTTPRequestHandler, public NotificationList
{
public:
PageRequestMessagedHandler();
inline void setProfiler(Profiler profiler) { mTimeProfiler = profiler; }
inline void setHost(const std::string &host) { mHost = host; }
inline void setLoginServerPath(const std::string& loginServerPath) { mLoginServerPath = loginServerPath; }
//Poco::Net::HTTPRequestHandler* createRequestHandler(const Poco::Net::HTTPServerRequest& request);
protected:
static const Poco::RegularExpression mDetectLanguageGET;
inline const char* gettext(Session* session, const char* text) { if (!session || !session->getLanguageCatalog()) return text; return session->getLanguageCatalog()->gettext(text); }
virtual Languages chooseLanguage(Poco::Net::HTTPServerRequest& request, std::string lang_btn = "");
unsigned long long getLastGetAsU64(const std::string& uri);
std::string getBaseUrl();
std::string getHost();
Profiler mTimeProfiler;
std::string mHost;
std::string mLoginServerPath;
};
#endif // PAGE_REQUEST_MESSAGE_HANDLER_INCLUDED

View File

@ -1,26 +0,0 @@
#include "SessionHTTPRequestHandler.h"
Languages SessionHTTPRequestHandler::chooseLanguage(Poco::Net::HTTPServerRequest& request, std::string lang_btn /*= ""*/)
{
Languages lang = LANG_NULL;
if (mSession) {
lang = mSession->getLanguage();
}
Languages langCurrent = PageRequestMessagedHandler::chooseLanguage(request, lang_btn);
if (langCurrent != LANG_NULL && lang != langCurrent) {
lang = langCurrent;
if (mSession) {
mSession->setLanguage(langCurrent);
}
}
return lang;
}

View File

@ -1,23 +0,0 @@
#ifndef SESSION_HTTP_REQUEST_HANDLER_INCLUDED
#define SESSION_HTTP_REQUEST_HANDLER_INCLUDED
#include "../model/Session.h"
#include "PageRequestMessagedHandler.h"
class SessionHTTPRequestHandler : public PageRequestMessagedHandler
{
public:
SessionHTTPRequestHandler(Session* session) : mSession(session) {}
protected:
Session* mSession;
Languages chooseLanguage(Poco::Net::HTTPServerRequest& request, std::string lang_btn = "");
inline const char* gettext(const char* text) { if (!mSession || !mSession->getLanguageCatalog()) return text; return mSession->getLanguageCatalog()->gettext(text); }
};
#endif // SESSION_HTTP_REQUEST_HANDLER_INCLUDED

View File

@ -1,113 +0,0 @@
#include "ImportantTests.h"
#include <string>
#include "ServerConfig.h"
//#include "Crypto/KeyPair.h"
#include "Crypto/KeyPairEd25519.h"
#include "lib/DataTypeConverter.h"
namespace ImportantTests {
bool validateKeyPairED25519(const std::string& passphrase, const Mnemonic* wordSource, const std::string& public_key_hex)
{
Poco::AutoPtr<Passphrase> passphrase_obj = new Passphrase(passphrase, wordSource);
//passphrase_obj->getWordIndices();
passphrase_obj->getWordIndices();
auto gradido_key_pair = std::unique_ptr<KeyPairEd25519>(KeyPairEd25519::create(passphrase_obj));
auto gradido_key_pair_public_hex = DataTypeConverter::pubkeyToHex(gradido_key_pair->getPublicKey());
if (gradido_key_pair_public_hex != public_key_hex) {
return false;
}
return true;
}
bool passphraseGenerationAndTransformation()
{
auto de_words = &ServerConfig::g_Mnemonic_WordLists[ServerConfig::MNEMONIC_GRADIDO_BOOK_GERMAN_RANDOM_ORDER];
auto de2_words = &ServerConfig::g_Mnemonic_WordLists[ServerConfig::MNEMONIC_GRADIDO_BOOK_GERMAN_RANDOM_ORDER_FIXED_CASES];
auto en_words = &ServerConfig::g_Mnemonic_WordLists[ServerConfig::MNEMONIC_BIP0039_SORTED_ORDER];
std::string passphrase_1_de = u8"beziffern Anbeginn häkeln Sozialabgaben Rasen fließen Frau weltweit Urlaub Urwissen Lohn plötzlich Gefrierpunkt Derartig Biedermeier getragen denken Realisierung Boden maximal voneinander Fördern Braten Entlastung";
std::string passphrase_1_en = "boil banner regret since goat awful crane imitate myth clump rally offer train airport purpose machine helmet ahead alley gesture load scrub river glory";
std::string passphrase_1_pubkey_hex = "cfce9cfad355ceb8c099a97f55a2bd7aa8d2bd0b86970f7d1e135be9e1da5eb7";
std::string passphrase_2_de = u8"dazu Zyklus Danach Auge losfliegen besprechen stoßen ohne heutige Begründung Dogma Erkenntnis genießen Medaille Äste Google woher Sprache Pädagoge Schweigen rasant Sekunde nahm Nordstern";
std::string passphrase_2_en = "place oblige gain jar neither note cry riot empty inform egg skate suffer garlic lake ladder liquid focus gorilla subject strong much oyster reduce";
std::string passphrase_2_pubkey_hex = "3d547825bb53465579b95560981f444105495f2b6a68134fbec28ce518ac7b38";
// test old key pair implementation
//KeyPair keys;
bool errorsOccured = false;
std::string filtered_1_de = Passphrase::filter(passphrase_1_de);
KeyPairEd25519* keys = nullptr;
keys = KeyPairEd25519::create(Passphrase::create(filtered_1_de, de_words));
std::string public_key_hex = keys->getPublicKeyHex();
if (std::string(public_key_hex.data(), public_key_hex.size() - 1) != passphrase_1_pubkey_hex) {
printf("1 de incorrect\n");
errorsOccured = true;
}
delete keys;
keys = KeyPairEd25519::create(Passphrase::create(passphrase_1_en, en_words));
public_key_hex = keys->getPublicKeyHex();
if (std::string(public_key_hex.data(), public_key_hex.size() - 1) != passphrase_1_pubkey_hex) {
printf("1 en incorrect\n");
errorsOccured = true;
}
std::string filtered_2_de = Passphrase::filter(passphrase_2_de);
delete keys;
keys = KeyPairEd25519::create(Passphrase::create(filtered_2_de, de_words));
public_key_hex = keys->getPublicKeyHex();
if (std::string(public_key_hex.data(), public_key_hex.size() - 1) != passphrase_2_pubkey_hex) {
printf("2 de incorrect\n");
errorsOccured = true;
}
delete keys;
keys = KeyPairEd25519::create(Passphrase::create(passphrase_2_en, en_words));
public_key_hex = keys->getPublicKeyHex();
if (std::string(public_key_hex.data(), public_key_hex.size() - 1) != passphrase_2_pubkey_hex) {
printf("2 en incorrect\n");
errorsOccured = true;
}
// test new key pair implementation
if (!validateKeyPairED25519(passphrase_1_de, de_words, passphrase_1_pubkey_hex)) {
printf("new 1 de incorrect\n");
errorsOccured = true;
}
if (!validateKeyPairED25519(passphrase_1_en, en_words, passphrase_1_pubkey_hex)) {
printf("new 1 en incorrect\n");
errorsOccured = true;
}
if (!validateKeyPairED25519(passphrase_2_de, de_words, passphrase_2_pubkey_hex)) {
printf("new 2 de incorrect\n");
errorsOccured = true;
}
if (!validateKeyPairED25519(passphrase_2_en, en_words, passphrase_2_pubkey_hex)) {
printf("new 2 en incorrect\n");
errorsOccured = true;
}
/*Poco::AutoPtr<Passphrase> passphrase_1_de_obj = new Passphrase(passphrase_1_de, de_words);
Poco::AutoPtr<Passphrase> passphrase_1_en_obj = new Passphrase(passphrase_1_en, en_words);
Poco::AutoPtr<Passphrase> passphrase_2_de_obj = new Passphrase(passphrase_2_de, de_words);
Poco::AutoPtr<Passphrase> passphrase_2_en_obj = new Passphrase(passphrase_2_en, en_words);
auto gradido_key_pair_1_de = std::unique_ptr<KeyPairEd25519>(KeyPairEd25519::create(passphrase_1_de_obj));
auto gradido_key_pair_1_de_public_hex = DataTypeConverter::pubkeyToHex(gradido_key_pair_1_de->getPublicKey());
if (gradido_key_pair_1_de_public_hex != passphrase_1_pubkey_hex) {
printf("gradido key 1 de incorrect\n");
errorsOccured = true;
}
auto gradido_key_pair_1_en = std::unique_ptr<KeyPairEd25519>(KeyPairEd25519::create(passphrase_1_en_obj));
if(DataTypeConverter::pubkeyToHex())
*/
if (!errorsOccured) return true;
return false;
}
}

View File

@ -1,12 +0,0 @@
#ifndef __GRADIDO_LOGIN_SERVER_IMPORTANT_TESTS_H
#define __GRADIDO_LOGIN_SERVER_IMPORTANT_TESTS_H
#include <string>
#include "Crypto/mnemonic.h"
namespace ImportantTests {
bool validateKeyPairED25519(const std::string& passphrase, const Mnemonic* wordSource, const std::string& public_key_hex);
bool passphraseGenerationAndTransformation();
};
#endif //__GRADIDO_LOGIN_SERVER_IMPORTANT_TESTS_H

View File

@ -1,109 +0,0 @@
#include "JsonAdminEmailVerificationResend.h"
#include "Poco/URI.h"
#include "../SingletonManager/SessionManager.h"
#include "../SingletonManager/EmailManager.h"
#include "../controller/User.h"
#include "../controller/EmailVerificationCode.h"
#include "../lib/DataTypeConverter.h"
Poco::JSON::Object* JsonAdminEmailVerificationResend::handle(Poco::Dynamic::Var params)
{
std::string email;
int session_id = 0;
bool parameterReaded = false;
// if is json object
if (params.type() == typeid(Poco::JSON::Object::Ptr)) {
Poco::JSON::Object::Ptr paramJsonObject = params.extract<Poco::JSON::Object::Ptr>();
/// Throws a RangeException if the value does not fit
/// into the result variable.
/// Throws a NotImplementedException if conversion is
/// not available for the given type.
/// Throws InvalidAccessException if Var is empty.
try {
paramJsonObject->get("email").convert(email);
paramJsonObject->get("session_id").convert(session_id);
parameterReaded = true;
}
catch (Poco::Exception& ex) {
return stateError("json exception", ex.displayText());
}
}
else if (params.isStruct()) {
auto _email = params["email"];
auto _session_id = params["session_id"];
parameterReaded = true;
//std::string miau = params["miau"];
}
else if (params.isVector()) {
const Poco::URI::QueryParameters queryParams = params.extract<Poco::URI::QueryParameters>();
for (auto it = queryParams.begin(); it != queryParams.end(); it++) {
if (it->first == "email") {
email = it->second;
break;
}
else if (it->first == "session_id") {
try {
auto numberParseResult = DataTypeConverter::strToInt(it->second, session_id);
if (DataTypeConverter::NUMBER_PARSE_OKAY != numberParseResult) {
return stateError("error parsing session_id", DataTypeConverter::numberParseStateToString(numberParseResult));
}
}
catch (Poco::Exception& ex) {
//printf("[JsonGetLogin::handle] exception: %s\n", ex.displayText().data());
return stateError("error parsing query params, Poco Error", ex.displayText());
}
}
}
parameterReaded = true;
}
if (!parameterReaded) {
return stateError("error reading parameter");
}
if ("" == email || 0 == session_id) {
return stateError("missing parameter");
}
auto sm = SessionManager::getInstance();
auto em = EmailManager::getInstance();
auto session = sm->getSession(session_id);
if (!session) {
return stateError("session not found");
}
auto user = session->getNewUser();
if(user.isNull()) {
return stateError("session hasn't valid user");
}
auto userModel = user->getModel();
if(model::table::ROLE_ADMIN != userModel->getRole()) {
return stateError("user isn't admin");
}
auto receiverUser = controller::User::create();
if (1 != receiverUser->load(email)) {
return stateError("receiver user not found");
}
if (receiverUser->getModel()->isEmailChecked()) {
return stateError("account already active");
}
auto emailVerification = controller::EmailVerificationCode::create(receiverUser->getModel()->getID(), model::table::EMAIL_OPT_IN_REGISTER);
if (emailVerification.isNull()) {
return stateError("no email verification code found");
}
emailVerification->getModel()->insertIntoDB(false);
emailVerification->setBaseUrl(ServerConfig::g_serverPath + "/checkEmail");
em->addEmail(new model::Email(emailVerification, receiverUser, model::EMAIL_ADMIN_USER_VERIFICATION_CODE_RESEND));
return stateSuccess();
}

View File

@ -1,16 +0,0 @@
#ifndef __JSON_VERIFICATION_EMAIL_RESEND_H
#define __JSON_VERIFICATION_EMAIL_RESEND_H
#include "JsonRequestHandler.h"
class JsonAdminEmailVerificationResend : public JsonRequestHandler
{
public:
Poco::JSON::Object* handle(Poco::Dynamic::Var params);
protected:
};
#endif // __JSON_VERIFICATION_EMAIL_RESEND_H

View File

@ -1,59 +0,0 @@
#include "JsonAppLogin.h"
#include "Poco/URI.h"
#include "../lib/DataTypeConverter.h"
#include "../controller/AppAccessToken.h"
#include "../controller/User.h"
#include "../SingletonManager/SessionManager.h"
Poco::JSON::Object* JsonAppLogin::handle(Poco::Dynamic::Var params)
{
Poco::UInt64 access_token_code;
if (params.isVector()) {
try {
const Poco::URI::QueryParameters queryParams = params.extract<Poco::URI::QueryParameters>();
for (auto it = queryParams.begin(); it != queryParams.end(); it++) {
if (it->first == "access_token") {
auto numberParseResult = DataTypeConverter::strToInt(it->second, access_token_code);
if (DataTypeConverter::NUMBER_PARSE_OKAY != numberParseResult) {
return stateError("error parsing access token", DataTypeConverter::numberParseStateToString(numberParseResult));
}
break;
}
}
//auto var = params[0];
}
catch (Poco::Exception& ex) {
return stateError("error parsing query params, Poco Error", ex.displayText());
}
}
auto sm = SessionManager::getInstance();
auto access_token = controller::AppAccessToken::load(access_token_code);
if (access_token.isNull()) {
return stateError("access token not found");
}
Poco::Timespan max_age;
max_age.assign(7, 0, 0, 0, 0);
if (access_token->getAge() > max_age) {
access_token->deleteFromDB();
return stateError("access token to old");
}
access_token->getModel()->update();
auto session = sm->getNewSession();
auto user = controller::User::create();
if (1 != user->load(access_token->getModel()->getUserId())) {
return stateError("access token invalid");
}
session->setUser(user);
Poco::JSON::Object* result = new Poco::JSON::Object;
result->set("state", "success");
result->set("session_id", session->getHandle());
return result;
}

View File

@ -1,16 +0,0 @@
#ifndef __JSON_INTERFACE_JSON_APP_LOGIN_H_
#define __JSON_INTERFACE_JSON_APP_LOGIN_H_
#include "JsonRequestHandler.h"
class JsonAppLogin : public JsonRequestHandler
{
public:
Poco::JSON::Object* handle(Poco::Dynamic::Var params);
protected:
};
#endif // __JSON_INTERFACE_JSON_APP_LOGIN_H_

View File

@ -1,46 +0,0 @@
#include "JsonAquireAccessToken.h"
#include "../SingletonManager/SessionManager.h"
#include "../controller/AppAccessToken.h"
#include "../controller/Group.h"
Poco::JSON::Object* JsonAquireAccessToken::handle(Poco::Dynamic::Var params)
{
if (!mSession || mSession->getNewUser().isNull()) {
auto session_result = checkAndLoadSession(params, true);
if (session_result) {
return session_result;
}
}
Poco::JSON::Object* result = new Poco::JSON::Object;
result->set("state", "success");
auto user = mSession->getNewUser();
auto user_id = user->getModel()->getID();
auto access_tokens = controller::AppAccessToken::load(user_id);
Poco::AutoPtr<controller::AppAccessToken> access_token;
if (access_tokens.size() > 0) {
access_token = access_tokens[0];
access_token->getModel()->update();
}
else {
access_token = controller::AppAccessToken::create(user_id);
// for a bit faster return
UniLib::controller::TaskPtr task = new model::table::ModelInsertTask(access_token->getModel(), false, true);
task->scheduleTask(task);
// default
//access_token->getModel()->insertIntoDB(false);
}
result->set("access_token", std::to_string(access_token->getModel()->getCode()));
auto group_base_url = user->getGroupBaseUrl();
auto group = controller::Group::load(user->getModel()->getGroupId());
if (!group.isNull()) {
result->set("group_base_url", group->getModel()->getUrl());
}
return result;
}

View File

@ -1,16 +0,0 @@
#ifndef __JSON_INTERFACE_JSON_ACQUIRE_ACCESS_TOKEN_
#define __JSON_INTERFACE_JSON_ACQUIRE_ACCESS_TOKEN_
#include "JsonRequestHandler.h"
class JsonAquireAccessToken : public JsonRequestHandler
{
public:
Poco::JSON::Object* handle(Poco::Dynamic::Var params);
protected:
};
#endif // __JSON_INTERFACE_JSON_ACQUIRE_ACCESS_TOKEN_

View File

@ -1,53 +0,0 @@
#include "JsonCheckSessionState.h"
#include "Poco/URI.h"
#include "../lib/DataTypeConverter.h"
#include "../SingletonManager/SessionManager.h"
Poco::JSON::Object* JsonCheckSessionState::handle(Poco::Dynamic::Var params)
{
int session_id = 0;
bool parameterReaded = false;
// if is json object
if (params.type() == typeid(Poco::JSON::Object::Ptr)) {
Poco::JSON::Object::Ptr paramJsonObject = params.extract<Poco::JSON::Object::Ptr>();
/// Throws a RangeException if the value does not fit
/// into the result variable.
/// Throws a NotImplementedException if conversion is
/// not available for the given type.
/// Throws InvalidAccessException if Var is empty.
try {
paramJsonObject->get("session_id").convert(session_id);
parameterReaded = true;
}
catch (Poco::Exception& ex) {
return stateError("json exception", ex.displayText());
}
}
else if (params.isVector()) {
const Poco::URI::QueryParameters queryParams = params.extract<Poco::URI::QueryParameters>();
for (auto it = queryParams.begin(); it != queryParams.end(); it++) {
if (it->first == "session_id") {
DataTypeConverter::strToInt(it->second, session_id);
//session_id = it->second;
break;
}
}
parameterReaded = true;
}
else {
return stateError("format not implemented", std::string(params.type().name()));
}
if (!parameterReaded) {
return stateError("parameter couldn't parsed");
}
auto sm = SessionManager::getInstance();
auto session = sm->getSession(session_id);
if (session) {
return stateSuccess();
}
else {
return customStateError("not found", "session not found");
}
}

View File

@ -1,16 +0,0 @@
#ifndef __JSON_INTERFACE_JSON_CHECK_SESSION_STATE_
#define __JSON_INTERFACE_JSON_CHECK_SESSION_STATE_
#include "JsonRequestHandler.h"
class JsonCheckSessionState : public JsonRequestHandler
{
public:
Poco::JSON::Object* handle(Poco::Dynamic::Var params);
protected:
};
#endif // __JSON_INTERFACE_JSON_CHECK_SESSION_STATE_

Some files were not shown because too many files have changed in this diff Show More