summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-01-17 04:58:45 +0000
committerAndrew Tridgell <tridge@samba.org>2003-01-17 04:58:45 +0000
commitec879eacc263043409b584797d1e8c39258ba125 (patch)
tree7a7775040b27f7fea0f7bd1c8f0ede91c9ce770d /source3/rpc_server
parentba51d1d888f98e196627486490e8569faeb641c2 (diff)
downloadsamba-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/rpc_server')
-rw-r--r--source3/rpc_server/srv_dfs_nt.c12
-rw-r--r--source3/rpc_server/srv_lsa_nt.c23
-rw-r--r--source3/rpc_server/srv_samr_nt.c8
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c2
4 files changed, 21 insertions, 24 deletions
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);