|
|
|
|
@@ -675,7 +675,7 @@ static WERROR cmd_spoolss_getprinter(struct rpc_pipe_client *cli,
|
|
|
|
|
|
|
|
|
|
static void display_reg_value(REGISTRY_VALUE value)
|
|
|
|
|
{
|
|
|
|
|
pstring text;
|
|
|
|
|
char *text = NULL;
|
|
|
|
|
|
|
|
|
|
switch(value.type) {
|
|
|
|
|
case REG_DWORD:
|
|
|
|
|
@@ -683,9 +683,12 @@ static void display_reg_value(REGISTRY_VALUE value)
|
|
|
|
|
*((uint32 *) value.data_p));
|
|
|
|
|
break;
|
|
|
|
|
case REG_SZ:
|
|
|
|
|
rpcstr_pull(text, value.data_p, sizeof(text), value.size,
|
|
|
|
|
STR_TERMINATE);
|
|
|
|
|
printf("%s: REG_SZ: %s\n", value.valuename, text);
|
|
|
|
|
rpcstr_pull_talloc(talloc_tos(),
|
|
|
|
|
&text,
|
|
|
|
|
value.data_p,
|
|
|
|
|
value.size,
|
|
|
|
|
STR_TERMINATE);
|
|
|
|
|
printf("%s: REG_SZ: %s\n", value.valuename, text ? text : "");
|
|
|
|
|
break;
|
|
|
|
|
case REG_BINARY: {
|
|
|
|
|
char *hex = hex_encode(NULL, value.data_p, value.size);
|
|
|
|
|
@@ -2163,7 +2166,7 @@ static WERROR cmd_spoolss_enum_jobs(struct rpc_pipe_client *cli,
|
|
|
|
|
WERROR result;
|
|
|
|
|
uint32 level = 1, num_jobs, i;
|
|
|
|
|
bool got_hnd = False;
|
|
|
|
|
pstring printername;
|
|
|
|
|
char *printername = NULL;
|
|
|
|
|
fstring servername, user;
|
|
|
|
|
POLICY_HND hnd;
|
|
|
|
|
JOB_INFO_CTR ctr;
|
|
|
|
|
@@ -2181,9 +2184,17 @@ static WERROR cmd_spoolss_enum_jobs(struct rpc_pipe_client *cli,
|
|
|
|
|
slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost);
|
|
|
|
|
strupper_m(servername);
|
|
|
|
|
fstrcpy(user, cli->user_name);
|
|
|
|
|
slprintf(printername, sizeof(servername)-1, "\\\\%s\\", cli->cli->desthost);
|
|
|
|
|
printername = talloc_asprintf(mem_ctx,
|
|
|
|
|
"\\\\%s\\",
|
|
|
|
|
cli->cli->desthost);
|
|
|
|
|
if (!printername) {
|
|
|
|
|
return WERR_NOMEM;
|
|
|
|
|
}
|
|
|
|
|
strupper_m(printername);
|
|
|
|
|
pstrcat(printername, argv[1]);
|
|
|
|
|
printername = talloc_asprintf_append(printername, "%s", argv[1]);
|
|
|
|
|
if (!printername) {
|
|
|
|
|
return WERR_NOMEM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername,
|
|
|
|
|
"", MAXIMUM_ALLOWED_ACCESS,
|
|
|
|
|
@@ -2233,7 +2244,7 @@ static WERROR cmd_spoolss_enum_data( struct rpc_pipe_client *cli,
|
|
|
|
|
WERROR result;
|
|
|
|
|
uint32 i=0, val_needed, data_needed;
|
|
|
|
|
bool got_hnd = False;
|
|
|
|
|
pstring printername;
|
|
|
|
|
char *printername = NULL;
|
|
|
|
|
fstring servername, user;
|
|
|
|
|
POLICY_HND hnd;
|
|
|
|
|
|
|
|
|
|
@@ -2247,9 +2258,19 @@ static WERROR cmd_spoolss_enum_data( struct rpc_pipe_client *cli,
|
|
|
|
|
slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost);
|
|
|
|
|
strupper_m(servername);
|
|
|
|
|
fstrcpy(user, cli->user_name);
|
|
|
|
|
slprintf(printername, sizeof(printername)-1, "\\\\%s\\", cli->cli->desthost);
|
|
|
|
|
printername = talloc_asprintf(mem_ctx,
|
|
|
|
|
"\\\\%s\\",
|
|
|
|
|
cli->cli->desthost);
|
|
|
|
|
if (!printername) {
|
|
|
|
|
return WERR_NOMEM;
|
|
|
|
|
}
|
|
|
|
|
strupper_m(printername);
|
|
|
|
|
pstrcat(printername, argv[1]);
|
|
|
|
|
printername = talloc_asprintf_append(mem_ctx,
|
|
|
|
|
"%s",
|
|
|
|
|
argv[1]);
|
|
|
|
|
if (!printername) {
|
|
|
|
|
return WERR_NOMEM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername,
|
|
|
|
|
"", MAXIMUM_ALLOWED_ACCESS,
|
|
|
|
|
@@ -2293,7 +2314,7 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli,
|
|
|
|
|
WERROR result;
|
|
|
|
|
uint32 i;
|
|
|
|
|
bool got_hnd = False;
|
|
|
|
|
pstring printername;
|
|
|
|
|
char *printername = NULL;
|
|
|
|
|
fstring servername, user;
|
|
|
|
|
const char *keyname = NULL;
|
|
|
|
|
POLICY_HND hnd;
|
|
|
|
|
@@ -2311,9 +2332,20 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli,
|
|
|
|
|
slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost);
|
|
|
|
|
strupper_m(servername);
|
|
|
|
|
fstrcpy(user, cli->user_name);
|
|
|
|
|
slprintf(printername, sizeof(printername)-1, "\\\\%s\\", cli->cli->desthost);
|
|
|
|
|
|
|
|
|
|
printername = talloc_asprintf(mem_ctx,
|
|
|
|
|
"\\\\%s\\",
|
|
|
|
|
cli->cli->desthost);
|
|
|
|
|
if (!printername) {
|
|
|
|
|
return WERR_NOMEM;
|
|
|
|
|
}
|
|
|
|
|
strupper_m(printername);
|
|
|
|
|
pstrcat(printername, argv[1]);
|
|
|
|
|
printername = talloc_asprintf_append(mem_ctx,
|
|
|
|
|
"%s",
|
|
|
|
|
argv[1]);
|
|
|
|
|
if (!printername) {
|
|
|
|
|
return WERR_NOMEM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername,
|
|
|
|
|
"", MAXIMUM_ALLOWED_ACCESS,
|
|
|
|
|
@@ -2356,7 +2388,7 @@ static WERROR cmd_spoolss_enum_printerkey( struct rpc_pipe_client *cli,
|
|
|
|
|
{
|
|
|
|
|
WERROR result;
|
|
|
|
|
bool got_hnd = False;
|
|
|
|
|
pstring printername;
|
|
|
|
|
char *printername = NULL;
|
|
|
|
|
fstring servername, user;
|
|
|
|
|
const char *keyname = NULL;
|
|
|
|
|
POLICY_HND hnd;
|
|
|
|
|
@@ -2377,9 +2409,21 @@ static WERROR cmd_spoolss_enum_printerkey( struct rpc_pipe_client *cli,
|
|
|
|
|
slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost);
|
|
|
|
|
strupper_m(servername);
|
|
|
|
|
fstrcpy(user, cli->user_name);
|
|
|
|
|
slprintf(printername, sizeof(printername)-1, "\\\\%s\\", cli->cli->desthost);
|
|
|
|
|
|
|
|
|
|
printername = talloc_asprintf(mem_ctx,
|
|
|
|
|
"\\\\%s\\",
|
|
|
|
|
cli->cli->desthost);
|
|
|
|
|
if (!printername) {
|
|
|
|
|
return WERR_NOMEM;
|
|
|
|
|
}
|
|
|
|
|
strupper_m(printername);
|
|
|
|
|
pstrcat(printername, argv[1]);
|
|
|
|
|
printername = talloc_asprintf_append(mem_ctx,
|
|
|
|
|
"%s",
|
|
|
|
|
argv[1]);
|
|
|
|
|
if (!printername) {
|
|
|
|
|
return WERR_NOMEM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername,
|
|
|
|
|
"", MAXIMUM_ALLOWED_ACCESS,
|
|
|
|
|
@@ -2399,9 +2443,12 @@ static WERROR cmd_spoolss_enum_printerkey( struct rpc_pipe_client *cli,
|
|
|
|
|
|
|
|
|
|
curkey = keylist;
|
|
|
|
|
while (*curkey != 0) {
|
|
|
|
|
pstring subkey;
|
|
|
|
|
rpcstr_pull(subkey, curkey, sizeof(subkey), -1,
|
|
|
|
|
char *subkey = NULL;
|
|
|
|
|
rpcstr_pull_talloc(mem_ctx, &subkey, curkey, -1,
|
|
|
|
|
STR_TERMINATE);
|
|
|
|
|
if (!subkey) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
printf("%s\n", subkey);
|
|
|
|
|
curkey += strlen(subkey) + 1;
|
|
|
|
|
}
|
|
|
|
|
@@ -2605,7 +2652,7 @@ static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli,
|
|
|
|
|
const char **argv)
|
|
|
|
|
{
|
|
|
|
|
fstring printername, servername1, servername2;
|
|
|
|
|
pstring printername_path;
|
|
|
|
|
char *printername_path = NULL;
|
|
|
|
|
struct cli_state *cli_server1 = cli->cli;
|
|
|
|
|
struct cli_state *cli_server2 = NULL;
|
|
|
|
|
struct rpc_pipe_client *cli2 = NULL;
|
|
|
|
|
@@ -2625,7 +2672,6 @@ static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli,
|
|
|
|
|
strupper_m( servername1 );
|
|
|
|
|
strupper_m( servername2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* first get the connection to the remote server */
|
|
|
|
|
|
|
|
|
|
nt_status = cli_full_connection(&cli_server2, global_myname(), servername2,
|
|
|
|
|
@@ -2649,7 +2695,13 @@ static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli,
|
|
|
|
|
|
|
|
|
|
/* now open up both printers */
|
|
|
|
|
|
|
|
|
|
pstr_sprintf( printername_path, "\\\\%s\\%s", servername1, printername );
|
|
|
|
|
printername_path = talloc_asprintf(mem_ctx,
|
|
|
|
|
"\\\\%s\\%s",
|
|
|
|
|
servername1,
|
|
|
|
|
printername);
|
|
|
|
|
if (!printername_path) {
|
|
|
|
|
return WERR_NOMEM;
|
|
|
|
|
}
|
|
|
|
|
printf("Opening %s...", printername_path);
|
|
|
|
|
werror = rpccli_spoolss_open_printer_ex( cli, mem_ctx, printername_path,
|
|
|
|
|
"", PRINTER_ALL_ACCESS, servername1, cli_server1->user_name, &hPrinter1);
|
|
|
|
|
@@ -2659,7 +2711,13 @@ static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli,
|
|
|
|
|
}
|
|
|
|
|
printf("ok\n");
|
|
|
|
|
|
|
|
|
|
pstr_sprintf( printername_path, "\\\\%s\\%s", servername2, printername );
|
|
|
|
|
printername_path = talloc_asprintf(mem_ctx,
|
|
|
|
|
"\\\\%s\\%s",
|
|
|
|
|
servername2,
|
|
|
|
|
printername);
|
|
|
|
|
if (!printername_path) {
|
|
|
|
|
return WERR_NOMEM;
|
|
|
|
|
}
|
|
|
|
|
printf("Opening %s...", printername_path);
|
|
|
|
|
werror = rpccli_spoolss_open_printer_ex( cli2, mem_ctx, printername_path,
|
|
|
|
|
"", PRINTER_ALL_ACCESS, servername2, cli_server2->user_name, &hPrinter2 );
|
|
|
|
|
@@ -2669,7 +2727,6 @@ static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli,
|
|
|
|
|
}
|
|
|
|
|
printf("ok\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compare_printer( cli, &hPrinter1, cli2, &hPrinter2 );
|
|
|
|
|
compare_printer_secdesc( cli, &hPrinter1, cli2, &hPrinter2 );
|
|
|
|
|
#if 0
|
|
|
|
|
@@ -2688,7 +2745,6 @@ done:
|
|
|
|
|
/* close the second remote connection */
|
|
|
|
|
|
|
|
|
|
cli_shutdown( cli_server2 );
|
|
|
|
|
|
|
|
|
|
return WERR_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|