svn commit: samba r9707 - in branches/SAMBA_4_0: . source/scripting/libjs

tridge at samba.org tridge at samba.org
Sun Aug 28 02:38:11 GMT 2005


Author: tridge
Date: 2005-08-28 02:38:11 +0000 (Sun, 28 Aug 2005)
New Revision: 9707

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9707

Log:
 r11080 at blu:  tridge | 2005-08-28 12:41:12 +1000
 make sure we leave the account enabled after creating a new user

Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/scripting/libjs/provision.js


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: svk:merge
   - a953eb74-4aff-0310-a63c-855d20285ebb:/local/samba4:11042
   + a953eb74-4aff-0310-a63c-855d20285ebb:/local/samba4:11080

Modified: branches/SAMBA_4_0/source/scripting/libjs/provision.js
===================================================================
--- branches/SAMBA_4_0/source/scripting/libjs/provision.js	2005-08-28 02:38:00 UTC (rev 9706)
+++ branches/SAMBA_4_0/source/scripting/libjs/provision.js	2005-08-28 02:38:11 UTC (rev 9707)
@@ -318,6 +318,28 @@
 }
 
 /*
+  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 @@
 		return false;
 	}
 
-	return true;
+	/*
+	  modify the userAccountControl to remove the disabled bit
+	*/
+	return enable_account(ldb, user_dn);
 }
 
 



More information about the samba-cvs mailing list