lmldap guide

Overview

lmldap links OpenLDAP 2.6 slapd, the LMDB (back-mdb) transactional storage engine, standard directory schemas (core, cosine, inetorgperson, nis), a multi-threaded HTTP-to-LDAPv3 REST translator, and the C++17 lmcode-cpp virtual machine into a single portable binary. It eliminates external slapd.conf files, schema directories, and LDIF bootstrap scripts while preserving full wire compatibility with RFC 4511 LDAPv3 clients.

Dual-protocol architecture and zero-config bootstrap

When launched with custom server flags (--port, --rest-port, --base-dn, --admin-dn, --admin-pw, --data-dir), lmldap intercepts process initialization before entering the upstream slapd listener loop:

Embedded lmcode host and live vs fallback execution

Running lmldap --lmcode program.dslb executes compiled LMScript bytecode against the embedded schema (context ldap: Ldap and Batch):

Security and operational boundaries

Keep the following boundaries in mind when deploying lmldap in automated test suites or local development environments:

Standard lmcode_std_v3 REST and CLI interfaces

In addition to context ldap: Ldap, lmldap embeds the 226-signature lmcode_std_v3 standard library. Scripts can combine directory operations with the 10 standard REST and CLI interfaces:

p = _lmcode_ cli="lmldap" install="github:lmctl-ai/lmldap@latest";
@"--org"
fn opt_org(x: RestExchange) -> void implements CliOption {
  x.set("org", x.query("org"));
}

@"seed"
fn cmd_seed(x: RestExchange) -> void implements CliCommand {
  let cn = x.get("org");
  let dn = "cn=" + cn + ",dc=example,dc=com";
  ldap.add(dn, "{\"objectClass\":[\"top\",\"person\"],\"cn\":\"" + cn + "\",\"sn\":\"" + cn + "\"}");
  x.send(str_from_int(x.increment("seeded")) + ":" + dn);
}

@"/exists/:cn"
fn get_exists(x: RestExchange) -> void implements RestGet {
  let ok = ldap.exists("cn=" + x.param("cn") + ",dc=example,dc=com");
  x.json("{\"exists\":" + (ok ? "true" : "false") + "}");
}

rest_config("session", "global");
assert_eq(rest_cli(str_split("--org=Ops seed", " ")), "1:cn=Ops,dc=example,dc=com");
assert_eq(rest_cli(str_split("/exists/Ops", " ")), "{\"exists\":true}");
end _lmcode_