summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_spoolss.c88
-rw-r--r--source3/rpcclient/display.c66
-rw-r--r--source3/rpcclient/display_spool.c116
-rw-r--r--source3/rpcclient/rpcclient.c2
4 files changed, 139 insertions, 133 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 6b5d45a249..30c1616779 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -204,9 +204,9 @@ static void display_print_info_0(PRINTER_INFO_0 *i1)
fstring name;
fstring servername;
- unistr_to_ascii(name, i1->printername.buffer, sizeof(name) - 1);
- unistr_to_ascii(servername, i1->servername.buffer, sizeof(servername) - 1);
-
+ rpcstr_pull(name, i1->printername.buffer, sizeof(name), 0, STR_TERMINATE);
+ rpcstr_pull(servername, i1->servername.buffer, sizeof(servername), 0,STR_TERMINATE);
+
printf("\tprintername:[%s]\n", name);
printf("\tservername:[%s]\n", servername);
printf("\tcjobs:[0x%x]\n", i1->cjobs);
@@ -257,9 +257,9 @@ static void display_print_info_1(PRINTER_INFO_1 *i1)
fstring name;
fstring comm;
- unistr_to_ascii(desc, i1->description.buffer, sizeof(desc) - 1);
- unistr_to_ascii(name, i1->name .buffer, sizeof(name) - 1);
- unistr_to_ascii(comm, i1->comment .buffer, sizeof(comm) - 1);
+ rpcstr_pull(desc, i1->description.buffer, sizeof(desc), 0, STR_TERMINATE);
+ rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
+ rpcstr_pull(comm, i1->comment.buffer, sizeof(comm), 0, STR_TERMINATE);
printf("\tflags:[0x%x]\n", i1->flags);
printf("\tname:[%s]\n", name);
@@ -284,23 +284,17 @@ static void display_print_info_2(PRINTER_INFO_2 *i2)
fstring datatype;
fstring parameters;
- unistr_to_ascii(servername, i2->servername.buffer,
- sizeof(servername) - 1);
- unistr_to_ascii(printername, i2->printername.buffer,
- sizeof(printername) - 1);
- unistr_to_ascii(sharename, i2->sharename.buffer,
- sizeof(sharename) - 1);
- unistr_to_ascii(portname, i2->portname.buffer, sizeof(portname) - 1);
- unistr_to_ascii(drivername, i2->drivername.buffer,
- sizeof(drivername) - 1);
- unistr_to_ascii(comment, i2->comment.buffer, sizeof(comment) - 1);
- unistr_to_ascii(location, i2->location.buffer, sizeof(location) - 1);
- unistr_to_ascii(sepfile, i2->sepfile.buffer, sizeof(sepfile) - 1);
- unistr_to_ascii(printprocessor, i2->printprocessor.buffer,
- sizeof(printprocessor) - 1);
- unistr_to_ascii(datatype, i2->datatype.buffer, sizeof(datatype) - 1);
- unistr_to_ascii(parameters, i2->parameters.buffer,
- sizeof(parameters) - 1);
+ rpcstr_pull(servername, i2->servername.buffer,sizeof(servername), 0, STR_TERMINATE);
+ rpcstr_pull(printername, i2->printername.buffer,sizeof(printername), 0, STR_TERMINATE);
+ rpcstr_pull(sharename, i2->sharename.buffer,sizeof(sharename), 0, STR_TERMINATE);
+ rpcstr_pull(portname, i2->portname.buffer,sizeof(portname), 0, STR_TERMINATE);
+ rpcstr_pull(drivername, i2->drivername.buffer,sizeof(drivername), 0, STR_TERMINATE);
+ rpcstr_pull(comment, i2->comment.buffer,sizeof(comment), 0, STR_TERMINATE);
+ rpcstr_pull(location, i2->location.buffer,sizeof(location), 0, STR_TERMINATE);
+ rpcstr_pull(sepfile, i2->sepfile.buffer,sizeof(sepfile), 0, STR_TERMINATE);
+ rpcstr_pull(printprocessor, i2->printprocessor.buffer,sizeof(printprocessor), 0, STR_TERMINATE);
+ rpcstr_pull(datatype, i2->datatype.buffer,sizeof(datatype), 0, STR_TERMINATE);
+ rpcstr_pull(parameters, i2->parameters.buffer,sizeof(parameters), 0, STR_TERMINATE);
printf("\tservername:[%s]\n", servername);
printf("\tprintername:[%s]\n", printername);
@@ -420,7 +414,7 @@ static void display_port_info_1(PORT_INFO_1 *i1)
{
fstring buffer;
- unistr_to_ascii(buffer, i1->port_name.buffer, sizeof(buffer)-1);
+ rpcstr_pull(buffer, i1->port_name.buffer, sizeof(buffer), 0, STR_TERMINATE);
printf("\tPort Name:\t[%s]\n", buffer);
}
@@ -431,11 +425,13 @@ static void display_port_info_2(PORT_INFO_2 *i2)
{
fstring buffer;
- unistr_to_ascii(buffer, i2->port_name.buffer, sizeof(buffer) - 1);
+ rpcstr_pull(buffer, i2->port_name.buffer, sizeof(buffer), 0, STR_TERMINATE);
printf("\tPort Name:\t[%s]\n", buffer);
- unistr_to_ascii(buffer, i2->monitor_name.buffer, sizeof(buffer) - 1);
+ rpcstr_pull(buffer, i2->monitor_name.buffer, sizeof(buffer), 0, STR_TERMINATE);
+
printf("\tMonitor Name:\t[%s]\n", buffer);
- unistr_to_ascii(buffer, i2->description.buffer, sizeof(buffer) - 1);
+ rpcstr_pull(buffer, i2->description.buffer, sizeof(buffer), 0, STR_TERMINATE);
+
printf("\tDescription:\t[%s]\n", buffer);
printf("\tPort Type:\t[%d]\n", i2->port_type);
printf("\tReserved:\t[%d]\n", i2->reserved);
@@ -600,7 +596,7 @@ static void display_print_driver_1(DRIVER_INFO_1 *i1)
if (i1 == NULL)
return;
- unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1);
+ rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
printf ("Printer Driver Info 1:\n");
printf ("\tDriver Name: [%s]\n\n", name);
@@ -621,11 +617,11 @@ static void display_print_driver_2(DRIVER_INFO_2 *i1)
if (i1 == NULL)
return;
- unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1);
- unistr_to_ascii(architecture, i1->architecture.buffer, sizeof(architecture)-1);
- unistr_to_ascii(driverpath, i1->driverpath.buffer, sizeof(driverpath)-1);
- unistr_to_ascii(datafile, i1->datafile.buffer, sizeof(datafile)-1);
- unistr_to_ascii(configfile, i1->configfile.buffer, sizeof(configfile)-1);
+ rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
+ rpcstr_pull(architecture, i1->architecture.buffer, sizeof(architecture), 0, STR_TERMINATE);
+ rpcstr_pull(driverpath, i1->driverpath.buffer, sizeof(driverpath), 0, STR_TERMINATE);
+ rpcstr_pull(datafile, i1->datafile.buffer, sizeof(datafile), 0, STR_TERMINATE);
+ rpcstr_pull(configfile, i1->configfile.buffer, sizeof(configfile), 0, STR_TERMINATE);
printf ("Printer Driver Info 2:\n");
printf ("\tVersion: [%x]\n", i1->version);
@@ -659,19 +655,18 @@ static void display_print_driver_3(DRIVER_INFO_3 *i1)
if (i1 == NULL)
return;
- unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1);
- unistr_to_ascii(architecture, i1->architecture.buffer, sizeof(architecture)-1);
- unistr_to_ascii(driverpath, i1->driverpath.buffer, sizeof(driverpath)-1);
- unistr_to_ascii(datafile, i1->datafile.buffer, sizeof(datafile)-1);
- unistr_to_ascii(configfile, i1->configfile.buffer, sizeof(configfile)-1);
- unistr_to_ascii(helpfile, i1->helpfile.buffer, sizeof(helpfile)-1);
-
- unistr_to_ascii(monitorname, i1->monitorname.buffer, sizeof(monitorname)-1);
- unistr_to_ascii(defaultdatatype, i1->defaultdatatype.buffer, sizeof(defaultdatatype)-1);
+ rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
+ rpcstr_pull(architecture, i1->architecture.buffer, sizeof(architecture), 0, STR_TERMINATE);
+ rpcstr_pull(driverpath, i1->driverpath.buffer, sizeof(driverpath), 0, STR_TERMINATE);
+ rpcstr_pull(datafile, i1->datafile.buffer, sizeof(datafile), 0, STR_TERMINATE);
+ rpcstr_pull(configfile, i1->configfile.buffer, sizeof(configfile), 0, STR_TERMINATE);
+ rpcstr_pull(helpfile, i1->helpfile.buffer, sizeof(helpfile), 0, STR_TERMINATE);
+ rpcstr_pull(monitorname, i1->monitorname.buffer, sizeof(monitorname), 0, STR_TERMINATE);
+ rpcstr_pull(defaultdatatype, i1->defaultdatatype.buffer, sizeof(defaultdatatype), 0, STR_TERMINATE);
printf ("Printer Driver Info 3:\n");
printf ("\tVersion: [%x]\n", i1->version);
- printf ("\tDriver Name: [%s]\n",name );
+ printf ("\tDriver Name: [%s]\n",name);
printf ("\tArchitecture: [%s]\n", architecture);
printf ("\tDriver Path: [%s]\n", driverpath);
printf ("\tDatafile: [%s]\n", datafile);
@@ -680,7 +675,8 @@ static void display_print_driver_3(DRIVER_INFO_3 *i1)
while (valid)
{
- unistr_to_ascii(dependentfiles, i1->dependentfiles+length, sizeof(dependentfiles)-1);
+ rpcstr_pull(dependentfiles, i1->dependentfiles+length, sizeof(dependentfiles), 0, STR_TERMINATE);
+
length+=strlen(dependentfiles)+1;
if (strlen(dependentfiles) > 0)
@@ -913,7 +909,7 @@ static void display_printdriverdir_1(DRIVER_DIRECTORY_1 *i1)
if (i1 == NULL)
return;
- unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1);
+ rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
printf ("\tDirectory Name:[%s]\n", name);
}
@@ -1139,7 +1135,7 @@ static uint32 cmd_spoolss_addprinterdriver (struct cli_state *cli, int argc, cha
return result;
}
- unistr_to_ascii (driver_name, info3.name.buffer, sizeof(driver_name)-1);
+ rpcstr_pull(driver_name, info3.name.buffer, sizeof(driver_name), 0, STR_TERMINATE);
printf ("Printer Driver %s successfully installed.\n", driver_name);
/* cleanup */
diff --git a/source3/rpcclient/display.c b/source3/rpcclient/display.c
index 12ae5e2dfe..345ed7d49a 100644
--- a/source3/rpcclient/display.c
+++ b/source3/rpcclient/display.c
@@ -170,8 +170,8 @@ void display_srv_info_101(FILE *out_hnd, enum action_type action,
fstring name;
fstring comment;
- fstrcpy(name , dos_unistrn2(sv101->uni_name .buffer, sv101->uni_name .uni_str_len));
- fstrcpy(comment , dos_unistrn2(sv101->uni_comment .buffer, sv101->uni_comment .uni_str_len));
+ rpcstr_pull(name, sv101->uni_name.buffer, sizeof(name), sv101->uni_name.uni_str_len*2, 0);
+ rpcstr_pull(comment, sv101->uni_comment.buffer, sizeof(comment), sv101->uni_comment.uni_str_len*2, 0);
display_server(out_hnd, action, name, sv101->srv_type, comment);
@@ -212,9 +212,9 @@ void display_srv_info_102(FILE *out_hnd, enum action_type action,SRV_INFO_102 *s
fstring comment;
fstring usr_path;
- fstrcpy(name , dos_unistrn2(sv102->uni_name .buffer, sv102->uni_name .uni_str_len));
- fstrcpy(comment , dos_unistrn2(sv102->uni_comment .buffer, sv102->uni_comment .uni_str_len));
- fstrcpy(usr_path, dos_unistrn2(sv102->uni_usr_path.buffer, sv102->uni_usr_path.uni_str_len));
+ rpcstr_pull(name, sv102->uni_name.buffer, sizeof(name), sv102->uni_name.uni_str_len*2, 0);
+ rpcstr_pull(comment, sv102->uni_comment.buffer, sizeof(comment), sv102->uni_comment.uni_str_len*2, 0);
+ rpcstr_pull(usr_path, sv102->uni_usr_path.buffer, sizeof(usr_path), sv102->uni_usr_path.uni_str_len*2, 0);
display_server(out_hnd, action, name, sv102->srv_type, comment);
@@ -325,8 +325,8 @@ void display_conn_info_1(FILE *out_hnd, enum action_type action,
fstring usr_name;
fstring net_name;
- fstrcpy(usr_name, dos_unistrn2(str1->uni_usr_name.buffer, str1->uni_usr_name.uni_str_len));
- fstrcpy(net_name, dos_unistrn2(str1->uni_net_name.buffer, str1->uni_net_name.uni_str_len));
+ rpcstr_pull(usr_name, str1->uni_usr_name.buffer, sizeof(usr_name), str1->uni_usr_name.uni_str_len*2,0);
+ rpcstr_pull(net_name, str1->uni_net_name.buffer, sizeof(net_name), str1->uni_net_name.uni_str_len*2,0);
fprintf(out_hnd, "\tid : %d\n", info1->id);
fprintf(out_hnd, "\ttype : %s\n", get_share_type_str(info1->type));
@@ -481,8 +481,8 @@ void display_share_info_1(FILE *out_hnd, enum action_type action,
fstring remark ;
fstring net_name;
- fstrcpy(net_name, dos_unistrn2(info1->info_1_str.uni_netname.buffer, info1->info_1_str.uni_netname.uni_str_len));
- fstrcpy(remark , dos_unistrn2(info1->info_1_str.uni_remark .buffer, info1->info_1_str.uni_remark .uni_str_len));
+ rpcstr_pull(net_name, info1->info_1_str.uni_netname.buffer, sizeof(net_name), info1->info_1_str.uni_netname.uni_str_len*2, 0);
+ rpcstr_pull(remark, info1->info_1_str.uni_remark.buffer, sizeof(remark), info1->info_1_str.uni_remark.uni_str_len*2, 0);
display_share(out_hnd, action, net_name, info1->info_1.type, remark);
@@ -523,10 +523,10 @@ void display_share_info_2(FILE *out_hnd, enum action_type action,
fstring path ;
fstring passwd ;
- fstrcpy(net_name, dos_unistrn2(info2->info_2_str.uni_netname.buffer, info2->info_2_str.uni_netname.uni_str_len));
- fstrcpy(remark , dos_unistrn2(info2->info_2_str.uni_remark .buffer, info2->info_2_str.uni_remark .uni_str_len));
- fstrcpy(path , dos_unistrn2(info2->info_2_str.uni_path .buffer, info2->info_2_str.uni_path .uni_str_len));
- fstrcpy(passwd , dos_unistrn2(info2->info_2_str.uni_passwd .buffer, info2->info_2_str.uni_passwd .uni_str_len));
+ rpcstr_pull(net_name, info2->info_2_str.uni_netname.buffer, sizeof(net_name), info2->info_2_str.uni_netname.uni_str_len*2, 0);
+ rpcstr_pull(remark, info2->info_2_str.uni_remark.buffer, sizeof(remark), info2->info_2_str.uni_remark.uni_str_len*2, 0);
+ rpcstr_pull(path, info2->info_2_str.uni_path.buffer, sizeof(path), info2->info_2_str.uni_path.uni_str_len*2, 0);
+ rpcstr_pull(passwd, info2->info_2_str.uni_passwd.buffer, sizeof(passwd), info2->info_2_str.uni_passwd.uni_str_len*2, 0);
display_share2(out_hnd, action, net_name,
info2->info_2.type, remark, info2->info_2.perms,
@@ -617,8 +617,8 @@ void display_file_info_3(FILE *out_hnd, enum action_type action,
fstring path_name;
fstring user_name;
- fstrcpy(path_name, dos_unistrn2(str3->uni_path_name.buffer, str3->uni_path_name.uni_str_len));
- fstrcpy(user_name, dos_unistrn2(str3->uni_user_name.buffer, str3->uni_user_name.uni_str_len));
+ rpcstr_pull(path_name, str3->uni_path_name.buffer, sizeof(path_name), str3->uni_path_name.uni_str_len*2, 0);
+ rpcstr_pull(user_name, str3->uni_user_name.buffer, sizeof(user_name), str3->uni_user_name.uni_str_len*2, 0);
fprintf(out_hnd, "\tid : %d\n", info3->id);
fprintf(out_hnd, "\tperms : %s\n", get_file_mode_str(info3->perms));
@@ -908,16 +908,27 @@ void display_sam_user_info_21(FILE *out_hnd, enum action_type action, SAM_USER_I
}
case ACTION_ENUMERATE:
{
- fprintf(out_hnd, "\t\tUser Name : %s\n", dos_unistrn2(usr->uni_user_name .buffer, usr->uni_user_name .uni_str_len)); /* username unicode string */
- fprintf(out_hnd, "\t\tFull Name : %s\n", dos_unistrn2(usr->uni_full_name .buffer, usr->uni_full_name .uni_str_len)); /* user's full name unicode string */
- fprintf(out_hnd, "\t\tHome Drive : %s\n", dos_unistrn2(usr->uni_home_dir .buffer, usr->uni_home_dir .uni_str_len)); /* home directory unicode string */
- fprintf(out_hnd, "\t\tDir Drive : %s\n", dos_unistrn2(usr->uni_dir_drive .buffer, usr->uni_dir_drive .uni_str_len)); /* home directory drive unicode string */
- fprintf(out_hnd, "\t\tProfile Path: %s\n", dos_unistrn2(usr->uni_profile_path.buffer, usr->uni_profile_path.uni_str_len)); /* profile path unicode string */
- fprintf(out_hnd, "\t\tLogon Script: %s\n", dos_unistrn2(usr->uni_logon_script.buffer, usr->uni_logon_script.uni_str_len)); /* logon script unicode string */
- fprintf(out_hnd, "\t\tDescription : %s\n", dos_unistrn2(usr->uni_acct_desc .buffer, usr->uni_acct_desc .uni_str_len)); /* user description unicode string */
- fprintf(out_hnd, "\t\tWorkstations: %s\n", dos_unistrn2(usr->uni_workstations.buffer, usr->uni_workstations.uni_str_len)); /* workstaions unicode string */
- fprintf(out_hnd, "\t\tUnknown Str : %s\n", dos_unistrn2(usr->uni_unknown_str .buffer, usr->uni_unknown_str .uni_str_len)); /* unknown string unicode string */
- fprintf(out_hnd, "\t\tRemote Dial : %s\n", dos_unistrn2(usr->uni_munged_dial .buffer, usr->uni_munged_dial .uni_str_len)); /* munged remote access unicode string */
+ pstring tmp;
+ rpcstr_pull(tmp, usr->uni_user_name.buffer, sizeof(tmp),usr->uni_user_name.uni_str_len*2, 0);
+ fprintf(out_hnd, "\t\tUser Name : %s\n", tmp); /* username unicode string */
+ rpcstr_pull(tmp, usr->uni_full_name.buffer, sizeof(tmp),usr->uni_full_name.uni_str_len*2, 0);
+ fprintf(out_hnd, "\t\tFull Name : %s\n", tmp); /* user's full name unicode string */
+ rpcstr_pull(tmp, usr->uni_home_dir.buffer, sizeof(tmp),usr->uni_home_dir.uni_str_len*2, 0);
+ fprintf(out_hnd, "\t\tHome Drive : %s\n", tmp); /* home directory unicode string */
+ rpcstr_pull(tmp, usr->uni_dir_drive.buffer, sizeof(tmp),usr->uni_dir_drive.uni_str_len*2, 0);
+ fprintf(out_hnd, "\t\tDir Drive : %s\n", tmp); /* home directory drive unicode string */
+ rpcstr_pull(tmp, usr->uni_profile_path.buffer, sizeof(tmp),usr->uni_profile_path.uni_str_len*2, 0);
+ fprintf(out_hnd, "\t\tProfile Path: %s\n", tmp); /* profile path unicode string */
+ rpcstr_pull(tmp, usr->uni_logon_script.buffer, sizeof(tmp),usr->uni_logon_script.uni_str_len*2, 0);
+ fprintf(out_hnd, "\t\tLogon Script: %s\n", tmp); /* logon script unicode string */
+ rpcstr_pull(tmp, usr->uni_acct_desc.buffer, sizeof(tmp),usr->uni_acct_desc.uni_str_len*2, 0);
+ fprintf(out_hnd, "\t\tDescription : %s\n", tmp); /* user description unicode string */
+ rpcstr_pull(tmp, usr->uni_workstations.buffer, sizeof(tmp),usr->uni_workstations.uni_str_len*2, 0);
+ fprintf(out_hnd, "\t\tWorkstations: %s\n", tmp); /* workstaions unicode string */
+ rpcstr_pull(tmp, usr->uni_unknows_str.buffer, sizeof(tmp),usr->uni_unknown_str.uni_str_len*2, 0);
+ fprintf(out_hnd, "\t\tUnknown Str : %s\n", tmp); /* unknown string unicode string */
+ rpcstr_pull(tmp, usr->uni_munged_dial.buffer, sizeof(tmp),usr->uni_munged_dial.uni_str_len*2, 0);
+ fprintf(out_hnd, "\t\tRemote Dial : %s\n", tmp); /* munged remote access unicode string */
fprintf(out_hnd, "\t\tLogon Time : %s\n", http_timestring(nt_time_to_unix(&(usr->logon_time ))));
fprintf(out_hnd, "\t\tLogoff Time : %s\n", http_timestring(nt_time_to_unix(&(usr->logoff_time ))));
@@ -1206,13 +1217,16 @@ char *get_reg_val_type_str(uint32 type)
static void print_reg_value(FILE *out_hnd, char *val_name, uint32 val_type, BUFFER2 *value)
{
fstring type;
+ pstring intvalue;
fstrcpy(type, get_reg_val_type_str(val_type));
switch (val_type)
{
case 0x01: /* unistr */
{
- fprintf(out_hnd,"\t%s:\t%s:\t%s\n", val_name, type, dos_buffer2_to_str(value));
+ rpcstr_pull(intvalue, value->buffer, sizeof(intvalue), value->buf_len, 0);
+ /*fprintf(out_hnd,"\t%s:\t%s:\t%s\n", val_name, type, dos_buffer2_to_str(value));*/
+ fprintf(out_hnd,"\t%s:\t%s:\t%s\n", val_name, type, value);
break;
}
diff --git a/source3/rpcclient/display_spool.c b/source3/rpcclient/display_spool.c
index 54162a99b7..cdca0c393d 100644
--- a/source3/rpcclient/display_spool.c
+++ b/source3/rpcclient/display_spool.c
@@ -32,8 +32,8 @@ static void display_print_info_0(FILE *out_hnd, PRINTER_INFO_0 *i1)
if (i1 == NULL)
return;
- unistr_to_ascii(name, i1->printername.buffer, sizeof(name)-1);
- unistr_to_ascii(server, i1->servername.buffer, sizeof(server)-1);
+ rpcstr_pull(name, i1->printername.buffer, sizeof(name), 0, STR_TERMINATE);
+ rpcstr_pull(server, i1->servername.buffer, sizeof(server), 0, STR_TERMINATE);
report(out_hnd, "\tprintername:[%s]\n", name);
report(out_hnd, "\tservername:[%s]\n", server);
@@ -85,9 +85,9 @@ static void display_print_info_1(FILE *out_hnd, PRINTER_INFO_1 *i1)
if (i1 == NULL)
return;
- unistr_to_ascii(desc, i1->description.buffer, sizeof(desc)-1);
- unistr_to_ascii(name, i1->name .buffer, sizeof(name)-1);
- unistr_to_ascii(comm, i1->comment .buffer, sizeof(comm)-1);
+ rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
+ rpcstr_pull(desc, i1->description.buffer, sizeof(desc), 0, STR_TERMINATE);
+ rpcstr_pull(comm, i1->comment.buffer, sizeof(comm), 0, STR_TERMINATE);
report(out_hnd, "\tflags:[%x]\n", i1->flags);
report(out_hnd, "\tname:[%s]\n", name);
@@ -115,18 +115,18 @@ static void display_print_info_2(FILE *out_hnd, PRINTER_INFO_2 *i2)
if (i2 == NULL)
return;
- unistr_to_ascii(servername, i2->servername.buffer, sizeof(servername)-1);
- unistr_to_ascii(printername, i2->printername.buffer, sizeof(printername)-1);
- unistr_to_ascii(sharename, i2->sharename.buffer, sizeof(sharename)-1);
- unistr_to_ascii(portname, i2->portname.buffer, sizeof(portname)-1);
- unistr_to_ascii(drivername, i2->drivername.buffer, sizeof(drivername)-1);
- unistr_to_ascii(comment, i2->comment.buffer, sizeof(comment)-1);
- unistr_to_ascii(location, i2->location.buffer, sizeof(location)-1);
- unistr_to_ascii(sepfile, i2->sepfile.buffer, sizeof(sepfile)-1);
- unistr_to_ascii(printprocessor, i2->printprocessor.buffer, sizeof(printprocessor)-1);
- unistr_to_ascii(datatype, i2->datatype.buffer, sizeof(datatype)-1);
- unistr_to_ascii(parameters, i2->parameters.buffer, sizeof(parameters)-1);
-
+ rpcstr_pull(servername, i2->servername.buffer,sizeof(servername), 0, STR_TERMINATE);
+ rpcstr_pull(printername, i2->printername.buffer,sizeof(printername), 0, STR_TERMINATE);
+ rpcstr_pull(sharename, i2->sharename.buffer,sizeof(sharename), 0, STR_TERMINATE);
+ rpcstr_pull(portname, i2->portname.buffer,sizeof(portname), 0, STR_TERMINATE);
+ rpcstr_pull(drivername, i2->drivername.buffer,sizeof(drivername), 0, STR_TERMINATE);
+ rpcstr_pull(comment, i2->comment.buffer,sizeof(comment), 0, STR_TERMINATE);
+ rpcstr_pull(location, i2->location.buffer,sizeof(location), 0, STR_TERMINATE);
+ rpcstr_pull(sepfile, i2->sepfile.buffer,sizeof(sepfile), 0, STR_TERMINATE);
+ rpcstr_pull(printprocessor, i2->printprocessor.buffer,sizeof(printprocessor), 0, STR_TERMINATE);
+ rpcstr_pull(datatype, i2->datatype.buffer,sizeof(datatype), 0, STR_TERMINATE);
+ rpcstr_pull(parameters, i2->parameters.buffer,sizeof(parameters), 0, STR_TERMINATE);
+
report(out_hnd, "\tservername:[%s]\n", servername);
report(out_hnd, "\tprintername:[%s]\n", printername);
report(out_hnd, "\tsharename:[%s]\n", sharename);
@@ -371,7 +371,7 @@ void display_port_info_1(FILE *out_hnd, enum action_type action, PORT_INFO_1 *i1
report(out_hnd, "Port:\n");
break;
case ACTION_ENUMERATE:
- unistr_to_ascii(buffer, i1->port_name.buffer, sizeof(buffer)-1);
+ rpcstr_pull(buffer, i1->port_name.buffer, sizeof(bufferi), 0, STR_TERMINATE);
fprintf (out_hnd, "\tPort Name:\t[%s]\n\n", buffer);
break;
case ACTION_FOOTER:
@@ -393,11 +393,12 @@ void display_port_info_2(FILE *out_hnd, enum action_type action, PORT_INFO_2 *i2
report(out_hnd, "Port:\n");
break;
case ACTION_ENUMERATE:
- unistr_to_ascii(buffer, i2->port_name.buffer, sizeof(buffer)-1);
+ rpcstr_pull(buffer, i2->port_name.buffer, sizeof(buffer), 0, STR_TERMINATE);
fprintf (out_hnd, "\tPort Name:\t[%s]\n", buffer);
- unistr_to_ascii(buffer, i2->monitor_name.buffer, sizeof(buffer)-1);
+ rpcstr_pull(buffer, i2->monitor_name.buffer, sizeof(buffer), 0, STR_TERMINATE);
+
fprintf (out_hnd, "\tMonitor Name:\t[%s]\n", buffer);
- unistr_to_ascii(buffer, i2->description.buffer, sizeof(buffer)-1);
+ rpcstr_pull(buffer, i2->description.buffer, sizeof(buffer), 0, STR_TERMINATE);
fprintf (out_hnd, "\tDescription:\t[%s]\n", buffer);
fprintf (out_hnd, "\tPort Type:\t[%d]\n", i2->port_type);
fprintf (out_hnd, "\tReserved:\t[%d]\n", i2->reserved);
@@ -429,7 +430,7 @@ void display_printer_enumdata(FILE *out_hnd, enum action_type action, uint32 idx
case ACTION_ENUMERATE:
report(out_hnd, "[%d]", idx);
report(out_hnd, "\t[%d]", valuelen);
- unistr_to_ascii(buffer, value, sizeof(buffer)-1);
+ rpcstr_pull(buffer, value, sizeof(buffer), 0, STR_TERMINATE);
report(out_hnd, "\t[%s]", buffer);
report(out_hnd, "\t[%d]", rvaluelen);
report(out_hnd, "\t\t[%d]", type);
@@ -467,29 +468,27 @@ void display_job_info_2(FILE *out_hnd, enum action_type action,
fstring tmp;
report(out_hnd, "\tjob id:\t%d\n", i2->jobid);
- unistr_to_ascii(tmp, i2->printername.buffer, sizeof(tmp)-1);
+ rpcstr_pull(tmp, i2->printername.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\tprinter name:\t%s\n", tmp);
- unistr_to_ascii(tmp, i2->machinename.buffer, sizeof(tmp)-1);
+ rpcstr_pull(tmp, i2->machinename.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\tmachine name:\t%s\n", tmp);
- unistr_to_ascii(tmp, i2->username.buffer, sizeof(tmp)-1);
+ rpcstr_pull(tmp, i2->username.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\tusername:\t%s\n", tmp);
- unistr_to_ascii(tmp, i2->document.buffer, sizeof(tmp)-1);
+ rpcstr_pull(tmp, i2->document.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\tdocument:\t%s\n", tmp);
- unistr_to_ascii(tmp, i2->notifyname.buffer, sizeof(tmp)-1);
+ rpcstr_pull(tmp, i2->notifyname.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\tnotify name:\t%s\n", tmp);
- unistr_to_ascii(tmp, i2->datatype.buffer, sizeof(tmp)-1);
+ rpcstr_pull(tmp, i2->datatype.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\tdata type:\t%s\n", tmp);
- unistr_to_ascii(tmp, i2->printprocessor.buffer, sizeof(tmp)-1);
+ rpcstr_pull(tmp, i2->printprocessor.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\tprint processor:\t%s\n", tmp);
- unistr_to_ascii(tmp, i2->parameters.buffer, sizeof(tmp)-1);
+ rpcstr_pull(tmp, i2->parameters.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\tparameters:\t%s\n", tmp);
- unistr_to_ascii(tmp, i2->drivername.buffer, sizeof(tmp)-1);
+ rpcstr_pull(tmp, i2->drivername.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\tdriver name:\t%s\n", tmp);
report(out_hnd, "\tDevice Mode:\tNOT DISPLAYED YET\n");
-/*
- DEVICEMODE *devmode;
-*/
- unistr_to_ascii(tmp, i2->text_status.buffer, sizeof(tmp)-1);
+
+ rpcstr_pull(tmp, i2->text_status.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\ttext status:\t%s\n", tmp);
/* SEC_DESC sec_desc;*/
report(out_hnd, "\tstatus:\t%d\n", i2->status);
@@ -539,17 +538,17 @@ void display_job_info_1(FILE *out_hnd, enum action_type action,
fstring tmp;
report(out_hnd, "\tjob id:\t%d\n", i1->jobid);
- unistr_to_ascii(tmp, i1->printername.buffer, sizeof(tmp)-1);
+ rpcstr_pull(tmp, i1->printername.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\tprinter name:\t%s\n", tmp);
- unistr_to_ascii(tmp, i1->machinename.buffer, sizeof(tmp)-1);
+ rpcstr_pull(tmp, i1->machinename.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\tmachine name:\t%s\n", tmp);
- unistr_to_ascii(tmp, i1->username.buffer, sizeof(tmp)-1);
+ rpcstr_pull(tmp, i1->username.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\tusername:\t%s\n", tmp);
- unistr_to_ascii(tmp, i1->document.buffer, sizeof(tmp)-1);
+ rpcstr_pull(tmp, i1->document.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\tdocument:\t%s\n", tmp);
- unistr_to_ascii(tmp, i1->datatype.buffer, sizeof(tmp)-1);
+ rpcstr_pull(tmp, i1->datatype.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\tdata type:\t%s\n", tmp);
- unistr_to_ascii(tmp, i1->text_status.buffer, sizeof(tmp)-1);
+ rpcstr_pull(tmp, i1->text_status.buffer, sizeof(tmp), 0, STR_TERMINATE);
report(out_hnd, "\ttext status:\t%s\n", tmp);
report(out_hnd, "\tstatus:\t%d\n", i1->status);
report(out_hnd, "\tpriority:\t%d\n", i1->priority);
@@ -690,7 +689,7 @@ static void display_print_driver_1(FILE *out_hnd, DRIVER_INFO_1 *i1)
if (i1 == NULL)
return;
- unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1);
+ rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
report(out_hnd, "\tname:[%s]\n", name);
}
@@ -708,11 +707,11 @@ static void display_print_driver_2(FILE *out_hnd, DRIVER_INFO_2 *i1)
if (i1 == NULL)
return;
- unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1);
- unistr_to_ascii(architecture, i1->architecture.buffer, sizeof(architecture)-1);
- unistr_to_ascii(driverpath, i1->driverpath.buffer, sizeof(driverpath)-1);
- unistr_to_ascii(datafile, i1->datafile.buffer, sizeof(datafile)-1);
- unistr_to_ascii(configfile, i1->configfile.buffer, sizeof(configfile)-1);
+ rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
+ rpcstr_pull(architecture, i1->architecture.buffer, sizeof(architecture), 0, STR_TERMINATE);
+ rpcstr_pull(driverpath, i1->driverpath.buffer, sizeof(driverpath), 0, STR_TERMINATE);
+ rpcstr_pull(datafile, i1->datafile.buffer, sizeof(datafile), 0, STR_TERMINATE);
+ rpcstr_pull(configfile, i1->conigfile.buffer, sizeof(configfile), 0, STR_TERMINATE);
report(out_hnd, "\tversion:[%x]\n", i1->version);
report(out_hnd, "\tname:[%s]\n", name);
@@ -743,18 +742,17 @@ static void display_print_driver_3(FILE *out_hnd, DRIVER_INFO_3 *i1)
if (i1 == NULL)
return;
- unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1);
- unistr_to_ascii(architecture, i1->architecture.buffer, sizeof(architecture)-1);
- unistr_to_ascii(driverpath, i1->driverpath.buffer, sizeof(driverpath)-1);
- unistr_to_ascii(datafile, i1->datafile.buffer, sizeof(datafile)-1);
- unistr_to_ascii(configfile, i1->configfile.buffer, sizeof(configfile)-1);
- unistr_to_ascii(helpfile, i1->helpfile.buffer, sizeof(helpfile)-1);
-
- unistr_to_ascii(monitorname, i1->monitorname.buffer, sizeof(monitorname)-1);
- unistr_to_ascii(defaultdatatype, i1->defaultdatatype.buffer, sizeof(defaultdatatype)-1);
+ rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
+ rpcstr_pull(architecture, i1->architecture.buffer, sizeof(architecture), 0, STR_TERMINATE);
+ rpcstr_pull(driverpath, i1->driverpath.buffer, sizeof(driverpath), 0, STR_TERMINATE);
+ rpcstr_pull(datafile, i1->datafile.buffer, sizeof(datafile), 0, STR_TERMINATE);
+ rpcstr_pull(configfile, i1->configfile.buffer, sizeof(configfile), 0, STR_TERMINATE);
+ rpcstr_pull(helpfile, i1->helpfile.buffer, sizeof(helpfile), 0, STR_TERMINATE);
+ rpcstr_pull(monitorname, i1->monitorname.buffer, sizeof(monitorname), 0, STR_TERMINATE);
+ rpcstr_pull(defaultdatatype, i1->defaultdatatype.buffer, sizeof(defaultdatatype), 0, STR_TERMINATE);
report(out_hnd, "\tversion:[%x]\n", i1->version);
- report(out_hnd, "\tname:[%s]\n",name );
+ report(out_hnd, "\tname:[%s]\n",name);
report(out_hnd, "\tarchitecture:[%s]\n", architecture);
report(out_hnd, "\tdriverpath:[%s]\n", driverpath);
report(out_hnd, "\tdatafile:[%s]\n", datafile);
@@ -763,7 +761,7 @@ static void display_print_driver_3(FILE *out_hnd, DRIVER_INFO_3 *i1)
while (valid)
{
- unistr_to_ascii(dependentfiles, i1->dependentfiles+length, sizeof(dependentfiles)-1);
+ rpcstr_pull(dependentfiles, i1->dependentfiles+length, sizeof(dependentfiles), 0, STR_TERMINATE);
length+=strlen(dependentfiles)+1;
if (strlen(dependentfiles) > 0)
@@ -888,7 +886,7 @@ static void display_printdriverdir_info_1(FILE *out_hnd, DRIVER_DIRECTORY_1 *i1)
if (i1 == NULL)
return;
- unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1);
+ rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
report(out_hnd, "\tname:[%s]\n", name);
}
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index e8029dec49..0d1b84f849 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -540,7 +540,6 @@ static void usage(char *pname)
server;
struct cmd_set **cmd_set;
- charset_initialise();
setlinebuf(stdout);
DEBUGLEVEL = 1;
@@ -623,7 +622,6 @@ static void usage(char *pname)
}
DEBUGLEVEL = olddebug;
- codepage_initialise(lp_client_code_page());
load_interfaces();
TimeInit();