Skip to content

LDAP: add the five LDAPServers columns a 1.5 table lacks - #42

Merged
mastacontrola merged 1 commit into
mainfrom
fix/ldap-15-upgrade-columns
Nov 2, 2026
Merged

mastacontrola merged 1 commit into
mainfrom
fix/ldap-15-upgrade-columns

Conversation

@mastacontrola

Copy link
Copy Markdown
Member

Problem

A server upgraded from 1.5 cannot add or edit an LDAP server. The UI shows "Add LDAP server failed!". The database answers Unknown column 'lsGroupNamAttr'. Reported in forum topic 18300.

Cause

Every released 1.5.10 LDAPServers table stops at lsEnableNestedGroup. createSql() is CREATE TABLE IF NOT EXISTS, so it leaves the 1.5 table as it is. No schema() step adds lsGroupNamAttr, lsDisplayNameEnabled, lsDisplayNameAttr, lsIsLDAPs or lsAllowAPI. Reads hide the gap, because getColumns() drops an absent column. save() names every declared column, so every write fails. "Update" on Plugin Management runs the pending steps, but none of them add these columns.

Fix

Step 29 adds each column only when it is absent. Only then does it backfill the existing rows to the 1.5 behavior:

Column Backfill Why
lsGroupNamAttr name 1.5 hard-coded (name=%s)
lsIsLDAPs 1 for port 636, 686, 3269, 7636 1.5 chose LDAPS by this port list
lsDisplayNameEnabled, lsDisplayNameAttr, lsAllowAPI off / empty 1.5 had no such feature

An install that already has a column keeps its rows unchanged.

Verification

  • Lab: the live 1.6 database cloned into MariaDB 11 under strict sql_mode, with LDAPServers cut back to the 1.5.10.2534 shape. Before: save() fails with 1054 Unknown column 'lsGroupNamAttr'. After schema()[29]: save() succeeds, existing rows get name, the port-636 row gets lsIsLDAPs = 1, and a second run changes nothing.
  • tests/ldap-upgrade-from-15-columns.test.php pins the 1.5.10.2534 column list. On main it fails and names exactly the five columns. On this branch it passes. sh tests/run-all.sh: 21 passed.

Known limit

If the ADD COLUMN succeeds and its backfill UPDATE then fails, a retry sees the column and skips the backfill. Those rows keep '' / 0.

🤖 Generated with Claude Code

A server upgraded from 1.5 could not add or edit an LDAP server: save()
failed with "Unknown column 'lsGroupNamAttr'" (forum topic 18300).

Every released 1.5.10 LDAPServers table stops at lsEnableNestedGroup.
createSql() is CREATE TABLE IF NOT EXISTS, so it leaves that table as it
is, and no schema() step added lsGroupNamAttr, lsDisplayNameEnabled,
lsDisplayNameAttr, lsIsLDAPs or lsAllowAPI. Reads hid the gap because
getColumns() drops an absent column. save() names every declared column.

Step 29 adds each column only when it is absent. Only then does it
backfill the rows to the 1.5 behavior: group-name attribute 'name' (1.5
hard-coded (name=%s)), LDAPS for ports 636/686/3269/7636, display name
and API sign-in off. An install that already has a column is unchanged.

The new test pins the 1.5.10.2534 column list. It fails on the old
code with exactly these five columns, and passes on this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mastacontrola
mastacontrola merged commit bbacd83 into main Nov 2, 2026
2 checks passed
@mastacontrola
mastacontrola deleted the fix/ldap-15-upgrade-columns branch November 2, 2026 18:22
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.

1 participant