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

Fix support for namecheap #467

Merged
merged 1 commit into from Jan 20, 2024
Merged

Conversation

Grub4K
Copy link
Contributor

@Grub4K Grub4K commented Jan 20, 2024

This PR fixes the 2 problems with the current namecheap support and also updates the README.md to reflect that.


The first problem stems from the good and nochg strings no longer getting sent back, making inadyn think the request failed (while it might not have).
The example in the README.md on the other hand will always succeed, since true is always in the response, even if it failed. Refer to the examples below.

I have decided to replace both with a check for <ErrCount>0</ErrCount>.

faulty response
<?xml version="1.0" encoding="utf-16"?>
<interface-response>
  <Command>SETDNSHOST</Command>
  <Language>eng</Language>
  <ErrCount>1</ErrCount>
  <errors>
    <Err1>Passwords do not match</Err1>
  </errors>
  <ResponseCount>1</ResponseCount>
  <responses>
    <response>
      <Description>Passwords do not match</Description>
      <ResponseNumber>304156</ResponseNumber>
      <ResponseString>Validation error; invalid ; password</ResponseString>
    </response>
  </responses>
  <Done>true</Done>
  <debug><![CDATA[]]></debug>
</interface-response>
successful response
<?xml version="1.0" encoding="utf-16"?>
<interface-response>
  <Command>SETDNSHOST</Command>
  <Language>eng</Language>
  <IP>XXX.XXX.XXX.XXX</IP>
  <ErrCount>0</ErrCount>
  <errors />
  <ResponseCount>0</ResponseCount>
  <responses />
  <Done>true</Done>
  <debug><![CDATA[]]></debug>
</interface-response>

The second problem is username and hostname being swapped in NAMECHEAP_UPDATE_IP_REQUEST causing it to send domain=%h, host=%u instead of domain=%u, host=%h. While we can work around this by swapping username and hostname in the config, this means we cannot specify multiple hostnames.

I have swapped the two fields and think it is worth this breaking change for ease of use, especially since the plugin is currently broken and people couldn't be relying on it anyways.

current option (custom provider)
custom namecheap {
  username    = domain.tld
  password    = mypass
  ddns-server = dynamicdns.park-your-domain.com
  ddns-path   = "/update?domain=%u&password=%p&host=%h&ip=%i"
  ddns-response = "<ErrCount>0</ErrCount>"
  hostname = { "@" "www" }
}
current option (plugin)
provider default@namecheap.com:1 {
  username = "@"
  password = mypass
  hostname = domain.tld
}
provider default@namecheap.com:2 {
  username = "www"
  password = mypass
  hostname = domain.tld
}
new option
provider default@namecheap.com {
  username = domain.tld
  password = mypass
  hostname = { "@" "www" }
}

Signed-off-by: Simon Sawicki <contact@grub4k.xyz>
@troglobit
Copy link
Owner

Well I don't have any way to test, so I'll just trust you. This does however make you de facto maintainer of the namecheap plugin 😉

@troglobit troglobit merged commit 0c17eca into troglobit:master Jan 20, 2024
@Grub4K Grub4K deleted the fix/namecheap branch January 20, 2024 18:45
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.

None yet

2 participants