Recycle Bin optional feature

tridge at samba.org tridge at samba.org
Thu Feb 11 06:47:57 MST 2010


Hi Eduardo,

 > Attached is the Recycle Bin source code that I've implemented so far. You
 > can get it from my remote repository:
 > http://repo.or.cz/w/Samba/eduardoll.git/commit/a36abe24d9d133184f31df4272d21345d6161296

I've been reviewing and testing your patches tonight. There were a few
problems which I have fixed in a test branch in my private tree
(git://git.samba.org/tridge/samba.git in branch
eduardo-recycle-bin-opfeature)

 - the use of strtok_r to parse the enableOptionalFeature attribute
   was fairly clumsy. I changed it to use strchr() and
   GUID_from_string().

 - I fixed the python script scripting/bin/enablerecyclebin so it
   works OK against a local ldb. That makes it easier to test

 - it is important to give sensible ldb error messages when an error
   occurs. For ldb module errors this should be done with
   ldb_asprintf_errstring() not DEBUG(), as you want the error
   transmitted to the client

 - please don't use C++ style comments, use C comments instead (some
   compilers don't accept C++ comments).

 - using strstr() to look for "Recycle Bin Feature" is
   incorrect. Instead you should compare the GUID with the well known
   GUID value. 

 > 1 - The execution always gets stuck when "rootdse_modify" returns TRUE. The
 > code responsible for this is a ldb_wait line in the function
 > ldb_do_autotransaction (ldbutil.c).

you were missing a call to ldb_module_done() at the end of
rootdse_enableoptionalfeature()

The way ldb modules works is that you must call ldb_module_done() if
you are returning LDB_SUCCESS. If you are returning an error you can
just return the error and skip ldb_module_done()

 > 2 - I tried to change the functional level during the provision but it
 > returns an error:
 > 
 > sudo ./setup/provision --realm=adr2.ltc.inovasoft.unicamp.br --domain=adr2
 > --host-name=lenovo --host-ip=143.106.167.132 --adminpass=passL3N0V03
 > --server-role="domain controller" --function-level="2008_R2"
 > 
 > File "./setup/provision", line 192, in <module>
 >     dom_for_fun_level = DS_DOMAIN_FUNCTION_2008_R2
 > NameError: name 'DS_DOMAIN_FUNCTION_2008_R2' is not defined

I've fixed that in the master branch. You also need to change 

    domainControllerFunctionality = DS_DC_FUNCTION_2008

in provision.py. We should really make that a command line option, but
for your testing you can just edit it.

 > This code is only the first version, so some things may change. Now I'm
 > working on the insertion of the backlink attribute in the Recycle Bin
 > Feature object, but having this first part working will help me to debug the
 > rest of the code.

sounds good!

please have a careful look at my eduardo-recycle-bin-opfeature branch
for ideas on how to improve your code.

Cheers, Tridge


More information about the samba-technical mailing list