diff options
author | Luke Leighton <lkcl@samba.org> | 1999-11-18 17:57:21 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-11-18 17:57:21 +0000 |
commit | a394a4a8fa2c4c0ff03fbc5bc4ea925245ec1fed (patch) | |
tree | 37225bf66089879429df84fdc144bebe46bfebe4 /source3 | |
parent | ccc8585567804d6a7e6f684a97d58871e2fd9f8a (diff) | |
download | samba-a394a4a8fa2c4c0ff03fbc5bc4ea925245ec1fed.tar.gz samba-a394a4a8fa2c4c0ff03fbc5bc4ea925245ec1fed.tar.bz2 samba-a394a4a8fa2c4c0ff03fbc5bc4ea925245ec1fed.zip |
updating reg_value_info() parsing code to take BUFFER2 instead of just
a char*. now copes with multiple types.
(This used to be commit 3df7c903c5b70f336294a95ad864aedbacf544b0)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 4 | ||||
-rw-r--r-- | source3/include/rpc_reg.h | 4 | ||||
-rw-r--r-- | source3/rpc_client/cli_reg.c | 7 | ||||
-rw-r--r-- | source3/rpc_parse/parse_reg.c | 36 | ||||
-rw-r--r-- | source3/rpc_server/srv_reg.c | 6 | ||||
-rw-r--r-- | source3/rpcclient/cmd_reg.c | 44 |
6 files changed, 55 insertions, 46 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index b84b6ef26d..5183f5dfb0 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1874,7 +1874,7 @@ BOOL do_reg_query_key(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, BOOL do_reg_unknown_1a(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, uint32 *unk); BOOL do_reg_query_info(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, const char* val_name, - char *type); + uint32 *type, BUFFER2 *buf); BOOL do_reg_set_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, uint32 sec_buf_size, SEC_DESC *sec_buf); BOOL do_reg_get_key_sec(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, @@ -2499,7 +2499,7 @@ BOOL make_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, const char *val_name, uint8 major, uint8 minor); BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth); BOOL make_reg_r_info(REG_R_INFO *r_r, - uint32 type, char *buf, + uint32 *type, BUFFER2 *buf, uint32 status); BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth); BOOL make_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, diff --git a/source3/include/rpc_reg.h b/source3/include/rpc_reg.h index b00b7a5a90..6b141b9f47 100644 --- a/source3/include/rpc_reg.h +++ b/source3/include/rpc_reg.h @@ -442,10 +442,10 @@ typedef struct q_reg_info_info typedef struct r_reg_info_info { uint32 ptr_type; /* buffer pointer */ - uint32 type; /* 0x1 - info level? */ + uint32 *type; /* 0x1 - info level? */ uint32 ptr_uni_type; /* pointer to o/s type */ - BUFFER2 uni_type; /* unicode string o/s type - "LanmanNT" */ + BUFFER2 *uni_type; /* unicode string o/s type - "LanmanNT" */ uint32 ptr_max_len; /* pointer to unknown_0 */ uint32 buf_max_len; /* 0x12 */ diff --git a/source3/rpc_client/cli_reg.c b/source3/rpc_client/cli_reg.c index 53d17bdefa..dbdf98dcf7 100644 --- a/source3/rpc_client/cli_reg.c +++ b/source3/rpc_client/cli_reg.c @@ -451,7 +451,7 @@ do a REG Query Info ****************************************************************************/ BOOL do_reg_query_info(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, const char* val_name, - char *type) + uint32 *type, BUFFER2 *buffer) { prs_struct rbuf; prs_struct buf; @@ -480,6 +480,9 @@ BOOL do_reg_query_info(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, ZERO_STRUCT(r_o); + r_o.type = type; + r_o.uni_type = buffer; + reg_io_r_info("", &r_o, &rbuf, 0); p = rbuf.offset != 0; @@ -493,8 +496,6 @@ BOOL do_reg_query_info(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd, if (p) { valid_query = True; - unibuf_to_ascii(type, (const char*)r_o.uni_type.buffer, - MIN(r_o.uni_type.buf_len, sizeof(fstring)-1)); } } diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 1a0168f21d..ec2699e745 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -896,27 +896,31 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) creates a structure. ********************************************************************/ BOOL make_reg_r_info(REG_R_INFO *r_r, - uint32 type, char *buf, + uint32 *type, BUFFER2 *buf, uint32 status) { - int len; - - if (r_r == NULL || buf == NULL) return False; - - len = strlen(buf); + if (r_r == NULL) return False; - r_r->ptr_type = type; + r_r->ptr_type = type != NULL ? 1 : 0; r_r->type = type; - r_r->ptr_uni_type = 1; - make_buffer2(&(r_r->uni_type), buf, len); - - r_r->ptr_max_len = 1; - r_r->buf_max_len = r_r->uni_type.buf_max_len; + r_r->ptr_uni_type = buf != NULL ? 1 : 0; + r_r->uni_type = buf; - r_r->ptr_len = 1; - r_r->buf_len = r_r->uni_type.buf_len; + if (buf != NULL) + { + r_r->ptr_max_len = 1; + r_r->buf_max_len = r_r->uni_type->buf_max_len; + r_r->ptr_len = 1; + r_r->buf_len = r_r->uni_type->buf_len; + } + else + { + r_r->ptr_max_len = 0; + r_r->ptr_len = 0; + } + r_r->status = status; return True; @@ -937,11 +941,11 @@ BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) prs_uint32("ptr_type", ps, depth, &(r_r->ptr_type)); if (r_r->ptr_type != 0) { - prs_uint32("type", ps, depth, &(r_r->type)); + prs_uint32("type", ps, depth, r_r->type); } prs_uint32("ptr_uni_type", ps, depth, &(r_r->ptr_uni_type)); - smb_io_buffer2("uni_type", &(r_r->uni_type), r_r->ptr_uni_type, ps, depth); + smb_io_buffer2("uni_type", r_r->uni_type, r_r->ptr_uni_type, ps, depth); prs_align(ps); prs_uint32("ptr_max_len", ps, depth, &(r_r->ptr_max_len)); diff --git a/source3/rpc_server/srv_reg.c b/source3/rpc_server/srv_reg.c index ab7e4cf3ec..18781d0cd0 100644 --- a/source3/rpc_server/srv_reg.c +++ b/source3/rpc_server/srv_reg.c @@ -187,6 +187,8 @@ static void reg_reply_info(REG_Q_INFO *q_u, uint32 status = 0; REG_R_INFO r_u; + uint32 type = 1; + BUFFER2 buf; DEBUG(5,("reg_info: %d\n", __LINE__)); @@ -197,7 +199,9 @@ static void reg_reply_info(REG_Q_INFO *q_u, if (status == 0) { - make_reg_r_info(&r_u, 1, "LanmanNT", status); + char *key = "LanmanNT"; + make_buffer2(&buf, key, strlen(key)); + make_reg_r_info(&r_u, &type, &buf, status); } diff --git a/source3/rpcclient/cmd_reg.c b/source3/rpcclient/cmd_reg.c index 316b5f6bc1..02544987ec 100644 --- a/source3/rpcclient/cmd_reg.c +++ b/source3/rpcclient/cmd_reg.c @@ -97,24 +97,6 @@ static void reg_display_key(int val, const char *full_keyname, int num) } } -static void reg_display_key_info(const char *full_name, - const char *name, time_t key_mod_time) -{ - display_reg_key_info(out_hnd, ACTION_HEADER , name, key_mod_time); - display_reg_key_info(out_hnd, ACTION_ENUMERATE, name, key_mod_time); - display_reg_key_info(out_hnd, ACTION_FOOTER , name, key_mod_time); -} - -static void reg_display_val_info(const char *full_name, - const char* name, - uint32 type, - const BUFFER2 *const value) -{ - display_reg_value_info(out_hnd, ACTION_HEADER , name, type, value); - display_reg_value_info(out_hnd, ACTION_ENUMERATE, name, type, value); - display_reg_value_info(out_hnd, ACTION_FOOTER , name, type, value); -} - /**************************************************************************** nt registry enum @@ -283,6 +265,24 @@ BOOL msrpc_reg_enum_key(struct cli_state *cli, const char* full_keyname, return res1; } +static void reg_display_key_info(const char *full_name, + const char *name, time_t key_mod_time) +{ + display_reg_key_info(out_hnd, ACTION_HEADER , name, key_mod_time); + display_reg_key_info(out_hnd, ACTION_ENUMERATE, name, key_mod_time); + display_reg_key_info(out_hnd, ACTION_FOOTER , name, key_mod_time); +} + +static void reg_display_val_info(const char *full_name, + const char* name, + uint32 type, + const BUFFER2 *const value) +{ + display_reg_value_info(out_hnd, ACTION_HEADER , name, type, value); + display_reg_value_info(out_hnd, ACTION_ENUMERATE, name, type, value); + display_reg_value_info(out_hnd, ACTION_FOOTER , name, type, value); +} + /**************************************************************************** nt registry enum ****************************************************************************/ @@ -325,9 +325,9 @@ void cmd_reg_query_info(struct client_info *info) * query value info */ - fstring type; + BUFFER2 buf; + uint32 type; - type[0] = 0; DEBUG(5, ("cmd_reg_enum: smb_cli->fd:%d\n", smb_cli->fd)); if (!next_token(NULL, full_keyname, NULL, sizeof(full_keyname))) @@ -364,11 +364,11 @@ void cmd_reg_query_info(struct client_info *info) /* query it */ res1 = res1 ? do_reg_query_info(smb_cli, fnum, &key_pol, - val_name, type) : False; + val_name, &type, &buf) : False; if (res1) { - report(out_hnd, "type:\t%s\n", type); + reg_display_val_info(full_keyname, val_name, type, &buf); } /* close the handles */ |