diff options
author | Simo Sorce <idra@samba.org> | 2007-02-15 14:50:30 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:48:21 -0500 |
commit | cccd788ba7356fc2b35a61e512ae356e46c7a0a5 (patch) | |
tree | fdc8a5f7dddb88d6e31448270849231d3cedd8d3 | |
parent | 48a75e18c9f19d8aaf9f956a85701fd0b4771ba8 (diff) | |
download | samba-cccd788ba7356fc2b35a61e512ae356e46c7a0a5.tar.gz samba-cccd788ba7356fc2b35a61e512ae356e46c7a0a5.tar.bz2 samba-cccd788ba7356fc2b35a61e512ae356e46c7a0a5.zip |
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)
-rw-r--r-- | services/samba/ldb.esp | 41 |
1 files 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; |