diff options
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_samr.c | 4 | ||||
-rw-r--r-- | source3/rpcclient/cmd_spoolss.c | 40 | ||||
-rw-r--r-- | source3/rpcclient/rpcclient.c | 8 |
3 files changed, 49 insertions, 3 deletions
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index c66f79938b..4d6cdf6409 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -1435,7 +1435,7 @@ void cmd_sam_add_aliasmem(struct client_info *info) while (next_token(NULL, tmp, NULL, sizeof(tmp))) { - if (!add_chars_to_array(&num_names, &names, tmp)) + if (add_chars_to_array(&num_names, &names, tmp) == NULL) { return; } @@ -1971,7 +1971,7 @@ void cmd_sam_add_groupmem(struct client_info *info) while (res && next_token(NULL, tmp, NULL, sizeof(tmp))) { - if (!add_chars_to_array(&num_names, &names, tmp)) + if (add_chars_to_array(&num_names, &names, tmp) == NULL) { return; } diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index 0e931d4a39..8966eb45c2 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -40,6 +40,46 @@ extern int smb_tidx; /**************************************************************************** nt spoolss query ****************************************************************************/ +void cmd_spoolss_enum_printers(struct client_info *info) +{ + uint16 nt_pipe_fnum; + fstring srv_name; + void **printers = NULL; + uint32 count = 0; + + BOOL res = True; + + fstrcpy(srv_name, "\\\\"); + fstrcat(srv_name, smb_cli->desthost); + strupper(srv_name); + + DEBUG(5, ("cmd_spoolss_open_printer_ex: smb_cli->fd:%d\n", smb_cli->fd)); + + /* open SPOOLSS session. */ + res = res ? cli_nt_session_open(smb_cli, PIPE_SPOOLSS, &nt_pipe_fnum) : False; + + res = res ? spoolss_enum_printers(smb_cli, nt_pipe_fnum, + 0x40, srv_name, 1, &count, &printers) : False; + + /* close the session */ + cli_nt_session_close(smb_cli, nt_pipe_fnum); + + if (res) + { + DEBUG(5,("cmd_spoolss_enum_printer: query succeeded\n")); + report(out_hnd, "OK\n"); + } + else + { + DEBUG(5,("cmd_spoolss_enum_printer: query failed\n")); + } + + free_void_array(count, printers, free); +} + +/**************************************************************************** +nt spoolss query +****************************************************************************/ void cmd_spoolss_open_printer_ex(struct client_info *info) { uint16 nt_pipe_fnum; diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 681ebb42fa..2231824b95 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -236,9 +236,15 @@ commands[] = */ { + "spoolenum", + cmd_spoolss_enum_printers, + "Spool Printer Enum Test", + {COMPL_NONE, COMPL_NONE} + }, + { "spoolopen", cmd_spoolss_open_printer_ex, - "Spool Printer Open Test", + "<printer name> Spool Printer Open Test", {COMPL_NONE, COMPL_NONE} }, /* |