diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2023-09-01 00:26:35 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2023-09-01 00:26:35 +0300 |
commit | 4588170d1e43db780c551177f5996598fe25bc6e (patch) | |
tree | bc9ec31b03fd179cb1b812df5c1493ab816f59fb /telegram/commands.go | |
parent | aa561c5be606c14cfd211df694ef0be856195df7 (diff) |
Harden the authorizer access to prevent crashesv1.8.1
Diffstat (limited to 'telegram/commands.go')
-rw-r--r-- | telegram/commands.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/telegram/commands.go b/telegram/commands.go index b4920d4..b729973 100644 --- a/telegram/commands.go +++ b/telegram/commands.go @@ -244,6 +244,9 @@ func (c *Client) ProcessTransportCommand(cmdline string, resource string) string return notEnoughArguments } + c.locks.authorizerWriteLock.Lock() + defer c.locks.authorizerWriteLock.Unlock() + if cmd == "login" { err := c.TryLogin(resource, args[0]) if err != nil { @@ -324,10 +327,13 @@ func (c *Client) ProcessTransportCommand(cmdline string, resource string) string lastname = rawCmdArguments(cmdline, 1) } + c.locks.authorizerWriteLock.Lock() if c.authorizer != nil && !c.authorizer.isClosed { c.authorizer.FirstName <- firstname c.authorizer.LastName <- lastname + c.locks.authorizerWriteLock.Unlock() } else { + c.locks.authorizerWriteLock.Unlock() if !c.Online() { return notOnline } |