PHP Classes

File: launcher/launcher.cpp

Recommend this page to a friend!
  Classes of André Liechti  >  multiOTP PHP class  >  launcher/launcher.cpp  >  Download  
File: launcher/launcher.cpp
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: multiOTP PHP class
Authenticate and manage OTP strong user tokens
Author: By
Last change: New release
ENH: Better docker support (also for Synology)
ENH: Add Raspberry Pi Bullseye 11.0 support
New release
FIX: Token "Without2FA" where not working all time with LDAP users
ENH: Embedded Windows nginx edition updated to version 1.21.6
ENH: Embedded Windows PHP edition updated to version 7.4.29
ENH: New MariaDB/MySQL indexes handling during schema creation and schema updates
ENH: Enhanced internal tests
ENH: Telnyx SMS provider support
ENH: PHP 7.4 deprecated code cleaned
ENH: Email token is now supported for Credential Provider
ENH: In CLI check, if username doesn't exist, it try automatically a shorter domain name step by step
ENH: Enhanced multiOTP Credential Provider support
ENH: VM version 011 support
(Debian Bullseye 11.0, PHP 7.4, FreeRADIUS 3.0.21, Nginx 1.18.0)
ENH: Removed multicast support on the network card Added compatibility with new multiOTP Credential Provider
New release
FIX: Dockerfile updated (php-bcmath added)
New release
ENH: eDirectory LDAP server support (set the LDAP server type value to 4)
ENH: Raspberry content also in source file
New release
FIX: Cookie privacy (httponly and secure) backported to previous virtual appliances
ENH: Weak SSL ciphers disabled
ENH: Better Docker support
ENH: Better log handling
New release
FIX: In some cases, the HOTP/TOTP was not well computed
New release
FIX: Too many ReadConfigData loop during initialization
FIX: Better unicode handling, multibyte fonctions also for mb_substr()
FIX: A device file was searched with the name of the FreeRADIUS Client-Shortname
ENH: Enhanced Web GUI accounts list (green=AD/LDAP synced, orange = delayed, red=locked)
ENH: -sync-delete-retention-days= option is set by default to 30 days
ENH: VM version 010 support (Debian Buster 10.5, PHP 7.3, FreeRADIUS 3.0.17)
ENH: MySQL optimization
ENH: Enhanced windows command line scripts (automatic administrator level)
ENH: New -sync-delete-retention-days= option in order to purge inexistent AD/LDAP users (SetSyncDeleteRetentionDays and GetSyncDeleteRetentionDays method)
ENH: Raspberry Pi 4B support
ENH: New unified distribution
ENH: Debian Buster 10.5 support
ENH: Enhanced PHP 7.3 support
ENH: Better mysqli support for alternate connection port
New release
FIX: Separated configuration/statistics storage handling
FIX: IsTemporaryBadServer function (thanks to brownowski on GitHub)
ENH: Better PHP 7.3 support
ENH: Base32 encoder/decoder new implementation
ENH: During WriteConfigData, loop on the current values, and check with the old values
ENH: Enhanced internal tests
ENH: Give an info if time based token is probably out of sync (in a window 10 time bigger)
(for example for hardware tokens not used for a long time)
ENH: Modifications for Debian 10.x (buster) binary images support (64 bits)
ENH: Enhanced error messages, more log information
ENH: In debug mode, display an error if logfile cannot be written
ENH: Global Access-Challenge support
ENH: New QRcode library used (without external files dependency)
ENH: New Raspberry images support for Raspberry Pi 1B/1B+/2B/3B/3B+
Date: 4 months ago
Size: 3,723 bytes


Class file image Download
 * @file  launcher.cpp
 * @brief Launcher for the multiOTP open source embedded CLI package
 * multiOTP C++ launcher - Strong two-factor authentication solution
 * https://www\
 * Visit for additional support.
 * Donation are always welcome! Please check https://www\
 * and you will find the magic button ;-)
 * The multiOTP C++ launcher is simply used to launch PHP
 * and run with the provided arguments.
 * @author    Andre Liechti, SysCo systemes de communication sa, <>
 * @version
 * @date      2022-05-08
 * @since     2016-12-08
 * @copyright (c) 2010-2022 SysCo systemes de communication sa
 * @copyright GNU Lesser General Public License
 *   Copyright (c) 2010-2022 SysCo systemes de communication sa
 *   SysCo (tm) is a trademark of SysCo systemes de communication sa
 *   (
 *   All rights reserved.
 *   This file is part of the multiOTP open source project.
 *   multiOTP open source project is free software; you can redistribute it
 *   and/or modify it under the terms of the GNU Lesser General Public License
 *   as published by the Free Software Foundation, either version 3 of the
 *   License, or (at your option) any later version.
 *   multiOTP open source project is distributed in the hope that it will be
 *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   GNU Lesser General Public License for more details.
 *   You should have received a copy of the GNU Lesser General Public
 *   License along with multiOTP open source project.
 *   If not, see <>.
 * Change Log
 *   2018-03-05 SysCo/al Adapt the php.exe path automatically
 *   2018-02-19 SysCo/al Quotes tested and debugged with Credential Provider
 *   2018-02-19 SysCo/al Comments cleaning
 *   2017-05-29 SysCo/al Quotes must by around the launch string
 *   2016-12-29 SysCo/al Initial implementation and distribution

#include "stdafx.h"


#include <direct.h>
#include <fcntl.h>
#include <io.h>
#include <windows.h>
#include <string>
#include <iostream>

#define VER_NUMBER  ""
#define VER_DATE    "2022-05-08"

int _tmain(int argc, _TCHAR* argv[])
  std::string cli_arg = argv[0];
  cli_arg = cli_arg + "\\..\\";

  const char* cli_arg_char = cli_arg.c_str();

  char basePath[4096] = "";
  _fullpath(basePath, cli_arg_char, sizeof(basePath));

  std::string quote = "\"";
  std::string pathToPhp = quote + basePath + "php\\php.exe" + quote;
  std::string pathToMultiotp = quote + basePath + "php\\" + quote;

  // std::string defaultPath = basePath + "php";
  // char defaultPath[4096] = "";
  // strcpy_s(defaultPath, basePath);
  // strcat_s(defaultPath, "php");

  std::string run_software = pathToPhp + " " + pathToMultiotp + " -base-dir=" + quote + basePath + "." + quote;

  for (int i = 1; i < argc; i = i + 1) {
      run_software = run_software + " " + quote + argv[i] + quote;

  // Put the run software between quotes, because system use CMD /K
  run_software = quote + run_software + quote;

  const char* run_software_char = run_software.c_str();
  // std::cout << "Full RUN: " << run_software_char << std::endl;


  return system(run_software_char);
For more information send a message to info at phpclasses dot org.