summaryrefslogtreecommitdiff
path: root/source3/rpc_client/cli_reg.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-07-27 00:47:19 +0000
committerJeremy Allison <jra@samba.org>2000-07-27 00:47:19 +0000
commit5ec1642809d9de83da8c88c65d6595c6eb0270f5 (patch)
treef6f4f1e0b3678394fca8b7c37f71084a1b166671 /source3/rpc_client/cli_reg.c
parent134a4b86548db77cba292c50fbd6b91ecaa69f14 (diff)
downloadsamba-5ec1642809d9de83da8c88c65d6595c6eb0270f5.tar.gz
samba-5ec1642809d9de83da8c88c65d6595c6eb0270f5.tar.bz2
samba-5ec1642809d9de83da8c88c65d6595c6eb0270f5.zip
Ok - this is a *BIG* change - but it fixes the problems with static strings
in the RPC code. This change was prompted by trying to save a long (>256) character comment in the printer properties page. The new system associates a TALLOC_CTX with the pipe struct, and frees the pool on return of a complete PDU. A global TALLOC_CTX is used for the odd buffer allocated in the BUFFERxx code, and is freed in the main loop. This code works with insure, and seems to be free of memory leaks and crashes (so far) but there are probably the occasional problem with code that uses UNISTRxx structs on the stack and expects them to contain storage without doing a init_unistrXX(). This means that rpcclient will probably be horribly broken. A TALLOC_CTX also needed associating with the struct cli_state also, to make the prs_xx code there work. The main interface change is the addition of a TALLOC_CTX to the prs_init calls - used for dynamic allocation in the prs_XXX calls. Now this is in place it should make dynamic allocation of all RPC memory on unmarshall *much* easier to fix. Jeremy. (This used to be commit 0ff2ce543ee54f7364e6d839db6d06e7ef1edcf4)
Diffstat (limited to 'source3/rpc_client/cli_reg.c')
-rw-r--r--source3/rpc_client/cli_reg.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/source3/rpc_client/cli_reg.c b/source3/rpc_client/cli_reg.c
index d8b6931b42..13a9b26515 100644
--- a/source3/rpc_client/cli_reg.c
+++ b/source3/rpc_client/cli_reg.c
@@ -86,8 +86,8 @@ BOOL do_reg_open_hklm(struct cli_state *cli, uint16 unknown_0, uint32 level,
if (hnd == NULL)
return False;
- prs_init(&buf , MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf , MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
/* create and send a MSRPC command with api REG_OPEN_HKLM */
@@ -147,8 +147,8 @@ BOOL do_reg_open_hku(struct cli_state *cli, uint16 unknown_0, uint32 level,
if (hnd == NULL)
return False;
- prs_init(&buf , MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf , MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
/* create and send a MSRPC command with api REG_OPEN_HKU */
@@ -209,8 +209,8 @@ BOOL do_reg_flush_key(struct cli_state *cli, POLICY_HND *hnd)
if (hnd == NULL)
return False;
- prs_init(&buf , MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf , MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
/* create and send a MSRPC command with api REG_FLUSH_KEY */
@@ -271,8 +271,8 @@ BOOL do_reg_query_key(struct cli_state *cli, POLICY_HND *hnd,
if (hnd == NULL)
return False;
- prs_init(&buf , MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf , MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
/* create and send a MSRPC command with api REG_QUERY_KEY */
@@ -339,8 +339,8 @@ BOOL do_reg_unknown_1a(struct cli_state *cli, POLICY_HND *hnd, uint32 *unk)
if (hnd == NULL)
return False;
- prs_init(&buf , MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf , MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
/* create and send a MSRPC command with api REG_UNKNOWN_1A */
@@ -399,8 +399,8 @@ BOOL do_reg_query_info(struct cli_state *cli, POLICY_HND *hnd,
if (hnd == NULL)
return False;
- prs_init(&buf , MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf , MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
/* create and send a MSRPC command with api REG_INFO */
@@ -459,8 +459,8 @@ BOOL do_reg_set_key_sec(struct cli_state *cli, POLICY_HND *hnd, SEC_DESC_BUF *se
if (hnd == NULL)
return False;
- prs_init(&buf , MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf , MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
/* create and send a MSRPC command with api REG_SET_KEY_SEC */
@@ -515,8 +515,8 @@ BOOL do_reg_get_key_sec(struct cli_state *cli, POLICY_HND *hnd, uint32 *sec_buf_
if (hnd == NULL)
return False;
- prs_init(&buf , MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf , MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
/* create and send a MSRPC command with api REG_GET_KEY_SEC */
@@ -581,8 +581,8 @@ BOOL do_reg_delete_val(struct cli_state *cli, POLICY_HND *hnd, char *val_name)
if (hnd == NULL)
return False;
- prs_init(&buf , MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf , MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
/* create and send a MSRPC command with api REG_DELETE_VALUE */
@@ -638,8 +638,8 @@ BOOL do_reg_delete_key(struct cli_state *cli, POLICY_HND *hnd, char *key_name)
if (hnd == NULL)
return False;
- prs_init(&buf , MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf , MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
/* create and send a MSRPC command with api REG_DELETE_KEY */
@@ -722,8 +722,8 @@ BOOL do_reg_create_key(struct cli_state *cli, POLICY_HND *hnd,
}
free_sec_desc(&sec);
- prs_init(&buf, MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf, MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
init_reg_q_create_key(&q_o, hnd, key_name, key_class, sam_access, sec_buf);
@@ -783,8 +783,8 @@ BOOL do_reg_enum_key(struct cli_state *cli, POLICY_HND *hnd,
if (hnd == NULL)
return False;
- prs_init(&buf, MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf, MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
/* create and send a MSRPC command with api REG_ENUM_KEY */
@@ -846,8 +846,8 @@ BOOL do_reg_create_val(struct cli_state *cli, POLICY_HND *hnd,
if (hnd == NULL)
return False;
- prs_init(&buf, MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf, MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
/* create and send a MSRPC command with api REG_CREATE_VALUE */
@@ -906,8 +906,8 @@ BOOL do_reg_enum_val(struct cli_state *cli, POLICY_HND *hnd,
if (hnd == NULL)
return False;
- prs_init(&buf, MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf, MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
/* create and send a MSRPC command with api REG_ENUM_VALUE */
@@ -969,8 +969,8 @@ BOOL do_reg_open_entry(struct cli_state *cli, POLICY_HND *hnd,
if (hnd == NULL)
return False;
- prs_init(&buf, MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf, MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
/* create and send a MSRPC command with api REG_OPEN_ENTRY */
@@ -1031,8 +1031,8 @@ BOOL do_reg_close(struct cli_state *cli, POLICY_HND *hnd)
/* create and send a MSRPC command with api REG_CLOSE */
- prs_init(&buf, MAX_PDU_FRAG_LEN, 4, MARSHALL);
- prs_init(&rbuf, 0, 4, UNMARSHALL);
+ prs_init(&buf, MAX_PDU_FRAG_LEN, 4, cli->mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, 4, cli->mem_ctx, UNMARSHALL);
DEBUG(4,("REG Close\n"));