diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-01-17 04:58:45 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-01-17 04:58:45 +0000 |
commit | ec879eacc263043409b584797d1e8c39258ba125 (patch) | |
tree | 7a7775040b27f7fea0f7bd1c8f0ede91c9ce770d /source3 | |
parent | ba51d1d888f98e196627486490e8569faeb641c2 (diff) | |
download | samba-ec879eacc263043409b584797d1e8c39258ba125.tar.gz samba-ec879eacc263043409b584797d1e8c39258ba125.tar.bz2 samba-ec879eacc263043409b584797d1e8c39258ba125.zip |
This removes the 3rd argument from init_unistr2(). There were 240
calls to init_unistr2() in the code and every one of them got the 3rd
argument incorrect, so I thought it best just to remove the argument.
The incorrect usage was caused by callers using strlen() to determine
the length of the string. The 3rd argument to init_unistr2() was
supposed to be the character length, not the byte length of the
string, so for non-english this could come out wrong.
I also removed the bogus 'always allocate at least 256 bytes'
hack. There may be some code that relies on this, but if there is then
the code is broken and needs fixing.
(This used to be commit b9eff31b1433c81fbff733e194914a40f25e3bda)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/python/py_spoolss_forms.c | 2 | ||||
-rw-r--r-- | source3/python/py_spoolss_forms_conv.c | 2 | ||||
-rw-r--r-- | source3/registry/reg_printing.c | 32 | ||||
-rw-r--r-- | source3/rpc_client/cli_srvsvc.c | 16 | ||||
-rw-r--r-- | source3/rpc_parse/parse_dfs.c | 20 | ||||
-rw-r--r-- | source3/rpc_parse/parse_lsa.c | 11 | ||||
-rw-r--r-- | source3/rpc_parse/parse_misc.c | 59 | ||||
-rw-r--r-- | source3/rpc_parse/parse_net.c | 51 | ||||
-rw-r--r-- | source3/rpc_parse/parse_reg.c | 18 | ||||
-rw-r--r-- | source3/rpc_parse/parse_samr.c | 96 | ||||
-rw-r--r-- | source3/rpc_parse/parse_spoolss.c | 70 | ||||
-rw-r--r-- | source3/rpc_parse/parse_srv.c | 54 | ||||
-rw-r--r-- | source3/rpc_server/srv_dfs_nt.c | 12 | ||||
-rw-r--r-- | source3/rpc_server/srv_lsa_nt.c | 23 | ||||
-rw-r--r-- | source3/rpc_server/srv_samr_nt.c | 8 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 2 | ||||
-rw-r--r-- | source3/rpcclient/cmd_spoolss.c | 4 |
17 files changed, 234 insertions, 246 deletions
diff --git a/source3/python/py_spoolss_forms.c b/source3/python/py_spoolss_forms.c index ef9ed94533..b446ce3c96 100644 --- a/source3/python/py_spoolss_forms.c +++ b/source3/python/py_spoolss_forms.c @@ -59,7 +59,7 @@ PyObject *spoolss_hnd_addform(PyObject *self, PyObject *args, PyObject *kw) PyObject *obj = PyDict_GetItemString(info, "name"); char *form_name = PyString_AsString(obj); - init_unistr2(&form.name, form_name, strlen(form_name) + 1); + init_unistr2(&form.name, form_name); break; } default: diff --git a/source3/python/py_spoolss_forms_conv.c b/source3/python/py_spoolss_forms_conv.c index 095a318fd2..40f7de8fdc 100644 --- a/source3/python/py_spoolss_forms_conv.c +++ b/source3/python/py_spoolss_forms_conv.c @@ -81,7 +81,7 @@ BOOL py_to_FORM(FORM *form, PyObject *dict) obj = PyDict_GetItemString(dict, "name"); name = PyString_AsString(obj); - init_unistr2(&form->name, name, strlen(name) + 1); + init_unistr2(&form->name, name); result = True; diff --git a/source3/registry/reg_printing.c b/source3/registry/reg_printing.c index 4b8eaa658e..6840dd9623 100644 --- a/source3/registry/reg_printing.c +++ b/source3/registry/reg_printing.c @@ -288,22 +288,22 @@ static int print_subpath_values_environments( char *key, REGVAL_CTR *val ) info3 = driver_ctr.info_3; filename = dos_basename( info3->driverpath ); - init_unistr2( &data, filename, strlen(filename)+1 ); + init_unistr2( &data, filename); regval_ctr_addvalue( val, "Driver", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); filename = dos_basename( info3->configfile ); - init_unistr2( &data, filename, strlen(filename)+1 ); + init_unistr2( &data, filename); regval_ctr_addvalue( val, "Configuration File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); filename = dos_basename( info3->datafile ); - init_unistr2( &data, filename, strlen(filename)+1 ); + init_unistr2( &data, filename); regval_ctr_addvalue( val, "Data File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); filename = dos_basename( info3->helpfile ); - init_unistr2( &data, filename, strlen(filename)+1 ); + init_unistr2( &data, filename); regval_ctr_addvalue( val, "Help File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); - init_unistr2( &data, info3->defaultdatatype, strlen(info3->defaultdatatype)+1 ); + init_unistr2( &data, info3->defaultdatatype); regval_ctr_addvalue( val, "Data Type", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); regval_ctr_addvalue( val, "Version", REG_DWORD, (char*)&info3->cversion, sizeof(info3->cversion) ); @@ -327,7 +327,7 @@ static int print_subpath_values_environments( char *key, REGVAL_CTR *val ) break; buffer = buffer2; - init_unistr2( &data, filename, length+1 ); + init_unistr2( &data, filename); memcpy( buffer+buffer_size, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); buffer_size += (length + 1)*sizeof(uint16); @@ -573,25 +573,25 @@ static int print_subpath_values_printers( char *key, REGVAL_CTR *val ) regval_ctr_addvalue( val, "cjobs", REG_DWORD, (char*)&info2->cjobs, sizeof(info2->cjobs) ); regval_ctr_addvalue( val, "AveragePPM", REG_DWORD, (char*)&info2->averageppm, sizeof(info2->averageppm) ); - init_unistr2( &data, info2->printername, strlen(info2->printername)+1 ); + init_unistr2( &data, info2->printername); regval_ctr_addvalue( val, "Name", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); - init_unistr2( &data, info2->location, strlen(info2->location)+1 ); + init_unistr2( &data, info2->location); regval_ctr_addvalue( val, "Location", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); - init_unistr2( &data, info2->comment, strlen(info2->comment)+1 ); + init_unistr2( &data, info2->comment); regval_ctr_addvalue( val, "Comment", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); - init_unistr2( &data, info2->parameters, strlen(info2->parameters)+1 ); + init_unistr2( &data, info2->parameters); regval_ctr_addvalue( val, "Parameters", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); - init_unistr2( &data, info2->portname, strlen(info2->portname)+1 ); + init_unistr2( &data, info2->portname); regval_ctr_addvalue( val, "Port", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); - init_unistr2( &data, info2->servername, strlen(info2->servername)+1 ); + init_unistr2( &data, info2->servername); regval_ctr_addvalue( val, "Server", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); - init_unistr2( &data, info2->sharename, strlen(info2->sharename)+1 ); + init_unistr2( &data, info2->sharename); regval_ctr_addvalue( val, "Share", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); - init_unistr2( &data, info2->drivername, strlen(info2->drivername)+1 ); + init_unistr2( &data, info2->drivername); regval_ctr_addvalue( val, "Driver", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); - init_unistr2( &data, info2->sepfile, strlen(info2->sepfile)+1 ); + init_unistr2( &data, info2->sepfile); regval_ctr_addvalue( val, "Separator File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); - init_unistr2( &data, "winprint", strlen("winprint")+1 ); + init_unistr2( &data, "winprint"); regval_ctr_addvalue( val, "Print Processor", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) ); diff --git a/source3/rpc_client/cli_srvsvc.c b/source3/rpc_client/cli_srvsvc.c index 1bdd19620b..013b4a077c 100644 --- a/source3/rpc_client/cli_srvsvc.c +++ b/source3/rpc_client/cli_srvsvc.c @@ -142,11 +142,11 @@ WERROR cli_srvsvc_net_share_enum(struct cli_state *cli, TALLOC_CTX *mem_ctx, s = unistr2_tdup(mem_ctx, &r.ctr.share.info1[i].info_1_str.uni_netname); if (s) - init_unistr2(&info1->info_1_str.uni_netname, s, strlen(s) + 1); + init_unistr2(&info1->info_1_str.uni_netname, s); s = unistr2_tdup(mem_ctx, &r.ctr.share.info1[i].info_1_str.uni_remark); if (s) - init_unistr2(&info1->info_1_str.uni_remark, s, strlen(s) + 1); + init_unistr2(&info1->info_1_str.uni_remark, s); } @@ -170,19 +170,19 @@ WERROR cli_srvsvc_net_share_enum(struct cli_state *cli, TALLOC_CTX *mem_ctx, s = unistr2_tdup(mem_ctx, &r.ctr.share.info2[i].info_2_str.uni_netname); if (s) - init_unistr2(&info2->info_2_str.uni_netname, s, strlen(s) + 1); + init_unistr2(&info2->info_2_str.uni_netname, s); s = unistr2_tdup(mem_ctx, &r.ctr.share.info2[i].info_2_str.uni_remark); if (s) - init_unistr2(&info2->info_2_str.uni_remark, s, strlen(s) + 1); + init_unistr2(&info2->info_2_str.uni_remark, s); s = unistr2_tdup(mem_ctx, &r.ctr.share.info2[i].info_2_str.uni_path); if (s) - init_unistr2(&info2->info_2_str.uni_path, s, strlen(s) + 1); + init_unistr2(&info2->info_2_str.uni_path, s); s = unistr2_tdup(mem_ctx, &r.ctr.share.info2[i].info_2_str.uni_passwd); if (s) - init_unistr2(&info2->info_2_str.uni_passwd, s, strlen(s) + 1); + init_unistr2(&info2->info_2_str.uni_passwd, s); } break; } @@ -388,11 +388,11 @@ WERROR cli_srvsvc_net_file_enum(struct cli_state *cli, TALLOC_CTX *mem_ctx, s = unistr2_tdup(mem_ctx, &r.ctr.file.info3[i].info_3_str.uni_path_name); if (s) - init_unistr2(&info3->info_3_str.uni_path_name, s, strlen(s) + 1); + init_unistr2(&info3->info_3_str.uni_path_name, s); s = unistr2_tdup(mem_ctx, &r.ctr.file.info3[i].info_3_str.uni_user_name); if (s) - init_unistr2(&info3->info_3_str.uni_user_name, s, strlen(s) + 1); + init_unistr2(&info3->info_3_str.uni_user_name, s); } diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index ccd6d429fa..c8774932e3 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, strlen(entrypath)+1); - init_unistr2(&q_d->ServerName, servername, strlen(servername)+1); - init_unistr2(&q_d->ShareName, sharename, strlen(sharename)+1); + init_unistr2(&q_d->DfsEntryPath, entrypath); + init_unistr2(&q_d->ServerName, servername); + init_unistr2(&q_d->ShareName, sharename); 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, strlen(entrypath)+1); - init_unistr2(&q_d->ServerName, servername, strlen(servername)+1); - init_unistr2(&q_d->ShareName, sharename, strlen(sharename)+1); + init_unistr2(&q_d->DfsEntryPath, entrypath); + init_unistr2(&q_d->ServerName, servername); + init_unistr2(&q_d->ShareName, sharename); if(comment != NULL) { - init_unistr2(&q_d->Comment, comment, strlen(comment)+1); + init_unistr2(&q_d->Comment, comment); 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, strlen(entrypath)+1); - init_unistr2(&q_d->uni_server, servername, strlen(servername)+1); - init_unistr2(&q_d->uni_share, sharename, strlen(sharename)+1); + init_unistr2(&q_d->uni_path, entrypath); + init_unistr2(&q_d->uni_server, servername); + init_unistr2(&q_d->uni_share, sharename); 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 7c9f74da37..d37a27a97f 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, len_name); + init_unistr2(uni_name, name); trn->domain_idx = idx; } @@ -346,8 +346,7 @@ 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, - strlen(server_name) + 1); + init_unistr2(&r_q->uni_server_name, server_name); init_lsa_obj_attr(&r_q->attr, attributes, qos); } @@ -1091,7 +1090,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], len); + init_unistr2(&q_l->uni_name[i], names[i]); } } @@ -1444,7 +1443,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, len_name); + init_unistr2(&trn->name, name); trn->lang_id = lang_id; trn->lang_id_sys = lang_id_sys; } @@ -1957,7 +1956,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, len_name); + init_unistr2(&trn->uni2_right, name); } /******************************************************************* diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 9d3bd6f28a..020c49cba1 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, strlen(buf)+1); + init_unistr2(str, buf); } else { *ptr = 0; - init_unistr2(str, "", 0); + init_unistr2(str, ""); } } @@ -881,37 +881,34 @@ BOOL smb_io_string2(const char *desc, STRING2 *str2, uint32 buffer, prs_struct * } /******************************************************************* - Inits a UNISTR2 structure. + 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! ********************************************************************/ - -void init_unistr2(UNISTR2 *str, const char *buf, size_t len) +void init_unistr2(UNISTR2 *str, const char *buf) { - ZERO_STRUCTP(str); + size_t len; - /* set up string lengths. */ - str->uni_max_len = (uint32)len; - str->undoc = 0; - str->uni_str_len = (uint32)len; + 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 = ""; + } - if (len < MAX_UNISTRLEN) - len = MAX_UNISTRLEN; - len *= sizeof(uint16); + len = push_ucs2_talloc(get_talloc_ctx() , &str->buffer, buf); - str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len); - if ((str->buffer == NULL) && (len > 0)) - { - smb_panic("init_unistr2: malloc fail\n"); - return; + if (len == -1) { + /* oops - we can't convert the string? */ + smb_panic("failed to convert string in init_unistr2"); } - /* - * 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); + /* 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; } /** @@ -1192,14 +1189,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, strlen(logon_srv)+1); + init_unistr2(&log->uni_logon_srv, logon_srv); } else { log->undoc_buffer = 0; } if (comp_name != NULL) { log->undoc_buffer2 = 1; - init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1); + init_unistr2(&log->uni_comp_name, comp_name); } else { log->undoc_buffer2 = 0; } @@ -1253,12 +1250,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, strlen(logon_srv)+1); - init_unistr2(&log->uni_acct_name, acct_name, strlen(acct_name)+1); + init_unistr2(&log->uni_logon_srv, logon_srv); + init_unistr2(&log->uni_acct_name, acct_name); log->sec_chan = sec_chan; - init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1); + init_unistr2(&log->uni_comp_name, comp_name); } /******************************************************************* diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index ac21e6f2dd..859ad6b408 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -136,16 +136,15 @@ 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, len_dc_name+1); + init_unistr2(&info->uni_trusted_dc_name, trusted_dc_name); else - init_unistr2(&info->uni_trusted_dc_name, "", 1); + init_unistr2(&info->uni_trusted_dc_name, ""); } /******************************************************************* @@ -230,7 +229,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, strlen(srv_name) + 1); + init_unistr2(&q_l->uni_server_name, srv_name); } /******************************************************************* @@ -360,7 +359,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, strlen(srv_name) + 1); + init_unistr2(&q_l->uni_server_name, srv_name); } /******************************************************************* @@ -447,7 +446,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, strlen(domain_name)+1); + init_unistr2(&r_t->uni_trust_dom_name[i], domain_name); /* the use of UNISTR2 here is non-standard. */ r_t->uni_trust_dom_name[i].undoc = 0x1; } @@ -539,8 +538,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 , strlen(logon_srv )+1); - init_unistr2(&q_c->uni_logon_clnt, logon_clnt, strlen(logon_clnt)+1); + init_unistr2(&q_c->uni_logon_srv, logon_srv ); + init_unistr2(&q_c->uni_logon_clnt, logon_clnt); memcpy(q_c->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data)); @@ -958,9 +957,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, 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_unistr2(&id->uni_domain_name, domain_name); + init_unistr2(&id->uni_user_name, user_name); + init_unistr2(&id->uni_wksta_name, wksta_name); } /******************************************************************* @@ -1070,9 +1069,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, 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_unistr2(&id->uni_domain_name, domain_name); + init_unistr2(&id->uni_user_name, user_name); + init_unistr2(&id->uni_wksta_name, 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); @@ -1352,12 +1351,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, 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); + 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); usr->num_groups2 = num_groups; @@ -1368,8 +1367,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, len_logon_srv); - init_unistr2(&usr->uni_logon_dom, logon_dom, len_logon_dom); + init_unistr2(&usr->uni_logon_srv, logon_srv); + init_unistr2(&usr->uni_logon_dom, logon_dom); init_dom_sid2(&usr->dom_sid, dom_sid); /* "other" sids are set up above */ @@ -1665,8 +1664,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, strlen(srv_name) + 1); - init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1); + init_unistr2(&q_s->uni_srv_name, srv_name); + init_unistr2(&q_s->uni_cli_name, cli_name); if (cli_creds) memcpy(&q_s->cli_creds, cli_creds, sizeof(q_s->cli_creds)); @@ -2842,8 +2841,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, strlen(srv_name) + 1); - init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1); + init_unistr2(&q_s->uni_srv_name, srv_name); + init_unistr2(&q_s->uni_cli_name, cli_name); 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 b4d20bf2ba..71344a2f9b 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, len_name); + init_unistr2(&q_c->uni_name, name); init_uni_hdr(&q_c->hdr_class, len_class); - init_unistr2(&q_c->uni_class, class, len_class); + init_unistr2(&q_c->uni_class, 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, len_name); + init_unistr2(&q_c->uni_name, 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, len_name); + init_unistr2(&q_c->uni_name, 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, len_type); + init_unistr2(&(q_i->uni_type), val_name); 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, strlen(val->valuename)+1 ); + init_unistr2( &r_u->uni_name, val->valuename); /* 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, val_len); + init_unistr2(&q_i->uni_name, val_name); 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, len_name); + init_unistr2(&r_q->uni_name, key_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, msg_len); + init_unistr2(&(q_s->uni_msg), msg); q_s->timeout = timeout; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 918cdbcd1d..e3db7d339c 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, len_name); + init_unistr2(&q_u->uni_domain, dom_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, len_server); + init_unistr2(&u_5->uni_server, 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, len_domain); - init_unistr2(&u_2->uni_server, server, len_server); + init_unistr2(&u_2->uni_domain, domain); + init_unistr2(&u_2->uni_server, 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), 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); + 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)); } 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, len_sam_name); - init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd), len_sam_desc); + init_unistr2(&sam->str[i].uni_srv_name, username); + init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd)); } 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, len_sam_name); - init_unistr2(&sam->str[i].uni_grp_desc, grp->comment, len_sam_desc); + init_unistr2(&sam->str[i].uni_grp_name, grp->name); + init_unistr2(&sam->str[i].uni_grp_desc, grp->comment); } 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, acct_len); - init_unistr2(&gr1->uni_acct_desc, acct_desc, desc_len); + init_unistr2(&gr1->uni_acct_name, acct_name); + init_unistr2(&gr1->uni_acct_desc, acct_desc); } /******************************************************************* @@ -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, acct_len); + init_unistr2(&gr4->uni_acct_desc, acct_desc); } /******************************************************************* @@ -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, acct_len); + init_unistr2(&q_e->uni_acct_desc, acct_desc); 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, acct_len_name); + init_unistr2(&al1->uni_acct_name, acct_name); al1->num_member=num_member; init_uni_hdr(&al1->hdr_acct_desc, acct_len_desc); - init_unistr2(&al1->uni_acct_desc, acct_desc, acct_len_desc); + init_unistr2(&al1->uni_acct_desc, acct_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, acct_len); + init_unistr2(&al3->uni_acct_desc, acct_desc); } /******************************************************************* @@ -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, acct_len); + init_unistr2(&q_u->uni_acct_desc, acct_desc); 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], len_name); /* unicode string for machine account */ + init_unistr2(&q_u->uni_name[i], name[i]); /* 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, len_name); + init_unistr2(&q_u->uni_name, 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, len_mach_acct); /* unicode string for machine account */ + init_unistr2(&usr->uni_mach_acct, 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, 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); + 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); 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, 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); + 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); 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, len_munged_dial); + init_unistr2(&usr->uni_munged_dial, 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, len_srv_name + 1); + init_unistr2(&q_u->uni_srv_name, srv_name); /* 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, len_srv_name + 1); + init_unistr2(&q_u->uni_srv_name, srv_name); /* 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, len_srv_name); + init_unistr2(&q_u->uni_srv_name, 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, len_dest_host); + init_unistr2(&q_u->uni_dest_host, dest_host); init_uni_hdr(&q_u->hdr_user_name, len_user_name); - init_unistr2(&q_u->uni_user_name, user_name, len_user_name); + init_unistr2(&q_u->uni_user_name, 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 cb3b2efd9d..b3fbb655ca 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, strlen(printername)+1); + init_unistr2(&q_u->printername, printername); 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, strlen(datatype)); + init_unistr2(&q_u->printer_default.datatype, 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, strlen(clientname)+1); - init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)+1); + init_unistr2(&q_u->user_ctr.user1.client_name, clientname); + init_unistr2(&q_u->user_ctr.user1.user_name, user_name); 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, strlen(srv_name)); + init_unistr2(&q_u->server_name, 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, strlen(clientname)+1); - init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)+1); + init_unistr2(&q_u->user_ctr.user1.client_name, clientname); + init_unistr2(&q_u->user_ctr.user1.user_name, user_name); 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, strlen(server)+1); - init_unistr2(&q_u->arch, arch, strlen(arch)+1); - init_unistr2(&q_u->driver, driver, strlen(driver)+1); + init_unistr2(&q_u->server, server); + init_unistr2(&q_u->arch, arch); + init_unistr2(&q_u->driver, driver); 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, strlen(valuename) + 1); + init_unistr2(&q_u->valuename, valuename); 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, strlen(valuename) + 1); - init_unistr2(&q_u->keyname, keyname, strlen(keyname) + 1); + init_unistr2(&q_u->valuename, valuename); + init_unistr2(&q_u->keyname, keyname); 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, strlen(srv_name)+1); + init_unistr2(&q_u->server_name, srv_name); 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, strlen(key)+1); + init_unistr2(&q_u->key, key); 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, strlen(value)+1); + init_unistr2(&q_u->value, value); 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, strlen(value)+1); - init_unistr2(&q_u->key, key, strlen(key)+1); + init_unistr2(&q_u->value, value); + init_unistr2(&q_u->key, key); 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, strlen(string)+1); + init_unistr2(&q_u->string, string); 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, strlen(key)+1); + init_unistr2(&q_u->key, key); 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, strlen(keyname)+1); + init_unistr2(&q_u->keyname, keyname); 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, strlen(name)+1); - init_unistr2(&q_u->environment, environment, strlen(environment)+1); + init_unistr2(&q_u->name, name); + init_unistr2(&q_u->environment, environment); 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, strlen(form_name) + 1); + init_unistr2(&q_u->name, form_name); 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, strlen(form) + 1); + init_unistr2(&q_u->name, form); 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, strlen(formname) + 1); + init_unistr2(&q_u->formname, formname); q_u->buffer=buffer; q_u->offered=offered; @@ -7642,16 +7642,13 @@ 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, - strlen(docname) + 1); + init_unistr2(&ctr->docinfo.doc_info_1.docname, docname); if (outputfile) - init_unistr2(&ctr->docinfo.doc_info_1.outputfile, outputfile, - strlen(outputfile) + 1); + init_unistr2(&ctr->docinfo.doc_info_1.outputfile, outputfile); if (datatype) - init_unistr2(&ctr->docinfo.doc_info_1.datatype, datatype, - strlen(datatype) + 1); + init_unistr2(&ctr->docinfo.doc_info_1.datatype, datatype); break; case 2: @@ -7700,7 +7697,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, strlen(valuename) + 1); + init_unistr2(&q_u->valuename, valuename); return True; } @@ -7714,8 +7711,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, strlen(value) + 1); - init_unistr2(&q_u->keyname, key, strlen(key) + 1); + init_unistr2(&q_u->valuename, value); + init_unistr2(&q_u->keyname, key); return True; } @@ -7735,8 +7732,7 @@ BOOL make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, q_u->localmachine_ptr = 1; - init_unistr2(&q_u->localmachine, localmachine, - strlen(localmachine) + 1); + init_unistr2(&q_u->localmachine, localmachine); q_u->printerlocal = printerlocal; diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index bfa1a13be9..fb3484d228 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, strlen(net_name)+1); + init_unistr2(&sh0->uni_netname, net_name); } /******************************************************************* @@ -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, strlen(net_name)+1); + init_unistr2(&sh1->uni_netname, net_name); if(remark) - init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh1->uni_remark, remark); } /******************************************************************* @@ -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, strlen(net_name)+1); + init_unistr2(&sh2->uni_netname, net_name); if (remark) - init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh2->uni_remark, remark); if (path) - init_unistr2(&sh2->uni_path, path, strlen(path)+1); + init_unistr2(&sh2->uni_path, path); if (passwd) - init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1); + init_unistr2(&sh2->uni_passwd, passwd); } /******************************************************************* @@ -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, strlen(net_name)+1); + init_unistr2(&sh501->uni_netname, net_name); if(remark) - init_unistr2(&sh501->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh501->uni_remark, remark); } /******************************************************************* @@ -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, strlen(net_name)+1); + init_unistr2(&sh502str->uni_netname, net_name); if(remark) - init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh502str->uni_remark, remark); if(path) - init_unistr2(&sh502str->uni_path, path, strlen(path)+1); + init_unistr2(&sh502str->uni_path, path); if(passwd) - init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1); + init_unistr2(&sh502str->uni_passwd, passwd); 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, strlen(remark)+1); + init_unistr2(&sh1004->uni_remark, remark); } /******************************************************************* @@ -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, strlen(alternate_directory_name)+1); + init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name); } /******************************************************************* @@ -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, strlen(srvname) +1); + init_unistr2(&q->uni_srv_name, srvname); 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, strlen(srvname) +1 ); - init_unistr2(&del->uni_share_name, sharename, strlen(sharename) + 1); + init_unistr2(&del->uni_srv_name, srvname); + init_unistr2(&del->uni_share_name, sharename); } /******************************************************************* @@ -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, strlen(name)+1); + init_unistr2(&ss0->uni_name, name); } /******************************************************************* @@ -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, strlen(name)+1); - init_unistr2(&ss1->uni_user, user, strlen(user)+1); + init_unistr2(&ss1->uni_name, name); + init_unistr2(&ss1->uni_user, user); } /******************************************************************* @@ -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, strlen(usr_name)+1); - init_unistr2(&ss1->uni_net_name, net_name, strlen(net_name)+1); + init_unistr2(&ss1->uni_usr_name, usr_name); + init_unistr2(&ss1->uni_net_name, net_name); } /******************************************************************* @@ -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, strlen(path_name)+1); - init_unistr2(&fi3->uni_user_name, user_name, strlen(user_name)+1); + init_unistr2(&fi3->uni_path_name, path_name); + init_unistr2(&fi3->uni_user_name, user_name); } /******************************************************************* @@ -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, strlen(server) + 1); + init_unistr2(&q_n->uni_srv_name, server); 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, strlen(server) + 1); + init_unistr2(&q_u->uni_srv_name, server); } diff --git a/source3/rpc_server/srv_dfs_nt.c b/source3/rpc_server/srv_dfs_nt.c index da92e5c06b..38a26d1988 100644 --- a/source3/rpc_server/srv_dfs_nt.c +++ b/source3/rpc_server/srv_dfs_nt.c @@ -198,7 +198,7 @@ static BOOL init_reply_dfs_info_1(struct junction_map* j, DFS_INFO_1* dfs1, int slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s\\%s", global_myname(), j[i].service_name, j[i].volume_name); DEBUG(5,("init_reply_dfs_info_1: %d) initing entrypath: %s\n",i,str)); - init_unistr2(&dfs1[i].entrypath,str,strlen(str)+1); + init_unistr2(&dfs1[i].entrypath,str); } return True; } @@ -212,7 +212,7 @@ static BOOL init_reply_dfs_info_2(struct junction_map* j, DFS_INFO_2* dfs2, int dfs2[i].ptr_entrypath = 1; slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s\\%s", global_myname(), j[i].service_name, j[i].volume_name); - init_unistr2(&dfs2[i].entrypath, str, strlen(str)+1); + init_unistr2(&dfs2[i].entrypath, str); dfs2[i].ptr_comment = 0; dfs2[i].state = 1; /* set up state of dfs junction as OK */ dfs2[i].num_storages = j[i].referral_count; @@ -234,9 +234,9 @@ static BOOL init_reply_dfs_info_3(TALLOC_CTX *ctx, struct junction_map* j, DFS_I slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s\\%s", global_myname(), j[i].service_name, j[i].volume_name); - init_unistr2(&dfs3[i].entrypath, str, strlen(str)+1); + init_unistr2(&dfs3[i].entrypath, str); dfs3[i].ptr_comment = 1; - init_unistr2(&dfs3[i].comment, "", 1); + init_unistr2(&dfs3[i].comment, ""); dfs3[i].state = 1; dfs3[i].num_storages = dfs3[i].num_storage_infos = j[i].referral_count; dfs3[i].ptr_storages = 1; @@ -267,8 +267,8 @@ static BOOL init_reply_dfs_info_3(TALLOC_CTX *ctx, struct junction_map* j, DFS_I *p = '\0'; DEBUG(5,("storage %d: %s.%s\n",ii,path,p+1)); stor->state = 2; /* set all storages as ONLINE */ - init_unistr2(&stor->servername, path, strlen(path)+1); - init_unistr2(&stor->sharename, p+1, strlen(p+1)+1); + init_unistr2(&stor->servername, path); + init_unistr2(&stor->sharename, p+1); stor->ptr_servername = stor->ptr_sharename = 1; } } diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c index fc51d7ef2f..07a04dabb0 100644 --- a/source3/rpc_server/srv_lsa_nt.c +++ b/source3/rpc_server/srv_lsa_nt.c @@ -77,7 +77,7 @@ static void init_dom_query(DOM_QUERY *d_q, const char *dom_name, DOM_SID *dom_si d_q->buffer_dom_sid = dom_sid != NULL ? 1 : 0; /* domain sid pointer */ /* this string is supposed to be character short */ - init_unistr2(&d_q->uni_domain_name, dom_name, domlen); + init_unistr2(&d_q->uni_domain_name, dom_name); d_q->uni_domain_name.uni_max_len++; if (dom_sid != NULL) @@ -121,7 +121,7 @@ static int init_dom_ref(DOM_R_REF *ref, char *dom_name, DOM_SID *dom_sid) init_uni_hdr(&ref->hdr_ref_dom[num].hdr_dom_name, len); ref->hdr_ref_dom[num].ptr_dom_sid = dom_sid != NULL ? 1 : 0; - init_unistr2(&ref->ref_dom[num].uni_dom_name, dom_name, len); + init_unistr2(&ref->ref_dom[num].uni_dom_name, dom_name); init_dom_sid2(&ref->ref_dom[num].ref_dom, dom_sid ); return num; @@ -350,24 +350,21 @@ static void init_dns_dom_info(LSA_DNS_DOM_INFO *r_l, const char *nb_name, { if (nb_name && *nb_name) { init_uni_hdr(&r_l->hdr_nb_dom_name, strlen(nb_name)); - init_unistr2(&r_l->uni_nb_dom_name, nb_name, - strlen(nb_name)); + init_unistr2(&r_l->uni_nb_dom_name, nb_name); r_l->hdr_nb_dom_name.uni_max_len += 2; r_l->uni_nb_dom_name.uni_max_len += 1; } if (dns_name && *dns_name) { init_uni_hdr(&r_l->hdr_dns_dom_name, strlen(dns_name)); - init_unistr2(&r_l->uni_dns_dom_name, dns_name, - strlen(dns_name)); + init_unistr2(&r_l->uni_dns_dom_name, dns_name); r_l->hdr_dns_dom_name.uni_max_len += 2; r_l->uni_dns_dom_name.uni_max_len += 1; } if (forest_name && *forest_name) { init_uni_hdr(&r_l->hdr_forest_name, strlen(forest_name)); - init_unistr2(&r_l->uni_forest_name, forest_name, - strlen(forest_name)); + init_unistr2(&r_l->uni_forest_name, forest_name); r_l->hdr_forest_name.uni_max_len += 2; r_l->uni_forest_name.uni_max_len += 1; } @@ -770,12 +767,12 @@ NTSTATUS _lsa_enum_privs(pipes_struct *p, LSA_Q_ENUM_PRIVS *q_u, LSA_R_ENUM_PRIV for (i = 0; i < PRIV_ALL_INDEX; i++, entry++) { if( i<enum_context) { init_uni_hdr(&entry->hdr_name, 0); - init_unistr2(&entry->name, NULL, 0 ); + init_unistr2(&entry->name, NULL); entry->luid_low = 0; entry->luid_high = 0; } else { init_uni_hdr(&entry->hdr_name, strlen(privs[i+1].priv)); - init_unistr2(&entry->name, privs[i+1].priv, strlen(privs[i+1].priv) ); + init_unistr2(&entry->name, privs[i+1].priv); entry->luid_low = privs[i+1].se_priv; entry->luid_high = 0; } @@ -818,7 +815,7 @@ NTSTATUS _lsa_priv_get_dispname(pipes_struct *p, LSA_Q_PRIV_GET_DISPNAME *q_u, L if (privs[i].se_priv!=SE_PRIV_ALL) { DEBUG(10,(": %s\n", privs[i].description)); init_uni_hdr(&r_u->hdr_desc, strlen(privs[i].description)); - init_unistr2(&r_u->desc, privs[i].description, strlen(privs[i].description) ); + init_unistr2(&r_u->desc, privs[i].description); r_u->ptr_info=0xdeadbeef; r_u->lang_id=q_u->lang_id; @@ -899,13 +896,13 @@ NTSTATUS _lsa_unk_get_connuser(pipes_struct *p, LSA_Q_UNK_GET_CONNUSER *q_u, LSA init_uni_hdr(&r_u->hdr_user_name, ulen); r_u->ptr_user_name = 1; - init_unistr2(&r_u->uni2_user_name, username, ulen); + init_unistr2(&r_u->uni2_user_name, username); r_u->unk1 = 1; init_uni_hdr(&r_u->hdr_dom_name, dlen); r_u->ptr_dom_name = 1; - init_unistr2(&r_u->uni2_dom_name, domname, dlen); + init_unistr2(&r_u->uni2_dom_name, domname); r_u->status = NT_STATUS_OK; diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index 2896fd79e4..74361fd931 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -717,7 +717,7 @@ static NTSTATUS make_user_sam_entry_list(TALLOC_CTX *ctx, SAM_ENTRY **sam_pp, UN for (i = 0; i < num_entries; i++) { pwd = disp_user_info[i+start_idx].sam; temp_name = pdb_get_username(pwd); - init_unistr2(&uni_temp_name, temp_name, strlen(temp_name)+1); + init_unistr2(&uni_temp_name, temp_name); user_sid = pdb_get_user_sid(pwd); if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) { @@ -866,7 +866,7 @@ static void make_group_sam_entry_list(TALLOC_CTX *ctx, SAM_ENTRY **sam_pp, UNIST int len = strlen(grp[i].name)+1; init_sam_entry(&sam[i], len, grp[i].rid); - init_unistr2(&uni_name[i], grp[i].name, len); + init_unistr2(&uni_name[i], grp[i].name); } *sam_pp = sam; @@ -1574,7 +1574,7 @@ static BOOL make_samr_lookup_rids(TALLOC_CTX *ctx, uint32 num_names, fstring nam int len = names[i] != NULL ? strlen(names[i]) : 0; DEBUG(10, ("names[%d]:%s\n", i, names[i])); init_uni_hdr(&hdr_name[i], len); - init_unistr2(&uni_name[i], names[i], len); + init_unistr2(&uni_name[i], names[i]); } *pp_uni_name = uni_name; @@ -2555,7 +2555,7 @@ static BOOL make_enum_domains(TALLOC_CTX *ctx, SAM_ENTRY **pp_sam, int len = doms[i] != NULL ? strlen(doms[i]) : 0; init_sam_entry(&sam[i], len, 0); - init_unistr2(&uni_name[i], doms[i], len); + init_unistr2(&uni_name[i], doms[i]); } *pp_sam = sam; diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index b44910883c..fd85d2f429 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -666,7 +666,7 @@ static void notify_string(struct spoolss_notify_msg *msg, /* The length of the message includes the trailing \0 */ - init_unistr2(&unistr, msg->notify.data, msg->len); + init_unistr2(&unistr, msg->notify.data); data->notify_data.data.length = msg->len * 2; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, msg->len * 2); diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index f7a34c2964..1c52f96891 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -1546,7 +1546,7 @@ static NTSTATUS cmd_spoolss_addform(struct cli_state *cli, TALLOC_CTX *mem_ctx, form.right = 20; form.bottom = 30; - init_unistr2(&form.name, argv[2], strlen(argv[2]) + 1); + init_unistr2(&form.name, argv[2]); /* Add the form */ @@ -1605,7 +1605,7 @@ static NTSTATUS cmd_spoolss_setform(struct cli_state *cli, TALLOC_CTX *mem_ctx, form.right = 2000; form.bottom = 3000; - init_unistr2(&form.name, argv[2], strlen(argv[2]) + 1); + init_unistr2(&form.name, argv[2]); /* Set the form */ |