Testing revealed some errors, reverting some of the lsa changes.
authorGünther Deschner <gd@samba.org>
Sat, 9 Feb 2008 00:33:47 +0000 (01:33 +0100)
committerGünther Deschner <gd@samba.org>
Sat, 9 Feb 2008 01:05:39 +0000 (02:05 +0100)
Guenther
(This used to be commit ac1e4f1eb2c046def4fa30ab0bd98c49add8e8c8)

source3/librpc/gen_ndr/cli_lsa.c
source3/librpc/gen_ndr/cli_lsa.h
source3/librpc/gen_ndr/lsa.h
source3/librpc/gen_ndr/ndr_lsa.c
source3/librpc/gen_ndr/srv_lsa.c
source3/librpc/idl/lsa.idl
source3/rpc_server/srv_lsa_nt.c
source3/rpcclient/cmd_lsarpc.c

index 64da84d55f4e656553269b8abd8b332947f97419..ddd0c7884d958870ccf4bb46564918a8b140dd0c 100644 (file)
@@ -427,7 +427,7 @@ NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli,
                                  struct policy_handle *handle,
                                  struct dom_sid2 *sid,
                                  uint32_t access_mask,
-                                 struct policy_handle **acct_handle)
+                                 struct policy_handle *acct_handle)
 {
        struct lsa_CreateAccount r;
        NTSTATUS status;
@@ -762,7 +762,7 @@ NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli,
                                struct policy_handle *handle,
                                struct dom_sid2 *sid,
                                uint32_t access_mask,
-                               struct policy_handle **acct_handle)
+                               struct policy_handle *acct_handle)
 {
        struct lsa_OpenAccount r;
        NTSTATUS status;
@@ -1499,7 +1499,7 @@ NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli,
 
 NTSTATUS rpccli_lsa_DeleteObject(struct rpc_pipe_client *cli,
                                 TALLOC_CTX *mem_ctx,
-                                struct policy_handle **handle)
+                                struct policy_handle *handle)
 {
        struct lsa_DeleteObject r;
        NTSTATUS status;
index 396debaca82245d37f47ef6b318157e276408150..3f64bb450dce52f1a6f4f07ab65b0d4174e5332a 100644 (file)
@@ -48,7 +48,7 @@ NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli,
                                  struct policy_handle *handle,
                                  struct dom_sid2 *sid,
                                  uint32_t access_mask,
-                                 struct policy_handle **acct_handle);
+                                 struct policy_handle *acct_handle);
 NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli,
                                 TALLOC_CTX *mem_ctx,
                                 struct policy_handle *handle,
@@ -95,7 +95,7 @@ NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli,
                                struct policy_handle *handle,
                                struct dom_sid2 *sid,
                                uint32_t access_mask,
-                               struct policy_handle **acct_handle);
+                               struct policy_handle *acct_handle);
 NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli,
                                     TALLOC_CTX *mem_ctx,
                                     struct policy_handle *handle,
@@ -171,7 +171,7 @@ NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli,
                                          uint16_t unknown);
 NTSTATUS rpccli_lsa_DeleteObject(struct rpc_pipe_client *cli,
                                 TALLOC_CTX *mem_ctx,
-                                struct policy_handle **handle);
+                                struct policy_handle *handle);
 NTSTATUS rpccli_lsa_EnumAccountsWithUserRight(struct rpc_pipe_client *cli,
                                              TALLOC_CTX *mem_ctx,
                                              struct policy_handle *handle,
index 06f714acc8b28722bbde2eb2bc1b8901919e5107..0df0ddecc56a7dc4f0b773d046dd1b92b2cb4e8b 100644 (file)
@@ -713,7 +713,7 @@ struct lsa_CreateAccount {
        } in;
 
        struct {
-               struct policy_handle **acct_handle;/* [ref] */
+               struct policy_handle *acct_handle;/* [ref] */
                NTSTATUS result;
        } out;
 
@@ -829,7 +829,7 @@ struct lsa_OpenAccount {
        } in;
 
        struct {
-               struct policy_handle **acct_handle;/* [ref] */
+               struct policy_handle *acct_handle;/* [ref] */
                NTSTATUS result;
        } out;
 
@@ -1051,11 +1051,11 @@ struct lsa_LookupPrivDisplayName {
 
 struct lsa_DeleteObject {
        struct {
-               struct policy_handle **handle;/* [ref] */
+               struct policy_handle *handle;/* [ref] */
        } in;
 
        struct {
-               struct policy_handle **handle;/* [ref] */
+               struct policy_handle *handle;/* [ref] */
                NTSTATUS result;
        } out;
 
index 5ac4cbcb595839a68dc40198aee2a2cecc8bbe89..a3565c8f2c2407b987bc47f355e47fe16d14fdb6 100644 (file)
@@ -5321,10 +5321,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int
                if (r->out.acct_handle == NULL) {
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
-               NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.acct_handle));
-               if (*r->out.acct_handle) {
-                       NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.acct_handle));
-               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.acct_handle));
                NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -5332,11 +5329,9 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int
 
 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, int flags, struct lsa_CreateAccount *r)
 {
-       uint32_t _ptr_acct_handle;
        TALLOC_CTX *_mem_save_handle_0;
        TALLOC_CTX *_mem_save_sid_0;
        TALLOC_CTX *_mem_save_acct_handle_0;
-       TALLOC_CTX *_mem_save_acct_handle_1;
        if (flags & NDR_IN) {
                ZERO_STRUCT(r->out);
 
@@ -5364,18 +5359,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, int
                }
                _mem_save_acct_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
                NDR_PULL_SET_MEM_CTX(ndr, r->out.acct_handle, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_acct_handle));
-               if (_ptr_acct_handle) {
-                       NDR_PULL_ALLOC(ndr, *r->out.acct_handle);
-               } else {
-                       *r->out.acct_handle = NULL;
-               }
-               if (*r->out.acct_handle) {
-                       _mem_save_acct_handle_1 = NDR_PULL_GET_MEM_CTX(ndr);
-                       NDR_PULL_SET_MEM_CTX(ndr, *r->out.acct_handle, 0);
-                       NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.acct_handle));
-                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_acct_handle_1, 0);
-               }
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.acct_handle));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_acct_handle_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
        }
@@ -5408,12 +5392,7 @@ _PUBLIC_ void ndr_print_lsa_CreateAccount(struct ndr_print *ndr, const char *nam
                ndr->depth++;
                ndr_print_ptr(ndr, "acct_handle", r->out.acct_handle);
                ndr->depth++;
-               ndr_print_ptr(ndr, "acct_handle", *r->out.acct_handle);
-               ndr->depth++;
-               if (*r->out.acct_handle) {
-                       ndr_print_policy_handle(ndr, "acct_handle", *r->out.acct_handle);
-               }
-               ndr->depth--;
+               ndr_print_policy_handle(ndr, "acct_handle", r->out.acct_handle);
                ndr->depth--;
                ndr_print_NTSTATUS(ndr, "result", r->out.result);
                ndr->depth--;
@@ -6208,10 +6187,7 @@ static enum ndr_err_code ndr_push_lsa_OpenAccount(struct ndr_push *ndr, int flag
                if (r->out.acct_handle == NULL) {
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
-               NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.acct_handle));
-               if (*r->out.acct_handle) {
-                       NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.acct_handle));
-               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.acct_handle));
                NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -6219,11 +6195,9 @@ static enum ndr_err_code ndr_push_lsa_OpenAccount(struct ndr_push *ndr, int flag
 
 static enum ndr_err_code ndr_pull_lsa_OpenAccount(struct ndr_pull *ndr, int flags, struct lsa_OpenAccount *r)
 {
-       uint32_t _ptr_acct_handle;
        TALLOC_CTX *_mem_save_handle_0;
        TALLOC_CTX *_mem_save_sid_0;
        TALLOC_CTX *_mem_save_acct_handle_0;
-       TALLOC_CTX *_mem_save_acct_handle_1;
        if (flags & NDR_IN) {
                ZERO_STRUCT(r->out);
 
@@ -6251,18 +6225,7 @@ static enum ndr_err_code ndr_pull_lsa_OpenAccount(struct ndr_pull *ndr, int flag
                }
                _mem_save_acct_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
                NDR_PULL_SET_MEM_CTX(ndr, r->out.acct_handle, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_acct_handle));
-               if (_ptr_acct_handle) {
-                       NDR_PULL_ALLOC(ndr, *r->out.acct_handle);
-               } else {
-                       *r->out.acct_handle = NULL;
-               }
-               if (*r->out.acct_handle) {
-                       _mem_save_acct_handle_1 = NDR_PULL_GET_MEM_CTX(ndr);
-                       NDR_PULL_SET_MEM_CTX(ndr, *r->out.acct_handle, 0);
-                       NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.acct_handle));
-                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_acct_handle_1, 0);
-               }
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.acct_handle));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_acct_handle_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
        }
@@ -6295,12 +6258,7 @@ _PUBLIC_ void ndr_print_lsa_OpenAccount(struct ndr_print *ndr, const char *name,
                ndr->depth++;
                ndr_print_ptr(ndr, "acct_handle", r->out.acct_handle);
                ndr->depth++;
-               ndr_print_ptr(ndr, "acct_handle", *r->out.acct_handle);
-               ndr->depth++;
-               if (*r->out.acct_handle) {
-                       ndr_print_policy_handle(ndr, "acct_handle", *r->out.acct_handle);
-               }
-               ndr->depth--;
+               ndr_print_policy_handle(ndr, "acct_handle", r->out.acct_handle);
                ndr->depth--;
                ndr_print_NTSTATUS(ndr, "result", r->out.result);
                ndr->depth--;
@@ -7757,19 +7715,13 @@ static enum ndr_err_code ndr_push_lsa_DeleteObject(struct ndr_push *ndr, int fla
                if (r->in.handle == NULL) {
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
-               NDR_CHECK(ndr_push_unique_ptr(ndr, *r->in.handle));
-               if (*r->in.handle) {
-                       NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.handle));
-               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
        }
        if (flags & NDR_OUT) {
                if (r->out.handle == NULL) {
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
-               NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.handle));
-               if (*r->out.handle) {
-                       NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.handle));
-               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
                NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -7777,9 +7729,7 @@ static enum ndr_err_code ndr_push_lsa_DeleteObject(struct ndr_push *ndr, int fla
 
 static enum ndr_err_code ndr_pull_lsa_DeleteObject(struct ndr_pull *ndr, int flags, struct lsa_DeleteObject *r)
 {
-       uint32_t _ptr_handle;
        TALLOC_CTX *_mem_save_handle_0;
-       TALLOC_CTX *_mem_save_handle_1;
        if (flags & NDR_IN) {
                ZERO_STRUCT(r->out);
 
@@ -7788,18 +7738,7 @@ static enum ndr_err_code ndr_pull_lsa_DeleteObject(struct ndr_pull *ndr, int fla
                }
                _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
                NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_handle));
-               if (_ptr_handle) {
-                       NDR_PULL_ALLOC(ndr, *r->in.handle);
-               } else {
-                       *r->in.handle = NULL;
-               }
-               if (*r->in.handle) {
-                       _mem_save_handle_1 = NDR_PULL_GET_MEM_CTX(ndr);
-                       NDR_PULL_SET_MEM_CTX(ndr, *r->in.handle, 0);
-                       NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.handle));
-                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_1, 0);
-               }
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_PULL_ALLOC(ndr, r->out.handle);
                *r->out.handle = *r->in.handle;
@@ -7810,18 +7749,7 @@ static enum ndr_err_code ndr_pull_lsa_DeleteObject(struct ndr_pull *ndr, int fla
                }
                _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
                NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_handle));
-               if (_ptr_handle) {
-                       NDR_PULL_ALLOC(ndr, *r->out.handle);
-               } else {
-                       *r->out.handle = NULL;
-               }
-               if (*r->out.handle) {
-                       _mem_save_handle_1 = NDR_PULL_GET_MEM_CTX(ndr);
-                       NDR_PULL_SET_MEM_CTX(ndr, *r->out.handle, 0);
-                       NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.handle));
-                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_1, 0);
-               }
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
        }
@@ -7840,12 +7768,7 @@ _PUBLIC_ void ndr_print_lsa_DeleteObject(struct ndr_print *ndr, const char *name
                ndr->depth++;
                ndr_print_ptr(ndr, "handle", r->in.handle);
                ndr->depth++;
-               ndr_print_ptr(ndr, "handle", *r->in.handle);
-               ndr->depth++;
-               if (*r->in.handle) {
-                       ndr_print_policy_handle(ndr, "handle", *r->in.handle);
-               }
-               ndr->depth--;
+               ndr_print_policy_handle(ndr, "handle", r->in.handle);
                ndr->depth--;
                ndr->depth--;
        }
@@ -7854,12 +7777,7 @@ _PUBLIC_ void ndr_print_lsa_DeleteObject(struct ndr_print *ndr, const char *name
                ndr->depth++;
                ndr_print_ptr(ndr, "handle", r->out.handle);
                ndr->depth++;
-               ndr_print_ptr(ndr, "handle", *r->out.handle);
-               ndr->depth++;
-               if (*r->out.handle) {
-                       ndr_print_policy_handle(ndr, "handle", *r->out.handle);
-               }
-               ndr->depth--;
+               ndr_print_policy_handle(ndr, "handle", r->out.handle);
                ndr->depth--;
                ndr_print_NTSTATUS(ndr, "result", r->out.result);
                ndr->depth--;
index 874cf4c410a80b01af0f16fa269f6673457a128c..d02bdb786b39d318c55a45c0950650eb6e6e7ef8 100644 (file)
@@ -806,7 +806,7 @@ static bool api_lsa_CreateAccount(pipes_struct *p)
        }
 
        ZERO_STRUCT(r->out);
-       r->out.acct_handle = talloc_zero(r, struct policy_handle *);
+       r->out.acct_handle = talloc_zero(r, struct policy_handle);
        if (r->out.acct_handle == NULL) {
                talloc_free(r);
                return false;
@@ -1372,7 +1372,7 @@ static bool api_lsa_OpenAccount(pipes_struct *p)
        }
 
        ZERO_STRUCT(r->out);
-       r->out.acct_handle = talloc_zero(r, struct policy_handle *);
+       r->out.acct_handle = talloc_zero(r, struct policy_handle);
        if (r->out.acct_handle == NULL) {
                talloc_free(r);
                return false;
index df1da31c9703640227beca5c9296e0ce40e234b3..516b4352578fb3a8c448f16e4d492aedbbe8999d 100644 (file)
@@ -278,7 +278,7 @@ import "security.idl";
                [in]    policy_handle *handle,
                [in,ref] dom_sid2 *sid,
                [in]    uint32 access_mask,
-               [out]   policy_handle **acct_handle
+               [out]   policy_handle *acct_handle
                );
 
        /******************/
@@ -429,11 +429,11 @@ import "security.idl";
 
        /*****************************************/
        /* Function:     0x11                    */
-       NTSTATUS lsa_OpenAccount (
+       NTSTATUS lsa_OpenAccount(
                [in]         policy_handle *handle,
                [in,ref]     dom_sid2 *sid,
                [in]         uint32 access_mask,
-               [out]        policy_handle **acct_handle
+               [out]        policy_handle *acct_handle
                );
 
 
@@ -664,7 +664,7 @@ import "security.idl";
 
        /* Function:        0x22 */
        NTSTATUS lsa_DeleteObject(
-               [in,out] policy_handle **handle
+               [in,out] policy_handle *handle
                );
 
        /*******************/
index 247a52df469a1fd7deb0594d214a3a3a6bc35d2b..6e25a64236787d0f8b8e7d9391b3b2f718f0b252 100644 (file)
@@ -1647,7 +1647,7 @@ NTSTATUS _lsa_CreateAccount(pipes_struct *p,
        info->access = r->in.access_mask;
 
        /* get a (unique) handle.  open a policy on it. */
-       if (!create_policy_hnd(p, *r->out.acct_handle, free_lsa_info, (void *)info))
+       if (!create_policy_hnd(p, r->out.acct_handle, free_lsa_info, (void *)info))
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 
        return privilege_create_account( &info->sid );
@@ -1691,7 +1691,7 @@ NTSTATUS _lsa_OpenAccount(pipes_struct *p,
        info->access = r->in.access_mask;
 
        /* get a (unique) handle.  open a policy on it. */
-       if (!create_policy_hnd(p, *r->out.acct_handle, free_lsa_info, (void *)info))
+       if (!create_policy_hnd(p, r->out.acct_handle, free_lsa_info, (void *)info))
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 
        return NT_STATUS_OK;
index 54791f143c3be7051eeb336a2f5b8eaebe61be67..e5d131e9c13da1e59a7d932840497fb991797925 100644 (file)
@@ -585,7 +585,7 @@ static NTSTATUS cmd_lsa_create_account(struct rpc_pipe_client *cli,
                                            const char **argv) 
 {
        POLICY_HND dom_pol;
-       POLICY_HND *user_pol = NULL;
+       POLICY_HND user_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        uint32 des_access = 0x000f000f;
        
@@ -632,7 +632,7 @@ static NTSTATUS cmd_lsa_enum_privsaccounts(struct rpc_pipe_client *cli,
                                            const char **argv) 
 {
        POLICY_HND dom_pol;
-       POLICY_HND *user_pol = NULL;
+       POLICY_HND user_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        uint32 access_desired = 0x000f000f;
        
@@ -666,7 +666,7 @@ static NTSTATUS cmd_lsa_enum_privsaccounts(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_lsa_enum_privsaccount(cli, mem_ctx, user_pol, &count, &set);
+       result = rpccli_lsa_enum_privsaccount(cli, mem_ctx, &user_pol, &count, &set);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;