Issue #24249:improve priv checking