jbonofre opened a new pull request, #3058: URL: https://github.com/apache/karaf/pull/3058
## Problem `JmsServiceImpl.delete()` and `JmsServiceImpl.lookupConnectionFactory()` put the connection factory name into OSGi filters without escaping. `lookupConnectionFactory()` is used by `jms:info`, `count`, `browse`, `consume`, `send`, `move`, `queues` and `topics`, and by the matching `JmsMBean` operations. As a result: - `jms:delete "*"` (or `"prod*"`) deletes every matching `org.apache.karaf.jms` configuration, instead of the one with that name; - the other commands resolve `*` to the highest ranked connection factory, instead of failing because no factory has that name; - a name containing `(`, `)` or `\` can't be found or deleted at all, because the filter is invalid. The filter can't be widened beyond the `org.apache.karaf.jms` factory configurations: Felix rejects a filter with more than one top-level operation. ## Fix Escape the name with the OSGi filter syntax (`\`, `*`, `(` and `)` preceded by a backslash) in both filters, so it is always matched literally. This uses OSGi escaping on purpose, not the LDAP hex escaping (`\2a`, `\28`) used by `JdbcServiceImpl.escapeLdapFilterValue()` (#2654). OSGi filters don't support hex escapes: `\2a` matches the literal value `2a`. So JDBC still blocks the wildcard, but a datasource whose name contains one of these characters can't be found. That is a separate fix. ## Testing New `JmsServiceImplTest`. It fakes Configuration Admin and the service registry, but evaluates the generated filters with the real OSGi filter parser (`FrameworkUtil.createFilter`). It checks that: - `delete()` and the lookup match only the named factory (by name, JNDI name or service id); - wildcards and filter syntax in the name match nothing; - names containing `(`, `)`, `*` and `\` are found. 4 of the 6 tests fail without the fix. `mvn -pl jms verify` passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
