Skip to content
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

Added porkbun support #473

Merged
merged 8 commits into from
Apr 16, 2024

Conversation

stescobedo92
Copy link
Contributor

This pull request aims to adapt Inadyn's code so that it can use the PorkBun API, a dynamic DNS provider. To do this, the following functions have been modified:

  • setup: to get zone ID and hostname ID using PorkBun API
  • request: to send DNS update request using PorkBun API
  • response: to check the PorkBun API response status code
  • json_extract: to extract the value of a JSON key from the PorkBun API response

and other functions

A new data structure has also been defined to store the information from PorkBun's dynamic DNS system, and corresponding values have been assigned to the structure's fields.

@BrainSlayer
Copy link
Contributor

../../src/../plugins/porkbun.c: In function 'check_success':
../../src/../plugins/porkbun.c:127:46: error: 'KEY_SUCCESS' undeclared (first use in this function); did you mean 'EXIT_SUCCESS'?
127 | if (jsoneq(json, tokens + i, KEY_SUCCESS) != 0)
| ^~~~~~~~~~~
| EXIT_SUCCESS
../../src/../plugins/porkbun.c:127:46: note: each undeclared identifier is reported only once for each function it appears in
../../src/../plugins/porkbun.c: In function 'get_result_value':
../../src/../plugins/porkbun.c:169:13: warning: implicit declaration of function 'check_status' [-Wimplicit-function-declaration]
169 | if (check_status(json, tokens, num_tokens) == -1) {
| ^~~~~~~~~~~~

@BrainSlayer
Copy link
Contributor

check_status function is missing too

@stescobedo92
Copy link
Contributor Author

These are the commits that resolve the issues

  • Adding KEY_SUCCESS missing value

  • Fixing errors

@troglobit
Copy link
Owner

check_status function is missing too

Thank you for taking the time to review this! 😃👍

@troglobit
Copy link
Owner

I've authorised the CI suite but it fails because inadyn -h now suddenly fails?

@stescobedo92
Copy link
Contributor Author

I've authorised the CI suite but it fails because inadyn -h now suddenly fails?

Yes I have noticed that it fails when you try to access the help

@troglobit
Copy link
Owner

I've authorised the CI suite but it fails because inadyn -h now suddenly fails?

Yes I have noticed that it fails when you try to access the help

Do you have any idea why? Looks like it segfaults. How have you tested these changes?

Also, I noticed you pushed another change to this branch. Do you want to change to a Draft PR?

@stescobedo92
Copy link
Contributor Author

I've authorised the CI suite but it fails because inadyn -h now suddenly fails?

Yes I have noticed that it fails when you try to access the help

Do you have any idea why? Looks like it segfaults. How have you tested these changes?

Also, I noticed you pushed another change to this branch. Do you want to change to a Draft PR?

I could check to see what happens if I think you can move the PR to draft until you see what the reason for the error is.

The last changes I added were examples for ipv4 and ipv6

@troglobit
Copy link
Owner

I've authorised the CI suite but it fails because inadyn -h now suddenly fails?

Yes I have noticed that it fails when you try to access the help

Do you have any idea why? Looks like it segfaults. How have you tested these changes?

Also, I noticed you pushed another change to this branch. Do you want to change to a Draft PR?

I could check to see what happens if I think you can move the PR to draft until you see what the reason for the error is.

The last changes I added were examples for ipv4 and ipv6

My point: a PR is usually not made unless you're done with a change to a project. Your change does not pass a basic test (issuing help) and you keep pushing new changes. So it seems to me (the project maintainer) that you're not ready yet for review or merge.

Yes, I see what your changes do. Do you plan to make more changes not related to fixing the problem I mentioned? If so, this should be converted to a draft, by you.

@stescobedo92
Copy link
Contributor Author

I've authorised the CI suite but it fails because inadyn -h now suddenly fails?

Yes I have noticed that it fails when you try to access the help

Do you have any idea why? Looks like it segfaults. How have you tested these changes?

Also, I noticed you pushed another change to this branch. Do you want to change to a Draft PR?

I could check to see what happens if I think you can move the PR to draft until you see what the reason for the error is.
The last changes I added were examples for ipv4 and ipv6

My point: a PR is usually not made unless you're done with a change to a project. Your change does not pass a basic test (issuing help) and you keep pushing new changes. So it seems to me (the project maintainer) that you're not ready yet for review or merge.

Yes, I see what your changes do. Do you plan to make more changes not related to fixing the problem I mentioned? If so, this should be converted to a draft, by you.

Those are the latest changes related to porkbun support

@BrainSlayer
Copy link
Contributor

the code makes no sense. the check_success function is unused. so KEY_SUCCESS you now inserted into the code will never be used. for me the code looks broken and incomplete. please fix it

@BrainSlayer
Copy link
Contributor

BrainSlayer commented Feb 21, 2024

i know the cause of the crash/segfault. see my first comment for Makefile.am. this is causing the crash in plugin_unregister. i know its curious. but i tested it. fixing this will avoid the crash

@stescobedo92
Copy link
Contributor Author

i know the cause of the crash/segfault. see my first comment for Makefile.am. this is causing the crash in plugin_unregister. i know its curious. but i tested it. fixing this will avoid the crash

I already fixed it, but noted that if you look at the Cloudflare plugin, the KEY_SUCCESS macro is used

@BrainSlayer
Copy link
Contributor

BrainSlayer commented Feb 22, 2024

i know the cause of the crash/segfault. see my first comment for Makefile.am. this is causing the crash in plugin_unregister. i know its curious. but i tested it. fixing this will avoid the crash

I already fixed it, but noted that if you look at the Cloudflare plugin, the KEY_SUCCESS macro is used

i never complained about the use of the macro. i complained that the whole function check_success which made use of this macro was never used. i see you corrected this now in the way i'm thinking its correct but that all makes me wonder how you ever tested it since the code was entirely broken before you fixed it

and you did still not fix the Makefile.am issue in src/Makefile.am
you inserted cloudxns.c twice by copy and paste error

@BrainSlayer
Copy link
Contributor

your last fixes are buggy too. the & must be removed. this cannot work. can you please test your code?

../../src/../plugins/porkbun.c:169:49: warning: passing argument 3 of 'check_success' makes integer from pointer without a cast [-Wint-conversion]
169 | if (check_success(json, tokens + i + 1, &num_tokens) == -1) {

@stescobedo92
Copy link
Contributor Author

your last fixes are buggy too. the & must be removed. this cannot work. can you please test your code?

../../src/../plugins/porkbun.c:169:49: warning: passing argument 3 of 'check_success' makes integer from pointer without a cast [-Wint-conversion] 169 | if (check_success(json, tokens + i + 1, &num_tokens) == -1) {

Fixed errors with & operator in the call of check_success function

@BrainSlayer
Copy link
Contributor

if this code has been tested and is working fully. i vote for merging. so far i havent seen any testresult or at least a word about that.

@stescobedo92
Copy link
Contributor Author

if this code has been tested and is working fully. i vote for merging. so far i havent seen any testresult or at least a word about that.

with the latest changes fixed it works completely

@mindofbeholder
Copy link

It's been a while so hoping to bump this to get it merged.

@troglobit
Copy link
Owner

OK, merging.

@troglobit troglobit merged commit 7d576c4 into troglobit:master Apr 16, 2024
@henfri
Copy link

henfri commented May 24, 2024

Hello,

thanks for the support for porkbun.
Unfortunately, it does not seem to work.
The first issue is, that the check-ip server does not seem to exist anymore.
I fixed that by a check-ip command.
But then, I get:

inadyn[2754903]: Request:
GET /client/v4/dns/retrieve/x.name HTTP/1.0
Host: api.porkbun.com
User-Agent: inadyn/2.12.0 https://github.com/troglobit/inadyn/issues
Accept: */*
Content-Type: application/json
Content-Length: 21

{"apikey":"[email protected]","secretapikey":"pk1_xxx"}
inadyn[2754903]: Successfully sent HTTPS request!
inadyn[2754903]: Successfully received HTTPS response (1693/8191 bytes)!
inadyn[2754903]: Response:
HTTP/1.1 404 Not Found

It is notable, that https://porkbun.com/account/api is refering to API V3. Here, I see no permissions like
permissions: Zone.Zone - Read, Zone.DNS - Edit.

Is there a change to the API?

Best regards,
Hendrik

@troglobit
Copy link
Owner

Hello,

thanks for the support for porkbun.

Unfortunately, it does not seem to work.

The first issue is, that the check-ip server does not seem to exist anymore.

I fixed that by a check-ip command.

But then, I get:


inadyn[2754903]: Request:

GET /client/v4/dns/retrieve/x.name HTTP/1.0

Host: api.porkbun.com

User-Agent: inadyn/2.12.0 https://github.com/troglobit/inadyn/issues

Accept: */*

Content-Type: application/json

Content-Length: 21



{"apikey":"[email protected]","secretapikey":"pk1_xxx"}

inadyn[2754903]: Successfully sent HTTPS request!

inadyn[2754903]: Successfully received HTTPS response (1693/8191 bytes)!

inadyn[2754903]: Response:

HTTP/1.1 404 Not Found



It is notable, that https://porkbun.com/account/api is refering to API V3. Here, I see no permissions like

permissions: Zone.Zone - Read, Zone.DNS - Edit.

Is there a change to the API?

Best regards,

Hendrik

@henfri this seems pretty bad, my gut reaction is to revert the porkbun support completely so other users don't experience the same issues. What do you think we should do?

@henfri
Copy link

henfri commented May 24, 2024

Lets wait for @stescobedo92 to comment...
Maybe it is easy to fix

@lunik1
Copy link

lunik1 commented May 24, 2024

Please also see #483

@lunik1
Copy link

lunik1 commented Sep 8, 2024

There has been no response from @stescobedo92, I think this should be reverted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants