Update server dependencies

This commit is contained in:
Hanzei 2018-09-23 08:18:35 +02:00
parent d0df44c109
commit d918262365
No known key found for this signature in database
GPG key ID: 69A2DEFD98937BA0
31 changed files with 1233 additions and 806 deletions

View file

@ -6,9 +6,12 @@ package model
import (
"encoding/json"
"io"
"math"
"net"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
"time"
)
@ -117,6 +120,7 @@ const (
LDAP_SETTINGS_DEFAULT_POSITION_ATTRIBUTE = ""
LDAP_SETTINGS_DEFAULT_LOGIN_FIELD_NAME = ""
SAML_SETTINGS_DEFAULT_ID_ATTRIBUTE = ""
SAML_SETTINGS_DEFAULT_FIRST_NAME_ATTRIBUTE = ""
SAML_SETTINGS_DEFAULT_LAST_NAME_ATTRIBUTE = ""
SAML_SETTINGS_DEFAULT_EMAIL_ATTRIBUTE = ""
@ -1122,6 +1126,7 @@ type TeamSettings struct {
MaxNotificationsPerChannel *int64
EnableConfirmNotificationsToChannel *bool
TeammateNameDisplay *string
ExperimentalViewArchivedChannels *bool
ExperimentalEnableAutomaticReplies *bool
ExperimentalHideTownSquareinLHS *bool
ExperimentalTownSquareIsReadOnly *bool
@ -1251,6 +1256,9 @@ func (s *TeamSettings) SetDefaults() {
s.EnableUserCreation = NewBool(true)
}
if s.ExperimentalViewArchivedChannels == nil {
s.ExperimentalViewArchivedChannels = NewBool(false)
}
}
type ClientRequirements struct {
@ -1449,8 +1457,9 @@ func (s *LocalizationSettings) SetDefaults() {
type SamlSettings struct {
// Basic
Enable *bool
EnableSyncWithLdap *bool
Enable *bool
EnableSyncWithLdap *bool
EnableSyncWithLdapIncludeAuth *bool
Verify *bool
Encrypt *bool
@ -1467,6 +1476,7 @@ type SamlSettings struct {
PrivateKeyFile *string
// User Mapping
IdAttribute *string
FirstNameAttribute *string
LastNameAttribute *string
EmailAttribute *string
@ -1491,6 +1501,10 @@ func (s *SamlSettings) SetDefaults() {
s.EnableSyncWithLdap = NewBool(false)
}
if s.EnableSyncWithLdapIncludeAuth == nil {
s.EnableSyncWithLdapIncludeAuth = NewBool(false)
}
if s.Verify == nil {
s.Verify = NewBool(true)
}
@ -1535,6 +1549,10 @@ func (s *SamlSettings) SetDefaults() {
s.LoginButtonText = NewString(USER_AUTH_SERVICE_SAML_TEXT)
}
if s.IdAttribute == nil {
s.IdAttribute = NewString(SAML_SETTINGS_DEFAULT_ID_ATTRIBUTE)
}
if s.FirstNameAttribute == nil {
s.FirstNameAttribute = NewString(SAML_SETTINGS_DEFAULT_FIRST_NAME_ATTRIBUTE)
}
@ -2352,7 +2370,15 @@ func (ss *ServiceSettings) isValid() *AppError {
}
}
if len(*ss.ListenAddress) == 0 {
host, port, err := net.SplitHostPort(*ss.ListenAddress)
var isValidHost bool
if host == "" {
isValidHost = true
} else {
isValidHost = (net.ParseIP(host) != nil) || IsDomainName(host)
}
portInt, err := strconv.Atoi(port)
if err != nil || !isValidHost || portInt < 0 || portInt > math.MaxUint16 {
return NewAppError("Config.IsValid", "model.config.is_valid.listen_address.app_error", nil, "", http.StatusBadRequest)
}