state: preserve nil expiry on user owned registration when no default is configured
When a user owned node registers or re registers with a PreAuthKey and the client sends zero client expiry while node.expiry is set to 0, the expiry column ends up stored as 0001-01-01 00:00:00 instead of NULL. Two sites in HandleNodeFromPreAuthKey build a non nil pointer to regReq.Expiry even when the value is zero time, and the needsDefaultExpiry guard only replaces it when s.cfg.Node.Expiry > 0, so the pointer to zero time survives to the database. Convert an unset regReq.Expiry to nil before handing it off so the needsDefaultExpiry path is the only place that assigns a non nil pointer. This is a narrower sibling of #3170 on the user owned PreAuthKey path. The regression was introduced alongside the fix for #3111 in 6337a3db.
A
Akhilesh Arora committed
0e10ca4e9a27d0eb379207c2939e76dc789484ce
Parent: ba251e7
Committed by Kristoffer Dalby <kristoffer@dalby.cc>
on 4/29/2026, 12:06:38 PM