summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2007-05-24 21:51:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:52:52 -0500
commitc64358e339aed0adba3dc66c1e598a0d3e8073a7 (patch)
tree9bac192383ad380953bb91486ee4f081f27f5f89 /source4
parentb0a1cf01e3cfba45273d636fd759fd2dd254f9d3 (diff)
downloadsamba-c64358e339aed0adba3dc66c1e598a0d3e8073a7.tar.gz
samba-c64358e339aed0adba3dc66c1e598a0d3e8073a7.tar.bz2
samba-c64358e339aed0adba3dc66c1e598a0d3e8073a7.zip
r23126: this was sitting on my laptop for a while...
change the way the ejs object is being created and return listing context (with status) rather than collecting all entries gathered from libnet call. rafal (This used to be commit b16787a56120498c985f2617f43250df725c285a)
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/ejs/ejsnet/mpr_user.c3
-rw-r--r--source4/scripting/ejs/ejsnet/net_user.c29
2 files changed, 14 insertions, 18 deletions
diff --git a/source4/scripting/ejs/ejsnet/mpr_user.c b/source4/scripting/ejs/ejsnet/mpr_user.c
index efeb68ffc1..23be089fde 100644
--- a/source4/scripting/ejs/ejsnet/mpr_user.c
+++ b/source4/scripting/ejs/ejsnet/mpr_user.c
@@ -101,6 +101,7 @@ done:
UserListCtx.ResumeIndex
UserListCtx.Count
UserListCtx.EndOfList
+ UserListCtx.Status
*/
struct MprVar mprUserListCtx(TALLOC_CTX *mem_ctx, struct libnet_UserList *list, NTSTATUS result)
{
@@ -144,6 +145,8 @@ struct MprVar mprUserListCtx(TALLOC_CTX *mem_ctx, struct libnet_UserList *list,
status = mprSetVar(&mprListCtx, "ResumeIndex", mprCreateIntegerVar((int)list->out.resume_index));
if (!NT_STATUS_IS_OK(status)) goto done;
status = mprSetVar(&mprListCtx, "EndOfList", mprCreateBoolVar(endOfList));
+ if (!NT_STATUS_IS_OK(status)) goto done;
+ status = mprSetVar(&mprListCtx, "Status", mprNTSTATUS(result));
done:
return mprListCtx;
diff --git a/source4/scripting/ejs/ejsnet/net_user.c b/source4/scripting/ejs/ejsnet/net_user.c
index 804ca04cd6..ba0bad0953 100644
--- a/source4/scripting/ejs/ejsnet/net_user.c
+++ b/source4/scripting/ejs/ejsnet/net_user.c
@@ -43,7 +43,7 @@ int ejs_net_userman(MprVarHandle eid, int argc, struct MprVar **argv)
{
struct libnet_context *ctx;
const char *userman_domain = NULL;
- struct MprVar *obj = NULL;
+ struct MprVar obj;
/* libnet context */
ctx = mprGetThisPtr(eid, "ctx");
@@ -74,20 +74,23 @@ int ejs_net_userman(MprVarHandle eid, int argc, struct MprVar **argv)
}
/* create 'net user' subcontext */
- obj = mprInitObject(eid, "NetUsrCtx", argc, argv);
+ obj = mprObject("NetUsrCtx");
/* we need to make a copy of the string for this object */
userman_domain = talloc_strdup(ctx, userman_domain);
/* add properties */
- mprSetPtrChild(obj, "ctx", ctx);
- mprSetPtrChild(obj, "domain", userman_domain);
+ mprSetPtrChild(&obj, "ctx", ctx);
+ mprSetPtrChild(&obj, "domain", userman_domain);
/* add methods */
- mprSetStringCFunction(obj, "Create", ejs_net_createuser);
- mprSetStringCFunction(obj, "Delete", ejs_net_deleteuser);
- mprSetStringCFunction(obj, "Info", ejs_net_userinfo);
- mprSetCFunction(obj, "List", ejs_net_userlist);
+ mprSetStringCFunction(&obj, "Create", ejs_net_createuser);
+ mprSetStringCFunction(&obj, "Delete", ejs_net_deleteuser);
+ mprSetStringCFunction(&obj, "Info", ejs_net_userinfo);
+ mprSetCFunction(&obj, "List", ejs_net_userlist);
+
+ /* set the object returned by this function */
+ mpr_Return(eid, obj);
return 0;
}
@@ -347,16 +350,6 @@ static int ejs_net_userlist(MprVarHandle eid, int argc, struct MprVar **argv)
req.in.page_size = page_size;
status = libnet_UserList(ctx, mem_ctx, &req);
- if (!NT_STATUS_IS_OK(status) &&
- !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES) &&
- !NT_STATUS_EQUAL(status, NT_STATUS_NO_MORE_ENTRIES)) {
-
- ejsSetErrorMsg(eid, "%s", req.out.error_string);
-
- mprListCtx = mprCreateNullVar();
- goto done;
- }
-
mprListCtx = mprUserListCtx(mem_ctx, &req, status);
done: