summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_lsa_nt.c
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/srv_lsa_nt.c
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/srv_lsa_nt.c')
-rw-r--r--source3/rpc_server/srv_lsa_nt.c23
1 files changed, 10 insertions, 13 deletions
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;