Mercurial > projects > sievemgr
comparison cmd/sievemgr/info.go @ 22:fc5e6970a0d5 default tip
Add support for specifying an authorization identity on the command line
author | Guido Berhoerster <guido+sievemgr@berhoerster.name> |
---|---|
date | Wed, 17 Feb 2021 07:50:55 +0100 |
parents | d14d93d011d7 |
children |
comparison
equal
deleted
inserted
replaced
21:ad5f548e3b10 | 22:fc5e6970a0d5 |
---|---|
29 "go.guido-berhoerster.org/managesieve" | 29 "go.guido-berhoerster.org/managesieve" |
30 ) | 30 ) |
31 | 31 |
32 func init() { | 32 func init() { |
33 cmdInfo.Flag.StringVar(&acctName, "a", "", "Select the account") | 33 cmdInfo.Flag.StringVar(&acctName, "a", "", "Select the account") |
34 cmdInfo.Flag.StringVar(&authzID, "A", "", "Specify the authorization identity") | |
34 } | 35 } |
35 | 36 |
36 var cmdInfo = &command{ | 37 var cmdInfo = &command{ |
37 UsageLine: "info [options]", | 38 UsageLine: "info [options]", |
38 Run: runInfo, | 39 Run: runInfo, |
75 err) | 76 err) |
76 } | 77 } |
77 } | 78 } |
78 saslMechs := c.SASLMechanisms() | 79 saslMechs := c.SASLMechanisms() |
79 | 80 |
80 auth := managesieve.PlainAuth("", acct.User, acct.Password, acct.Host) | 81 auth := managesieve.PlainAuth(authzID, acct.User, acct.Password, acct.Host) |
81 if err := c.Authenticate(auth); err != nil { | 82 if err := c.Authenticate(auth); err != nil { |
82 return fmt.Errorf("failed to authenticate user %s: %s", | 83 return fmt.Errorf("failed to authenticate user %s: %s", |
83 acct.User, err) | 84 acct.User, err) |
84 } | 85 } |
85 defer c.Logout() | 86 defer c.Logout() |