diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-08-28 02:38:11 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2005-08-28 02:38:11 +0000 |
commit | eb353b624543393aa02e5e77c97d102aef3a6fb3 (patch) | |
tree | dea124611f73457126d08de10feb1f888293743e /source/scripting/libjs | |
parent | 1467b04787bf9a85caac99d462e670ef8380c59e (diff) | |
download | samba-eb353b624543393aa02e5e77c97d102aef3a6fb3.tar.gz samba-eb353b624543393aa02e5e77c97d102aef3a6fb3.tar.xz samba-eb353b624543393aa02e5e77c97d102aef3a6fb3.zip |
r9707: r11080@blu: tridge | 2005-08-28 12:41:12 +1000
make sure we leave the account enabled after creating a new user
Diffstat (limited to 'source/scripting/libjs')
-rw-r--r-- | source/scripting/libjs/provision.js | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/source/scripting/libjs/provision.js b/source/scripting/libjs/provision.js index 0bcb2fa761e..afa5adaa9f5 100644 --- a/source/scripting/libjs/provision.js +++ b/source/scripting/libjs/provision.js @@ -318,6 +318,28 @@ function searchone(ldb, expression, attribute) } /* + modify an account to remove the +*/ +function enable_account(ldb, user_dn) +{ + var attrs = new Array("userAccountControl"); + var res = ldb.search(NULL, user_dn, ldb.SCOPE_ONELEVEL, attrs); + assert(res.length == 1); + var userAccountControl = res[0].userAccountControl; + userAccountControl = userAccountControl - 2; /* remove disabled bit */ + var mod = sprintf(" +dn: %s +changetype: modify +replace: userAccountControl +userAccountControl: %u +", + user_dn, userAccountControl); + var ok = ldb.modify(mod); + return ok; +} + + +/* add a new user record */ function newuser(username, unixname, password, message) @@ -385,7 +407,10 @@ member: %s return false; } - return true; + /* + modify the userAccountControl to remove the disabled bit + */ + return enable_account(ldb, user_dn); } |