summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-01-17 06:15:18 +0000
committerAndrew Tridgell <tridge@samba.org>2003-01-17 06:15:18 +0000
commit96c795cea7518b50a40caba34e656f056a832589 (patch)
treea75d467bddd17c322b932734549db27cf1cf56fa /source3/rpc_parse
parentec879eacc263043409b584797d1e8c39258ba125 (diff)
downloadsamba-96c795cea7518b50a40caba34e656f056a832589.tar.gz
samba-96c795cea7518b50a40caba34e656f056a832589.tar.bz2
samba-96c795cea7518b50a40caba34e656f056a832589.zip
reverted this patch till I sort out the craziness with UNIHDR
(This used to be commit e3d00fa47d38cd214f5e350e1d6b30d90ed8a52c)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_dfs.c20
-rw-r--r--source3/rpc_parse/parse_lsa.c11
-rw-r--r--source3/rpc_parse/parse_misc.c59
-rw-r--r--source3/rpc_parse/parse_net.c51
-rw-r--r--source3/rpc_parse/parse_reg.c18
-rw-r--r--source3/rpc_parse/parse_samr.c96
-rw-r--r--source3/rpc_parse/parse_spoolss.c70
-rw-r--r--source3/rpc_parse/parse_srv.c54
8 files changed, 194 insertions, 185 deletions
diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c
index c8774932e3..ccd6d429fa 100644
--- a/source3/rpc_parse/parse_dfs.c
+++ b/source3/rpc_parse/parse_dfs.c
@@ -80,9 +80,9 @@ BOOL init_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, char *entrypath,
char *servername, char *sharename)
{
DEBUG(5,("init_dfs_q_dfs_remove\n"));
- init_unistr2(&q_d->DfsEntryPath, entrypath);
- init_unistr2(&q_d->ServerName, servername);
- init_unistr2(&q_d->ShareName, sharename);
+ init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1);
+ init_unistr2(&q_d->ServerName, servername, strlen(servername)+1);
+ init_unistr2(&q_d->ShareName, sharename, strlen(sharename)+1);
q_d->ptr_ServerName = q_d->ptr_ShareName = 1;
return True;
}
@@ -154,11 +154,11 @@ BOOL init_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, char *entrypath, char *servername,
{
DEBUG(5,("init_dfs_q_dfs_add\n"));
q_d->ptr_DfsEntryPath = q_d->ptr_ServerName = q_d->ptr_ShareName = 1;
- init_unistr2(&q_d->DfsEntryPath, entrypath);
- init_unistr2(&q_d->ServerName, servername);
- init_unistr2(&q_d->ShareName, sharename);
+ init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1);
+ init_unistr2(&q_d->ServerName, servername, strlen(servername)+1);
+ init_unistr2(&q_d->ShareName, sharename, strlen(sharename)+1);
if(comment != NULL) {
- init_unistr2(&q_d->Comment, comment);
+ init_unistr2(&q_d->Comment, comment, strlen(comment)+1);
q_d->ptr_Comment = 1;
} else {
q_d->ptr_Comment = 0;
@@ -236,9 +236,9 @@ BOOL init_dfs_q_dfs_get_info(DFS_Q_DFS_GET_INFO *q_d, char *entrypath,
uint32 info_level)
{
DEBUG(5,("init_dfs_q2_get_info\n"));
- init_unistr2(&q_d->uni_path, entrypath);
- init_unistr2(&q_d->uni_server, servername);
- init_unistr2(&q_d->uni_share, sharename);
+ init_unistr2(&q_d->uni_path, entrypath, strlen(entrypath)+1);
+ init_unistr2(&q_d->uni_server, servername, strlen(servername)+1);
+ init_unistr2(&q_d->uni_share, sharename, strlen(sharename)+1);
q_d->level = info_level;
q_d->ptr_server = q_d->ptr_share = 1;
return True;
diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c
index d37a27a97f..7c9f74da37 100644
--- a/source3/rpc_parse/parse_lsa.c
+++ b/source3/rpc_parse/parse_lsa.c
@@ -43,7 +43,7 @@ void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name,
trn->sid_name_use = sid_name_use;
init_uni_hdr(&trn->hdr_name, len_name);
- init_unistr2(uni_name, name);
+ init_unistr2(uni_name, name, len_name);
trn->domain_idx = idx;
}
@@ -346,7 +346,8 @@ void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, const char *server_name,
r_q->des_access = desired_access;
- init_unistr2(&r_q->uni_server_name, server_name);
+ init_unistr2(&r_q->uni_server_name, server_name,
+ strlen(server_name) + 1);
init_lsa_obj_attr(&r_q->attr, attributes, qos);
}
@@ -1090,7 +1091,7 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l,
len = strlen(names[i]);
init_uni_hdr(&q_l->hdr_name[i], len);
- init_unistr2(&q_l->uni_name[i], names[i]);
+ init_unistr2(&q_l->uni_name[i], names[i], len);
}
}
@@ -1443,7 +1444,7 @@ void init_lsa_priv_get_dispname(LSA_Q_PRIV_GET_DISPNAME *trn, POLICY_HND *hnd, c
memcpy(&trn->pol, hnd, sizeof(trn->pol));
init_uni_hdr(&trn->hdr_name, len_name);
- init_unistr2(&trn->name, name);
+ init_unistr2(&trn->name, name, len_name);
trn->lang_id = lang_id;
trn->lang_id_sys = lang_id_sys;
}
@@ -1956,7 +1957,7 @@ void init_lsa_q_lookupprivvalue(LSA_Q_LOOKUPPRIVVALUE *trn, POLICY_HND *hnd, con
len_name = 1;
init_uni_hdr(&trn->hdr_right, len_name);
- init_unistr2(&trn->uni2_right, name);
+ init_unistr2(&trn->uni2_right, name, len_name);
}
/*******************************************************************
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index 020c49cba1..9d3bd6f28a 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -766,12 +766,12 @@ void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf)
if (buf != NULL) {
*ptr = 1;
- init_unistr2(str, buf);
+ init_unistr2(str, buf, strlen(buf)+1);
} else {
*ptr = 0;
- init_unistr2(str, "");
+ init_unistr2(str, "", 0);
}
}
@@ -881,34 +881,37 @@ BOOL smb_io_string2(const char *desc, STRING2 *str2, uint32 buffer, prs_struct *
}
/*******************************************************************
- Inits a UNISTR2 structure. This function used to deliberately
- over-allocate to a minimum of 256 bytes. That is rather silly, and
- just hides potential bugs. If you need to overallocate then don't use
- this function!
+ Inits a UNISTR2 structure.
********************************************************************/
-void init_unistr2(UNISTR2 *str, const char *buf)
+
+void init_unistr2(UNISTR2 *str, const char *buf, size_t len)
{
- size_t len;
+ ZERO_STRUCTP(str);
- if (!buf) {
- /* this is incorrect, but is needed to cope with some
- broken code that assumes this function will always
- return a valid initialised UNISTR2 */
- buf = "";
- }
+ /* set up string lengths. */
+ str->uni_max_len = (uint32)len;
+ str->undoc = 0;
+ str->uni_str_len = (uint32)len;
- len = push_ucs2_talloc(get_talloc_ctx() , &str->buffer, buf);
+ if (len < MAX_UNISTRLEN)
+ len = MAX_UNISTRLEN;
+ len *= sizeof(uint16);
- if (len == -1) {
- /* oops - we can't convert the string? */
- smb_panic("failed to convert string in init_unistr2");
+ str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len);
+ if ((str->buffer == NULL) && (len > 0))
+ {
+ smb_panic("init_unistr2: malloc fail\n");
+ return;
}
- /* set up string lengths. Note that len is guaranteed to be a
- * multiple of 2 from push_ucs2 */
- str->uni_max_len = len/2;
- str->undoc = 0;
- str->uni_str_len = len/2;
+ /*
+ * don't move this test above ! The UNISTR2 must be initialized !!!
+ * jfm, 7/7/2001.
+ */
+ if (buf==NULL)
+ return;
+
+ rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE);
}
/**
@@ -1189,14 +1192,14 @@ static void init_clnt_srv(DOM_CLNT_SRV *log, const char *logon_srv, const char *
if (logon_srv != NULL) {
log->undoc_buffer = 1;
- init_unistr2(&log->uni_logon_srv, logon_srv);
+ init_unistr2(&log->uni_logon_srv, logon_srv, strlen(logon_srv)+1);
} else {
log->undoc_buffer = 0;
}
if (comp_name != NULL) {
log->undoc_buffer2 = 1;
- init_unistr2(&log->uni_comp_name, comp_name);
+ init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1);
} else {
log->undoc_buffer2 = 0;
}
@@ -1250,12 +1253,12 @@ void init_log_info(DOM_LOG_INFO *log, const char *logon_srv, const char *acct_na
log->undoc_buffer = 1;
- init_unistr2(&log->uni_logon_srv, logon_srv);
- init_unistr2(&log->uni_acct_name, acct_name);
+ init_unistr2(&log->uni_logon_srv, logon_srv, strlen(logon_srv)+1);
+ init_unistr2(&log->uni_acct_name, acct_name, strlen(acct_name)+1);
log->sec_chan = sec_chan;
- init_unistr2(&log->uni_comp_name, comp_name);
+ init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1);
}
/*******************************************************************
diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c
index 859ad6b408..ac21e6f2dd 100644
--- a/source3/rpc_parse/parse_net.c
+++ b/source3/rpc_parse/parse_net.c
@@ -136,15 +136,16 @@ static BOOL net_io_netinfo_1(const char *desc, NETLOGON_INFO_1 *info, prs_struct
static void init_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status,
uint32 tc_status, const char *trusted_dc_name)
{
+ int len_dc_name = strlen(trusted_dc_name);
info->flags = flags;
info->pdc_status = pdc_status;
info->ptr_trusted_dc_name = 1;
info->tc_status = tc_status;
if (trusted_dc_name != NULL)
- init_unistr2(&info->uni_trusted_dc_name, trusted_dc_name);
+ init_unistr2(&info->uni_trusted_dc_name, trusted_dc_name, len_dc_name+1);
else
- init_unistr2(&info->uni_trusted_dc_name, "");
+ init_unistr2(&info->uni_trusted_dc_name, "", 1);
}
/*******************************************************************
@@ -229,7 +230,7 @@ void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, const char *srv_name,
q_l->query_level = query_level;
q_l->switch_value = 0x01;
- init_unistr2(&q_l->uni_server_name, srv_name);
+ init_unistr2(&q_l->uni_server_name, srv_name, strlen(srv_name) + 1);
}
/*******************************************************************
@@ -359,7 +360,7 @@ void init_net_q_logon_ctrl(NET_Q_LOGON_CTRL *q_l, const char *srv_name,
q_l->function_code = 0x01; /* ??? */
q_l->query_level = query_level;
- init_unistr2(&q_l->uni_server_name, srv_name);
+ init_unistr2(&q_l->uni_server_name, srv_name, strlen(srv_name) + 1);
}
/*******************************************************************
@@ -446,7 +447,7 @@ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t,
fstring domain_name;
fstrcpy(domain_name, dom_name);
strupper(domain_name);
- init_unistr2(&r_t->uni_trust_dom_name[i], domain_name);
+ init_unistr2(&r_t->uni_trust_dom_name[i], domain_name, strlen(domain_name)+1);
/* the use of UNISTR2 here is non-standard. */
r_t->uni_trust_dom_name[i].undoc = 0x1;
}
@@ -538,8 +539,8 @@ void init_q_req_chal(NET_Q_REQ_CHAL *q_c,
q_c->undoc_buffer = 1; /* don't know what this buffer is */
- init_unistr2(&q_c->uni_logon_srv, logon_srv );
- init_unistr2(&q_c->uni_logon_clnt, logon_clnt);
+ init_unistr2(&q_c->uni_logon_srv, logon_srv , strlen(logon_srv )+1);
+ init_unistr2(&q_c->uni_logon_clnt, logon_clnt, strlen(logon_clnt)+1);
memcpy(q_c->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data));
@@ -957,9 +958,9 @@ void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name,
init_owf_info(&id->lm_owf, lm_cypher);
init_owf_info(&id->nt_owf, nt_cypher);
- init_unistr2(&id->uni_domain_name, domain_name);
- init_unistr2(&id->uni_user_name, user_name);
- init_unistr2(&id->uni_wksta_name, wksta_name);
+ init_unistr2(&id->uni_domain_name, domain_name, len_domain_name);
+ init_unistr2(&id->uni_user_name, user_name, len_user_name);
+ init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name);
}
/*******************************************************************
@@ -1069,9 +1070,9 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name,
init_str_hdr(&id->hdr_nt_chal_resp, nt_chal_resp_len, nt_chal_resp_len, (nt_chal_resp != NULL) ? 1 : 0);
init_str_hdr(&id->hdr_lm_chal_resp, lm_chal_resp_len, lm_chal_resp_len, (lm_chal_resp != NULL) ? 1 : 0);
- init_unistr2(&id->uni_domain_name, domain_name);
- init_unistr2(&id->uni_user_name, user_name);
- init_unistr2(&id->uni_wksta_name, wksta_name);
+ init_unistr2(&id->uni_domain_name, domain_name, len_domain_name);
+ init_unistr2(&id->uni_user_name, user_name, len_user_name);
+ init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name);
init_string2(&id->nt_chal_resp, (const char *)nt_chal_resp, nt_chal_resp_len, nt_chal_resp_len);
init_string2(&id->lm_chal_resp, (const char *)lm_chal_resp, lm_chal_resp_len, lm_chal_resp_len);
@@ -1351,12 +1352,12 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr,
usr->num_other_sids = num_other_sids;
usr->buffer_other_sids = (num_other_sids != 0) ? 1 : 0;
- init_unistr2(&usr->uni_user_name, user_name);
- init_unistr2(&usr->uni_full_name, full_name);
- init_unistr2(&usr->uni_logon_script, logon_script);
- init_unistr2(&usr->uni_profile_path, profile_path);
- init_unistr2(&usr->uni_home_dir, home_dir);
- init_unistr2(&usr->uni_dir_drive, dir_drive);
+ init_unistr2(&usr->uni_user_name, user_name, len_user_name);
+ init_unistr2(&usr->uni_full_name, full_name, len_full_name);
+ init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script);
+ init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path);
+ init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir);
+ init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive);
usr->num_groups2 = num_groups;
@@ -1367,8 +1368,8 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr,
for (i = 0; i < num_groups; i++)
usr->gids[i] = gids[i];
- init_unistr2(&usr->uni_logon_srv, logon_srv);
- init_unistr2(&usr->uni_logon_dom, logon_dom);
+ init_unistr2(&usr->uni_logon_srv, logon_srv, len_logon_srv);
+ init_unistr2(&usr->uni_logon_dom, logon_dom, len_logon_dom);
init_dom_sid2(&usr->dom_sid, dom_sid);
/* "other" sids are set up above */
@@ -1664,8 +1665,8 @@ BOOL init_net_q_sam_sync(NET_Q_SAM_SYNC * q_s, const char *srv_name,
{
DEBUG(5, ("init_q_sam_sync\n"));
- init_unistr2(&q_s->uni_srv_name, srv_name);
- init_unistr2(&q_s->uni_cli_name, cli_name);
+ init_unistr2(&q_s->uni_srv_name, srv_name, strlen(srv_name) + 1);
+ init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1);
if (cli_creds)
memcpy(&q_s->cli_creds, cli_creds, sizeof(q_s->cli_creds));
@@ -2841,8 +2842,8 @@ BOOL init_net_q_sam_deltas(NET_Q_SAM_DELTAS *q_s, const char *srv_name,
{
DEBUG(5, ("init_net_q_sam_deltas\n"));
- init_unistr2(&q_s->uni_srv_name, srv_name);
- init_unistr2(&q_s->uni_cli_name, cli_name);
+ init_unistr2(&q_s->uni_srv_name, srv_name, strlen(srv_name) + 1);
+ init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1);
memcpy(&q_s->cli_creds, cli_creds, sizeof(q_s->cli_creds));
memset(&q_s->ret_creds, 0, sizeof(q_s->ret_creds));
diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c
index 71344a2f9b..b4d20bf2ba 100644
--- a/source3/rpc_parse/parse_reg.c
+++ b/source3/rpc_parse/parse_reg.c
@@ -289,10 +289,10 @@ void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd,
memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol));
init_uni_hdr(&q_c->hdr_name, len_name);
- init_unistr2(&q_c->uni_name, name);
+ init_unistr2(&q_c->uni_name, name, len_name);
init_uni_hdr(&q_c->hdr_class, len_class);
- init_unistr2(&q_c->uni_class, class);
+ init_unistr2(&q_c->uni_class, class, len_class);
q_c->reserved = 0x00000000;
memcpy(&q_c->sam_access, sam_access, sizeof(q_c->sam_access));
@@ -403,7 +403,7 @@ void init_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd,
memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol));
init_uni_hdr(&q_c->hdr_name, len_name);
- init_unistr2(&q_c->uni_name, name);
+ init_unistr2(&q_c->uni_name, name, len_name);
}
/*******************************************************************
@@ -469,7 +469,7 @@ void init_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd,
memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol));
init_uni_hdr(&q_c->hdr_name, len_name);
- init_unistr2(&q_c->uni_name, name);
+ init_unistr2(&q_c->uni_name, name, len_name);
}
/*******************************************************************
@@ -1018,7 +1018,7 @@ BOOL init_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char* val_name)
q_i->pol = *pol;
init_uni_hdr(&(q_i->hdr_type), len_type);
- init_unistr2(&(q_i->uni_type), val_name);
+ init_unistr2(&(q_i->uni_type), val_name, len_type);
q_i->ptr_reserved = 1;
q_i->ptr_buf = 1;
@@ -1271,7 +1271,7 @@ void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val )
DEBUG(10,("init_reg_r_enum_val: Valuename => [%s]\n", val->valuename));
init_uni_hdr( &r_u->hdr_name, strlen(val->valuename)+1 );
- init_unistr2( &r_u->uni_name, val->valuename);
+ init_unistr2( &r_u->uni_name, val->valuename, strlen(val->valuename)+1 );
/* type */
@@ -1425,7 +1425,7 @@ void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol,
memcpy(&q_i->pol, pol, sizeof(q_i->pol));
init_uni_hdr(&q_i->hdr_name, val_len);
- init_unistr2(&q_i->uni_name, val_name);
+ init_unistr2(&q_i->uni_name, val_name, val_len);
q_i->type = type;
q_i->buf_value = val;
@@ -1655,7 +1655,7 @@ void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol,
memcpy(&r_q->pol, pol, sizeof(r_q->pol));
init_uni_hdr(&r_q->hdr_name, len_name);
- init_unistr2(&r_q->uni_name, key_name);
+ init_unistr2(&r_q->uni_name, key_name, len_name);
r_q->unknown_0 = 0x00000000;
r_q->access_desired = access_desired;
@@ -1747,7 +1747,7 @@ void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, const char *msg,
q_s->ptr_2 = 1;
init_uni_hdr(&(q_s->hdr_msg), msg_len);
- init_unistr2(&(q_s->uni_msg), msg);
+ init_unistr2(&(q_s->uni_msg), msg, msg_len);
q_s->timeout = timeout;
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index e3db7d339c..918cdbcd1d 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -101,7 +101,7 @@ void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN * q_u,
q_u->connect_pol = *pol;
init_uni_hdr(&q_u->hdr_domain, len_name);
- init_unistr2(&q_u->uni_domain, dom_name);
+ init_unistr2(&q_u->uni_domain, dom_name, len_name);
}
/*******************************************************************
@@ -637,7 +637,7 @@ void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *server)
init_uni_hdr(&u_5->hdr_server, len_server);
- init_unistr2(&u_5->uni_server, server);
+ init_unistr2(&u_5->uni_server, server, len_server);
}
/*******************************************************************
@@ -692,8 +692,8 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2,
memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */
- init_unistr2(&u_2->uni_domain, domain);
- init_unistr2(&u_2->uni_server, server);
+ init_unistr2(&u_2->uni_domain, domain, len_domain);
+ init_unistr2(&u_2->uni_server, server, len_server);
}
/*******************************************************************
@@ -1573,9 +1573,9 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en
ZERO_STRUCTP(&sam->str[i].uni_full_name);
ZERO_STRUCTP(&sam->str[i].uni_acct_desc);
- init_unistr2(&sam->str[i].uni_acct_name, pdb_get_username(pwd));
- init_unistr2(&sam->str[i].uni_full_name, pdb_get_fullname(pwd));
- init_unistr2(&sam->str[i].uni_acct_desc, pdb_get_acct_desc(pwd));
+ init_unistr2(&sam->str[i].uni_acct_name, pdb_get_username(pwd), len_sam_name);
+ init_unistr2(&sam->str[i].uni_full_name, pdb_get_fullname(pwd), len_sam_full);
+ init_unistr2(&sam->str[i].uni_acct_desc, pdb_get_acct_desc(pwd), len_sam_desc);
}
return NT_STATUS_OK;
@@ -1691,8 +1691,8 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en
ZERO_STRUCTP(&sam->str[i].uni_srv_name);
ZERO_STRUCTP(&sam->str[i].uni_srv_desc);
- init_unistr2(&sam->str[i].uni_srv_name, username);
- init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd));
+ init_unistr2(&sam->str[i].uni_srv_name, username, len_sam_name);
+ init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd), len_sam_desc);
}
return NT_STATUS_OK;
@@ -1785,8 +1785,8 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_en
init_sam_entry3(&sam->sam[i], start_idx + i + 1, len_sam_name, len_sam_desc, grp->rid);
- init_unistr2(&sam->str[i].uni_grp_name, grp->name);
- init_unistr2(&sam->str[i].uni_grp_desc, grp->comment);
+ init_unistr2(&sam->str[i].uni_grp_name, grp->name, len_sam_name);
+ init_unistr2(&sam->str[i].uni_grp_desc, grp->comment, len_sam_desc);
}
return NT_STATUS_OK;
@@ -2223,8 +2223,8 @@ void init_samr_group_info1(GROUP_INFO1 * gr1,
init_uni_hdr(&gr1->hdr_acct_desc, desc_len);
- init_unistr2(&gr1->uni_acct_name, acct_name);
- init_unistr2(&gr1->uni_acct_desc, acct_desc);
+ init_unistr2(&gr1->uni_acct_name, acct_name, acct_len);
+ init_unistr2(&gr1->uni_acct_desc, acct_desc, desc_len);
}
/*******************************************************************
@@ -2308,7 +2308,7 @@ void init_samr_group_info4(GROUP_INFO4 * gr4, char *acct_desc)
DEBUG(5, ("init_samr_group_info4\n"));
init_uni_hdr(&gr4->hdr_acct_desc, acct_len);
- init_unistr2(&gr4->uni_acct_desc, acct_desc);
+ init_unistr2(&gr4->uni_acct_desc, acct_desc, acct_len);
}
/*******************************************************************
@@ -2391,7 +2391,7 @@ void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e,
q_e->pol = *pol;
init_uni_hdr(&q_e->hdr_acct_desc, acct_len);
- init_unistr2(&q_e->uni_acct_desc, acct_desc);
+ init_unistr2(&q_e->uni_acct_desc, acct_desc, acct_len);
q_e->access_mask = access_mask;
}
@@ -3509,12 +3509,12 @@ void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member
DEBUG(5, ("init_samr_alias_info1\n"));
init_uni_hdr(&al1->hdr_acct_name, acct_len_name);
- init_unistr2(&al1->uni_acct_name, acct_name);
+ init_unistr2(&al1->uni_acct_name, acct_name, acct_len_name);
al1->num_member=num_member;
init_uni_hdr(&al1->hdr_acct_desc, acct_len_desc);
- init_unistr2(&al1->uni_acct_desc, acct_desc);
+ init_unistr2(&al1->uni_acct_desc, acct_desc, acct_len_desc);
}
/*******************************************************************
@@ -3565,7 +3565,7 @@ void init_samr_alias_info3(ALIAS_INFO3 * al3, char *acct_desc)
DEBUG(5, ("init_samr_alias_info3\n"));
init_uni_hdr(&al3->hdr_acct_desc, acct_len);
- init_unistr2(&al3->uni_acct_desc, acct_desc);
+ init_unistr2(&al3->uni_acct_desc, acct_desc, acct_len);
}
/*******************************************************************
@@ -4280,7 +4280,7 @@ void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u,
q_u->dom_pol = *hnd;
init_uni_hdr(&q_u->hdr_acct_desc, acct_len);
- init_unistr2(&q_u->uni_acct_desc, acct_desc);
+ init_unistr2(&q_u->uni_acct_desc, acct_desc, acct_len);
q_u->access_mask = 0x001f000f;
}
@@ -4672,7 +4672,7 @@ NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u,
for (i = 0; i < num_names; i++) {
int len_name = name[i] != NULL ? strlen(name[i]) : 0;
init_uni_hdr(&q_u->hdr_name[i], len_name); /* unicode header for user_name */
- init_unistr2(&q_u->uni_name[i], name[i]); /* unicode string for machine account */
+ init_unistr2(&q_u->uni_name[i], name[i], len_name); /* unicode string for machine account */
}
return NT_STATUS_OK;
@@ -5016,7 +5016,7 @@ void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u,
q_u->domain_pol = *pol;
init_uni_hdr(&q_u->hdr_name, len_name);
- init_unistr2(&q_u->uni_name, name);
+ init_unistr2(&q_u->uni_name, name, len_name);
q_u->acb_info = acb_info;
q_u->access_mask = access_mask;
@@ -5273,7 +5273,7 @@ void init_sam_user_info11(SAM_USER_INFO_11 * usr,
ZERO_STRUCT(usr->padding_7); /* 0 - padding 16 bytes */
usr->padding_8 = 0; /* 0 - padding 4 bytes */
- init_unistr2(&usr->uni_mach_acct, mach_acct); /* unicode string for machine account */
+ init_unistr2(&usr->uni_mach_acct, mach_acct, len_mach_acct); /* unicode string for machine account */
}
/*******************************************************************
@@ -5585,16 +5585,16 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z
memcpy(usr->pass, newpass, sizeof(usr->pass));
- init_unistr2(&usr->uni_user_name, user_name); /* NULL */
- init_unistr2(&usr->uni_full_name, full_name);
- init_unistr2(&usr->uni_home_dir, home_dir);
- init_unistr2(&usr->uni_dir_drive, dir_drive);
- init_unistr2(&usr->uni_logon_script, log_scr);
- init_unistr2(&usr->uni_profile_path, prof_path);
- init_unistr2(&usr->uni_acct_desc, desc);
- init_unistr2(&usr->uni_workstations, wkstas);
- init_unistr2(&usr->uni_unknown_str, unk_str);
- init_unistr2(&usr->uni_munged_dial, mung_dial);
+ init_unistr2(&usr->uni_user_name, user_name, len_user_name); /* NULL */
+ init_unistr2(&usr->uni_full_name, full_name, len_full_name);
+ init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir);
+ init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive);
+ init_unistr2(&usr->uni_logon_script, log_scr, len_logon_script);
+ init_unistr2(&usr->uni_profile_path, prof_path, len_profile_path);
+ init_unistr2(&usr->uni_acct_desc, desc, len_description);
+ init_unistr2(&usr->uni_workstations, wkstas, len_workstations);
+ init_unistr2(&usr->uni_unknown_str, unk_str, len_unknown_str);
+ init_unistr2(&usr->uni_munged_dial, mung_dial, len_munged_dial);
usr->unknown_6 = unknown_6; /* 0x0000 04ec */
usr->padding4 = 0;
@@ -6093,16 +6093,16 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID *
ZERO_STRUCT(usr->padding1);
ZERO_STRUCT(usr->padding2);
- init_unistr2(&usr->uni_user_name, user_name);
- init_unistr2(&usr->uni_full_name, full_name);
- init_unistr2(&usr->uni_home_dir, home_dir);
- init_unistr2(&usr->uni_dir_drive, dir_drive);
- init_unistr2(&usr->uni_logon_script, logon_script);
- init_unistr2(&usr->uni_profile_path, profile_path);
- init_unistr2(&usr->uni_acct_desc, description);
- init_unistr2(&usr->uni_workstations, workstations);
- init_unistr2(&usr->uni_unknown_str, NULL);
- init_unistr2(&usr->uni_munged_dial, munged_dial);
+ init_unistr2(&usr->uni_user_name, user_name, len_user_name);
+ init_unistr2(&usr->uni_full_name, full_name, len_full_name);
+ init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir);
+ init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive);
+ init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script);
+ init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path);
+ init_unistr2(&usr->uni_acct_desc, description, len_description);
+ init_unistr2(&usr->uni_workstations, workstations, len_workstations);
+ init_unistr2(&usr->uni_unknown_str, NULL, len_unknown_str);
+ init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial);
usr->unknown_6 = pdb_get_unknown_6(pw);
usr->padding4 = 0;
@@ -6245,7 +6245,7 @@ void init_sam_user_info20A(SAM_USER_INFO_20 *usr, SAM_ACCOUNT *pw)
len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0;
init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial);
- init_unistr2(&usr->uni_munged_dial, munged_dial);
+ init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial);
}
@@ -6717,7 +6717,7 @@ void init_samr_q_connect(SAMR_Q_CONNECT * q_u,
/* make PDC server name \\server */
q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0;
- init_unistr2(&q_u->uni_srv_name, srv_name);
+ init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1);
/* example values: 0x0000 0002 */
q_u->access_mask = access_mask;
@@ -6790,7 +6790,7 @@ void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u,
/* make PDC server name \\server */
q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0;
- init_unistr2(&q_u->uni_srv_name, srv_name);
+ init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1);
/* Only value we've seen, possibly an address type ? */
q_u->unk_0 = 2;
@@ -6935,7 +6935,7 @@ void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO * q_u,
q_u->ptr = 1;
init_uni_hdr(&q_u->hdr_srv_name, len_srv_name);
- init_unistr2(&q_u->uni_srv_name, srv_name);
+ init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name);
}
/*******************************************************************
@@ -7103,9 +7103,9 @@ void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u,
q_u->ptr_0 = 1;
init_uni_hdr(&q_u->hdr_dest_host, len_dest_host);
- init_unistr2(&q_u->uni_dest_host, dest_host);
+ init_unistr2(&q_u->uni_dest_host, dest_host, len_dest_host);
init_uni_hdr(&q_u->hdr_user_name, len_user_name);
- init_unistr2(&q_u->uni_user_name, user_name);
+ init_unistr2(&q_u->uni_user_name, user_name, len_user_name);
init_enc_passwd(&q_u->nt_newpass, nt_newpass);
init_enc_hash(&q_u->nt_oldhash, nt_oldhash);
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index b3fbb655ca..cb3b2efd9d 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -916,12 +916,12 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u,
{
DEBUG(5,("make_spoolss_q_open_printer_ex\n"));
q_u->printername_ptr = (printername!=NULL)?1:0;
- init_unistr2(&q_u->printername, printername);
+ init_unistr2(&q_u->printername, printername, strlen(printername)+1);
q_u->printer_default.datatype_ptr = 0;
/*
q_u->printer_default.datatype_ptr = (datatype!=NULL)?1:0;
- init_unistr2(&q_u->printer_default.datatype, datatype);
+ init_unistr2(&q_u->printer_default.datatype, datatype, strlen(datatype));
*/
q_u->printer_default.devmode_cont.size=0;
q_u->printer_default.devmode_cont.devmode_ptr=0;
@@ -937,8 +937,8 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u,
q_u->user_ctr.user1.major=2;
q_u->user_ctr.user1.minor=0;
q_u->user_ctr.user1.processor=0;
- init_unistr2(&q_u->user_ctr.user1.client_name, clientname);
- init_unistr2(&q_u->user_ctr.user1.user_name, user_name);
+ init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)+1);
+ init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)+1);
return True;
}
@@ -963,7 +963,7 @@ BOOL make_spoolss_q_addprinterex(
ZERO_STRUCTP(q_u);
q_u->server_name_ptr = (srv_name!=NULL)?1:0;
- init_unistr2(&q_u->server_name, srv_name);
+ init_unistr2(&q_u->server_name, srv_name, strlen(srv_name));
q_u->level = level;
@@ -991,8 +991,8 @@ BOOL make_spoolss_q_addprinterex(
q_u->user_ctr.user1.major=2;
q_u->user_ctr.user1.minor=0;
q_u->user_ctr.user1.processor=0;
- init_unistr2(&q_u->user_ctr.user1.client_name, clientname);
- init_unistr2(&q_u->user_ctr.user1.user_name, user_name);
+ init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)+1);
+ init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)+1);
q_u->user_ctr.user1.size=q_u->user_ctr.user1.user_name.uni_str_len +
q_u->user_ctr.user1.client_name.uni_str_len + 2;
@@ -1187,9 +1187,9 @@ BOOL make_spoolss_q_deleteprinterdriver(
/* these must be NULL terminated or else NT4 will
complain about invalid parameters --jerry */
- init_unistr2(&q_u->server, server);
- init_unistr2(&q_u->arch, arch);
- init_unistr2(&q_u->driver, driver);
+ init_unistr2(&q_u->server, server, strlen(server)+1);
+ init_unistr2(&q_u->arch, arch, strlen(arch)+1);
+ init_unistr2(&q_u->driver, driver, strlen(driver)+1);
return True;
@@ -1209,7 +1209,7 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u,
DEBUG(5,("make_spoolss_q_getprinterdata\n"));
q_u->handle = *handle;
- init_unistr2(&q_u->valuename, valuename);
+ init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1);
q_u->size = size;
return True;
@@ -1228,8 +1228,8 @@ BOOL make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX *q_u,
DEBUG(5,("make_spoolss_q_getprinterdataex\n"));
q_u->handle = *handle;
- init_unistr2(&q_u->valuename, valuename);
- init_unistr2(&q_u->keyname, keyname);
+ init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1);
+ init_unistr2(&q_u->keyname, keyname, strlen(keyname) + 1);
q_u->size = size;
return True;
@@ -5373,7 +5373,7 @@ BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx,
DEBUG(5,("make_spoolss_q_addprinterdriver\n"));
q_u->server_name_ptr = (srv_name!=NULL)?1:0;
- init_unistr2(&q_u->server_name, srv_name);
+ init_unistr2(&q_u->server_name, srv_name, strlen(srv_name)+1);
q_u->level = level;
@@ -6161,7 +6161,7 @@ BOOL make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u,
uint32 size)
{
memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
- init_unistr2(&q_u->key, key);
+ init_unistr2(&q_u->key, key, strlen(key)+1);
q_u->size = size;
return True;
@@ -6174,7 +6174,7 @@ BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND
{
memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
q_u->type = data_type;
- init_unistr2(&q_u->value, value);
+ init_unistr2(&q_u->value, value, strlen(value)+1);
q_u->max_len = q_u->real_len = data_size;
q_u->data = data;
@@ -6190,8 +6190,8 @@ BOOL make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX *q_u, const POLICY
{
memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
q_u->type = data_type;
- init_unistr2(&q_u->value, value);
- init_unistr2(&q_u->key, key);
+ init_unistr2(&q_u->value, value, strlen(value)+1);
+ init_unistr2(&q_u->key, key, strlen(key)+1);
q_u->max_len = q_u->real_len = data_size;
q_u->data = data;
@@ -6588,7 +6588,7 @@ BOOL make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u,
if (q_u == NULL)
return False;
- init_unistr2(&q_u->string, string);
+ init_unistr2(&q_u->string, string, strlen(string)+1);
q_u->printer=printer;
q_u->type=type;
@@ -7091,7 +7091,7 @@ BOOL make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u,
DEBUG(5,("make_spoolss_q_enumprinterkey\n"));
memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
- init_unistr2(&q_u->key, key);
+ init_unistr2(&q_u->key, key, strlen(key)+1);
q_u->size = size;
return True;
@@ -7160,7 +7160,7 @@ BOOL make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY *q_u,
DEBUG(5,("make_spoolss_q_deleteprinterkey\n"));
memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
- init_unistr2(&q_u->keyname, keyname);
+ init_unistr2(&q_u->keyname, keyname, strlen(keyname)+1);
return True;
}
@@ -7382,8 +7382,8 @@ BOOL make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTOR
{
DEBUG(5,("make_spoolss_q_getprintprocessordirectory\n"));
- init_unistr2(&q_u->name, name);
- init_unistr2(&q_u->environment, environment);
+ init_unistr2(&q_u->name, name, strlen(name)+1);
+ init_unistr2(&q_u->environment, environment, strlen(environment)+1);
q_u->level = level;
@@ -7509,7 +7509,7 @@ BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle,
q_u->level = level;
q_u->level2 = level;
memcpy(&q_u->form, form, sizeof(FORM));
- init_unistr2(&q_u->name, form_name);
+ init_unistr2(&q_u->name, form_name, strlen(form_name) + 1);
return True;
}
@@ -7521,7 +7521,7 @@ BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle,
BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, char *form)
{
memcpy(&q_u->handle, handle, sizeof(POLICY_HND));
- init_unistr2(&q_u->name, form);
+ init_unistr2(&q_u->name, form, strlen(form) + 1);
return True;
}
@@ -7535,7 +7535,7 @@ BOOL make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle,
{
memcpy(&q_u->handle, handle, sizeof(POLICY_HND));
q_u->level = level;
- init_unistr2(&q_u->formname, formname);
+ init_unistr2(&q_u->formname, formname, strlen(formname) + 1);
q_u->buffer=buffer;
q_u->offered=offered;
@@ -7642,13 +7642,16 @@ BOOL make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER *q_u,
ctr->docinfo.doc_info_1.p_datatype = datatype ? 1 : 0;
if (docname)
- init_unistr2(&ctr->docinfo.doc_info_1.docname, docname);
+ init_unistr2(&ctr->docinfo.doc_info_1.docname, docname,
+ strlen(docname) + 1);
if (outputfile)
- init_unistr2(&ctr->docinfo.doc_info_1.outputfile, outputfile);
+ init_unistr2(&ctr->docinfo.doc_info_1.outputfile, outputfile,
+ strlen(outputfile) + 1);
if (datatype)
- init_unistr2(&ctr->docinfo.doc_info_1.datatype, datatype);
+ init_unistr2(&ctr->docinfo.doc_info_1.datatype, datatype,
+ strlen(datatype) + 1);
break;
case 2:
@@ -7697,7 +7700,7 @@ BOOL make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u,
POLICY_HND *handle, char *valuename)
{
memcpy(&q_u->handle, handle, sizeof(POLICY_HND));
- init_unistr2(&q_u->valuename, valuename);
+ init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1);
return True;
}
@@ -7711,8 +7714,8 @@ BOOL make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX *q_u,
char *value)
{
memcpy(&q_u->handle, handle, sizeof(POLICY_HND));
- init_unistr2(&q_u->valuename, value);
- init_unistr2(&q_u->keyname, key);
+ init_unistr2(&q_u->valuename, value, strlen(value) + 1);
+ init_unistr2(&q_u->keyname, key, strlen(key) + 1);
return True;
}
@@ -7732,7 +7735,8 @@ BOOL make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle,
q_u->localmachine_ptr = 1;
- init_unistr2(&q_u->localmachine, localmachine);
+ init_unistr2(&q_u->localmachine, localmachine,
+ strlen(localmachine) + 1);
q_u->printerlocal = printerlocal;
diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c
index fb3484d228..bfa1a13be9 100644
--- a/source3/rpc_parse/parse_srv.c
+++ b/source3/rpc_parse/parse_srv.c
@@ -37,7 +37,7 @@ void init_srv_share_info0_str(SH_INFO_0_STR *sh0, const char *net_name)
DEBUG(5,("init_srv_share_info0_str\n"));
if(net_name)
- init_unistr2(&sh0->uni_netname, net_name);
+ init_unistr2(&sh0->uni_netname, net_name, strlen(net_name)+1);
}
/*******************************************************************
@@ -102,9 +102,9 @@ void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const ch
DEBUG(5,("init_srv_share_info1_str\n"));
if(net_name)
- init_unistr2(&sh1->uni_netname, net_name);
+ init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1);
if(remark)
- init_unistr2(&sh1->uni_remark, remark);
+ init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1);
}
/*******************************************************************
@@ -185,13 +185,13 @@ void init_srv_share_info2_str(SH_INFO_2_STR *sh2,
DEBUG(5,("init_srv_share_info2_str\n"));
if (net_name)
- init_unistr2(&sh2->uni_netname, net_name);
+ init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1);
if (remark)
- init_unistr2(&sh2->uni_remark, remark);
+ init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1);
if (path)
- init_unistr2(&sh2->uni_path, path);
+ init_unistr2(&sh2->uni_path, path, strlen(path)+1);
if (passwd)
- init_unistr2(&sh2->uni_passwd, passwd);
+ init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1);
}
/*******************************************************************
@@ -297,9 +297,9 @@ void init_srv_share_info501_str(SH_INFO_501_STR *sh501,
DEBUG(5,("init_srv_share_info501_str\n"));
if(net_name)
- init_unistr2(&sh501->uni_netname, net_name);
+ init_unistr2(&sh501->uni_netname, net_name, strlen(net_name)+1);
if(remark)
- init_unistr2(&sh501->uni_remark, remark);
+ init_unistr2(&sh501->uni_remark, remark, strlen(remark)+1);
}
/*******************************************************************
@@ -447,13 +447,13 @@ void init_srv_share_info502_str(SH_INFO_502_STR *sh502str,
DEBUG(5,("init_srv_share_info502_str\n"));
if(net_name)
- init_unistr2(&sh502str->uni_netname, net_name);
+ init_unistr2(&sh502str->uni_netname, net_name, strlen(net_name)+1);
if(remark)
- init_unistr2(&sh502str->uni_remark, remark);
+ init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1);
if(path)
- init_unistr2(&sh502str->uni_path, path);
+ init_unistr2(&sh502str->uni_path, path, strlen(path)+1);
if(passwd)
- init_unistr2(&sh502str->uni_passwd, passwd);
+ init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1);
sh502str->sd = psd;
sh502str->reserved = 0;
sh502str->sd_size = sd_size;
@@ -552,7 +552,7 @@ void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark)
DEBUG(5,("init_srv_share_info1004_str\n"));
if(remark)
- init_unistr2(&sh1004->uni_remark, remark);
+ init_unistr2(&sh1004->uni_remark, remark, strlen(remark)+1);
}
/*******************************************************************
@@ -659,7 +659,7 @@ void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate
DEBUG(5,("init_srv_share_info1007_str\n"));
if(alternate_directory_name)
- init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name);
+ init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, strlen(alternate_directory_name)+1);
}
/*******************************************************************
@@ -1473,7 +1473,7 @@ void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname,
const char *path, const char *passwd)
{
q->ptr_srv_name = 1;
- init_unistr2(&q->uni_srv_name, srvname);
+ init_unistr2(&q->uni_srv_name, srvname, strlen(srvname) +1);
q->info.switch_value = q->info_level = 2;
q->info.ptr_share_ctr = 1;
@@ -1524,8 +1524,8 @@ void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname,
const char *sharename)
{
del->ptr_srv_name = 1;
- init_unistr2(&del->uni_srv_name, srvname);
- init_unistr2(&del->uni_share_name, sharename);
+ init_unistr2(&del->uni_srv_name, srvname, strlen(srvname) +1 );
+ init_unistr2(&del->uni_share_name, sharename, strlen(sharename) + 1);
}
/*******************************************************************
@@ -1588,7 +1588,7 @@ void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, const char *name)
{
DEBUG(5,("init_srv_sess_info0_str\n"));
- init_unistr2(&ss0->uni_name, name);
+ init_unistr2(&ss0->uni_name, name, strlen(name)+1);
}
/*******************************************************************
@@ -1702,8 +1702,8 @@ void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, const char *name, const char
{
DEBUG(5,("init_srv_sess_info1_str\n"));
- init_unistr2(&ss1->uni_name, name);
- init_unistr2(&ss1->uni_user, user);
+ init_unistr2(&ss1->uni_name, name, strlen(name)+1);
+ init_unistr2(&ss1->uni_user, user, strlen(user)+1);
}
/*******************************************************************
@@ -2074,8 +2074,8 @@ void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const c
{
DEBUG(5,("init_srv_conn_info1_str\n"));
- init_unistr2(&ss1->uni_usr_name, usr_name);
- init_unistr2(&ss1->uni_net_name, net_name);
+ init_unistr2(&ss1->uni_usr_name, usr_name, strlen(usr_name)+1);
+ init_unistr2(&ss1->uni_net_name, net_name, strlen(net_name)+1);
}
/*******************************************************************
@@ -2364,8 +2364,8 @@ void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, const char *user_name, const
{
DEBUG(5,("init_srv_file_info3_str\n"));
- init_unistr2(&fi3->uni_path_name, path_name);
- init_unistr2(&fi3->uni_user_name, user_name);
+ init_unistr2(&fi3->uni_path_name, path_name, strlen(path_name)+1);
+ init_unistr2(&fi3->uni_user_name, user_name, strlen(user_name)+1);
}
/*******************************************************************
@@ -2627,7 +2627,7 @@ void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, const char *server,
uint32 file_id)
{
q_n->ptr_srv_name = 1;
- init_unistr2(&q_n->uni_srv_name, server);
+ init_unistr2(&q_n->uni_srv_name, server, strlen(server) + 1);
q_n->file_id = file_id;
}
@@ -3585,6 +3585,6 @@ BOOL srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC
void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server)
{
q_u->ptr_srv_name = 1;
- init_unistr2(&q_u->uni_srv_name, server);
+ init_unistr2(&q_u->uni_srv_name, server, strlen(server) + 1);
}