From 8aa04c2821af278d75b9d1f2b28b548b6e298e47 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Mon, 17 May 2021 18:35:21 +0200 Subject: [PATCH] Fix : Camera freeze on Mac LDAP quickfixes: - Fix break lines in tooltips - Add timeout field - Remove sip scheme customization - Change LDPA settings layout - Remove 'sip_scheme' option and better URI normalization. The normalization is done when not having domain : it will be set after linphone_core_interpret_url - Add anonymous bind (no bindDN and no password) - Add multiple results for one contact (it allows to have one contact for each phone numbers for example) - Add error message when using ldaps --- linphone-app/assets/languages/en.ts | 40 +++++++-------- .../src/components/ldap/LdapModel.cpp | 51 ++++++++++--------- .../src/components/ldap/LdapModel.hpp | 23 +++++---- .../App/Settings/Dialogs/SettingsLdapEdit.qml | 37 ++++++++------ linphone-sdk | 2 +- 5 files changed, 81 insertions(+), 72 deletions(-) diff --git a/linphone-app/assets/languages/en.ts b/linphone-app/assets/languages/en.ts index 76ac9c803..20da6536d 100644 --- a/linphone-app/assets/languages/en.ts +++ b/linphone-app/assets/languages/en.ts @@ -1444,7 +1444,7 @@ Click here: <a href="%1">%1</a> bindDNTooltip 'Bind DN' can be a keyword. Check LDAP documentations - The bind DN is the credential that is used to authenticate against an LDAP.\n eg: cn=ausername,ou=people,dc=bc,dc=com + The bind DN is the credential that is used to authenticate against an LDAP.<br> eg: cn=ausername,ou=people,dc=bc,dc=com passwordLabel @@ -1456,7 +1456,7 @@ Click here: <a href="%1">%1</a> useTLSTooltip - Encrypt transactions by LDAP over TLS(StartTLS). You must use \'ldap\' scheme. \'ldaps\' for LDAP over SSL is non-standardized and deprecated.\nStartTLS in an extension to the LDAP protocol which uses the TLS protocol to encrypt communication. \nIt works by establishing a normal - i.e. unsecured - connection with the LDAP server before a handshake negotiation between the server and the web services is carried out. Here, the server sends its certificate to prove its identity before the secure connection is established. + Encrypt transactions by LDAP over TLS(StartTLS). You must use \'ldap\' scheme. \'ldaps\' for LDAP over SSL is non-standardized and deprecated.<br>StartTLS in an extension to the LDAP protocol which uses the TLS protocol to encrypt communication. <br>It works by establishing a normal - i.e. unsecured - connection with the LDAP server before a handshake negotiation between the server and the web services is carried out. Here, the server sends its certificate to prove its identity before the secure connection is established. useSalLabel @@ -1495,18 +1495,18 @@ Click here: <a href="%1">%1</a> baseObjectLabel - 'Base Object' can be a keyword. Check LDAP documentations - Base Object + 'Base Object'/'Search Base' can be a keyword. Check LDAP documentations + Search Base baseObjectPlaceholder - 'Base Object' can be a keyword. Check LDAP documentations - Base Object + 'Base Object'/'Search Base' can be a keyword. Check LDAP documentations + Search Base baseObjectTooltip - 'Base Object'and 'Base DN' can be keywords. Check LDAP documentations - Base Object is a specification for LDAP Search Scopes that specifies that the Search Request should only be performed against the entry specified as the search base DN.\n\nNo entries below it will be considered. + 'Base Object', 'Search Base' and 'Base DN' can be keywords. Check LDAP documentations + Base Object/Search Base is a specification for LDAP Search Scopes that specifies that the Search Request should only be performed against the entry specified as the search base DN.<br>No entries above it will be considered. filterLabel @@ -1514,7 +1514,7 @@ Click here: <a href="%1">%1</a> filterTooltip - The search is base on this filter to search friends. Default value : (sn=%s) + The search is base on this filter to search contacts.<br>Default value : (sn=%s) maxResultsLabel @@ -1534,7 +1534,7 @@ Click here: <a href="%1">%1</a> nameAttributesTooltip - Check these attributes To build Name Friend, separated by a comma and the first is the highest priority. The default value is: sn + Check these attributes To build Name Contact, separated by a comma and the first is the highest priority.<br>The default value is: sn sipAttributesLabel @@ -1543,15 +1543,7 @@ Click here: <a href="%1">%1</a> sipAttributesTooltip Default values : (mobile,telephoneNumber,homePhone,sn) are keywords. - Check these attributes to build the SIP username in address of Friend. Attributes are separated by a comma and the first is the highest priority. The default value is: mobile,telephoneNumber,homePhone,sn - - - schemeLabel - Scheme - - - schemeTooltip - Add the scheme to the sip address(scheme:username@domain). The default value is sip + Check these attributes to build the SIP username in address of Contact. Attributes are separated by a comma and the first is the highest priority.<br>The default value is: mobile,telephoneNumber,homePhone,sn domainLabel @@ -1559,7 +1551,7 @@ Click here: <a href="%1">%1</a> domainTooltip - Add the domain to the sip address(scheme:username@domain). The default value is sip.linphone.org + Add the domain to the sip address(sip:username@domain).<br>The default value is sip.linphone.org miscLabel @@ -1574,6 +1566,14 @@ Click here: <a href="%1">%1</a> debugTooltip Get verbose logs in Linphone log file when doing transactions (useful to debug TLS connections). + + timeoutLabel + Timeout + + + timeoutTooltip + The connection and search timeout in seconds. It must be positive.<br>Default is 5s. + SettingsNetwork diff --git a/linphone-app/src/components/ldap/LdapModel.cpp b/linphone-app/src/components/ldap/LdapModel.cpp index 74b945bdc..b70fec32c 100644 --- a/linphone-app/src/components/ldap/LdapModel.cpp +++ b/linphone-app/src/components/ldap/LdapModel.cpp @@ -37,6 +37,7 @@ using namespace std; LdapModel::LdapModel (const int& id,QObject *parent ) : QObject(parent), mId(id){ mIsValid = false; mMaxResults = 50; + mTimeout = 5; mDebug = false; mVerifyServerCertificates = -1; mUseTls = true; @@ -53,13 +54,13 @@ void LdapModel::init(){ bool LdapModel::isValid(){ bool valid = mServerFieldError=="" && mMaxResultsFieldError=="" + && mTimeoutFieldError=="" && mPasswordFieldError=="" && mBindDnFieldError=="" && mBaseObjectFieldError=="" && mFilterFieldError=="" && mNameAttributesFieldError=="" && mSipAttributesFieldError=="" - && mSipSchemeFieldError=="" && mSipDomainFieldError==""; if( valid != mIsValid){ mIsValid = valid; @@ -131,13 +132,13 @@ void LdapModel::set(){ mConfig["use_tls"] = (mUseTls?"1":"0"); mConfig["server"] = mServer; mConfig["max_results"] = mMaxResults; + mConfig["timeout"] = mTimeout; mConfig["password"] = mPassword; mConfig["bind_dn"] = mBindDn; mConfig["base_object"] = mBaseObject; mConfig["filter"] = mFilter; mConfig["name_attribute"] = mNameAttributes; mConfig["sip_attribute"] = mSipAttributes; - mConfig["sip_scheme"] = mSipScheme; mConfig["sip_domain"] = mSipDomain; mConfig["debug"] = (mDebug?"1":"0"); mConfig["verify_server_certificates"] = mVerifyServerCertificates; @@ -149,26 +150,26 @@ void LdapModel::unset(){ mUseTls = mConfig["use_tls"].toString() == "1"; mUseSal = mConfig["use_sal"].toString() == "1"; mMaxResults = mConfig["max_results"].toInt(); + mTimeout = mConfig["timeout"].toInt(); mPassword = mConfig["password"].toString(); mBindDn = mConfig["bind_dn"].toString(); mBaseObject = mConfig["base_object"].toString(); mFilter = mConfig["filter"].toString(); mNameAttributes = mConfig["name_attribute"].toString(); mSipAttributes = mConfig["sip_attribute"].toString(); - mSipScheme = mConfig["sip_scheme"].toString(); mSipDomain = mConfig["sip_domain"].toString(); mDebug = mConfig["debug"].toString() == "1"; mVerifyServerCertificates = mConfig["verify_server_certificates"].toInt(); testServerField(); testMaxResultsField(); + testTimeoutField(); testPasswordField(); testBindDnField(); testBaseObjectField(); testFilterField(); testNameAttributesField(); testSipAttributesField(); - testSipSchemeField(); testSipDomainField(); isValid(); } @@ -199,7 +200,9 @@ void LdapModel::testServerField(){ if(!url.isValid()) valid = "Server is not an URL"; else if(url.scheme().left(4) != "ldap") - valid = "URL must begin by a ldap scheme"; + valid = "URL must begin by a ldap scheme."; + else if(url.scheme() == "ldaps") + valid = "ldaps is not supported."; else valid = ""; } @@ -228,6 +231,24 @@ void LdapModel::testMaxResultsField(){ } } +void LdapModel::setTimeout(const int& data){ + mTimeout = data; + testTimeoutField(); + emit timeoutChanged(); +} +void LdapModel::testTimeoutField(){ + QString valid; + if(mTimeout < 0) + valid = "Timeout must be positive in seconds."; + else + valid = ""; + if( valid != mTimeoutFieldError){ + mTimeoutFieldError = valid; + emit timeoutFieldErrorChanged(); + isValid(); + } +} + void LdapModel::setPassword(const QString& data){ mPassword = data; testPasswordField(); @@ -249,10 +270,6 @@ void LdapModel::setBindDn(const QString& data){ } void LdapModel::testBindDnField(){ QString valid; - if(mBindDn == "") - valid = "Bind DN must not be empty"; - else - valid = ""; if( valid != mBindDnFieldError){ mBindDnFieldError = valid; emit bindDnFieldErrorChanged(); @@ -268,7 +285,7 @@ void LdapModel::setBaseObject(const QString& data){ void LdapModel::testBaseObjectField(){ QString valid; if(mBaseObject == "") - valid = "Base Object must not be empty"; + valid = "Search Base must not be empty"; else valid = ""; if( valid != mBaseObjectFieldError){ @@ -320,20 +337,6 @@ void LdapModel::testSipAttributesField(){ } } -void LdapModel::setSipScheme(const QString& data){ - mSipScheme = data; - testSipSchemeField(); - emit sipSchemeChanged(); -} -void LdapModel::testSipSchemeField(){ - QString valid = ""; - if( valid != mSipSchemeFieldError){ - mSipSchemeFieldError = valid; - emit sipSchemeFieldErrorChanged(); - isValid(); - } -} - void LdapModel::setSipDomain(const QString& data){ mSipDomain = data; testSipDomainField(); diff --git a/linphone-app/src/components/ldap/LdapModel.hpp b/linphone-app/src/components/ldap/LdapModel.hpp index f3bc3ab64..3ea2edc73 100644 --- a/linphone-app/src/components/ldap/LdapModel.hpp +++ b/linphone-app/src/components/ldap/LdapModel.hpp @@ -45,6 +45,10 @@ class LdapModel : public QObject { Q_PROPERTY(int maxResults MEMBER mMaxResults WRITE setMaxResults NOTIFY maxResultsChanged) Q_PROPERTY(QString maxResultsFieldError MEMBER mMaxResultsFieldError NOTIFY maxResultsFieldErrorChanged) + Q_PROPERTY(int timeout MEMBER mTimeout WRITE setTimeout NOTIFY timeoutChanged) + Q_PROPERTY(QString timeoutFieldError MEMBER mTimeoutFieldError NOTIFY timeoutFieldErrorChanged) + + Q_PROPERTY(QString password MEMBER mPassword WRITE setPassword NOTIFY passwordChanged) Q_PROPERTY(QString passwordFieldError MEMBER mPasswordFieldError NOTIFY passwordFieldErrorChanged) @@ -63,9 +67,6 @@ class LdapModel : public QObject { Q_PROPERTY(QString sipAttributes MEMBER mSipAttributes WRITE setSipAttributes NOTIFY sipAttributesChanged) Q_PROPERTY(QString sipAttributesFieldError MEMBER mSipAttributesFieldError NOTIFY sipAttributesFieldErrorChanged) - Q_PROPERTY(QString sipScheme MEMBER mSipScheme WRITE setSipScheme NOTIFY sipSchemeChanged) - Q_PROPERTY(QString sipSchemeFieldError MEMBER mSipSchemeFieldError NOTIFY sipSchemeFieldErrorChanged) - Q_PROPERTY(QString sipDomain MEMBER mSipDomain WRITE setSipDomain NOTIFY sipDomainChanged) Q_PROPERTY(QString sipDomainFieldError MEMBER mSipDomainFieldError NOTIFY sipDomainFieldErrorChanged) @@ -95,7 +96,12 @@ public: QString mMaxResultsFieldError; void setMaxResults(const int& data); void testMaxResultsField(); - + + int mTimeout; + QString mTimeoutFieldError; + void setTimeout(const int& data); + void testTimeoutField(); + QString mPassword; QString mPasswordFieldError; void setPassword(const QString& data); @@ -126,11 +132,6 @@ public: void setSipAttributes(const QString& data); void testSipAttributesField(); - QString mSipScheme; - QString mSipSchemeFieldError; - void setSipScheme(const QString& data); - void testSipSchemeField(); - QString mSipDomain; QString mSipDomainFieldError; void setSipDomain(const QString& data); @@ -163,13 +164,13 @@ signals: void useSalChanged(); void isServerValidChanged(); void maxResultsChanged(); + void timeoutChanged(); void passwordChanged(); void bindDnChanged(); void baseObjectChanged(); void filterChanged(); void nameAttributesChanged(); void sipAttributesChanged(); - void sipSchemeChanged(); void sipDomainChanged(); void debugChanged(); void verifyServerCertificatesChanged(); @@ -177,13 +178,13 @@ signals: void serverFieldErrorChanged(); void maxResultsFieldErrorChanged(); + void timeoutFieldErrorChanged(); void passwordFieldErrorChanged(); void bindDnFieldErrorChanged(); void baseObjectFieldErrorChanged(); void filterFieldErrorChanged(); void nameAttributesFieldErrorChanged(); void sipAttributesFieldErrorChanged(); - void sipSchemeFieldErrorChanged(); void sipDomainFieldErrorChanged(); void enabledChanged(); diff --git a/linphone-app/ui/views/App/Settings/Dialogs/SettingsLdapEdit.qml b/linphone-app/ui/views/App/Settings/Dialogs/SettingsLdapEdit.qml index 277dbf82e..46dcca50e 100644 --- a/linphone-app/ui/views/App/Settings/Dialogs/SettingsLdapEdit.qml +++ b/linphone-app/ui/views/App/Settings/Dialogs/SettingsLdapEdit.qml @@ -103,6 +103,7 @@ DialogPlus { FormLine { FormGroup { + id:passwordGroup label: qsTr('passwordLabel')//'Password' PasswordField { id:password @@ -115,6 +116,7 @@ DialogPlus { } FormLine { id:useRow + width:passwordGroup.width FormGroup { label: qsTr('useTLSLabel')//'Use TLS' Switch { @@ -194,6 +196,7 @@ DialogPlus { FormLine { FormGroup { + id:filterGroup label: qsTr('filterLabel')//'Filter' TextField { id:filter @@ -208,7 +211,10 @@ DialogPlus { } } + FormLine { + id:connectionRow + width:filterGroup.width FormGroup { label: qsTr('maxResultsLabel')//'Max Results' @@ -218,10 +224,24 @@ DialogPlus { error : ldapData.maxResultsFieldError onTextChanged: ldapData.maxResults = text TooltipArea{ + tooltipParent:connectionRow text : qsTr('maxResultsTooltip')//'The max results when requesting searches' } } } + FormGroup { + label: qsTr('timeoutLabel') + NumericField { + id:timeout + text:ldapData.timeout + error : ldapData.timeoutFieldError + onTextChanged: ldapData.timeout = text + TooltipArea{ + tooltipParent:connectionRow + text : qsTr('timeoutTooltip')//'The connection and search timeout in seconds. Default is 5' + } + } + } } } // ----------------------------------------------------------------------- @@ -262,21 +282,6 @@ DialogPlus { } } } - FormLine { - FormGroup { - label: qsTr('schemeLabel')//'Scheme' - TextField { - id:scheme - placeholderText :'sip' - text:ldapData.sipScheme - error : ldapData.sipSchemeFieldError - onTextChanged: ldapData.sipScheme = text - TooltipArea{ - text : qsTr('schemeTooltip')//'Add the scheme to the sip address(scheme:username@domain). The default value is sip' - } - } - } - } FormLine { FormGroup { label: qsTr('domainLabel')//'Domain' @@ -287,7 +292,7 @@ DialogPlus { error : ldapData.sipDomainFieldError onTextChanged: ldapData.sipDomain = text TooltipArea{ - text : qsTr('domainTooltip')//'Add the domain to the sip address(scheme:username@domain). The default value is sip.linphone.org' + text : qsTr('domainTooltip')//'Add the domain to the sip address(username@domain). The default value is sip.linphone.org' } } } diff --git a/linphone-sdk b/linphone-sdk index eacd44cc7..21339c949 160000 --- a/linphone-sdk +++ b/linphone-sdk @@ -1 +1 @@ -Subproject commit eacd44cc787cdcd3f68e75da303fabc57ce4416e +Subproject commit 21339c9493940a981a4231ae047f174b2aa9aca4