From cccd788ba7356fc2b35a61e512ae356e46c7a0a5 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 15 Feb 2007 14:50:30 +0000 Subject: r21368: Adapy Json to the new ldb functions return object, this allow us to return meaningful erors back to swat (This used to be commit 5fe63e1e87d225e2f142f9b58f4ba1debfc8767c) --- services/samba/ldb.esp | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/services/samba/ldb.esp b/services/samba/ldb.esp index 8b0a57d5e3..f69abde388 100644 --- a/services/samba/ldb.esp +++ b/services/samba/ldb.esp @@ -334,7 +334,14 @@ function _search(params, error) return error; } - return ldb.search(expr, baseDN, scope, attrs); + var res = ldb.search(expr, baseDN, scope, attrs); + + if (res.error != 0) { + error.setError(res.error, res.errstr); + return error; + } + + return res.msgs; } jsonrpc.method.search = _search; @@ -371,7 +378,13 @@ function _add(params, error) return ldb; } - return ldb.add(params[1]); + var res = ldb.add(params[1]); + if (res.error != 0) { + error.setError(res.error, res.errstr); + return error; + } + + return true; } jsonrpc.method.add = _add; @@ -408,7 +421,13 @@ function _modify(params, error) return ldb; } - return ldb.modify(params[1]); + var res = ldb.modify(params[1]); + if (res.error != 0) { + error.setError(res.error, res.errstr); + return error; + } + + return true; } jsonrpc.method.modify = _modify; @@ -445,7 +464,13 @@ function _del(params, error) return ldb; } - return ldb.del(params[1]); + var res = ldb.del(params[1]); + if (res.error != 0) { + error.setError(res.error, res.errstr); + return error; + } + + return true; } jsonrpc.method.del = _del; @@ -485,7 +510,13 @@ function _rename(params, error) return ldb; } - return ldb.rename(params[1], params[2]); + var res = ldb.rename(params[1], params[2]); + if (res.error != 0) { + error.setError(res.error, res.errstr); + return error; + } + + return true; } jsonrpc.method.rename = _rename; -- cgit