From 7ca399c0755e186508a4ed9796cbbbe6f50181e9 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 14 Feb 2007 21:55:29 +0000 Subject: 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) --- source4/setup/setpassword | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source4/setup') 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 { -- cgit