From b1844905d2c1ca26aef0ccba799ff16383348fc1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 28 Aug 2005 22:17:07 +0000 Subject: [PATCH] r9718: Work a bit on the SWAT interface --- source/lib/ldb/ldb_map/ldb_map.c | 4 +- source/lib/ldb/tests/samba3.ldif | 106 ++++++++++++++----------------- source/lib/samba3/PLAN | 12 +++- source/lib/samba3/README | 3 + source/scripting/libjs/samba3.js | 8 +++ swat/install/samba3.esp | 40 ++++++++++++ swat/menu.js | 3 +- 7 files changed, 114 insertions(+), 62 deletions(-) create mode 100644 source/scripting/libjs/samba3.js create mode 100644 swat/install/samba3.esp diff --git a/source/lib/ldb/ldb_map/ldb_map.c b/source/lib/ldb/ldb_map/ldb_map.c index 5ae4a435d86..1a8ea2afc40 100644 --- a/source/lib/ldb/ldb_map/ldb_map.c +++ b/source/lib/ldb/ldb_map/ldb_map.c @@ -136,8 +136,10 @@ static struct ldb_parse_tree *ldb_map_parse_tree(struct ldb_module *module, TALL return attr->convert_operator(privdat, module, tree); } - if (map_type == MAP_IGNORE) + if (map_type == MAP_IGNORE) { + DEBUG(0, ("Search on ignored attribute '%s'!\n", tree->u.equality.attr)); return NULL; + } if (map_type == MAP_GENERATE) { DEBUG(0, ("Can't do conversion for MAP_GENERATE in map_parse_tree without convert_operator for '%s'\n", tree->u.equality.attr)); diff --git a/source/lib/ldb/tests/samba3.ldif b/source/lib/ldb/tests/samba3.ldif index fb0a1386d49..02103b65b62 100644 --- a/source/lib/ldb/tests/samba3.ldif +++ b/source/lib/ldb/tests/samba3.ldif @@ -1,49 +1,4 @@ -dn: dc=idealx,dc=org -objectClass: dcObject -objectclass: organization -o: idealx -dc: idealx - -dn: ou=Users,dc=idealx,dc=org -objectClass: organizationalUnit -ou: Users - -dn: ou=Groups,dc=idealx,dc=org -objectClass: organizationalUnit -ou: Groups - -dn: ou=Computers,dc=idealx,dc=org -objectClass: organizationalUnit -ou: Computers -dn: uid=Administrator,ou=Users,dc=idealx,dc=org -cn: Administrator -sn: Administrator -objectClass: inetOrgPerson -objectClass: sambaSAMAccount -objectClass: posixAccount -objectClass: shadowAccount -gidNumber: 512 -uid: Administrator -uidNumber: 0 -homeDirectory: /home/%U -sambaPwdLastSet: 0 -sambaLogonTime: 0 -sambaLogoffTime: 2147483647 -sambaKickoffTime: 2147483647 -sambaPwdCanChange: 0 -sambaPwdMustChange: 2147483647 -sambaHomePath: \\PDC-SMB3\home\%U -sambaHomeDrive: H: -sambaProfilePath: \\PDC-SMB3\profiles\%U\Administrator -sambaPrimaryGroupSID: S-1-5-21-4231626423-2410014848-2360679739-512 -sambaLMPassword: XXX -sambaNTPassword: XXX -sambaAcctFlags: [U ] -sambaSID: S-1-5-21-4231626423-2410014848-2360679739-2996 -loginShell: /bin/false -gecos: Netbios Domain Administrator - -dn: uid=nobody,ou=Users,dc=idealx,dc=org +dn: uid=nobody,ou=Users,dc=test,dc=vernstok,dc=nl cn: nobody sn: nobody objectClass: inetOrgPerson @@ -70,7 +25,7 @@ sambaAcctFlags: [NU ] sambaSID: S-1-5-21-4231626423-2410014848-2360679739-2998 loginShell: /bin/false -dn: cn=Domain Admins,ou=Groups,dc=idealx,dc=org +dn: cn=Domain Admins,ou=Groups,dc=test,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 512 @@ -81,7 +36,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-512 sambaGroupType: 2 displayName: Domain Admins -dn: cn=Domain Users,ou=Groups,dc=idealx,dc=org +dn: cn=Domain Users,ou=Groups,dc=test,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 513 @@ -91,7 +46,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-513 sambaGroupType: 2 displayName: Domain Users -dn: cn=Domain Guests,ou=Groups,dc=idealx,dc=org +dn: cn=Domain Guests,ou=Groups,dc=test,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 514 @@ -101,7 +56,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-514 sambaGroupType: 2 displayName: Domain Guests -dn: cn=Print Operators,ou=Groups,dc=idealx,dc=org +dn: cn=Print Operators,ou=Groups,dc=test,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 550 @@ -111,7 +66,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-550 sambaGroupType: 2 displayName: Print Operators -dn: cn=Backup Operators,ou=Groups,dc=idealx,dc=org +dn: cn=Backup Operators,ou=Groups,dc=test,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 551 @@ -121,7 +76,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-551 sambaGroupType: 2 displayName: Backup Operators -dn: cn=Replicator,ou=Groups,dc=idealx,dc=org +dn: cn=Replicator,ou=Groups,dc=test,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 552 @@ -131,7 +86,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-552 sambaGroupType: 2 displayName: Replicator -dn: cn=Domain Computers,ou=Groups,dc=idealx,dc=org +dn: cn=Domain Computers,ou=Groups,dc=test,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 553 @@ -141,7 +96,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-553 sambaGroupType: 2 displayName: Domain Computers -dn: cn=Administrators,ou=Groups,dc=idealx,dc=org +dn: cn=Administrators,ou=Groups,dc=test,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 544 @@ -151,7 +106,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-544 sambaGroupType: 2 displayName: Administrators -dn: cn=Users,ou=Groups,dc=idealx,dc=org +dn: cn=Users,ou=Groups,dc=test,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 545 @@ -161,7 +116,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-545 sambaGroupType: 2 displayName: users -dn: cn=Guests,ou=Groups,dc=idealx,dc=org +dn: cn=Guests,ou=Groups,dc=test,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 546 @@ -172,7 +127,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-546 sambaGroupType: 2 displayName: Guests -dn: cn=Power Users,ou=Groups,dc=idealx,dc=org +dn: cn=Power Users,ou=Groups,dc=test,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 547 @@ -182,7 +137,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-547 sambaGroupType: 2 displayName: Power Users -dn: cn=Account Operators,ou=Groups,dc=idealx,dc=org +dn: cn=Account Operators,ou=Groups,dc=test,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 548 @@ -192,7 +147,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-548 sambaGroupType: 2 displayName: Account Operators -dn: cn=Server Operators,ou=Groups,dc=idealx,dc=org +dn: cn=Server Operators,ou=Groups,dc=test,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 549 @@ -201,3 +156,36 @@ description: Netbios Domain Server Operators sambaSID: S-1-5-21-4231626423-2410014848-2360679739-549 sambaGroupType: 2 displayName: Server Operators + +dn: ou=Computers,dc=test,dc=vernstok,dc=nl +objectClass: organizationalUnit +ou: Computers +dn: uid=Administrator,ou=Users,dc=test,dc=vernstok,dc=nl +cn: Administrator +sn: Administrator +objectClass: inetOrgPerson +objectClass: sambaSAMAccount +objectClass: posixAccount +objectClass: shadowAccount +gidNumber: 512 +uid: Administrator +uidNumber: 0 +homeDirectory: /home/%U +sambaPwdLastSet: 0 +sambaLogonTime: 0 +sambaLogoffTime: 2147483647 +sambaKickoffTime: 2147483647 +sambaPwdCanChange: 0 +sambaPwdMustChange: 2147483647 +sambaHomePath: \\PDC-SMB3\home\%U +sambaHomeDrive: H: +sambaProfilePath: \\PDC-SMB3\profiles\%U\Administrator +sambaPrimaryGroupSID: S-1-5-21-4231626423-2410014848-2360679739-512 +sambaLMPassword: XXX +sambaNTPassword: XXX +sambaAcctFlags: [U ] +sambaSID: S-1-5-21-4231626423-2410014848-2360679739-2996 +loginShell: /bin/false +gecos: Netbios Domain Administrator + + diff --git a/source/lib/samba3/PLAN b/source/lib/samba3/PLAN index 26bf54634ca..8bc90da427f 100644 --- a/source/lib/samba3/PLAN +++ b/source/lib/samba3/PLAN @@ -1,6 +1,6 @@ Three possible viable approaches: 1) TDB conversion approach. Read in TDB dump out LDIF (one-way) - - samr.ldb: from tdbsam/smbpasswd, account_policy.tdb, secrets.tdb, group_mapping.tdb, privilege.tdb + - samr.ldb: from tdbsam/smbpasswd, account_policy.tdb, secrets.tdb, group_mapping.tdb - registry.ldb: from registry.tdb - wins.ldif: from wins.tdb/wins.dat - smb.conf/ea's: generated from the old smb.conf + share_info.tdb @@ -29,3 +29,13 @@ Three possible viable approaches: - convert smb.conf (using Jerry's registry hack) (going with a combination of 1 and 2) + +ldb mapping backend: + - do search in new and old (mapped) backend and merge results? + +Upgrade process: + - take libdir & smb.conf + - read various tdb files / old smb.conf + - write new smb.conf (ejs?) + - list of parameters to keep.. generate some of the others + - add generated LDIF (ejs?) diff --git a/source/lib/samba3/README b/source/lib/samba3/README index 3f6553f7e8a..83520f673d2 100644 --- a/source/lib/samba3/README +++ b/source/lib/samba3/README @@ -3,3 +3,6 @@ Samba3 import, migration and compatibility. For example, the first file in this directory (smbpasswd.c) handles portions of the smbpasswd file format. + +The other files in this directory support reading the various +TDB databases from Samba3. diff --git a/source/scripting/libjs/samba3.js b/source/scripting/libjs/samba3.js new file mode 100644 index 00000000000..7f50c8c4b28 --- /dev/null +++ b/source/scripting/libjs/samba3.js @@ -0,0 +1,8 @@ +/* + backend code for upgrading from Samba3 + Copyright Jelmer Vernooij 2005 + Released under the GNU GPL v2 or later +*/ + + +return 0; diff --git a/swat/install/samba3.esp b/swat/install/samba3.esp new file mode 100644 index 00000000000..ead694a107b --- /dev/null +++ b/swat/install/samba3.esp @@ -0,0 +1,40 @@ +<% page_header("columns", "Upgrade", "install"); + + include("/scripting/forms.js"); + libinclude("base.js"); + libinclude("provision.js"); + libinclude("samba3.js"); +%> + +

Import from Samba3

+ +<% +var f = FormObj("Import from Samba3", 0, 2); +var i; + +f.add("SMBCONF", "smb.conf file"); +f.add("LIBDIR", "Lib directory"); +f.submit[0] = "Import"; +f.submit[1] = "Cancel"; + +if (form['submit'] == "Cancel") { + redirect("/"); +} + +if (form['submit'] == "Import") { + for (r in form) { + subobj[r] = form[r]; + } +} + +f.element[0].value = "/etc/samba/smb.conf"; +f.element[1].value = "/var/lib/samba"; + +if (form['submit'] == "import") { + // provision(subobj, writefln, false); +} else { + f.display(); +} +%> + +<% page_footer(); %> diff --git a/swat/menu.js b/swat/menu.js index 83529825f12..e28160e16f8 100644 --- a/swat/menu.js +++ b/swat/menu.js @@ -39,7 +39,8 @@ swat_menus.esptest = simple_menu( swat_menus.install = simple_menu( "Installation", "Provisioning", session_uri("/install/provision.esp"), - "New User", session_uri("/install/newuser.esp")); + "New User", session_uri("/install/newuser.esp"), + "Import from Samba3", session_uri("/install/samba3.esp")); swat_menus.nbt_server = simple_menu( -- 2.34.1