Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Vault
Commits
6106b48f
Unverified
Commit
6106b48f
authored
3 years ago
by
Josh Black
Committed by
GitHub
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
fix version check (#14395)
parent
dafe86ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
vault/token_store.go
+14
-8
vault/token_store.go
vault/version_store.go
+2
-2
vault/version_store.go
with
16 additions
and
10 deletions
+16
-10
vault/token_store.go
+
14
-
8
View file @
6106b48f
...
@@ -996,16 +996,22 @@ func (ts *TokenStore) create(ctx context.Context, entry *logical.TokenEntry) err
...
@@ -996,16 +996,22 @@ func (ts *TokenStore) create(ctx context.Context, entry *logical.TokenEntry) err
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
newestVersion
,
err
:=
version
.
NewVersion
(
ver
)
if
err
!=
nil
{
var
newestVersion
*
version
.
Version
return
err
var
oneTen
*
version
.
Version
}
oneTen
,
err
:=
version
.
NewVersion
(
"1.10.0"
)
if
ver
!=
""
{
if
err
!=
nil
{
newestVersion
,
err
=
version
.
NewVersion
(
ver
)
return
err
if
err
!=
nil
{
return
err
}
oneTen
,
err
=
version
.
NewVersion
(
"1.10.0"
)
if
err
!=
nil
{
return
err
}
}
}
if
ts
.
core
.
DisableSSCTokens
()
||
newestVersion
.
LessThan
(
oneTen
)
{
if
ts
.
core
.
DisableSSCTokens
()
||
(
newestVersion
!=
nil
&&
newestVersion
.
LessThan
(
oneTen
)
)
{
entry
.
ID
=
consts
.
LegacyBatchTokenPrefix
+
bEntry
entry
.
ID
=
consts
.
LegacyBatchTokenPrefix
+
bEntry
}
else
{
}
else
{
entry
.
ID
=
consts
.
BatchTokenPrefix
+
bEntry
entry
.
ID
=
consts
.
BatchTokenPrefix
+
bEntry
...
...
This diff is collapsed.
Click to expand it.
vault/version_store.go
+
2
-
2
View file @
6106b48f
...
@@ -70,7 +70,7 @@ func (c *Core) storeVersionTimestamp(ctx context.Context, version string, timest
...
@@ -70,7 +70,7 @@ func (c *Core) storeVersionTimestamp(ctx context.Context, version string, timest
// FindOldestVersionTimestamp searches for the vault version with the oldest
// FindOldestVersionTimestamp searches for the vault version with the oldest
// upgrade timestamp from storage. The earliest version this can be is 1.9.0.
// upgrade timestamp from storage. The earliest version this can be is 1.9.0.
func
(
c
*
Core
)
FindOldestVersionTimestamp
()
(
string
,
time
.
Time
,
error
)
{
func
(
c
*
Core
)
FindOldestVersionTimestamp
()
(
string
,
time
.
Time
,
error
)
{
if
len
(
c
.
versionTimestamps
)
==
0
{
if
c
.
versionTimestamps
==
nil
{
return
""
,
time
.
Time
{},
fmt
.
Errorf
(
"version timestamps are not initialized"
)
return
""
,
time
.
Time
{},
fmt
.
Errorf
(
"version timestamps are not initialized"
)
}
}
...
@@ -87,7 +87,7 @@ func (c *Core) FindOldestVersionTimestamp() (string, time.Time, error) {
...
@@ -87,7 +87,7 @@ func (c *Core) FindOldestVersionTimestamp() (string, time.Time, error) {
}
}
func
(
c
*
Core
)
FindNewestVersionTimestamp
()
(
string
,
time
.
Time
,
error
)
{
func
(
c
*
Core
)
FindNewestVersionTimestamp
()
(
string
,
time
.
Time
,
error
)
{
if
len
(
c
.
versionTimestamps
)
==
0
{
if
c
.
versionTimestamps
==
nil
{
return
""
,
time
.
Time
{},
fmt
.
Errorf
(
"version timestamps are not initialized"
)
return
""
,
time
.
Time
{},
fmt
.
Errorf
(
"version timestamps are not initialized"
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help