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
ipa-join: implement calls to JSON-RPC endpoints #4724
Conversation
|
0c60b59
to
544d156
Compare
2ee4170
to
ac30ebf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work! I'm impressed.
I have marked a couple of places where NULL or error checks are missing. Explicit error checking in C is a PITB. :(
Normally I wouldn't bee too concerned with memory leaks in short-running binaries. But our internal build systems and QA has static code analyzers that will flag any potential leak.
caf6f4e
to
8f919a8
Compare
8f919a8
to
6bf12b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang code analyzer doesn't four lines of code:
$ scan-build make
...
ipa-join.c:690:34: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'char *'
response->payload = (char *) malloc(sizeof(response->payload));
~~~~~~ ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
ipa-join.c:941:9: warning: Branch condition evaluates to a garbage value
if (cb.payload)
^~~~~~~~~~
ipa-join.c:1026:9: warning: Branch condition evaluates to a garbage value
if (cb.payload)
^~~~~~~~~~
ipa-join.c:1400:9: warning: Value stored to 'krberr' is never read
krberr = krb5_cc_initialize(krbctx, ccache, creds.client);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
@tiran Issues found by clang are fixed. I'm going to move the fixes to the respective commits once you reviewed them. |
36efe85
to
0d27eed
Compare
|
0d27eed
to
e942e5a
Compare
@Carbenium Can you rebase this against the current master? CI is failing because some code that controls template versions is out-of-date. |
Adding JSON-C and LibCURL library into configure.ac and Makefile.am Creating a API call with option '-j' or '--jsonrpc' to make host join on FreeIPA with JSONRPC and libCURL. Related: https://pagure.io/freeipa/issue/7966 Signed-off-by: Alexandre Mulatinho <alex@mulatinho.net>
CURLOPT_WRITEFUNCTION is not guaranteed to be called only once per request and receive all data at once. Use a dynamic buffer to cope with that case. Related: https://pagure.io/freeipa/issue/7966
Additionally JSON-RPC should bail out if host is already joined. Check HTTP status of JSON-RPC request and report 401 Unauthorized error explicitly. Related: https://pagure.io/freeipa/issue/7966
…arate function Also fix some some memleaks on the way. Related: https://pagure.io/freeipa/issue/7966
The used RPC protocol (JSON or XML) is defined at build time. Related: https://pagure.io/freeipa/issue/7966
7b41e28
to
3c5b279
Compare
@rcritten Sure thing. Here you go. |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
Triggering Azure CI + PR-CI as the Azure failure is unrelated to the PR. |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
LGTM. So this is going to be a change in defaults: we would default to using JSON-RPC now unless I think it is worth to document in the release notes (add 'changelog' entry in the ticket') because this client would not be able to enroll to very old servers (IPA v2.x?). No practical change to anything else, though. |
master:
|
Based on work done by @mulatinho in PR #3544