summaryrefslogtreecommitdiff
path: root/source4/setup
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2007-02-14 21:55:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:18 -0500
commit7ca399c0755e186508a4ed9796cbbbe6f50181e9 (patch)
tree50c7ce84b894bfdd46a773c16a890401afe751c1 /source4/setup
parentbd7df755f326e9c601439c0aa727961c4a4f4518 (diff)
downloadsamba-7ca399c0755e186508a4ed9796cbbbe6f50181e9.tar.gz
samba-7ca399c0755e186508a4ed9796cbbbe6f50181e9.tar.bz2
samba-7ca399c0755e186508a4ed9796cbbbe6f50181e9.zip
r21351: Change ldb ejs bindings return codes.
We were returning just true/false and discarding error number and string. This checking probably breaks swat, will fix it in next round as swat is what made me look into this as I had no way to get back error messages to show to the users. Simo. (This used to be commit 35886b4ae68be475b0fc8b2689ca04d766661261)
Diffstat (limited to 'source4/setup')
-rw-r--r--source4/setup/setpassword13
1 files changed, 7 insertions, 6 deletions
diff --git a/source4/setup/setpassword b/source4/setup/setpassword
index c3357a3cdd..618e304077 100644
--- a/source4/setup/setpassword
+++ b/source4/setup/setpassword
@@ -78,21 +78,22 @@ if (options['newpassword'] == undefined) {
var attrs = new Array("defaultNamingContext");
var attrs2 = new Array("cn");
res = ldb.search("defaultNamingContext=*", "", ldb.SCOPE_BASE, attrs);
-assert(res.length == 1 && res[0].defaultNamingContext != undefined);
-var domain_dn = res[0].defaultNamingContext;
+assert(res.error == 0);
+assert(res.msgs.length == 1 && res.msgs[0].defaultNamingContext != undefined);
+var domain_dn = res.msgs[0].defaultNamingContext;
assert(domain_dn != undefined);
if (options['filter'] != undefined) {
var res = ldb.search(options['filter'],
domain_dn, ldb.SCOPE_SUBTREE, attrs2);
- if (res.length != 1) {
+ if (res.error != 0 || res.msgs.length != 1) {
message("Failed to find record for filter %s\n", options['filter']);
exit(1);
}
} else {
var res = ldb.search(sprintf("samAccountName=%s", options['username']),
domain_dn, ldb.SCOPE_SUBTREE, attrs2);
- if (res.length != 1) {
+ if (res.error != 0 || res.msgs.length != 1) {
message("Failed to find record for user %s\n", options['username']);
exit(1);
}
@@ -106,9 +107,9 @@ sambaPassword: %s
",
res[0].dn, options['newpassword']);
var ok = ldb.modify(mod);
-if (!ok) {
+if (ok.error != 0) {
message("set password for %s failed - %s\n",
- res[0].dn, ldb.errstring());
+ res[0].dn, ok.errstr);
ldb.transaction_cancel();
exit(1);
} else {