-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow flux-logger(1) and flux_log(3) to get an EPERM error, optionally #1000
Conversation
Problem: flux_open() does not call flux_handle_destroy() on its new handle if errors occur after its creation. Ensure that the handle is destroyed in those paths.
Problem: if a request is rejected by the reactor message dispatcher due to security policy, it receives a response even if it is not expecting one. Don't send a response if matchtag is FLUX_MATCHTAG_NONE.
Problem: with new multi-user security features, a log request can be denied by the message dispatcher if it comes from a user other than the instance owner. In some case flux_log() users may want to treat this as a fatal error, but they can't if there is no RPC response. If the log.append request was sent with FLUX_MATCTHAG_NONE, there is no response as before. Otherwise, a success/fail response is returned to the sender.
Problem: flux_log() cannot return an error. If the FLUX_LOG_CHECK bit is set in the severity parameter passed to flux_log() or flux_vlog(), make the log.append RPC with flags=0 and block until a response is received. Otherwise, make it with flags=FLUX_RPC_NORESPONSE and return immediately, as before. Change the return value of these functions from void to int. If the FLUX_LOG_CHECK bit is set, a return of -1 with errno set is possible. Otherwise, the return value will always be 0.
Problem: flux_logger returns success even if the user is not allowed to log to the instance. Add the FLUX_LOG_CHECK flag to the flux_log() call, and check its return value. Fixes flux-framework#999
Ensure that "flux logger" and "flux dmesg" receive EPERM errors when the owner role is not held.
Just noticed there is no man page for flux-log(3) so I will add that. |
Add a missing line separator and a missing secondary man page.
Oh, nicely done without affecting most callers. Once travis is done is this ready for merge? |
I think so, thanks. |
Codecov Report
@@ Coverage Diff @@
## master #1000 +/- ##
==========================================
+ Coverage 76.16% 76.18% +0.02%
==========================================
Files 153 153
Lines 26517 26545 +28
==========================================
+ Hits 20197 20224 +27
- Misses 6320 6321 +1
Continue to review full report at Codecov.
|
This PR changes the return value of
flux_log()
andflux_vlog()
from void to int, and adds a flag FLUX_LOG_CHECK (ored with "severity") which enables these functions to return an error.If that flag is set, switch
flux_log()
from "fire and forget" mode to a synchronous RPC with the possibility of an error response. Issue the optional response in the broker "log.append" RPC handler. Then use the flag influx-logger
where attempting to log to an instance without appropriate permission really should be reported as an error.Also: fix a mem leak in the
flux_open()
error path, and change the EPERM response logic to NOT send a response to fire and forget RPC's (based on the matchtag value).Add a couple tests.