Commit Graph
4 Commits
Author SHA1 Message Date
yuanyuanxianganddeepseek-flash 2b26f22d27 Feature: add tooltips to the password input dialog
The passcode input dialog now explains every control the operator can
use on hover, using the same MFC built-in tooltip mechanism as the
generate-passcode dialog (EnableToolTips + OnToolHitTest + TTN_NEEDTEXT,
with the max tip width applied when the tip is requested).

The passcode tip carries the main point: the value must match the
current serial and binding mode, and a passcode that was tampered with,
cracked or forged is invalid. The OK tip says the authorization check
verifies the passcode after saving rather than claiming the dialog
checks it. The checksum tip reflects that V2 verifies the passcode
signature while V1 checks the passcode itself, and the root-credential
tip notes that clearing the box does not delete the stored credential.

While here, the TTN_NEEDTEXT handlers keep idFrom in UINT_PTR: on x64
the old UINT intermediate could truncate a control HWND. The same fix
is applied to the generate-passcode dialog.

All 6 texts are translated in the en_US, de_DE and zh_TW packs.

Co-Authored-By: deepseek-flash
2026-12-06 22:39:08 +01:00
yuanyuanxianganddeepseek-flash f22bd574ea Feature: add tooltips to the generate-passcode dialog
Every control the operator can use on the passcode-generation dialog now
explains itself on hover, reusing the MFC built-in tooltip mechanism from
the build-server dialog (EnableToolTips + OnToolHitTest + TTN_NEEDTEXT,
with the max tip width applied when the tip is requested so the explicit
line breaks hold; hidden controls are skipped).

The password, private-key and Generate tips carry the main point: a
passcode is only valid when produced with the right super-admin password
(V1) or a legitimate private key (V2); tampered passwords, forged keys
and hand-assembled values always fail client verification. The
root-credential tip now describes the field as the downward credential
filled in after generating, which is what V2 actually writes there.

All 18 texts are translated in the en_US, de_DE and zh_TW packs.

Co-Authored-By: deepseek-flash
2026-12-06 22:22:40 +01:00
yuanyuanxiang 740ec8baf3 Perf(license): mutex + write-suppression for licenses.ini hot path
licenses.ini was hit on every heartbeat -- 5s x clients x ~8 SetStr per
auth -- with no concurrency protection. Two consequences:
  1. 100 concurrent online would saturate the file (~160 writes/sec,
     full-file rewrite each via WritePrivateProfileString).
  2. Concurrent SetPendingRenewal / DecrementPendingQuota with no lock
     occasionally clobbered freshly-set renewal quotas (reported by
     user as "preset renewal silently disappears").

Add LicensesIniMutex() (Meyers singleton recursive_mutex, exposed in
CPasswordDlg.h so both CPasswordDlg.cpp and CLicenseDlg.cpp share it)
and wrap all 15 functions that touch licenses.ini.

Rewrite UpdateLicenseActivity around g_activityCache (in-memory state
keyed by "SN|IP|machine"): skip the entire write path when nothing
changed and the 30s LastActiveTime throttle window hasn't expired.
Passcode/HMAC are only flushed on actual change (renewal path); IP
list is only rewritten when the yyMMdd timestamp would roll a day.

Measured impact (local 2-client baseline):
  before: 0.60 writes/sec (4 writes per heartbeat cluster)
  after:  0.07 writes/sec (one write per client per 30s throttle)

Extrapolated to the 100-online target:
  before: ~160 writes/sec (saturation)
  after:  ~3.3 writes/sec  (100 clients / 30s throttle window)

Race elimination is the more important win: PendingQuota's
read-modify-write is now atomic, so the "preset renewal disappears"
race is closed.

Notes from audit (these landed during the same iteration):
- Cache key is (SN, IP, machine), not SN alone. A single SN can be
  shared by 100+ end machines in bulk-license deployments, so a
  per-SN cache flips on every heartbeat and defeats suppression.
  Per-(SN, IP, machine) throttling is what makes the 100/30 model
  actually hold; an SN-only key reproduced the original ~0.7 writes/s.
- DeleteLicense invalidates the per-SN activity cache via
  InvalidateLicenseActivityCache() (prefix scan since one SN maps to
  many cache entries). Without this, cache hits after delete would
  skip the auto-recreate path and leave the section permanently
  missing.
- OnLicenseViewIPs: m_ListLicense.SetItemText moved outside the lock
  so the critical section only covers disk I/O.
2026-05-22 00:31:54 +02:00
yuanyuanxiang 5a325a202b Init: Migrate SimpleRemoter (Since v1.3.1) to Gitea 2026-04-19 22:55:21 +02:00