summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2007-09-21 14:37:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:30:58 -0500
commitc97fe37ea3d92a631e8da17c21dafae1db15e97b (patch)
tree8a198088c25da1fdd720da7e9d056186eb468380
parent6873d5446e4cee76b022bfc0d33e9e8380e796c0 (diff)
downloadsamba-c97fe37ea3d92a631e8da17c21dafae1db15e97b.tar.gz
samba-c97fe37ea3d92a631e8da17c21dafae1db15e97b.tar.bz2
samba-c97fe37ea3d92a631e8da17c21dafae1db15e97b.zip
r25294: Tidy up callers of unistr2_to_ascii() to pass sizeof(target_area) to
the maxeln parameter instead of sizeof(target_area) - 1 (or even sizeof(fstring) - 1 in some places. I hope these were really all there were. Michael (This used to be commit 9a28be220df622322857dfe102fa35e108f932dc)
-rw-r--r--source3/printing/nt_printing.c10
-rw-r--r--source3/rpc_client/cli_samr.c8
-rw-r--r--source3/rpc_parse/parse_spoolss.c54
-rw-r--r--source3/rpc_server/srv_samr_nt.c10
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c54
-rw-r--r--source3/rpcclient/cmd_netlogon.c8
-rw-r--r--source3/rpcclient/cmd_samr.c60
-rw-r--r--source3/utils/net_rpc.c10
-rw-r--r--source3/utils/net_rpc_samsync.c34
-rw-r--r--source3/winbindd/winbindd_rpc.c4
10 files changed, 126 insertions, 126 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 55023823a0..cbd220d260 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -760,7 +760,7 @@ BOOL get_a_builtin_ntform(UNISTR2 *uni_formname,nt_forms_struct *form)
{
int i,count;
fstring form_name;
- unistr2_to_ascii(form_name, uni_formname, sizeof(form_name)-1);
+ unistr2_to_ascii(form_name, uni_formname, sizeof(form_name));
DEBUGADD(6,("Looking for builtin form %s \n", form_name));
count = sizeof(default_forms) / sizeof(default_forms[0]);
for (i=0;i<count;i++) {
@@ -863,7 +863,7 @@ BOOL add_a_form(nt_forms_struct **list, const FORM *form, int *count)
update=False;
- unistr2_to_ascii(form_name, &form->name, sizeof(form_name)-1);
+ unistr2_to_ascii(form_name, &form->name, sizeof(form_name));
for (n=0; n<*count; n++) {
if ( strequal((*list)[n].name, form_name) ) {
update=True;
@@ -876,7 +876,7 @@ BOOL add_a_form(nt_forms_struct **list, const FORM *form, int *count)
DEBUG(0,("add_a_form: failed to enlarge forms list!\n"));
return False;
}
- unistr2_to_ascii((*list)[n].name, &form->name, sizeof((*list)[n].name)-1);
+ unistr2_to_ascii((*list)[n].name, &form->name, sizeof((*list)[n].name));
(*count)++;
}
@@ -906,7 +906,7 @@ BOOL delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, WERROR
*ret = WERR_OK;
- unistr2_to_ascii(form_name, del_name, sizeof(form_name)-1);
+ unistr2_to_ascii(form_name, del_name, sizeof(form_name));
for (n=0; n<*count; n++) {
if (!strncmp((*list)[n].name, form_name, strlen(form_name))) {
@@ -938,7 +938,7 @@ void update_a_form(nt_forms_struct **list, const FORM *form, int count)
{
int n=0;
fstring form_name;
- unistr2_to_ascii(form_name, &(form->name), sizeof(form_name)-1);
+ unistr2_to_ascii(form_name, &(form->name), sizeof(form_name));
DEBUG(106, ("[%s]\n", form_name));
for (n=0; n<count; n++) {
diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c
index 7a210f0d3a..b1b6623bcd 100644
--- a/source3/rpc_client/cli_samr.c
+++ b/source3/rpc_client/cli_samr.c
@@ -683,7 +683,7 @@ NTSTATUS rpccli_samr_enum_dom_users(struct rpc_pipe_client *cli, TALLOC_CTX *mem
fstring conv_buf;
(*rids)[i] = r.sam[i].rid;
- unistr2_to_ascii(conv_buf, &(r.uni_acct_name[i]), sizeof(conv_buf) - 1);
+ unistr2_to_ascii(conv_buf, &(r.uni_acct_name[i]), sizeof(conv_buf));
(*dom_users)[i] = talloc_strdup(mem_ctx, conv_buf);
}
}
@@ -751,7 +751,7 @@ NTSTATUS rpccli_samr_enum_dom_groups(struct rpc_pipe_client *cli,
if (r.sam[i].hdr_name.buffer) {
unistr2_to_ascii((*dom_groups)[i].acct_name,
&r.uni_grp_name[name_idx],
- sizeof(fstring) - 1);
+ sizeof((*dom_groups)[i].acct_name));
name_idx++;
}
@@ -822,7 +822,7 @@ NTSTATUS rpccli_samr_enum_als_groups(struct rpc_pipe_client *cli,
if (r.sam[i].hdr_name.buffer) {
unistr2_to_ascii((*dom_aliases)[i].acct_name,
&r.uni_grp_name[name_idx],
- sizeof(fstring) - 1);
+ sizeof((*dom_aliases)[i].acct_name));
name_idx++;
}
@@ -1699,7 +1699,7 @@ NTSTATUS rpccli_samr_lookup_rids(struct rpc_pipe_client *cli,
for (i = 0; i < r.num_names1; i++) {
fstring tmp;
- unistr2_to_ascii(tmp, &r.uni_name[i], sizeof(tmp) - 1);
+ unistr2_to_ascii(tmp, &r.uni_name[i], sizeof(tmp));
(*names)[i] = talloc_strdup(mem_ctx, tmp);
(*name_types)[i] = r.type[i];
}
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index a0d818bd67..8430460312 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -5384,14 +5384,14 @@ BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni,
d->cversion=uni->cversion;
- unistr2_to_ascii(d->name, &uni->name, sizeof(d->name)-1);
- unistr2_to_ascii(d->environment, &uni->environment, sizeof(d->environment)-1);
- unistr2_to_ascii(d->driverpath, &uni->driverpath, sizeof(d->driverpath)-1);
- unistr2_to_ascii(d->datafile, &uni->datafile, sizeof(d->datafile)-1);
- unistr2_to_ascii(d->configfile, &uni->configfile, sizeof(d->configfile)-1);
- unistr2_to_ascii(d->helpfile, &uni->helpfile, sizeof(d->helpfile)-1);
- unistr2_to_ascii(d->monitorname, &uni->monitorname, sizeof(d->monitorname)-1);
- unistr2_to_ascii(d->defaultdatatype, &uni->defaultdatatype, sizeof(d->defaultdatatype)-1);
+ unistr2_to_ascii(d->name, &uni->name, sizeof(d->name));
+ unistr2_to_ascii(d->environment, &uni->environment, sizeof(d->environment));
+ unistr2_to_ascii(d->driverpath, &uni->driverpath, sizeof(d->driverpath));
+ unistr2_to_ascii(d->datafile, &uni->datafile, sizeof(d->datafile));
+ unistr2_to_ascii(d->configfile, &uni->configfile, sizeof(d->configfile));
+ unistr2_to_ascii(d->helpfile, &uni->helpfile, sizeof(d->helpfile));
+ unistr2_to_ascii(d->monitorname, &uni->monitorname, sizeof(d->monitorname));
+ unistr2_to_ascii(d->defaultdatatype, &uni->defaultdatatype, sizeof(d->defaultdatatype));
DEBUGADD(8,( "version: %d\n", d->cversion));
DEBUGADD(8,( "name: %s\n", d->name));
@@ -5431,14 +5431,14 @@ BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni,
d->version=uni->version;
- unistr2_to_ascii(d->name, &uni->name, sizeof(d->name)-1);
- unistr2_to_ascii(d->environment, &uni->environment, sizeof(d->environment)-1);
- unistr2_to_ascii(d->driverpath, &uni->driverpath, sizeof(d->driverpath)-1);
- unistr2_to_ascii(d->datafile, &uni->datafile, sizeof(d->datafile)-1);
- unistr2_to_ascii(d->configfile, &uni->configfile, sizeof(d->configfile)-1);
- unistr2_to_ascii(d->helpfile, &uni->helpfile, sizeof(d->helpfile)-1);
- unistr2_to_ascii(d->monitorname, &uni->monitorname, sizeof(d->monitorname)-1);
- unistr2_to_ascii(d->defaultdatatype, &uni->defaultdatatype, sizeof(d->defaultdatatype)-1);
+ unistr2_to_ascii(d->name, &uni->name, sizeof(d->name));
+ unistr2_to_ascii(d->environment, &uni->environment, sizeof(d->environment));
+ unistr2_to_ascii(d->driverpath, &uni->driverpath, sizeof(d->driverpath));
+ unistr2_to_ascii(d->datafile, &uni->datafile, sizeof(d->datafile));
+ unistr2_to_ascii(d->configfile, &uni->configfile, sizeof(d->configfile));
+ unistr2_to_ascii(d->helpfile, &uni->helpfile, sizeof(d->helpfile));
+ unistr2_to_ascii(d->monitorname, &uni->monitorname, sizeof(d->monitorname));
+ unistr2_to_ascii(d->defaultdatatype, &uni->defaultdatatype, sizeof(d->defaultdatatype));
DEBUGADD(8,( "version: %d\n", d->version));
DEBUGADD(8,( "name: %s\n", d->name));
@@ -5475,17 +5475,17 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni,
d->status=uni->status;
d->cjobs=uni->cjobs;
- unistr2_to_ascii(d->servername, &uni->servername, sizeof(d->servername)-1);
- unistr2_to_ascii(d->printername, &uni->printername, sizeof(d->printername)-1);
- unistr2_to_ascii(d->sharename, &uni->sharename, sizeof(d->sharename)-1);
- unistr2_to_ascii(d->portname, &uni->portname, sizeof(d->portname)-1);
- unistr2_to_ascii(d->drivername, &uni->drivername, sizeof(d->drivername)-1);
- unistr2_to_ascii(d->comment, &uni->comment, sizeof(d->comment)-1);
- unistr2_to_ascii(d->location, &uni->location, sizeof(d->location)-1);
- unistr2_to_ascii(d->sepfile, &uni->sepfile, sizeof(d->sepfile)-1);
- unistr2_to_ascii(d->printprocessor, &uni->printprocessor, sizeof(d->printprocessor)-1);
- unistr2_to_ascii(d->datatype, &uni->datatype, sizeof(d->datatype)-1);
- unistr2_to_ascii(d->parameters, &uni->parameters, sizeof(d->parameters)-1);
+ unistr2_to_ascii(d->servername, &uni->servername, sizeof(d->servername));
+ unistr2_to_ascii(d->printername, &uni->printername, sizeof(d->printername));
+ unistr2_to_ascii(d->sharename, &uni->sharename, sizeof(d->sharename));
+ unistr2_to_ascii(d->portname, &uni->portname, sizeof(d->portname));
+ unistr2_to_ascii(d->drivername, &uni->drivername, sizeof(d->drivername));
+ unistr2_to_ascii(d->comment, &uni->comment, sizeof(d->comment));
+ unistr2_to_ascii(d->location, &uni->location, sizeof(d->location));
+ unistr2_to_ascii(d->sepfile, &uni->sepfile, sizeof(d->sepfile));
+ unistr2_to_ascii(d->printprocessor, &uni->printprocessor, sizeof(d->printprocessor));
+ unistr2_to_ascii(d->datatype, &uni->datatype, sizeof(d->datatype));
+ unistr2_to_ascii(d->parameters, &uni->parameters, sizeof(d->parameters));
return True;
}
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index e95fd0c7f9..950a186e03 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -4470,7 +4470,7 @@ NTSTATUS _samr_create_dom_alias(pipes_struct *p, SAMR_Q_CREATE_DOM_ALIAS *q_u, S
if (!sid_equal(&dom_sid, get_global_sam_sid()))
return NT_STATUS_ACCESS_DENIED;
- unistr2_to_ascii(name, &q_u->uni_acct_desc, sizeof(name)-1);
+ unistr2_to_ascii(name, &q_u->uni_acct_desc, sizeof(name));
se_priv_copy( &se_rights, &se_add_users );
can_add_accounts = user_has_privileges( p->pipe_user.nt_user_token, &se_rights );
@@ -4659,10 +4659,10 @@ NTSTATUS _samr_set_groupinfo(pipes_struct *p, SAMR_Q_SET_GROUPINFO *q_u, SAMR_R_
switch (ctr->switch_value1) {
case 1:
- unistr2_to_ascii(map.comment, &(ctr->group.info1.uni_acct_desc), sizeof(map.comment)-1);
+ unistr2_to_ascii(map.comment, &(ctr->group.info1.uni_acct_desc), sizeof(map.comment));
break;
case 4:
- unistr2_to_ascii(map.comment, &(ctr->group.info4.uni_acct_desc), sizeof(map.comment)-1);
+ unistr2_to_ascii(map.comment, &(ctr->group.info4.uni_acct_desc), sizeof(map.comment));
break;
default:
return NT_STATUS_INVALID_INFO_CLASS;
@@ -4743,7 +4743,7 @@ NTSTATUS _samr_set_aliasinfo(pipes_struct *p, SAMR_Q_SET_ALIASINFO *q_u, SAMR_R_
return NT_STATUS_INVALID_PARAMETER;
unistr2_to_ascii( acct_name, ctr->alias.info2.name.string,
- sizeof(acct_name)-1 );
+ sizeof(acct_name));
/* If the name is the same just reply "ok". Yes this
doesn't allow you to change the case of a group name. */
@@ -4766,7 +4766,7 @@ NTSTATUS _samr_set_aliasinfo(pipes_struct *p, SAMR_Q_SET_ALIASINFO *q_u, SAMR_R_
if ( ctr->alias.info3.description.string ) {
unistr2_to_ascii( info.acct_desc,
ctr->alias.info3.description.string,
- sizeof(info.acct_desc)-1 );
+ sizeof(info.acct_desc));
}
else
fstrcpy( info.acct_desc, "" );
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 600eb2f688..f573d3fdc6 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -1549,7 +1549,7 @@ WERROR _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u,
/* some sanity check because you can open a printer or a print server */
/* aka: \\server\printer or \\server */
- unistr2_to_ascii(name, q_u->printername, sizeof(name)-1);
+ unistr2_to_ascii(name, q_u->printername, sizeof(name));
DEBUGADD(3,("checking name: %s\n",name));
@@ -1997,8 +1997,8 @@ WERROR _spoolss_deleteprinterdriver(pipes_struct *p, SPOOL_Q_DELETEPRINTERDRIVER
return WERR_ACCESS_DENIED;
}
- unistr2_to_ascii(driver, &q_u->driver, sizeof(driver)-1 );
- unistr2_to_ascii(arch, &q_u->arch, sizeof(arch)-1 );
+ unistr2_to_ascii(driver, &q_u->driver, sizeof(driver));
+ unistr2_to_ascii(arch, &q_u->arch, sizeof(arch));
/* check that we have a valid driver name first */
@@ -2092,8 +2092,8 @@ WERROR _spoolss_deleteprinterdriverex(pipes_struct *p, SPOOL_Q_DELETEPRINTERDRIV
return WERR_ACCESS_DENIED;
}
- unistr2_to_ascii(driver, &q_u->driver, sizeof(driver)-1 );
- unistr2_to_ascii(arch, &q_u->arch, sizeof(arch)-1 );
+ unistr2_to_ascii(driver, &q_u->driver, sizeof(driver));
+ unistr2_to_ascii(arch, &q_u->arch, sizeof(arch));
/* check that we have a valid driver name first */
if ((version=get_version_id(arch)) == -1) {
@@ -2470,7 +2470,7 @@ WERROR _spoolss_getprinterdata(pipes_struct *p, SPOOL_Q_GETPRINTERDATA *q_u, SPO
goto done;
}
- unistr2_to_ascii(value, valuename, sizeof(value)-1);
+ unistr2_to_ascii(value, valuename, sizeof(value));
if ( Printer->printer_type == SPLHND_SERVER )
status = getprinterdata_printer_server( p->mem_ctx, value, type, data, needed, *out_size );
@@ -2688,7 +2688,7 @@ WERROR _spoolss_rffpcnex(pipes_struct *p, SPOOL_Q_RFFPCNEX *q_u, SPOOL_R_RFFPCNE
Printer->notify.option=dup_spool_notify_option(option);
unistr2_to_ascii(Printer->notify.localmachine, localmachine,
- sizeof(Printer->notify.localmachine)-1);
+ sizeof(Printer->notify.localmachine));
/* Connect to the client machine and send a ReplyOpenPrinter */
@@ -4804,7 +4804,7 @@ WERROR _spoolss_enumprinters( pipes_struct *p, SPOOL_Q_ENUMPRINTERS *q_u, SPOOL_
* Level 5: same as Level 2
*/
- unistr2_to_ascii(name, servername, sizeof(name)-1);
+ unistr2_to_ascii(name, servername, sizeof(name));
strupper_m(name);
switch (level) {
@@ -5788,7 +5788,7 @@ WERROR _spoolss_getprinterdriver2(pipes_struct *p, SPOOL_Q_GETPRINTERDRIVER2 *q_
*serverminorversion = 0;
fstrcpy(servername, get_server_name( printer ));
- unistr2_to_ascii(architecture, uni_arch, sizeof(architecture)-1);
+ unistr2_to_ascii(architecture, uni_arch, sizeof(architecture));
if (!get_printer_snum(p, handle, &snum, NULL))
return WERR_BADFID;
@@ -7215,8 +7215,8 @@ WERROR _spoolss_enumprinterdrivers( pipes_struct *p, SPOOL_Q_ENUMPRINTERDRIVERS
*needed = 0;
*returned = 0;
- unistr2_to_ascii(architecture, &q_u->environment, sizeof(architecture)-1);
- unistr2_to_ascii(servername, &q_u->name, sizeof(servername)-1);
+ unistr2_to_ascii(architecture, &q_u->environment, sizeof(architecture));
+ unistr2_to_ascii(servername, &q_u->name, sizeof(servername));
if ( !is_myname_or_ipaddr( servername ) )
return WERR_UNKNOWN_PRINTER_DRIVER;
@@ -7388,7 +7388,7 @@ WERROR _spoolss_getform(pipes_struct *p, SPOOL_Q_GETFORM *q_u, SPOOL_R_GETFORM *
rpcbuf_move(q_u->buffer, &r_u->buffer);
buffer = r_u->buffer;
- unistr2_to_ascii(form_name, uni_formname, sizeof(form_name)-1);
+ unistr2_to_ascii(form_name, uni_formname, sizeof(form_name));
DEBUG(4,("_spoolss_getform\n"));
DEBUGADD(5,("Offered buffer size [%d]\n", offered));
@@ -8004,8 +8004,8 @@ static WERROR getprinterdriverdir_level_1(UNISTR2 *name, UNISTR2 *uni_environmen
DRIVER_DIRECTORY_1 *info=NULL;
WERROR result = WERR_OK;
- unistr2_to_ascii(servername, name, sizeof(servername)-1);
- unistr2_to_ascii(long_archi, uni_environment, sizeof(long_archi)-1);
+ unistr2_to_ascii(servername, name, sizeof(servername));
+ unistr2_to_ascii(long_archi, uni_environment, sizeof(long_archi));
/* check for beginning double '\'s and that the server
long enough */
@@ -8322,7 +8322,7 @@ WERROR _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u, SP
if (!W_ERROR_IS_OK(status))
return status;
- unistr2_to_ascii( valuename, value, sizeof(valuename)-1 );
+ unistr2_to_ascii(valuename, value, sizeof(valuename));
/*
* When client side code sets a magic printer data key, detect it and save
@@ -8414,7 +8414,7 @@ WERROR _spoolss_deleteprinterdata(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATA *q_
if (!W_ERROR_IS_OK(status))
return status;
- unistr2_to_ascii( valuename, value, sizeof(valuename)-1 );
+ unistr2_to_ascii(valuename, value, sizeof(valuename));
status = delete_printer_dataex( printer, SPOOL_PRINTERDATA_KEY, valuename );
@@ -9136,8 +9136,8 @@ WERROR _spoolss_getprinterdataex(pipes_struct *p, SPOOL_Q_GETPRINTERDATAEX *q_u,
DEBUG(4,("_spoolss_getprinterdataex\n"));
- unistr2_to_ascii(keyname, &q_u->keyname, sizeof(keyname) - 1);
- unistr2_to_ascii(valuename, &q_u->valuename, sizeof(valuename) - 1);
+ unistr2_to_ascii(keyname, &q_u->keyname, sizeof(keyname));
+ unistr2_to_ascii(valuename, &q_u->valuename, sizeof(valuename));
DEBUG(10, ("_spoolss_getprinterdataex: key => [%s], value => [%s]\n",
keyname, valuename));
@@ -9268,8 +9268,8 @@ WERROR _spoolss_setprinterdataex(pipes_struct *p, SPOOL_Q_SETPRINTERDATAEX *q_u,
if (!W_ERROR_IS_OK(status))
return status;
- unistr2_to_ascii( valuename, &q_u->value, sizeof(valuename) - 1);
- unistr2_to_ascii( keyname, &q_u->key, sizeof(keyname) - 1);
+ unistr2_to_ascii( valuename, &q_u->value, sizeof(valuename));
+ unistr2_to_ascii( keyname, &q_u->key, sizeof(keyname));
/* check for OID in valuename */
@@ -9346,8 +9346,8 @@ WERROR _spoolss_deleteprinterdataex(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATAEX
if (!W_ERROR_IS_OK(status))
return status;
- unistr2_to_ascii( valuename, value, sizeof(valuename)-1 );
- unistr2_to_ascii( keyname, key, sizeof(keyname)-1 );
+ unistr2_to_ascii(valuename, value, sizeof(valuename));
+ unistr2_to_ascii(keyname, key, sizeof(keyname));
status = delete_printer_dataex( printer, keyname, valuename );
@@ -9395,7 +9395,7 @@ WERROR _spoolss_enumprinterkey(pipes_struct *p, SPOOL_Q_ENUMPRINTERKEY *q_u, SPO
/* get the list of subkey names */
- unistr2_to_ascii( key, &q_u->key, sizeof(key)-1 );
+ unistr2_to_ascii(key, &q_u->key, sizeof(key));
data = printer->info_2->data;
num_keys = get_printer_subkeys( data, key, &keynames );
@@ -9470,7 +9470,7 @@ WERROR _spoolss_deleteprinterkey(pipes_struct *p, SPOOL_Q_DELETEPRINTERKEY *q_u,
/* delete the key and all subneys */
- unistr2_to_ascii(key, &q_u->keyname, sizeof(key) - 1);
+ unistr2_to_ascii(key, &q_u->keyname, sizeof(key));
status = delete_all_printer_data( printer->info_2, key );
@@ -9521,7 +9521,7 @@ WERROR _spoolss_enumprinterdataex(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATAEX *q_
* --jerry
*/
- unistr2_to_ascii(key, &q_u->key, sizeof(key) - 1);
+ unistr2_to_ascii(key, &q_u->key, sizeof(key));
if ( !strlen(key) ) {
result = WERR_INVALID_PARAM;
goto done;
@@ -9541,7 +9541,7 @@ WERROR _spoolss_enumprinterdataex(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATAEX *q_
p_data = printer->info_2->data;
- unistr2_to_ascii(key, &q_u->key, sizeof(key) - 1);
+ unistr2_to_ascii(key, &q_u->key, sizeof(key));
if ( (key_index = lookup_printerkey( p_data, key)) == -1 )
{
DEBUG(10,("_spoolss_enumprinterdataex: Unknown keyname [%s]\n", key));
@@ -9658,7 +9658,7 @@ static WERROR getprintprocessordirectory_level_1(UNISTR2 *name,
PRINTPROCESSOR_DIRECTORY_1 *info=NULL;
WERROR result = WERR_OK;
- unistr2_to_ascii(long_archi, environment, sizeof(long_archi)-1);
+ unistr2_to_ascii(long_archi, environment, sizeof(long_archi));
if (!get_short_archi(long_archi))
return WERR_INVALID_ENVIRONMENT;
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index dd8cb6afc5..6acac8273c 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -338,25 +338,25 @@ static void display_sam_sync(uint32 num_deltas, SAM_DELTA_HDR *hdr_deltas,
case SAM_DELTA_DOMAIN_INFO:
unistr2_to_ascii(name,
&deltas[i].domain_info.uni_dom_name,
- sizeof(name) - 1);
+ sizeof(name));
printf("Domain: %s\n", name);
break;
case SAM_DELTA_GROUP_INFO:
unistr2_to_ascii(name,
&deltas[i].group_info.uni_grp_name,
- sizeof(name) - 1);
+ sizeof(name));
printf("Group: %s\n", name);
break;
case SAM_DELTA_ACCOUNT_INFO:
unistr2_to_ascii(name,
&deltas[i].account_info.uni_acct_name,
- sizeof(name) - 1);
+ sizeof(name));
printf("Account: %s\n", name);
break;
case SAM_DELTA_ALIAS_INFO:
unistr2_to_ascii(name,
&deltas[i].alias_info.uni_als_name,
- sizeof(name) - 1);
+ sizeof(name));
printf("Alias: %s\n", name);
break;
case SAM_DELTA_ALIAS_MEM: {
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index d8528339fe..b4cfb1eb29 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -33,7 +33,7 @@ static void display_sam_user_info_7(SAM_USER_INFO_7 *usr)
{
fstring temp;
- unistr2_to_ascii(temp, &usr->uni_name, sizeof(temp)-1);
+ unistr2_to_ascii(temp, &usr->uni_name, sizeof(temp));
printf("\tUser Name :\t%s\n", temp);
}
@@ -60,34 +60,34 @@ static void display_sam_user_info_21(SAM_USER_INFO_21 *usr)
{
fstring temp;
- unistr2_to_ascii(temp, &usr->uni_user_name, sizeof(temp)-1);
+ unistr2_to_ascii(temp, &usr->uni_user_name, sizeof(temp));
printf("\tUser Name :\t%s\n", temp);
- unistr2_to_ascii(temp, &usr->uni_full_name, sizeof(temp)-1);
+ unistr2_to_ascii(temp, &usr->uni_full_name, sizeof(temp));
printf("\tFull Name :\t%s\n", temp);
- unistr2_to_ascii(temp, &usr->uni_home_dir, sizeof(temp)-1);
+ unistr2_to_ascii(temp, &usr->uni_home_dir, sizeof(temp));
printf("\tHome Drive :\t%s\n", temp);
- unistr2_to_ascii(temp, &usr->uni_dir_drive, sizeof(temp)-1);
+ unistr2_to_ascii(temp, &usr->uni_dir_drive, sizeof(temp));
printf("\tDir Drive :\t%s\n", temp);
- unistr2_to_ascii(temp, &usr->uni_profile_path, sizeof(temp)-1);
+ unistr2_to_ascii(temp, &usr->uni_profile_path, sizeof(temp));
printf("\tProfile Path:\t%s\n", temp);
- unistr2_to_ascii(temp, &usr->uni_logon_script, sizeof(temp)-1);
+ unistr2_to_ascii(temp, &usr->uni_logon_script, sizeof(temp));
printf("\tLogon Script:\t%s\n", temp);
- unistr2_to_ascii(temp, &usr->uni_acct_desc, sizeof(temp)-1);
+ unistr2_to_ascii(temp, &usr->uni_acct_desc, sizeof(temp));
printf("\tDescription :\t%s\n", temp);
- unistr2_to_ascii(temp, &usr->uni_workstations, sizeof(temp)-1);
+ unistr2_to_ascii(temp, &usr->uni_workstations, sizeof(temp));
printf("\tWorkstations:\t%s\n", temp);
- unistr2_to_ascii(temp, &usr->uni_comment, sizeof(temp)-1);
+ unistr2_to_ascii(temp, &usr->uni_comment, sizeof(temp));
printf("\tUnknown Str :\t%s\n", temp);
- unistr2_to_ascii(temp, &usr->uni_munged_dial, sizeof(temp)-1);
+ unistr2_to_ascii(temp, &usr->uni_munged_dial, sizeof(temp));
printf("\tRemote Dial :\t%s\n", temp);
printf("\tLogon Time :\t%s\n",
@@ -159,13 +159,13 @@ static void display_sam_unk_info_2(SAM_UNK_INFO_2 *info2)
{
fstring name;
- unistr2_to_ascii(name, &info2->uni_domain, sizeof(name) - 1);
+ unistr2_to_ascii(name, &info2->uni_domain, sizeof(name));
printf("Domain:\t\t%s\n", name);
- unistr2_to_ascii(name, &info2->uni_server, sizeof(name) - 1);
+ unistr2_to_ascii(name, &info2->uni_server, sizeof(name));
printf("Server:\t\t%s\n", name);
- unistr2_to_ascii(name, &info2->uni_comment, sizeof(name) - 1);
+ unistr2_to_ascii(name, &info2->uni_comment, sizeof(name));
printf("Comment:\t%s\n", name);
printf("Total Users:\t%d\n", info2->num_domain_usrs);
@@ -190,7 +190,7 @@ static void display_sam_unk_info_4(SAM_UNK_INFO_4 *info4)
{
fstring name;
- unistr2_to_ascii(name, &info4->uni_comment, sizeof(name) - 1);
+ unistr2_to_ascii(name, &info4->uni_comment, sizeof(name));
printf("Comment:\t%s\n", name);
}
@@ -198,7 +198,7 @@ static void display_sam_unk_info_5(SAM_UNK_INFO_5 *info5)
{
fstring name;
- unistr2_to_ascii(name, &info5->uni_domain, sizeof(name) - 1);
+ unistr2_to_ascii(name, &info5->uni_domain, sizeof(name));
printf("Domain:\t\t%s\n", name);
}
@@ -206,7 +206,7 @@ static void display_sam_unk_info_6(SAM_UNK_INFO_6 *info6)
{
fstring name;
- unistr2_to_ascii(name, &info6->uni_server, sizeof(name) - 1);
+ unistr2_to_ascii(name, &info6->uni_server, sizeof(name));
printf("Server:\t\t%s\n", name);
}
@@ -252,13 +252,13 @@ static void display_sam_info_1(SAM_ENTRY1 *e1, SAM_STR1 *s1)
printf("RID: 0x%x ", e1->rid_user);
printf("acb: 0x%x ", e1->acb_info);
- unistr2_to_ascii(tmp, &s1->uni_acct_name, sizeof(tmp)-1);
+ unistr2_to_ascii(tmp, &s1->uni_acct_name, sizeof(tmp));
printf("Account: %s\t", tmp);
- unistr2_to_ascii(tmp, &s1->uni_full_name, sizeof(tmp)-1);
+ unistr2_to_ascii(tmp, &s1->uni_full_name, sizeof(tmp));
printf("Name: %s\t", tmp);
- unistr2_to_ascii(tmp, &s1->uni_acct_desc, sizeof(tmp)-1);
+ unistr2_to_ascii(tmp, &s1->uni_acct_desc, sizeof(tmp));
printf("Desc: %s\n", tmp);
}
@@ -270,10 +270,10 @@ static void display_sam_info_2(SAM_ENTRY2 *e2, SAM_STR2 *s2)
printf("RID: 0x%x ", e2->rid_user);
printf("acb: 0x%x ", e2->acb_info);
- unistr2_to_ascii(tmp, &s2->uni_srv_name, sizeof(tmp)-1);
+ unistr2_to_ascii(tmp, &s2->uni_srv_name, sizeof(tmp));
printf("Account: %s\t", tmp);
- unistr2_to_ascii(tmp, &s2->uni_srv_desc, sizeof(tmp)-1);
+ unistr2_to_ascii(tmp, &s2->uni_srv_desc, sizeof(tmp));
printf("Name: %s\n", tmp);
}
@@ -286,10 +286,10 @@ static void display_sam_info_3(SAM_ENTRY3 *e3, SAM_STR3 *s3)
printf("RID: 0x%x ", e3->rid_grp);
printf("attr: 0x%x ", e3->attr);
- unistr2_to_ascii(tmp, &s3->uni_grp_name, sizeof(tmp)-1);
+ unistr2_to_ascii(tmp, &s3->uni_grp_name, sizeof(tmp));
printf("Account: %s\t", tmp);
- unistr2_to_ascii(tmp, &s3->uni_grp_desc, sizeof(tmp)-1);
+ unistr2_to_ascii(tmp, &s3->uni_grp_desc, sizeof(tmp));
printf("Name: %s\n", tmp);
}
@@ -450,9 +450,9 @@ static void display_group_info1(GROUP_INFO1 *info1)
{
fstring temp;
- unistr2_to_ascii(temp, &info1->uni_acct_name, sizeof(temp)-1);
+ unistr2_to_ascii(temp, &info1->uni_acct_name, sizeof(temp));
printf("\tGroup Name:\t%s\n", temp);
- unistr2_to_ascii(temp, &info1->uni_acct_desc, sizeof(temp)-1);
+ unistr2_to_ascii(temp, &info1->uni_acct_desc, sizeof(temp));
printf("\tDescription:\t%s\n", temp);
printf("\tGroup Attribute:%d\n", info1->group_attr);
printf("\tNum Members:%d\n", info1->num_members);
@@ -465,7 +465,7 @@ static void display_group_info2(GROUP_INFO2 *info2)
{
fstring name;
- unistr2_to_ascii(name, &info2->uni_acct_name, sizeof(name)-1);
+ unistr2_to_ascii(name, &info2->uni_acct_name, sizeof(name));
printf("\tGroup Description:%s\n", name);
}
@@ -486,7 +486,7 @@ static void display_group_info4(GROUP_INFO4 *info4)
{
fstring desc;
- unistr2_to_ascii(desc, &info4->uni_acct_desc, sizeof(desc)-1);
+ unistr2_to_ascii(desc, &info4->uni_acct_desc, sizeof(desc));
printf("\tGroup Description:%s\n", desc);
}
@@ -497,9 +497,9 @@ static void display_group_info5(GROUP_INFO5 *info5)
{
fstring temp;
- unistr2_to_ascii(temp, &info5->uni_acct_name, sizeof(temp)-1);
+ unistr2_to_ascii(temp, &info5->uni_acct_name, sizeof(temp));
printf("\tGroup Name:\t%s\n", temp);
- unistr2_to_ascii(temp, &info5->uni_acct_desc, sizeof(temp)-1);
+ unistr2_to_ascii(temp, &info5->uni_acct_desc, sizeof(temp));
printf("\tDescription:\t%s\n", temp);
printf("\tGroup Attribute:%d\n", info5->group_attr);
printf("\tNum Members:%d\n", info5->num_members);
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index e44d33d874..b2e37ac559 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -1257,9 +1257,9 @@ static NTSTATUS rpc_user_list_internals(const DOM_SID *domain_sid,
loop_count++;
for (i = 0; i < num_entries; i++) {
- unistr2_to_ascii(user, &(&ctr.sam.info1->str[i])->uni_acct_name, sizeof(user)-1);
+ unistr2_to_ascii(user, &(&ctr.sam.info1->str[i])->uni_acct_name, sizeof(user));
if (opt_long_list_entries)
- unistr2_to_ascii(desc, &(&ctr.sam.info1->str[i])->uni_acct_desc, sizeof(desc)-1);
+ unistr2_to_ascii(desc, &(&ctr.sam.info1->str[i])->uni_acct_desc, sizeof(desc));
if (opt_long_list_entries)
printf("%-21.21s %s\n", user, desc);
@@ -1808,7 +1808,7 @@ static NTSTATUS rpc_group_delete_internals(const DOM_SID *domain_sid,
if (user_ctr->info.id21->group_rid == group_rid) {
unistr2_to_ascii(temp, &(user_ctr->info.id21)->uni_user_name,
- sizeof(temp)-1);
+ sizeof(temp));
if (opt_verbose)
d_printf("Group is primary group of %s\n",temp);
group_is_primary = True;
@@ -2515,8 +2515,8 @@ static NTSTATUS rpc_group_list_internals(const DOM_SID *domain_sid,
fstring group, desc;
- unistr2_to_ascii(group, &(&ctr.sam.info3->str[i])->uni_grp_name, sizeof(group)-1);
- unistr2_to_ascii(desc, &(&ctr.sam.info3->str[i])->uni_grp_desc, sizeof(desc)-1);
+ unistr2_to_ascii(group, &(&ctr.sam.info3->str[i])->uni_grp_name, sizeof(group));
+ unistr2_to_ascii(desc, &(&ctr.sam.info3->str[i])->uni_grp_desc, sizeof(desc));
if (opt_long_list_entries)
printf("%-21.21s %-50.50s\n",
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index 0be9381c3a..72b7f63cc4 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -585,8 +585,8 @@ static NTSTATUS fetch_group_info(uint32 rid, SAM_GROUP_INFO *delta)
GROUP_MAP map;
BOOL insert = True;
- unistr2_to_ascii(name, &delta->uni_grp_name, sizeof(name)-1);
- unistr2_to_ascii(comment, &delta->uni_grp_desc, sizeof(comment)-1);
+ unistr2_to_ascii(name, &delta->uni_grp_name, sizeof(name));
+ unistr2_to_ascii(comment, &delta->uni_grp_desc, sizeof(comment));
/* add the group to the mapping table */
sid_copy(&group_sid, get_global_sam_sid());
@@ -776,8 +776,8 @@ static NTSTATUS fetch_alias_info(uint32 rid, SAM_ALIAS_INFO *delta,
GROUP_MAP map;
BOOL insert = True;
- unistr2_to_ascii(name, &delta->uni_als_name, sizeof(name)-1);
- unistr2_to_ascii(comment, &delta->uni_als_desc, sizeof(comment)-1);
+ unistr2_to_ascii(name, &delta->uni_als_name, sizeof(name));
+ unistr2_to_ascii(comment, &delta->uni_als_desc, sizeof(comment));
/* Find out whether the group is already mapped */
sid_copy(&alias_sid, &dom_sid);
@@ -839,7 +839,7 @@ static NTSTATUS fetch_domain_info(uint32 rid, SAM_DOMAIN_INFO *delta)
u_lockoutreset = uint64s_nt_time_to_unix_abs(&delta->account_lockout.reset_count);
u_lockouttime = uint64s_nt_time_to_unix_abs(&delta->account_lockout.lockout_duration);
- unistr2_to_ascii(domname, &delta->uni_dom_name, sizeof(domname) - 1);
+ unistr2_to_ascii(domname, &delta->uni_dom_name, sizeof(domname));
/* we don't handle BUILTIN account policies */
if (!strequal(domname, get_global_sam_name())) {
@@ -1399,7 +1399,7 @@ static NTSTATUS fetch_group_info_to_ldif(SAM_DELTA_CTR *delta, GROUPMAP *groupma
/* Get the group name */
unistr2_to_ascii(groupname,
&(delta->group_info.uni_grp_name),
- sizeof(groupname)-1);
+ sizeof(groupname));
/* Set up the group type (always 2 for group info) */
grouptype = 2;
@@ -1470,7 +1470,7 @@ static NTSTATUS fetch_account_info_to_ldif(SAM_DELTA_CTR *delta,
/* Get the username */
unistr2_to_ascii(username,
&(delta->account_info.uni_acct_name),
- sizeof(username)-1);
+ sizeof(username));
/* Get the rid */
rid = delta->account_info.user_rid;
@@ -1482,7 +1482,7 @@ static NTSTATUS fetch_account_info_to_ldif(SAM_DELTA_CTR *delta,
/* Get the home directory */
if (delta->account_info.acb_info & ACB_NORMAL) {
unistr2_to_ascii(homedir, &(delta->account_info.uni_home_dir),
- sizeof(homedir)-1);
+ sizeof(homedir));
if (!*homedir) {
pstr_sprintf(homedir, "/home/%s", username);
} else {
@@ -1496,27 +1496,27 @@ static NTSTATUS fetch_account_info_to_ldif(SAM_DELTA_CTR *delta,
/* Get the logon script */
unistr2_to_ascii(logonscript, &(delta->account_info.uni_logon_script),
- sizeof(logonscript)-1);
+ sizeof(logonscript));
/* Get the home drive */
unistr2_to_ascii(homedrive, &(delta->account_info.uni_dir_drive),
- sizeof(homedrive)-1);
+ sizeof(homedrive));
/* Get the home path */
unistr2_to_ascii(homepath, &(delta->account_info.uni_home_dir),
- sizeof(homepath)-1);
+ sizeof(homepath));
/* Get the description */
unistr2_to_ascii(description, &(delta->account_info.uni_acct_desc),
- sizeof(description)-1);
+ sizeof(description));
/* Get the display name */
unistr2_to_ascii(fullname, &(delta->account_info.uni_full_name),
- sizeof(fullname)-1);
+ sizeof(fullname));
/* Get the profile path */
unistr2_to_ascii(profilepath, &(delta->account_info.uni_profile),
- sizeof(profilepath)-1);
+ sizeof(profilepath));
/* Get lm and nt password data */
if (memcmp(delta->account_info.pass.buf_lm_pwd, zero_buf, 16) != 0) {
@@ -1620,11 +1620,11 @@ static NTSTATUS fetch_alias_info_to_ldif(SAM_DELTA_CTR *delta,
/* Get the alias name */
unistr2_to_ascii(aliasname, &(delta->alias_info.uni_als_name),
- sizeof(aliasname)-1);
+ sizeof(aliasname));
/* Get the alias description */
unistr2_to_ascii(description, &(delta->alias_info.uni_als_desc),
- sizeof(description)-1);
+ sizeof(description));
/* Set up the group type */
switch (db_type) {
@@ -1895,7 +1895,7 @@ static NTSTATUS fetch_database_to_ldif(struct rpc_pipe_client *pipe_hnd,
unistr2_to_ascii(
domainname,
&deltas[k].domain_info.uni_dom_name,
- sizeof(domainname)-1);
+ sizeof(domainname));
break;
case SAM_DELTA_GROUP_INFO:
diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c
index 6d2dd35080..283b4f36e9 100644
--- a/source3/winbindd/winbindd_rpc.c
+++ b/source3/winbindd/winbindd_rpc.c
@@ -96,8 +96,8 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
fstring username, fullname;
uint32 rid = ctr.sam.info1->sam[j].rid_user;
- unistr2_to_ascii( username, &(&ctr.sam.info1->str[j])->uni_acct_name, sizeof(username)-1);
- unistr2_to_ascii( fullname, &(&ctr.sam.info1->str[j])->uni_full_name, sizeof(fullname)-1);
+ unistr2_to_ascii( username, &(&ctr.sam.info1->str[j])->uni_acct_name, sizeof(username));
+ unistr2_to_ascii( fullname, &(&ctr.sam.info1->str[j])->uni_full_name, sizeof(fullname));
(*info)[i].acct_name = talloc_strdup(mem_ctx, username );
(*info)[i].full_name = talloc_strdup(mem_ctx, fullname );