mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Merge from eugenesan/keepassx to implement 1.8.4.1 improvements
This commit is contained in:
parent
175167b311
commit
cbb1269b39
@ -153,6 +153,7 @@ find_package(Qt5Concurrent 5.2 REQUIRED)
|
|||||||
find_package(Qt5Widgets 5.2 REQUIRED)
|
find_package(Qt5Widgets 5.2 REQUIRED)
|
||||||
find_package(Qt5Test 5.2 REQUIRED)
|
find_package(Qt5Test 5.2 REQUIRED)
|
||||||
find_package(Qt5LinguistTools 5.2 REQUIRED)
|
find_package(Qt5LinguistTools 5.2 REQUIRED)
|
||||||
|
find_package(Qt5Network 5.2 REQUIRED)
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
|
||||||
# Debian sets the the build type to None for package builds.
|
# Debian sets the the build type to None for package builds.
|
||||||
|
@ -174,7 +174,7 @@ qt5_wrap_ui(keepassx_SOURCES ${keepassx_FORMS})
|
|||||||
|
|
||||||
add_library(keepassx_core STATIC ${keepassx_SOURCES})
|
add_library(keepassx_core STATIC ${keepassx_SOURCES})
|
||||||
set_target_properties(keepassx_core PROPERTIES COMPILE_DEFINITIONS KEEPASSX_BUILDING_CORE)
|
set_target_properties(keepassx_core PROPERTIES COMPILE_DEFINITIONS KEEPASSX_BUILDING_CORE)
|
||||||
target_link_libraries(keepassx_core Qt5::Core Qt5::Concurrent Qt5::Widgets)
|
target_link_libraries(keepassx_core Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network)
|
||||||
|
|
||||||
add_executable(${PROGNAME} WIN32 MACOSX_BUNDLE ${keepassx_SOURCES_MAINEXE})
|
add_executable(${PROGNAME} WIN32 MACOSX_BUNDLE ${keepassx_SOURCES_MAINEXE})
|
||||||
target_link_libraries(${PROGNAME}
|
target_link_libraries(${PROGNAME}
|
||||||
@ -183,6 +183,7 @@ target_link_libraries(${PROGNAME}
|
|||||||
Qt5::Core
|
Qt5::Core
|
||||||
Qt5::Concurrent
|
Qt5::Concurrent
|
||||||
Qt5::Widgets
|
Qt5::Widgets
|
||||||
|
Qt5::Network
|
||||||
${GCRYPT_LIBRARIES}
|
${GCRYPT_LIBRARIES}
|
||||||
${ZLIB_LIBRARIES})
|
${ZLIB_LIBRARIES})
|
||||||
|
|
||||||
|
@ -126,6 +126,18 @@ void HttpSettings::setSupportKphFields(bool supportKphFields)
|
|||||||
config()->set("Http/SupportKphFields", supportKphFields);
|
config()->set("Http/SupportKphFields", supportKphFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString HttpSettings::httpHost()
|
||||||
|
{
|
||||||
|
static const QString host = "localhost";
|
||||||
|
|
||||||
|
return config()->get("Http/Host", host).toString().toUtf8();
|
||||||
|
}
|
||||||
|
|
||||||
|
void HttpSettings::setHttpHost(QString host)
|
||||||
|
{
|
||||||
|
config()->set("Http/Host", host);
|
||||||
|
}
|
||||||
|
|
||||||
int HttpSettings::httpPort()
|
int HttpSettings::httpPort()
|
||||||
{
|
{
|
||||||
static const int PORT = 19455;
|
static const int PORT = 19455;
|
||||||
|
@ -42,6 +42,8 @@ public:
|
|||||||
static void setSearchInAllDatabases(bool searchInAllDatabases);
|
static void setSearchInAllDatabases(bool searchInAllDatabases);
|
||||||
static bool supportKphFields();
|
static bool supportKphFields();
|
||||||
static void setSupportKphFields(bool supportKphFields);
|
static void setSupportKphFields(bool supportKphFields);
|
||||||
|
static QString httpHost();
|
||||||
|
static void setHttpHost(QString host);
|
||||||
static int httpPort();
|
static int httpPort();
|
||||||
static void setHttpPort(int port);
|
static void setHttpPort(int port);
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ void OptionDialog::loadSettings()
|
|||||||
ui->sortByUsername->setChecked(true);
|
ui->sortByUsername->setChecked(true);
|
||||||
else
|
else
|
||||||
ui->sortByTitle->setChecked(true);
|
ui->sortByTitle->setChecked(true);
|
||||||
|
ui->httpHost->setText(settings.httpHost());
|
||||||
ui->httpPort->setText(QString::number(settings.httpPort()));
|
ui->httpPort->setText(QString::number(settings.httpPort()));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -68,6 +69,7 @@ void OptionDialog::saveSettings()
|
|||||||
settings.setUnlockDatabase(ui->unlockDatabase->isChecked());
|
settings.setUnlockDatabase(ui->unlockDatabase->isChecked());
|
||||||
settings.setMatchUrlScheme(ui->matchUrlScheme->isChecked());
|
settings.setMatchUrlScheme(ui->matchUrlScheme->isChecked());
|
||||||
settings.setSortByUsername(ui->sortByUsername->isChecked());
|
settings.setSortByUsername(ui->sortByUsername->isChecked());
|
||||||
|
settings.setHttpHost(ui->httpHost->text());
|
||||||
settings.setHttpPort(ui->httpPort->text().toInt());
|
settings.setHttpPort(ui->httpPort->text().toInt());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -28,7 +28,7 @@ This is required for accessing keypass database from ChromeIPass or PassIfox</st
|
|||||||
<enum>QTabWidget::Rounded</enum>
|
<enum>QTabWidget::Rounded</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -200,6 +200,30 @@ Only entries with the same scheme (http://, https://, ftp://, ...) are returned<
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>HTTP Host:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="httpHost">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Default host: localhost</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
|
@ -27,7 +27,7 @@ static const char * const STR_SET_LOGIN = "set-login";
|
|||||||
static const char * const STR_ASSOCIATE = "associate";
|
static const char * const STR_ASSOCIATE = "associate";
|
||||||
static const char * const STR_TEST_ASSOCIATE = "test-associate";
|
static const char * const STR_TEST_ASSOCIATE = "test-associate";
|
||||||
static const char * const STR_GENERATE_PASSWORD = "generate-password";
|
static const char * const STR_GENERATE_PASSWORD = "generate-password";
|
||||||
static const char * const STR_VERSION = "1.8.4.1"; // TODO: not true, need to incorporate change of listener host
|
static const char * const STR_VERSION = "1.8.4.1";
|
||||||
|
|
||||||
}/*namespace KeepassHttpProtocol*/
|
}/*namespace KeepassHttpProtocol*/
|
||||||
|
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
#include <QtCore/QCryptographicHash>
|
#include <QtCore/QCryptographicHash>
|
||||||
#include <QtWidgets/QMessageBox>
|
#include <QtWidgets/QMessageBox>
|
||||||
#include <QEventLoop>
|
#include <QEventLoop>
|
||||||
|
#include <QtNetwork/QHostInfo>
|
||||||
|
#include <QtNetwork/QHostAddress>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
using namespace KeepassHttpProtocol;
|
using namespace KeepassHttpProtocol;
|
||||||
|
|
||||||
@ -324,11 +327,49 @@ void Server::start(void)
|
|||||||
|
|
||||||
int port = HttpSettings::httpPort();
|
int port = HttpSettings::httpPort();
|
||||||
|
|
||||||
daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, port, NULL, NULL,
|
struct sockaddr_in as;
|
||||||
&this->request_handler_wrapper, this,
|
struct sockaddr_in *ss = &as;
|
||||||
MHD_OPTION_NOTIFY_COMPLETED,
|
bool nohost = true;
|
||||||
this->request_completed, NULL,
|
|
||||||
MHD_OPTION_END);
|
QHostInfo info = QHostInfo::fromName(HttpSettings::httpHost());
|
||||||
|
if (!info.addresses().isEmpty()) {
|
||||||
|
QHostAddress address = info.addresses().first();
|
||||||
|
|
||||||
|
if (address.protocol() == QAbstractSocket::IPv4Protocol) {
|
||||||
|
struct sockaddr_in* addr = ss;
|
||||||
|
memset(addr, 0, sizeof(struct sockaddr_in));
|
||||||
|
addr->sin_family = AF_INET;
|
||||||
|
addr->sin_port = htons(HttpSettings::httpPort());
|
||||||
|
addr->sin_addr.s_addr = htonl(address.toIPv4Address());
|
||||||
|
nohost = false;
|
||||||
|
#ifdef MHD_USE_IPv6
|
||||||
|
} else {
|
||||||
|
struct sockaddr_in6* addr = (sockaddr_in6*)ss;
|
||||||
|
memset(addr, 0, sizeof(struct sockaddr_in6));
|
||||||
|
addr->sin6_family = AF_INET6;
|
||||||
|
addr->sin6_port = htons(HttpSettings::httpPort());
|
||||||
|
memcpy(&addr->sin6_addr, address.toIPv6Address().c, 16);
|
||||||
|
nohost = false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, port, NULL, NULL,
|
||||||
|
&this->request_handler_wrapper, this,
|
||||||
|
MHD_OPTION_NOTIFY_COMPLETED,
|
||||||
|
this->request_completed, NULL,
|
||||||
|
MHD_OPTION_SOCK_ADDR,
|
||||||
|
ss,
|
||||||
|
MHD_OPTION_END);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nohost) {
|
||||||
|
daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, port, NULL, NULL,
|
||||||
|
&this->request_handler_wrapper, this,
|
||||||
|
MHD_OPTION_NOTIFY_COMPLETED,
|
||||||
|
this->request_completed, NULL,
|
||||||
|
MHD_OPTION_END);
|
||||||
|
}
|
||||||
|
|
||||||
m_started = true;
|
m_started = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user