Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
keystore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
id
keystore
Commits
f160f1cb
Commit
f160f1cb
authored
7 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Requests are in the shared namespace
parent
6fe3e7df
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dovecot/keyproxy.go
+9
-4
9 additions, 4 deletions
dovecot/keyproxy.go
with
9 additions
and
4 deletions
dovecot/keyproxy.go
+
9
−
4
View file @
f160f1cb
...
...
@@ -78,17 +78,22 @@ func NewKeyLookupProxy(config *Config) (*KeyLookupProxy, error) {
},
nil
}
const
(
namespace
=
"shared"
namespaceLen
=
len
(
namespace
)
)
// Lookup a key using the dovecot dict proxy interface.
//
// We can be sent a userdb lookup, or a passdb lookup, and we can tell
// them apart with the key prefix (passdb/ or userdb/).
func
(
s
*
KeyLookupProxy
)
Lookup
(
ctx
context
.
Context
,
key
string
)
(
interface
{},
bool
,
error
)
{
switch
{
case
strings
.
HasPrefix
(
key
,
"
passdb/"
)
:
kparts
:=
strings
.
SplitN
(
key
[
7
:
],
passwordSep
,
2
)
case
strings
.
HasPrefix
(
key
,
namespace
+
"/
passdb/"
)
:
kparts
:=
strings
.
SplitN
(
key
[
namespaceLen
+
8
:
],
passwordSep
,
2
)
return
s
.
lookupPassdb
(
ctx
,
kparts
[
0
],
kparts
[
1
])
case
strings
.
HasPrefix
(
key
,
"
userdb/"
)
:
return
s
.
lookupUserdb
(
ctx
,
key
[
7
:
])
case
strings
.
HasPrefix
(
key
,
namespace
+
"/
userdb/"
)
:
return
s
.
lookupUserdb
(
ctx
,
key
[
namespaceLen
+
8
:
])
default
:
log
.
Printf
(
"unknown key %s"
,
key
)
return
nil
,
false
,
nil
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment