Merge pull request #17970 from mjstapp/fix_privs_no_caps

libs: return from change_caps if no caps
This commit is contained in:
Donald Sharp 2025-02-03 12:57:44 -05:00 committed by GitHub
commit f54241a346
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -210,10 +210,11 @@ int zprivs_change_caps(zebra_privs_ops_t op)
{
cap_flag_value_t cflag;
/* should be no possibility of being called without valid caps */
assert(zprivs_state.syscaps_p && zprivs_state.caps);
if (!(zprivs_state.syscaps_p && zprivs_state.caps))
exit(1);
/* Called without valid caps - just return. Not every daemon needs
* privs.
*/
if (zprivs_state.syscaps_p == NULL || zprivs_state.caps == NULL)
return 0;
if (op == ZPRIVS_RAISE)
cflag = CAP_SET;