pidl-generated code now in Samba3
The first autogenerated RPC interface (DFS) is now in SVN, thanks to Jeremy. Hopefully the rest will follow soon.
The first autogenerated RPC interface (DFS) is now in SVN, thanks to Jeremy. Hopefully the rest will follow soon.
Two days ago, I finally took the time to sit down and attempt to write a Samba3 backend to pidl (the IDL compiler in Samba 4). Turned out to be much easier then I expected! It took me two evenings (~16 hours total) to write basic NDR parser, header, server, client and template generators.
The code currently generated runs inside of the Samba3 tree without modifications (uses no additional helper functions and the like). I’m currently focussing on making the DFS interface autogenerated. Most things seem to work now, except for some name changes (the functions in Samba3 and Samba4’s IDL don’t have the same names). I’m working on that now. The latest generated sources are available at http://samba.org/~jelmer/pidl_samba3/ .
My first package (nunit) is now in the Debian archive. It was approved by ftp-master two days ago.
Thanks go to Andrew “ajmitch” Mitchell for sponsoring and to Mirco “meebey” Bauer and David “Dajobe” Beckett for comments and feedback. See the pkg-mono pages for details.
Meebey has uploaded another package (gnunit) that provides a Gtk# interface to NUnit. Screenshot
Over the last few days, I’ve done another attempt to generate a Bazaar-NG version of Samba4 using tailor. I had to fix a couple of small bugs but got it working eventually. It took me about 8 hours for 5924 revisions using the following tailor configuration:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #!/usr/bin/env tailor """ [DEFAULT] verbose = Yes [samba4] source = svn:samba4 target = bzrng:samba4 refill-changelogs = Yes state-file = samba4.state root-directory = ~/bzr/bzr.samba4 before-commit = samba_remap_authors [svn:samba4] repository = svn://svnanon.samba.org/samba module = /branches/SAMBA_4_0 use-propset = Yes [bzrng:samba4] repository = ~/bzr/samba4 """ def samba_remap_authors(context, changeset): authors_map = { u'metze': u'Stefan Metzmacher', u'tridge': u'Andrew Tridgell', u'abartlet': u'Andrew Bartlett', u'tpot': u'Tim Potter', u'jerry': u'Gerald (Jerry) Carter', u'vlendec': u'Volker Lendecke', u'crh': u'Chris Hertel', u'jra': u'Jeremy Allison', u'jelmer': u'Jelmer Vernooij', u'vance': u'Vance Lankhaar', u'derell': u'Derell Lipman', u'gd': u'Guenther Deschner', u'lmuelle': u'Lars Mueller', u'herb': u'Herb Lewis', u'jht': u'John Terpstra', u'jmcd': u'Jim McDonough', u'stevef': u'Steve French', u'jpeach': u'James Peach', u'mimir': u'Rafal Szczesniak', u'ab': u'Alexander Bokovoy', u'deryck': u'Deryck Hodge', u'lha': u'Love H\uffffrnquist \uffffstrand', u'idra': u'Simo Sorce', u'rsharpe': u'Richard Sharpe' } author = changeset.author if authors_map.has_key(author): changeset.author = "%s <%s@samba.org>" % (authors_map[author],author) return True |
This branch is now up on samba.org. You’ll need the bzr “newformat” branch in order to check it out.
I’m a bit disappointed by the speed of “bzr branch” (takes around 3 hours when run locally, pulling in those ~6000 revisions).
Branching from a remote branch still gives me an error (this branch is up at http://samba.org/~jelmer/bzr.samba4/ and is the same I pull from locally):
1 2 3 | bzr: ERROR: 'RemoteBranch' object has no attribute 'weave_store' at /usr/lib/python2.4/site-packages/bzrlib/fetch.py line 92, in __init__() see ~/.bzr.log for debug information |
Encouraged by the fact that ethereal now uses pidl as part of its’ standard build, I tried to upload Pidl as a package to CPAN today. Turned out to be much easier to become a perl developer then to become a Debian developer… :-)
More information is available at Pidl at CPAN.
It’s been a while since I’ve written about version control and the landscape has changed quite a bit since then. Writing your own SCM seems to be the latest hype…
I’m currently using Subversion for most of the projects I work on (including those on Windows). Several other systems look interesting. I especially like darcs, as it is written in Haskell and has an elegant UI, though it is horribly slow. Bzr looks very promising, though its doesn’t really store data efficiently at the moment.
Another very interesting project, and a very useful one now with all the various SCM’s around, is tailor - a tool that can do conversions between the various projects.
So, just a few more minutes until the deadline of the Google Summer of Code, 2005! I got pretty much all that I wanted in there done, except for the ldb_map module, which is still a bit dodgy.
Participating was a nice and interesting experience! The other participants that were working on Samba for SoC have produced some great code and it looks like they’re going to stick around. Especially Brads’ work on DSSYNC looks promising. I can certainly recommend anyone to participate if Google is repeating SoC again sometime in the future!
Looking back, I guess it could’ve been interesting to work on a different project then Samba such as mono (I do actually actively follow mono development, I just don’t contribute at the moment), althought what I did now was probably more productive and allowed me to spend some time on other sides of Samba than I am usually involved in as well.
I just committed the file STATUS file to the tree:
—- Samba3 -> Samba4 Upgrade —- (C) 2005 Jelmer Vernooij <jelmer@samba.org> Published under the GNU GPL
Sponsored by the Google Summer of Code program (http://code.google.com/summerofcode.html) Mentored by Andrew Bartlett <abartlet@samba.org> Thanks!
Source files: source/lib/ldb/modules/ldb_map.c source/lib/ldb/modules/ldb_map.h source/lib/samba3/group.c source/lib/samba3/idmap.c source/lib/samba3/policy.c source/lib/samba3/registry.c source/lib/samba3/samba3.c source/lib/samba3/secrets.c source/lib/samba3/share_info.c source/lib/samba3/smbpasswd.c source/lib/samba3/tdbsam.c source/lib/samba3/winsdb.c source/lib/samba3/samba3.h source/scripting/libjs/upgrade.js source/scripting/ejs/smbcalls_param.c source/scripting/ejs/smbcalls_samba3.c source/param/generic.c source/param/generic.h testdata/samba3/verify testprogs/ejs/samba3sam source/setup/upgrade source/scripting/bin/samba3dump source/dsdb/samdb/ldb_modules/samba3sam.c source/script/tests/test_s3upgrade.sh swat/install/samba3.esp
Looking more closely at one of the other approaches I could’ve taken for migrating from Samba3. We will probably end up supporting this method later on anyway, once we expand the vampire code. I do think the path I’ve taken for SoC is the right one though - it allows the upgrade with the least hassle and user input.
This approach could be splitted up into the various parts:
Advantages of this approach:
Disadvantages:
The one-way upgrade from Samba3 to Samba4 is now partially working! There are both a web-frontend and a console utility that can do an upgrade, given a libdir (usually /var/lib/samba) and a configuration file (usually in /etc/samba/smb.conf).
Last night, I rewrote most of the conversion code to be in EJS rather then in C. One of the positive things about this is that I can use embedded LDIF inside of the JavaScript code and that I can build on the existing Samba4 provisioning code (which is in EJS as well). Writing EJS wrappers for my existing C code was easier then I had thought.
One of the other things I did today is add a fallback mechanism for ldb_map where it can store the data that could not be mapped. There are now two types of records in ldb_map: those that are partially mapped (mapped, but might have one or two attributes stored in the fallback database) and those that are completely stored in the fallback database.
Below are some screenshots of the upgrade procedure in SWAT: /blog/uploads/screenshots/upgr1.png /blog/uploads/screenshots/upgr2.png /blog/uploads/screenshots/upgr3.png
The sam.ldif and winbind.ldif generation code now works as well. I’ll be working on generating the new smb.conf next.
One of the things that worries me is the fact that I can generate so few of the Samba4 ‘user’ and ‘group’ attributes. Probably need to borrow some code from the current provisioning script to fix that up.
I’m wondering whether I should do some of the upgrade using EJS, so it can be integrated into SWAT easily…
ldb_map and the samba3sam ldb module that is based on it work nicely now and appear to be memory-leak free. I have so far been testing with a TDB backend loaded with an LDIF from Samba3. Tomorrow will be the big day, testing against an OpenLDAP server.
Since the LDAP schema for Samba3 contains information that the Samba4 SAM database doesn’t store and vice versa, it will be interesting to find out whether the current mapping will be sufficient. If it is not, I might have to fall back to storing the Samba4 attributes I can’t store in the Samba3 LDAP database in a seperate database instead.
Another thing I did today is clean up the parameter list in Samba4 - I removed all unused parameters. This should hopefully make it easier to do the Samba3->Samba4 smb.conf conversion code.
TODO is down to:
Today was a productive day. I just got the LDIF output for samba3dump working for wins.ldif and the various registry hives. TODO is down to:
I hope to get the first three done tomorrow.
Next on my list is the generation of the LDIF’s for the one-way upgrade path. These will be generated by internally building ldb_ldif structs and then dumping them using the LDB helper functions. This would easily allow us to later on directly write to LDB database.
I’ll need to generate the following LDIF files:
I’ll also make a start on the smb.conf output.
Finally got the ldb_map code done. This is a simple skeleton module that takes a mapping table of LDAP attributes and objectclasses and then maps between two different schema’s. Also got the initial part of ldb_samba3 compiling, which is the first module that actually uses ldb_map.
Yesterday evening, I also added support for reading smb.conf files and share_info.tdb files to the lib/samba3/ directory. Looks like my TODO-list is now down to:
I’ve now finished the ability to read the various TDB files. I’ve also started on the “mapping” LDB module that will allow a simple mapping from one objectclass to another. We’ll need this for the backwards compatible LDAP backend for Samba3.
This backend will never be used itself but instead have other backends based on it (e.g. ldb_samba3 for a Samba3-LDAP-to-samdb backend)
Each backend that uses this skeleton has to specify an array of struct objectclass_mapping’s (see ldb_map.h).
If no mappings are defined for an objectclass, it will be kept as is.
Will also keep cache of mapped dn’s so we don’t have to traverse the tree each time
So, TODO left: