Skip to content

Add support for rpccookiefile alternative to rpcuser/rpcpassword#60

Merged
luke-jr merged 20 commits intoOCEAN-xyz:masterfrom
luke-jr:rpccookie
Mar 7, 2025
Merged

Add support for rpccookiefile alternative to rpcuser/rpcpassword#60
luke-jr merged 20 commits intoOCEAN-xyz:masterfrom
luke-jr:rpccookie

Conversation

@luke-jr
Copy link
Copy Markdown
Contributor

@luke-jr luke-jr commented Jan 15, 2025

No description provided.

jesterhodl and others added 7 commits December 10, 2024 23:07
…once and reuse

- in order to eliminate discrepancies between char array sizes, use sizeof() in max_string_length of datum_config_options

- introduce a warning in case a config option is truncated

- where userpass was reused for a filepath, create a separate variable

- reduce user and pass to 128 bytes

- exit during config upon parsing error, makes more sense to me
@luke-jr luke-jr added the enhancement New feature or request label Jan 15, 2025
@luke-jr luke-jr added this to the v0.3.0 milestone Jan 15, 2025
@1ma
Copy link
Copy Markdown

1ma commented Jan 28, 2025

Tested "rpccookiefile" without "rpcuser" nor "rpcpassword" in the config file at bbfcd29, seems to work fine.

src/datum_conf.c Outdated
datum_config_opt_missing_error(datum_config_get_option_info2("bitcoind", "rpcpassword"));
return 0;
}
sprintf(datum_config.bitcoind_rpcuserpass, "%s:%s", datum_config.bitcoind_rpcuser, datum_config.bitcoind_rpcpassword);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is safe because we truncate to max_string_len, but compiler doesn't know and gives a warning. How about resize bitcoind_rpcuser and bitcoind_rpcpassword in datum_conf.h from 256 to 128. That would be in line with #46 where I set these to 128 to align array sizes with max_string_len limits. (Yes, I still have that PR to work on)

And use snprintf to future-proof in case sizes are changed:

snprintf(datum_config.bitcoind_rpcuserpass, sizeof(datum_config.bitcoind_rpcuserpass), "%s:%s", datum_config.bitcoind_rpcuser, datum_config.bitcoind_rpcpassword);

@luke-jr luke-jr merged commit 98cfb40 into OCEAN-xyz:master Mar 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants