Skip to content

Commit 6af0cdd

Browse files
committed
Bug#25541837 PRIVILEGE_SUPER=FALSE RESETS ALMOST ALL PERMISSIONS
Problem: ======== Invalid boolean operator used during removal of the specified privilege, using the sec context service. Fix: ==== Unary complement (bit inversion) applied during unsetting specified privilege, using the sec context service. Reviewed-by: ============ Georgi Kodinov <georgi.kodinov@oracle.com> Steinar Gunderson <steinar.gunderson@oracle.com>
1 parent 2198cbe commit 6af0cdd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sql/auth/service_security_context.cc

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
22
This program is free software; you can redistribute it and/or modify
33
it under the terms of the GNU General Public License as published by
44
the Free Software Foundation; version 2 of the License.
@@ -307,18 +307,18 @@ my_svc_bool security_context_set_option(MYSQL_SECURITY_CONTEXT ctx,
307307
{
308308
my_svc_bool value= *(my_svc_bool *) pvalue;
309309
if (value)
310-
ctx->set_master_access(ctx->master_access() | SUPER_ACL);
310+
ctx->set_master_access(ctx->master_access() | (SUPER_ACL));
311311
else
312-
ctx->set_master_access(ctx->master_access() & !(SUPER_ACL));
312+
ctx->set_master_access(ctx->master_access() & ~(SUPER_ACL));
313313

314314
}
315315
else if (!strcmp(name, "privilege_execute"))
316316
{
317317
my_svc_bool value= *(my_svc_bool *) pvalue;
318318
if (value)
319-
ctx->set_master_access(ctx->master_access() | EXECUTE_ACL);
319+
ctx->set_master_access(ctx->master_access() | (EXECUTE_ACL));
320320
else
321-
ctx->set_master_access(ctx->master_access() & !(EXECUTE_ACL));
321+
ctx->set_master_access(ctx->master_access() & ~(EXECUTE_ACL));
322322
}
323323
else
324324
return MY_SVC_TRUE; /** invalid option */

0 commit comments

Comments
 (0)