summaryrefslogtreecommitdiff
path: root/source4/scripting/ejs
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2006-12-12 23:01:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:29:14 -0500
commita1af18217b9876327647552df1f328924ae726c4 (patch)
tree8eba793a4acbf5ce12e3b3e3ca0733e03daba605 /source4/scripting/ejs
parentf1317dadc09f3e1b28e74e0877c362a58792ff8d (diff)
downloadsamba-a1af18217b9876327647552df1f328924ae726c4.tar.gz
samba-a1af18217b9876327647552df1f328924ae726c4.tar.bz2
samba-a1af18217b9876327647552df1f328924ae726c4.zip
r20143: a bit of experiments before doing serious changes in ejsnet.
rafal (This used to be commit 3cdd43ebcedfa7d1d59bd33b3bfed4e80560ec82)
Diffstat (limited to 'source4/scripting/ejs')
-rw-r--r--source4/scripting/ejs/ejsnet.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/source4/scripting/ejs/ejsnet.c b/source4/scripting/ejs/ejsnet.c
index cef3b99d05..5daf478506 100644
--- a/source4/scripting/ejs/ejsnet.c
+++ b/source4/scripting/ejs/ejsnet.c
@@ -336,6 +336,11 @@ static int ejs_net_userinfo(MprVarHandle eid, int argc, char **argv)
struct libnet_context *ctx;
const char *userman_domain = NULL;
struct libnet_UserInfo req;
+ struct MprVar mprUserInfo;
+ struct MprVar mprAccountName, mprFullName, mprDescription;
+ struct MprVar mprHomeDir, mprHomeDrive, mprComment;
+ struct MprVar mprLogonScript;
+ struct MprVar mprAcctExpiry, mprAllowPassChange, mprForcePassChange;
if (argc != 1) {
ejsSetErrorMsg(eid, "argument 1 must be a string");
@@ -364,9 +369,44 @@ static int ejs_net_userinfo(MprVarHandle eid, int argc, char **argv)
ejsSetErrorMsg(eid, "%s", req.out.error_string);
}
- /* TODO: create user info object and pass received properties */
+ /* create UserInfo object */
+ mprUserInfo = mprObject("UserInfo");
+
+ mprAccountName = mprString(req.out.account_name);
+ mprFullName = mprString(req.out.full_name);
+ mprDescription = mprString(req.out.description);
+ mprHomeDir = mprString(req.out.home_directory);
+ mprHomeDrive = mprString(req.out.home_drive);
+ mprComment = mprString(req.out.comment);
+ mprLogonScript = mprString(req.out.logon_script);
+ mprAcctExpiry = mprString(timestring(mem_ctx, req.out.acct_expiry->tv_sec));
+ mprAllowPassChange = mprString(timestring(mem_ctx, req.out.allow_password_change->tv_sec));
+ mprForcePassChange = mprString(timestring(mem_ctx, req.out.force_password_change->tv_sec));
+
+ status = mprSetVar(&mprUserInfo, "AccountName", mprAccountName);
+ if (!NT_STATUS_IS_OK(status)) goto done;
+ status = mprSetVar(&mprUserInfo, "FullName", mprFullName);
+ if (!NT_STATUS_IS_OK(status)) goto done;
+ status = mprSetVar(&mprUserInfo, "Description", mprDescription);
+ if (!NT_STATUS_IS_OK(status)) goto done;
+ status = mprSetVar(&mprUserInfo, "HomeDirectory", mprHomeDir);
+ if (!NT_STATUS_IS_OK(status)) goto done;
+ status = mprSetVar(&mprUserInfo, "HomeDrive", mprHomeDrive);
+ if (!NT_STATUS_IS_OK(status)) goto done;
+ status = mprSetVar(&mprUserInfo, "Comment", mprComment);
+ if (!NT_STATUS_IS_OK(status)) goto done;
+ status = mprSetVar(&mprUserInfo, "LogonScript", mprLogonScript);
+ if (!NT_STATUS_IS_OK(status)) goto done;
+ status = mprSetVar(&mprUserInfo, "AcctExpiry", mprAcctExpiry);
+ if (!NT_STATUS_IS_OK(status)) goto done;
+ status = mprSetVar(&mprUserInfo, "AllowPasswordChange", mprAllowPassChange);
+ if (!NT_STATUS_IS_OK(status)) goto done;
+ status = mprSetVar(&mprUserInfo, "ForcePasswordChange", mprForcePassChange);
+ if (!NT_STATUS_IS_OK(status)) goto done;
+done:
talloc_free(mem_ctx);
+ mpr_Return(eid, mprUserInfo);
return 0;
}