s3: Do not reference ndr_table when calling rpc_srv_register
[kai/samba-autobuild/.git] / source3 / librpc / gen_ndr / srv_wbint.c
index 2cc750c4b57d741dd5403d2b8fdb46342008eba1..9144a467e02d4f56d689fc5c0e7217f773a0c311 100644 (file)
@@ -15,7 +15,7 @@ static bool api_wbint_Ping(pipes_struct *p)
        DATA_BLOB blob;
        struct wbint_Ping *r;
 
-       call = &ndr_table_wbint.calls[NDR_WBINT_PING];
+       call = &p->interface->calls[NDR_WBINT_PING];
 
        r = talloc(talloc_tos(), struct wbint_Ping);
        if (r == NULL) {
@@ -95,7 +95,7 @@ static bool api_wbint_LookupSid(pipes_struct *p)
        DATA_BLOB blob;
        struct wbint_LookupSid *r;
 
-       call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPSID];
+       call = &p->interface->calls[NDR_WBINT_LOOKUPSID];
 
        r = talloc(talloc_tos(), struct wbint_LookupSid);
        if (r == NULL) {
@@ -187,7 +187,7 @@ static bool api_wbint_LookupName(pipes_struct *p)
        DATA_BLOB blob;
        struct wbint_LookupName *r;
 
-       call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPNAME];
+       call = &p->interface->calls[NDR_WBINT_LOOKUPNAME];
 
        r = talloc(talloc_tos(), struct wbint_LookupName);
        if (r == NULL) {
@@ -273,7 +273,7 @@ static bool api_wbint_Sid2Uid(pipes_struct *p)
        DATA_BLOB blob;
        struct wbint_Sid2Uid *r;
 
-       call = &ndr_table_wbint.calls[NDR_WBINT_SID2UID];
+       call = &p->interface->calls[NDR_WBINT_SID2UID];
 
        r = talloc(talloc_tos(), struct wbint_Sid2Uid);
        if (r == NULL) {
@@ -353,7 +353,7 @@ static bool api_wbint_Sid2Gid(pipes_struct *p)
        DATA_BLOB blob;
        struct wbint_Sid2Gid *r;
 
-       call = &ndr_table_wbint.calls[NDR_WBINT_SID2GID];
+       call = &p->interface->calls[NDR_WBINT_SID2GID];
 
        r = talloc(talloc_tos(), struct wbint_Sid2Gid);
        if (r == NULL) {
@@ -433,7 +433,7 @@ static bool api_wbint_Uid2Sid(pipes_struct *p)
        DATA_BLOB blob;
        struct wbint_Uid2Sid *r;
 
-       call = &ndr_table_wbint.calls[NDR_WBINT_UID2SID];
+       call = &p->interface->calls[NDR_WBINT_UID2SID];
 
        r = talloc(talloc_tos(), struct wbint_Uid2Sid);
        if (r == NULL) {
@@ -513,7 +513,7 @@ static bool api_wbint_Gid2Sid(pipes_struct *p)
        DATA_BLOB blob;
        struct wbint_Gid2Sid *r;
 
-       call = &ndr_table_wbint.calls[NDR_WBINT_GID2SID];
+       call = &p->interface->calls[NDR_WBINT_GID2SID];
 
        r = talloc(talloc_tos(), struct wbint_Gid2Sid);
        if (r == NULL) {
@@ -584,6 +584,166 @@ static bool api_wbint_Gid2Sid(pipes_struct *p)
        return true;
 }
 
+static bool api_wbint_AllocateUid(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct wbint_AllocateUid *r;
+
+       call = &p->interface->calls[NDR_WBINT_ALLOCATEUID];
+
+       r = talloc(talloc_tos(), struct wbint_AllocateUid);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r, NULL);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(wbint_AllocateUid, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.uid = talloc_zero(r, uint64_t);
+       if (r->out.uid == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _wbint_AllocateUid(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(wbint_AllocateUid, r);
+       }
+
+       push = ndr_push_init_ctx(r, NULL);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_wbint_AllocateGid(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct wbint_AllocateGid *r;
+
+       call = &p->interface->calls[NDR_WBINT_ALLOCATEGID];
+
+       r = talloc(talloc_tos(), struct wbint_AllocateGid);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r, NULL);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(wbint_AllocateGid, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.gid = talloc_zero(r, uint64_t);
+       if (r->out.gid == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _wbint_AllocateGid(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(wbint_AllocateGid, r);
+       }
+
+       push = ndr_push_init_ctx(r, NULL);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
 static bool api_wbint_QueryUser(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
@@ -591,11 +751,411 @@ static bool api_wbint_QueryUser(pipes_struct *p)
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct wbint_QueryUser *r;
+       struct wbint_QueryUser *r;
+
+       call = &p->interface->calls[NDR_WBINT_QUERYUSER];
+
+       r = talloc(talloc_tos(), struct wbint_QueryUser);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r, NULL);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(wbint_QueryUser, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.info = talloc_zero(r, struct wbint_userinfo);
+       if (r->out.info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _wbint_QueryUser(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(wbint_QueryUser, r);
+       }
+
+       push = ndr_push_init_ctx(r, NULL);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_wbint_LookupUserAliases(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct wbint_LookupUserAliases *r;
+
+       call = &p->interface->calls[NDR_WBINT_LOOKUPUSERALIASES];
+
+       r = talloc(talloc_tos(), struct wbint_LookupUserAliases);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r, NULL);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(wbint_LookupUserAliases, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.rids = talloc_zero(r, struct wbint_RidArray);
+       if (r->out.rids == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _wbint_LookupUserAliases(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(wbint_LookupUserAliases, r);
+       }
+
+       push = ndr_push_init_ctx(r, NULL);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_wbint_LookupUserGroups(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct wbint_LookupUserGroups *r;
+
+       call = &p->interface->calls[NDR_WBINT_LOOKUPUSERGROUPS];
+
+       r = talloc(talloc_tos(), struct wbint_LookupUserGroups);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r, NULL);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(wbint_LookupUserGroups, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.sids = talloc_zero(r, struct wbint_SidArray);
+       if (r->out.sids == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _wbint_LookupUserGroups(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(wbint_LookupUserGroups, r);
+       }
+
+       push = ndr_push_init_ctx(r, NULL);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_wbint_QuerySequenceNumber(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct wbint_QuerySequenceNumber *r;
+
+       call = &p->interface->calls[NDR_WBINT_QUERYSEQUENCENUMBER];
+
+       r = talloc(talloc_tos(), struct wbint_QuerySequenceNumber);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r, NULL);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(wbint_QuerySequenceNumber, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.sequence = talloc_zero(r, uint32_t);
+       if (r->out.sequence == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _wbint_QuerySequenceNumber(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(wbint_QuerySequenceNumber, r);
+       }
+
+       push = ndr_push_init_ctx(r, NULL);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_wbint_LookupGroupMembers(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct wbint_LookupGroupMembers *r;
+
+       call = &p->interface->calls[NDR_WBINT_LOOKUPGROUPMEMBERS];
+
+       r = talloc(talloc_tos(), struct wbint_LookupGroupMembers);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r, NULL);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(wbint_LookupGroupMembers, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.members = talloc_zero(r, struct wbint_Principals);
+       if (r->out.members == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _wbint_LookupGroupMembers(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(wbint_LookupGroupMembers, r);
+       }
+
+       push = ndr_push_init_ctx(r, NULL);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_wbint_QueryUserList(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct wbint_QueryUserList *r;
 
-       call = &ndr_table_wbint.calls[NDR_WBINT_QUERYUSER];
+       call = &p->interface->calls[NDR_WBINT_QUERYUSERLIST];
 
-       r = talloc(talloc_tos(), struct wbint_QueryUser);
+       r = talloc(talloc_tos(), struct wbint_QueryUserList);
        if (r == NULL) {
                return false;
        }
@@ -619,17 +1179,17 @@ static bool api_wbint_QueryUser(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_IN_DEBUG(wbint_QueryUser, r);
+               NDR_PRINT_IN_DEBUG(wbint_QueryUserList, r);
        }
 
        ZERO_STRUCT(r->out);
-       r->out.info = talloc_zero(r, struct wbint_userinfo);
-       if (r->out.info == NULL) {
+       r->out.users = talloc_zero(r, struct wbint_userinfos);
+       if (r->out.users == NULL) {
                talloc_free(r);
                return false;
        }
 
-       r->out.result = _wbint_QueryUser(p, r);
+       r->out.result = _wbint_QueryUserList(p, r);
 
        if (p->rng_fault_state) {
                talloc_free(r);
@@ -638,7 +1198,7 @@ static bool api_wbint_QueryUser(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_OUT_DEBUG(wbint_QueryUser, r);
+               NDR_PRINT_OUT_DEBUG(wbint_QueryUserList, r);
        }
 
        push = ndr_push_init_ctx(r, NULL);
@@ -664,18 +1224,18 @@ static bool api_wbint_QueryUser(pipes_struct *p)
        return true;
 }
 
-static bool api_wbint_LookupUserAliases(pipes_struct *p)
+static bool api_wbint_QueryGroupList(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct wbint_LookupUserAliases *r;
+       struct wbint_QueryGroupList *r;
 
-       call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPUSERALIASES];
+       call = &p->interface->calls[NDR_WBINT_QUERYGROUPLIST];
 
-       r = talloc(talloc_tos(), struct wbint_LookupUserAliases);
+       r = talloc(talloc_tos(), struct wbint_QueryGroupList);
        if (r == NULL) {
                return false;
        }
@@ -699,17 +1259,17 @@ static bool api_wbint_LookupUserAliases(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_IN_DEBUG(wbint_LookupUserAliases, r);
+               NDR_PRINT_IN_DEBUG(wbint_QueryGroupList, r);
        }
 
        ZERO_STRUCT(r->out);
-       r->out.rids = talloc_zero(r, struct wbint_RidArray);
-       if (r->out.rids == NULL) {
+       r->out.groups = talloc_zero(r, struct wbint_Principals);
+       if (r->out.groups == NULL) {
                talloc_free(r);
                return false;
        }
 
-       r->out.result = _wbint_LookupUserAliases(p, r);
+       r->out.result = _wbint_QueryGroupList(p, r);
 
        if (p->rng_fault_state) {
                talloc_free(r);
@@ -718,7 +1278,7 @@ static bool api_wbint_LookupUserAliases(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_OUT_DEBUG(wbint_LookupUserAliases, r);
+               NDR_PRINT_OUT_DEBUG(wbint_QueryGroupList, r);
        }
 
        push = ndr_push_init_ctx(r, NULL);
@@ -744,18 +1304,18 @@ static bool api_wbint_LookupUserAliases(pipes_struct *p)
        return true;
 }
 
-static bool api_wbint_LookupUserGroups(pipes_struct *p)
+static bool api_wbint_DsGetDcName(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct wbint_LookupUserGroups *r;
+       struct wbint_DsGetDcName *r;
 
-       call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPUSERGROUPS];
+       call = &p->interface->calls[NDR_WBINT_DSGETDCNAME];
 
-       r = talloc(talloc_tos(), struct wbint_LookupUserGroups);
+       r = talloc(talloc_tos(), struct wbint_DsGetDcName);
        if (r == NULL) {
                return false;
        }
@@ -779,17 +1339,17 @@ static bool api_wbint_LookupUserGroups(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_IN_DEBUG(wbint_LookupUserGroups, r);
+               NDR_PRINT_IN_DEBUG(wbint_DsGetDcName, r);
        }
 
        ZERO_STRUCT(r->out);
-       r->out.sids = talloc_zero(r, struct wbint_SidArray);
-       if (r->out.sids == NULL) {
+       r->out.dc_info = talloc_zero(r, struct netr_DsRGetDCNameInfo *);
+       if (r->out.dc_info == NULL) {
                talloc_free(r);
                return false;
        }
 
-       r->out.result = _wbint_LookupUserGroups(p, r);
+       r->out.result = _wbint_DsGetDcName(p, r);
 
        if (p->rng_fault_state) {
                talloc_free(r);
@@ -798,7 +1358,7 @@ static bool api_wbint_LookupUserGroups(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_OUT_DEBUG(wbint_LookupUserGroups, r);
+               NDR_PRINT_OUT_DEBUG(wbint_DsGetDcName, r);
        }
 
        push = ndr_push_init_ctx(r, NULL);
@@ -824,18 +1384,18 @@ static bool api_wbint_LookupUserGroups(pipes_struct *p)
        return true;
 }
 
-static bool api_wbint_QuerySequenceNumber(pipes_struct *p)
+static bool api_wbint_LookupRids(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct wbint_QuerySequenceNumber *r;
+       struct wbint_LookupRids *r;
 
-       call = &ndr_table_wbint.calls[NDR_WBINT_QUERYSEQUENCENUMBER];
+       call = &p->interface->calls[NDR_WBINT_LOOKUPRIDS];
 
-       r = talloc(talloc_tos(), struct wbint_QuerySequenceNumber);
+       r = talloc(talloc_tos(), struct wbint_LookupRids);
        if (r == NULL) {
                return false;
        }
@@ -859,17 +1419,17 @@ static bool api_wbint_QuerySequenceNumber(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_IN_DEBUG(wbint_QuerySequenceNumber, r);
+               NDR_PRINT_IN_DEBUG(wbint_LookupRids, r);
        }
 
        ZERO_STRUCT(r->out);
-       r->out.sequence = talloc_zero(r, uint32_t);
-       if (r->out.sequence == NULL) {
+       r->out.names = talloc_zero(r, struct wbint_Principals);
+       if (r->out.names == NULL) {
                talloc_free(r);
                return false;
        }
 
-       r->out.result = _wbint_QuerySequenceNumber(p, r);
+       r->out.result = _wbint_LookupRids(p, r);
 
        if (p->rng_fault_state) {
                talloc_free(r);
@@ -878,7 +1438,7 @@ static bool api_wbint_QuerySequenceNumber(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_OUT_DEBUG(wbint_QuerySequenceNumber, r);
+               NDR_PRINT_OUT_DEBUG(wbint_LookupRids, r);
        }
 
        push = ndr_push_init_ctx(r, NULL);
@@ -904,18 +1464,18 @@ static bool api_wbint_QuerySequenceNumber(pipes_struct *p)
        return true;
 }
 
-static bool api_wbint_LookupGroupMembers(pipes_struct *p)
+static bool api_wbint_CheckMachineAccount(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct wbint_LookupGroupMembers *r;
+       struct wbint_CheckMachineAccount *r;
 
-       call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPGROUPMEMBERS];
+       call = &p->interface->calls[NDR_WBINT_CHECKMACHINEACCOUNT];
 
-       r = talloc(talloc_tos(), struct wbint_LookupGroupMembers);
+       r = talloc(talloc_tos(), struct wbint_CheckMachineAccount);
        if (r == NULL) {
                return false;
        }
@@ -939,17 +1499,10 @@ static bool api_wbint_LookupGroupMembers(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_IN_DEBUG(wbint_LookupGroupMembers, r);
-       }
-
-       ZERO_STRUCT(r->out);
-       r->out.members = talloc_zero(r, struct wbint_Principals);
-       if (r->out.members == NULL) {
-               talloc_free(r);
-               return false;
+               NDR_PRINT_IN_DEBUG(wbint_CheckMachineAccount, r);
        }
 
-       r->out.result = _wbint_LookupGroupMembers(p, r);
+       r->out.result = _wbint_CheckMachineAccount(p, r);
 
        if (p->rng_fault_state) {
                talloc_free(r);
@@ -958,7 +1511,7 @@ static bool api_wbint_LookupGroupMembers(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_OUT_DEBUG(wbint_LookupGroupMembers, r);
+               NDR_PRINT_OUT_DEBUG(wbint_CheckMachineAccount, r);
        }
 
        push = ndr_push_init_ctx(r, NULL);
@@ -984,18 +1537,18 @@ static bool api_wbint_LookupGroupMembers(pipes_struct *p)
        return true;
 }
 
-static bool api_wbint_QueryUserList(pipes_struct *p)
+static bool api_wbint_ChangeMachineAccount(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct wbint_QueryUserList *r;
+       struct wbint_ChangeMachineAccount *r;
 
-       call = &ndr_table_wbint.calls[NDR_WBINT_QUERYUSERLIST];
+       call = &p->interface->calls[NDR_WBINT_CHANGEMACHINEACCOUNT];
 
-       r = talloc(talloc_tos(), struct wbint_QueryUserList);
+       r = talloc(talloc_tos(), struct wbint_ChangeMachineAccount);
        if (r == NULL) {
                return false;
        }
@@ -1019,17 +1572,10 @@ static bool api_wbint_QueryUserList(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_IN_DEBUG(wbint_QueryUserList, r);
-       }
-
-       ZERO_STRUCT(r->out);
-       r->out.users = talloc_zero(r, struct wbint_userinfos);
-       if (r->out.users == NULL) {
-               talloc_free(r);
-               return false;
+               NDR_PRINT_IN_DEBUG(wbint_ChangeMachineAccount, r);
        }
 
-       r->out.result = _wbint_QueryUserList(p, r);
+       r->out.result = _wbint_ChangeMachineAccount(p, r);
 
        if (p->rng_fault_state) {
                talloc_free(r);
@@ -1038,7 +1584,7 @@ static bool api_wbint_QueryUserList(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_OUT_DEBUG(wbint_QueryUserList, r);
+               NDR_PRINT_OUT_DEBUG(wbint_ChangeMachineAccount, r);
        }
 
        push = ndr_push_init_ctx(r, NULL);
@@ -1064,18 +1610,18 @@ static bool api_wbint_QueryUserList(pipes_struct *p)
        return true;
 }
 
-static bool api_wbint_DsGetDcName(pipes_struct *p)
+static bool api_wbint_SetMapping(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct wbint_DsGetDcName *r;
+       struct wbint_SetMapping *r;
 
-       call = &ndr_table_wbint.calls[NDR_WBINT_DSGETDCNAME];
+       call = &p->interface->calls[NDR_WBINT_SETMAPPING];
 
-       r = talloc(talloc_tos(), struct wbint_DsGetDcName);
+       r = talloc(talloc_tos(), struct wbint_SetMapping);
        if (r == NULL) {
                return false;
        }
@@ -1099,17 +1645,10 @@ static bool api_wbint_DsGetDcName(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_IN_DEBUG(wbint_DsGetDcName, r);
+               NDR_PRINT_IN_DEBUG(wbint_SetMapping, r);
        }
 
-       ZERO_STRUCT(r->out);
-       r->out.dc_info = talloc_zero(r, struct netr_DsRGetDCNameInfo *);
-       if (r->out.dc_info == NULL) {
-               talloc_free(r);
-               return false;
-       }
-
-       r->out.result = _wbint_DsGetDcName(p, r);
+       r->out.result = _wbint_SetMapping(p, r);
 
        if (p->rng_fault_state) {
                talloc_free(r);
@@ -1118,7 +1657,7 @@ static bool api_wbint_DsGetDcName(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_OUT_DEBUG(wbint_DsGetDcName, r);
+               NDR_PRINT_OUT_DEBUG(wbint_SetMapping, r);
        }
 
        push = ndr_push_init_ctx(r, NULL);
@@ -1144,18 +1683,18 @@ static bool api_wbint_DsGetDcName(pipes_struct *p)
        return true;
 }
 
-static bool api_wbint_LookupRids(pipes_struct *p)
+static bool api_wbint_RemoveMapping(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct wbint_LookupRids *r;
+       struct wbint_RemoveMapping *r;
 
-       call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPRIDS];
+       call = &p->interface->calls[NDR_WBINT_REMOVEMAPPING];
 
-       r = talloc(talloc_tos(), struct wbint_LookupRids);
+       r = talloc(talloc_tos(), struct wbint_RemoveMapping);
        if (r == NULL) {
                return false;
        }
@@ -1179,17 +1718,83 @@ static bool api_wbint_LookupRids(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_IN_DEBUG(wbint_LookupRids, r);
+               NDR_PRINT_IN_DEBUG(wbint_RemoveMapping, r);
        }
 
-       ZERO_STRUCT(r->out);
-       r->out.names = talloc_zero(r, struct wbint_Principals);
-       if (r->out.names == NULL) {
+       r->out.result = _wbint_RemoveMapping(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(wbint_RemoveMapping, r);
+       }
+
+       push = ndr_push_init_ctx(r, NULL);
+       if (push == NULL) {
                talloc_free(r);
                return false;
        }
 
-       r->out.result = _wbint_LookupRids(p, r);
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_wbint_SetHWM(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct wbint_SetHWM *r;
+
+       call = &p->interface->calls[NDR_WBINT_SETHWM];
+
+       r = talloc(talloc_tos(), struct wbint_SetHWM);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r, NULL);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(wbint_SetHWM, r);
+       }
+
+       r->out.result = _wbint_SetHWM(p, r);
 
        if (p->rng_fault_state) {
                talloc_free(r);
@@ -1198,7 +1803,7 @@ static bool api_wbint_LookupRids(pipes_struct *p)
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_OUT_DEBUG(wbint_LookupRids, r);
+               NDR_PRINT_OUT_DEBUG(wbint_SetHWM, r);
        }
 
        push = ndr_push_init_ctx(r, NULL);
@@ -1226,7 +1831,7 @@ static bool api_wbint_LookupRids(pipes_struct *p)
 
 
 /* Tables */
-static struct api_struct api_wbint_cmds[] =
+static struct api_struct api_wbint_cmds[] = 
 {
        {"WBINT_PING", NDR_WBINT_PING, api_wbint_Ping},
        {"WBINT_LOOKUPSID", NDR_WBINT_LOOKUPSID, api_wbint_LookupSid},
@@ -1235,14 +1840,22 @@ static struct api_struct api_wbint_cmds[] =
        {"WBINT_SID2GID", NDR_WBINT_SID2GID, api_wbint_Sid2Gid},
        {"WBINT_UID2SID", NDR_WBINT_UID2SID, api_wbint_Uid2Sid},
        {"WBINT_GID2SID", NDR_WBINT_GID2SID, api_wbint_Gid2Sid},
+       {"WBINT_ALLOCATEUID", NDR_WBINT_ALLOCATEUID, api_wbint_AllocateUid},
+       {"WBINT_ALLOCATEGID", NDR_WBINT_ALLOCATEGID, api_wbint_AllocateGid},
        {"WBINT_QUERYUSER", NDR_WBINT_QUERYUSER, api_wbint_QueryUser},
        {"WBINT_LOOKUPUSERALIASES", NDR_WBINT_LOOKUPUSERALIASES, api_wbint_LookupUserAliases},
        {"WBINT_LOOKUPUSERGROUPS", NDR_WBINT_LOOKUPUSERGROUPS, api_wbint_LookupUserGroups},
        {"WBINT_QUERYSEQUENCENUMBER", NDR_WBINT_QUERYSEQUENCENUMBER, api_wbint_QuerySequenceNumber},
        {"WBINT_LOOKUPGROUPMEMBERS", NDR_WBINT_LOOKUPGROUPMEMBERS, api_wbint_LookupGroupMembers},
        {"WBINT_QUERYUSERLIST", NDR_WBINT_QUERYUSERLIST, api_wbint_QueryUserList},
+       {"WBINT_QUERYGROUPLIST", NDR_WBINT_QUERYGROUPLIST, api_wbint_QueryGroupList},
        {"WBINT_DSGETDCNAME", NDR_WBINT_DSGETDCNAME, api_wbint_DsGetDcName},
        {"WBINT_LOOKUPRIDS", NDR_WBINT_LOOKUPRIDS, api_wbint_LookupRids},
+       {"WBINT_CHECKMACHINEACCOUNT", NDR_WBINT_CHECKMACHINEACCOUNT, api_wbint_CheckMachineAccount},
+       {"WBINT_CHANGEMACHINEACCOUNT", NDR_WBINT_CHANGEMACHINEACCOUNT, api_wbint_ChangeMachineAccount},
+       {"WBINT_SETMAPPING", NDR_WBINT_SETMAPPING, api_wbint_SetMapping},
+       {"WBINT_REMOVEMAPPING", NDR_WBINT_REMOVEMAPPING, api_wbint_RemoveMapping},
+       {"WBINT_SETHWM", NDR_WBINT_SETHWM, api_wbint_SetHWM},
 };
 
 void wbint_get_pipe_fns(struct api_struct **fns, int *n_fns)
@@ -1251,7 +1864,7 @@ void wbint_get_pipe_fns(struct api_struct **fns, int *n_fns)
        *n_fns = sizeof(api_wbint_cmds) / sizeof(struct api_struct);
 }
 
-NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)
+NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *interface, uint32_t interface_version, uint32_t opnum, void *_r)
 {
        if (cli->pipes_struct == NULL) {
                return NT_STATUS_INVALID_PARAMETER;
@@ -1358,6 +1971,30 @@ NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co
                        return NT_STATUS_OK;
                }
 
+               case NDR_WBINT_ALLOCATEUID: {
+                       struct wbint_AllocateUid *r = (struct wbint_AllocateUid *)_r;
+                       ZERO_STRUCT(r->out);
+                       r->out.uid = talloc_zero(mem_ctx, uint64_t);
+                       if (r->out.uid == NULL) {
+                       return NT_STATUS_NO_MEMORY;
+                       }
+
+                       r->out.result = _wbint_AllocateUid(cli->pipes_struct, r);
+                       return NT_STATUS_OK;
+               }
+
+               case NDR_WBINT_ALLOCATEGID: {
+                       struct wbint_AllocateGid *r = (struct wbint_AllocateGid *)_r;
+                       ZERO_STRUCT(r->out);
+                       r->out.gid = talloc_zero(mem_ctx, uint64_t);
+                       if (r->out.gid == NULL) {
+                       return NT_STATUS_NO_MEMORY;
+                       }
+
+                       r->out.result = _wbint_AllocateGid(cli->pipes_struct, r);
+                       return NT_STATUS_OK;
+               }
+
                case NDR_WBINT_QUERYUSER: {
                        struct wbint_QueryUser *r = (struct wbint_QueryUser *)_r;
                        ZERO_STRUCT(r->out);
@@ -1430,6 +2067,18 @@ NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co
                        return NT_STATUS_OK;
                }
 
+               case NDR_WBINT_QUERYGROUPLIST: {
+                       struct wbint_QueryGroupList *r = (struct wbint_QueryGroupList *)_r;
+                       ZERO_STRUCT(r->out);
+                       r->out.groups = talloc_zero(mem_ctx, struct wbint_Principals);
+                       if (r->out.groups == NULL) {
+                       return NT_STATUS_NO_MEMORY;
+                       }
+
+                       r->out.result = _wbint_QueryGroupList(cli->pipes_struct, r);
+                       return NT_STATUS_OK;
+               }
+
                case NDR_WBINT_DSGETDCNAME: {
                        struct wbint_DsGetDcName *r = (struct wbint_DsGetDcName *)_r;
                        ZERO_STRUCT(r->out);
@@ -1454,6 +2103,36 @@ NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co
                        return NT_STATUS_OK;
                }
 
+               case NDR_WBINT_CHECKMACHINEACCOUNT: {
+                       struct wbint_CheckMachineAccount *r = (struct wbint_CheckMachineAccount *)_r;
+                       r->out.result = _wbint_CheckMachineAccount(cli->pipes_struct, r);
+                       return NT_STATUS_OK;
+               }
+
+               case NDR_WBINT_CHANGEMACHINEACCOUNT: {
+                       struct wbint_ChangeMachineAccount *r = (struct wbint_ChangeMachineAccount *)_r;
+                       r->out.result = _wbint_ChangeMachineAccount(cli->pipes_struct, r);
+                       return NT_STATUS_OK;
+               }
+
+               case NDR_WBINT_SETMAPPING: {
+                       struct wbint_SetMapping *r = (struct wbint_SetMapping *)_r;
+                       r->out.result = _wbint_SetMapping(cli->pipes_struct, r);
+                       return NT_STATUS_OK;
+               }
+
+               case NDR_WBINT_REMOVEMAPPING: {
+                       struct wbint_RemoveMapping *r = (struct wbint_RemoveMapping *)_r;
+                       r->out.result = _wbint_RemoveMapping(cli->pipes_struct, r);
+                       return NT_STATUS_OK;
+               }
+
+               case NDR_WBINT_SETHWM: {
+                       struct wbint_SetHWM *r = (struct wbint_SetHWM *)_r;
+                       r->out.result = _wbint_SetHWM(cli->pipes_struct, r);
+                       return NT_STATUS_OK;
+               }
+
                default:
                        return NT_STATUS_NOT_IMPLEMENTED;
        }
@@ -1461,5 +2140,5 @@ NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co
 
 NTSTATUS rpc_wbint_init(void)
 {
-       return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "wbint", "wbint", &ndr_table_wbint, api_wbint_cmds, sizeof(api_wbint_cmds) / sizeof(struct api_struct));
+       return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "wbint", "wbint", NDR_WBINT_UUID, NDR_WBINT_VERSION, api_wbint_cmds, sizeof(api_wbint_cmds) / sizeof(struct api_struct));
 }