mirror of
https://github.com/samba-team/samba.git
synced 2025-11-30 20:23:49 +03:00
r20885: - I forgot the page size passed to enumeration function is actually
size of a buffer for result returned, not number of entries - pass libnet function returned status to UserListCtx creation to properly mark the last chunk of the list rafal
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
fd0650283b
commit
05d307546f
@@ -100,11 +100,13 @@ done:
|
||||
UserListCtx.Users[]
|
||||
UserListCtx.ResumeIndex
|
||||
UserListCtx.Count
|
||||
UserListCtx.EndOfList
|
||||
*/
|
||||
struct MprVar mprUserListCtx(TALLOC_CTX *mem_ctx, struct libnet_UserList *list)
|
||||
struct MprVar mprUserListCtx(TALLOC_CTX *mem_ctx, struct libnet_UserList *list, NTSTATUS result)
|
||||
{
|
||||
const char *name = "UserListCtx";
|
||||
NTSTATUS status;
|
||||
bool endOfList;
|
||||
struct MprVar mprListCtx, mprUserList;
|
||||
struct MprVar mprUser, mprSid, mprUsername;
|
||||
int i;
|
||||
@@ -114,6 +116,9 @@ struct MprVar mprUserListCtx(TALLOC_CTX *mem_ctx, struct libnet_UserList *list)
|
||||
goto done;
|
||||
}
|
||||
|
||||
endOfList = (NT_STATUS_EQUAL(result, NT_STATUS_NO_MORE_ENTRIES) ||
|
||||
NT_STATUS_IS_OK(result));
|
||||
|
||||
mprUserList = mprArray("Users");
|
||||
for (i = 0; i < list->out.count; i++) {
|
||||
struct userlist u = list->out.users[i];
|
||||
@@ -128,7 +133,7 @@ struct MprVar mprUserListCtx(TALLOC_CTX *mem_ctx, struct libnet_UserList *list)
|
||||
mprSetVar(&mprUser, "SID", mprSid);
|
||||
|
||||
/* add the object to the array being constructed */
|
||||
mprAddArray(&mprUserList, 0, mprUser);
|
||||
mprAddArray(&mprUserList, i, mprUser);
|
||||
}
|
||||
|
||||
mprListCtx = mprObject(name);
|
||||
@@ -138,6 +143,7 @@ struct MprVar mprUserListCtx(TALLOC_CTX *mem_ctx, struct libnet_UserList *list)
|
||||
if (!NT_STATUS_IS_OK(status)) goto done;
|
||||
status = mprSetVar(&mprListCtx, "ResumeIndex", mprCreateIntegerVar((int)list->out.resume_index));
|
||||
if (!NT_STATUS_IS_OK(status)) goto done;
|
||||
status = mprSetVar(&mprListCtx, "EndOfList", mprCreateBoolVar(endOfList));
|
||||
|
||||
done:
|
||||
return mprListCtx;
|
||||
|
||||
Reference in New Issue
Block a user