[PATCH: Domain backup and restore samba-tool commands] (with patch actually attached)

Stefan Metzmacher metze at samba.org
Thu Jun 21 14:33:34 UTC 2018


Hi Aaron,

there're a couple of places where you add '){' without a whitespace in
between, can you fix change that?

Thanks!
metze

Am 21.06.2018 um 02:47 schrieb Jeremy Allison via samba-technical:
> On Thu, Jun 21, 2018 at 12:11:27PM +1200, Aaron Haslett via samba-technical wrote:
>> +	TALLOC_CTX *db_context = talloc_new(event_ctx);;
> 
> Needs check for NULL on talloc_new() fail.
> 
>> From 13ace68b4950c210146912142b0a86007c508052 Mon Sep 17 00:00:00 2001
>> From: Aaron Haslett <aaronhaslett at catalyst.net.nz>
>> Date: Tue, 1 May 2018 11:10:43 +1200
>> Subject: [PATCH 02/12] tdb: adding readonly locks mode to tdbbackup tool
>>
>> Signed-off-by: Aaron Haslett <aaronhaslett at catalyst.net.nz>
>> ---
>>  lib/tdb/tools/tdbbackup.c | 31 ++++++++++++++++++++++++-------
>>  1 file changed, 24 insertions(+), 7 deletions(-)
>>
>> diff --git a/lib/tdb/tools/tdbbackup.c b/lib/tdb/tools/tdbbackup.c
>> index eb33e25..cfd2820 100644
>> --- a/lib/tdb/tools/tdbbackup.c
>> +++ b/lib/tdb/tools/tdbbackup.c
>> @@ -105,7 +105,7 @@ static int test_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
>>    this function is also used for restore
>>  */
>>  static int backup_tdb(const char *old_name, const char *new_name,
>> -		      int hash_size, int nolock)
>> +		      int hash_size, int nolock, int readonly)
>>  {
>>  	TDB_CONTEXT *tdb;
>>  	TDB_CONTEXT *tdb_new;
>> @@ -145,8 +145,17 @@ static int backup_tdb(const char *old_name, const char *new_name,
>>  		return 1;
>>  	}
>>  
>> -	if (tdb_transaction_start(tdb) != 0) {
>> -		printf("Failed to start transaction on old tdb\n");
>> +	if (readonly){
>> +		if(tdb_lockall_read(tdb) != 0){
>> +			printf("Failed to readonly lock on old tdb\n");
>> +			tdb_close(tdb);
>> +			tdb_close(tdb_new);
>> +			unlink(tmp_name);
> 
> Error checks please !
> 
>> diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c
>> index e7e908f..6aa8414 100644
>> --- a/source4/param/pyparam.c
>> +++ b/source4/param/pyparam.c
>> @@ -445,7 +445,24 @@ static PyGetSetDef py_lp_ctx_getset[] = {
>>  
>>  static PyObject *py_lp_ctx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
>>  {
>> -	return pytalloc_reference(type, loadparm_init_global(false));
>> +	const char *kwnames[] = {"_filename_for_non_global_lp", NULL};
>> +	PyObject *lp_ctx;
>> +	const char *conf_filename = NULL;
>> +	struct loadparm_context *ctx;
>> +
>> +	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|s",
>> +	    discard_const_p(char *, kwnames), &conf_filename)){
>> +		return NULL;
>> +	}
>> +	if (conf_filename != NULL){
>> +		ctx = loadparm_init(NULL);
> 
> ctx == Null check here.
> 
>> +		lp_ctx = pytalloc_reference(type, ctx);
> 
> And here for lp_ctx.
> 
> Jeremy.
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180621/940c9c5a/signature.sig>


More information about the samba-technical mailing list