From f7cb616cd2128656a49dd5f2d129019e6620f090 Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Tue, 12 Jun 2018 13:38:13 -0700 Subject: [PATCH] Optimization per @cdevienne Signed-off-by: Derek Collison --- server/client.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/server/client.go b/server/client.go index 91f5c4cf..d2e794c9 100644 --- a/server/client.go +++ b/server/client.go @@ -1297,9 +1297,7 @@ func (c *client) prunePubPermsCache() { // pubAllowed checks on publish permissioning. func (c *client) pubAllowed() bool { // Disallow publish to _SYS.>, these are reserved for internals. - if c.pa.subject[0] == '_' && len(c.pa.subject) > 4 && - c.pa.subject[1] == 'S' && c.pa.subject[2] == 'Y' && - c.pa.subject[3] == 'S' && c.pa.subject[4] == '.' { + if len(c.pa.subject) > 4 && string(c.pa.subject[:5]) == "_SYS." { c.pubPermissionViolation(c.pa.subject) return false }