summaryrefslogtreecommitdiffstats
path: root/utils/license.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-02-04 13:01:14 -0800
committerCorey Hulen <corey@hulen.com>2016-02-04 13:01:14 -0800
commitaf6ade338002a215ff7c7771f7fe6bbbb06f0cd7 (patch)
treea8e696aaaf8fd4e483d52f356e848aafcf2a6c25 /utils/license.go
parentec51c31c325b3dc648a261f0e8634b6d70d7ba73 (diff)
parente45282deaa1d78d7ff3a125e9fd11e3fdc120b07 (diff)
downloadchat-af6ade338002a215ff7c7771f7fe6bbbb06f0cd7.tar.gz
chat-af6ade338002a215ff7c7771f7fe6bbbb06f0cd7.tar.bz2
chat-af6ade338002a215ff7c7771f7fe6bbbb06f0cd7.zip
Merge pull request #2073 from mattermost/ee-updates
Some general updates to EE
Diffstat (limited to 'utils/license.go')
-rw-r--r--utils/license.go37
1 files changed, 4 insertions, 33 deletions
diff --git a/utils/license.go b/utils/license.go
index 0d1cd597c..b773a163e 100644
--- a/utils/license.go
+++ b/utils/license.go
@@ -1,19 +1,15 @@
-// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package utils
import (
- "bytes"
"crypto"
"crypto/rsa"
"crypto/sha512"
"crypto/x509"
"encoding/base64"
"encoding/pem"
- "io"
- "os"
- "path/filepath"
"strconv"
"strings"
@@ -22,10 +18,6 @@ import (
"github.com/mattermost/platform/model"
)
-const (
- LICENSE_FILENAME = "active.dat"
-)
-
var IsLicensed bool = false
var License *model.License = &model.License{}
var ClientLicense map[string]string = make(map[string]string)
@@ -41,18 +33,8 @@ NxpC+5KFhU+xSeeklNqwCgnlOyZ7qSTxmdJHb+60SwuYnnGIYzLJhY4LYDr4J+KR
1wIDAQAB
-----END PUBLIC KEY-----`)
-func LoadLicense() {
- file, err := os.Open(LicenseLocation())
- if err != nil {
- l4g.Warn(T("utils.license.load_license.open_find.warn"))
- return
- }
- defer file.Close()
-
- buf := bytes.NewBuffer(nil)
- io.Copy(buf, file)
-
- if success, licenseStr := ValidateLicense(buf.Bytes()); success {
+func LoadLicense(licenseBytes []byte) {
+ if success, licenseStr := ValidateLicense(licenseBytes); success {
license := model.LicenseFromJson(strings.NewReader(licenseStr))
SetLicense(license)
return
@@ -74,21 +56,10 @@ func SetLicense(license *model.License) bool {
return false
}
-func LicenseLocation() string {
- return filepath.Dir(CfgFileName) + "/" + LICENSE_FILENAME
-}
-
-func RemoveLicense() bool {
+func RemoveLicense() {
License = &model.License{}
IsLicensed = false
ClientLicense = getClientLicense(License)
-
- if err := os.Remove(LicenseLocation()); err != nil {
- l4g.Error(T("utils.license.remove_license.unable.error"), err.Error())
- return false
- }
-
- return true
}
func ValidateLicense(signed []byte) (bool, string) {