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
This commit is contained in:
Julien Wadel 2021-05-17 18:35:21 +02:00
parent fc5bc239ce
commit 8aa04c2821
5 changed files with 81 additions and 72 deletions

View file

@ -1444,7 +1444,7 @@ Click here: <a href="%1">%1</a>
<message>
<source>bindDNTooltip</source>
<translatorcomment>&apos;Bind DN&apos; can be a keyword. Check LDAP documentations</translatorcomment>
<translation>The bind DN is the credential that is used to authenticate against an LDAP.\n eg: cn=ausername,ou=people,dc=bc,dc=com</translation>
<translation>The bind DN is the credential that is used to authenticate against an LDAP.&lt;br&gt; eg: cn=ausername,ou=people,dc=bc,dc=com</translation>
</message>
<message>
<source>passwordLabel</source>
@ -1456,7 +1456,7 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message>
<message>
<source>useTLSTooltip</source>
<translation>Encrypt transactions by LDAP over TLS(StartTLS). You must use \&apos;ldap\&apos; scheme. \&apos;ldaps\&apos; 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.</translation>
<translation>Encrypt transactions by LDAP over TLS(StartTLS). You must use \&apos;ldap\&apos; scheme. \&apos;ldaps\&apos; for LDAP over SSL is non-standardized and deprecated.&lt;br&gt;StartTLS in an extension to the LDAP protocol which uses the TLS protocol to encrypt communication. &lt;br&gt;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.</translation>
</message>
<message>
<source>useSalLabel</source>
@ -1495,18 +1495,18 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message>
<message>
<source>baseObjectLabel</source>
<translatorcomment>&apos;Base Object&apos; can be a keyword. Check LDAP documentations</translatorcomment>
<translation>Base Object</translation>
<translatorcomment>&apos;Base Object&apos;/&apos;Search Base&apos; can be a keyword. Check LDAP documentations</translatorcomment>
<translation>Search Base</translation>
</message>
<message>
<source>baseObjectPlaceholder</source>
<translatorcomment>&apos;Base Object&apos; can be a keyword. Check LDAP documentations</translatorcomment>
<translation>Base Object</translation>
<translatorcomment>&apos;Base Object&apos;/&apos;Search Base&apos; can be a keyword. Check LDAP documentations</translatorcomment>
<translation>Search Base</translation>
</message>
<message>
<source>baseObjectTooltip</source>
<translatorcomment>&apos;Base Object&apos;and &apos;Base DN&apos; can be keywords. Check LDAP documentations</translatorcomment>
<translation>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.</translation>
<translatorcomment>&apos;Base Object&apos;, &apos;Search Base&apos; and &apos;Base DN&apos; can be keywords. Check LDAP documentations</translatorcomment>
<translation>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.&lt;br&gt;No entries above it will be considered.</translation>
</message>
<message>
<source>filterLabel</source>
@ -1514,7 +1514,7 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message>
<message>
<source>filterTooltip</source>
<translation>The search is base on this filter to search friends. Default value : (sn=%s)</translation>
<translation>The search is base on this filter to search contacts.&lt;br&gt;Default value : (sn=%s)</translation>
</message>
<message>
<source>maxResultsLabel</source>
@ -1534,7 +1534,7 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message>
<message>
<source>nameAttributesTooltip</source>
<translation>Check these attributes To build Name Friend, separated by a comma and the first is the highest priority. The default value is: sn</translation>
<translation>Check these attributes To build Name Contact, separated by a comma and the first is the highest priority.&lt;br&gt;The default value is: sn</translation>
</message>
<message>
<source>sipAttributesLabel</source>
@ -1543,15 +1543,7 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<message>
<source>sipAttributesTooltip</source>
<translatorcomment>Default values : (mobile,telephoneNumber,homePhone,sn) are keywords.</translatorcomment>
<translation>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</translation>
</message>
<message>
<source>schemeLabel</source>
<translation>Scheme</translation>
</message>
<message>
<source>schemeTooltip</source>
<translation>Add the scheme to the sip address(scheme:username@domain). The default value is sip</translation>
<translation>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.&lt;br&gt;The default value is: mobile,telephoneNumber,homePhone,sn</translation>
</message>
<message>
<source>domainLabel</source>
@ -1559,7 +1551,7 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message>
<message>
<source>domainTooltip</source>
<translation>Add the domain to the sip address(scheme:username@domain). The default value is sip.linphone.org</translation>
<translation>Add the domain to the sip address(sip:username@domain).&lt;br&gt;The default value is sip.linphone.org</translation>
</message>
<message>
<source>miscLabel</source>
@ -1574,6 +1566,14 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>debugTooltip</source>
<translation>Get verbose logs in Linphone log file when doing transactions (useful to debug TLS connections).</translation>
</message>
<message>
<source>timeoutLabel</source>
<translation>Timeout</translation>
</message>
<message>
<source>timeoutTooltip</source>
<translation>The connection and search timeout in seconds. It must be positive.&lt;br&gt;Default is 5s.</translation>
</message>
</context>
<context>
<name>SettingsNetwork</name>

View file

@ -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();

View file

@ -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();

View file

@ -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'
}
}
}

@ -1 +1 @@
Subproject commit eacd44cc787cdcd3f68e75da303fabc57ce4416e
Subproject commit 21339c9493940a981a4231ae047f174b2aa9aca4