Skip to content

Add Hardware ID support on Licenses#766

Draft
Repflez wants to merge 2 commits into
fuzziqersoftware:masterfrom
Repflez:hardware_id_support
Draft

Add Hardware ID support on Licenses#766
Repflez wants to merge 2 commits into
fuzziqersoftware:masterfrom
Repflez:hardware_id_support

Conversation

@Repflez

@Repflez Repflez commented May 22, 2026

Copy link
Copy Markdown
Contributor

This PR adds Hardware ID support to newserv by using the id sent during the login sequence.
This has changes to the license formats for the affected platforms, but don't require making a new format for them. Included is a fallback so previous licenses can be loaded without the need of editing the files manually.

I'm including small checklist to track progress

  • Config: Add setting to allow binding ids
  • Config: Add entry for banned ids
  • BB: License file changes
  • BB: Bind and lockout on mismatched ids
  • DC: Add support for binding/lockout
  • newserv: Allow banning ids using the same codepath as banning via IPs

This PR is a draft until the checklist is completed, but wanted to post the work done so far on this for feedback.

@Repflez Repflez changed the title Add Hardware ID support Add Hardware ID support on Licenses May 22, 2026

@fuzziqersoftware fuzziqersoftware left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Overall this looks good; I have a couple of style comments. Thanks for working on this.

I didn't review until now because this PR is in the draft state, but today I noticed that the PR description asks for feedback. In the future you can ping me (on Discord, or here with an @-mention) if I don't notice and you want a more timely review.

Comment thread src/Account.hh
struct BBLicense {
std::string username;
std::string password;
std::string hardware_id;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

std::optional<uint64_t> would make more sense here. We could serialize it as an integer or null in JSON.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I originally tried to serialize it as a uint64_t, but either I screwed something up or it was a serialization issue that it ended up being as signed in the json file and when read back, it was doing it wrong, that's why I went for a string. I'll change it to the std::optional<uint64_t>, though.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The negative value in the JSON file should still work as long as its 64-bit representation matches the unsigned value that was originally serialized. If that feels a bit weird (as it probably would to me, to be honest), you could also change all the places where hardware_id is used to le_int64_t/be_int64_t/int64_t for consistency. The treatment of hardware ID as a 64-bit integer is nonstandard anyway with regard to vanilla PSO, so it's not important that the value is unsigned.

Comment thread src/Account.cc

shared_ptr<Login> AccountIndex::from_bb_credentials(
const string& username, const string* password, bool allow_create) {
const string& username, const string* password, const uint64_t* hardware_id, bool allow_create, bool bind_hardware_id) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

It would be cleaner to not have bool bind_hardware_id, and if the hardware_id pointer is null, it means the hardware ID shouldn't be checked or bound. Then the callsite in on_93_BB would just pass null here if s->bind_hardware_ids_on_login is false.

@Repflez Repflez Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't remember exactly why I did it that way, I think it was to make it work with other usages like $bbsave (I think it was that one), I'll change it to be that way, though.

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.

2 participants