mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
s3:net_rpc_printer: make use of cli_credentials_get_username()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Günther Deschner <gd@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Mon Sep 29 10:51:37 CEST 2014 on sn-devel-104
This commit is contained in:
parent
ceb26257dd
commit
f3ce6b4d35
@ -706,9 +706,10 @@ static bool net_spoolss_open_printer_ex(struct rpc_pipe_client *pipe_hnd,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
const char *printername,
|
||||
uint32_t access_required,
|
||||
const char *username,
|
||||
struct policy_handle *hnd)
|
||||
{
|
||||
struct cli_credentials *creds = gensec_get_credentials(pipe_hnd->auth->auth_ctx);
|
||||
const char *username = cli_credentials_get_username(creds);
|
||||
WERROR result;
|
||||
fstring printername2;
|
||||
|
||||
@ -1122,7 +1123,6 @@ static bool get_printer_info(struct rpc_pipe_client *pipe_hnd,
|
||||
{
|
||||
struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
|
||||
struct policy_handle hnd;
|
||||
struct cli_credentials *creds = gensec_get_credentials(pipe_hnd->auth->auth_ctx);
|
||||
WERROR werr;
|
||||
|
||||
/* no arguments given, enumerate all printers */
|
||||
@ -1139,7 +1139,6 @@ static bool get_printer_info(struct rpc_pipe_client *pipe_hnd,
|
||||
/* argument given, get a single printer by name */
|
||||
if (!net_spoolss_open_printer_ex(pipe_hnd, mem_ctx, argv[0],
|
||||
MAXIMUM_ALLOWED_ACCESS,
|
||||
cli_credentials_get_username(creds),
|
||||
&hnd))
|
||||
return false;
|
||||
|
||||
@ -1318,8 +1317,6 @@ static NTSTATUS rpc_printer_publish_internals_args(struct rpc_pipe_client *pipe_
|
||||
struct policy_handle hnd = { 0, };
|
||||
WERROR result;
|
||||
const char *action_str;
|
||||
struct cli_credentials *creds = gensec_get_credentials(pipe_hnd->auth->auth_ctx);
|
||||
const char *username = cli_credentials_get_username(creds);
|
||||
|
||||
if (!get_printer_info(pipe_hnd, mem_ctx, 2, argc, argv, &num_printers, &info_enum))
|
||||
return nt_status;
|
||||
@ -1335,7 +1332,7 @@ static NTSTATUS rpc_printer_publish_internals_args(struct rpc_pipe_client *pipe_
|
||||
|
||||
/* open printer handle */
|
||||
if (!net_spoolss_open_printer_ex(pipe_hnd, mem_ctx, sharename,
|
||||
PRINTER_ALL_ACCESS, username, &hnd))
|
||||
PRINTER_ALL_ACCESS, &hnd))
|
||||
goto done;
|
||||
|
||||
/* check for existing dst printer */
|
||||
@ -1492,7 +1489,7 @@ NTSTATUS rpc_printer_publish_list_internals(struct net_context *c,
|
||||
|
||||
/* open printer handle */
|
||||
if (!net_spoolss_open_printer_ex(pipe_hnd, mem_ctx, sharename,
|
||||
PRINTER_ALL_ACCESS, cli->user_name, &hnd))
|
||||
PRINTER_ALL_ACCESS, &hnd))
|
||||
goto done;
|
||||
|
||||
/* check for existing dst printer */
|
||||
@ -1628,12 +1625,12 @@ NTSTATUS rpc_printer_migrate_security_internals(struct net_context *c,
|
||||
|
||||
/* open src printer handle */
|
||||
if (!net_spoolss_open_printer_ex(pipe_hnd, mem_ctx, sharename,
|
||||
MAXIMUM_ALLOWED_ACCESS, cli->user_name, &hnd_src))
|
||||
MAXIMUM_ALLOWED_ACCESS, &hnd_src))
|
||||
goto done;
|
||||
|
||||
/* open dst printer handle */
|
||||
if (!net_spoolss_open_printer_ex(pipe_hnd_dst, mem_ctx, sharename,
|
||||
PRINTER_ALL_ACCESS, cli_dst->user_name, &hnd_dst))
|
||||
PRINTER_ALL_ACCESS, &hnd_dst))
|
||||
goto done;
|
||||
|
||||
/* check for existing dst printer */
|
||||
@ -1784,12 +1781,12 @@ NTSTATUS rpc_printer_migrate_forms_internals(struct net_context *c,
|
||||
|
||||
/* open src printer handle */
|
||||
if (!net_spoolss_open_printer_ex(pipe_hnd, mem_ctx, sharename,
|
||||
MAXIMUM_ALLOWED_ACCESS, cli->user_name, &hnd_src))
|
||||
MAXIMUM_ALLOWED_ACCESS, &hnd_src))
|
||||
goto done;
|
||||
|
||||
/* open dst printer handle */
|
||||
if (!net_spoolss_open_printer_ex(pipe_hnd_dst, mem_ctx, sharename,
|
||||
PRINTER_ALL_ACCESS, cli->user_name, &hnd_dst))
|
||||
PRINTER_ALL_ACCESS, &hnd_dst))
|
||||
goto done;
|
||||
|
||||
/* check for existing dst printer */
|
||||
@ -1917,8 +1914,6 @@ NTSTATUS rpc_printer_migrate_drivers_internals(struct net_context *c,
|
||||
struct cli_state *cli_share_src = NULL;
|
||||
struct cli_state *cli_share_dst = NULL;
|
||||
const char *drivername = NULL;
|
||||
struct cli_credentials *creds = gensec_get_credentials(pipe_hnd->auth->auth_ctx);
|
||||
const char *username = cli_credentials_get_username(creds);
|
||||
WERROR werr;
|
||||
|
||||
DEBUG(3,("copying printer-drivers\n"));
|
||||
@ -1986,7 +1981,7 @@ NTSTATUS rpc_printer_migrate_drivers_internals(struct net_context *c,
|
||||
|
||||
/* open dst printer handle */
|
||||
if (!net_spoolss_open_printer_ex(pipe_hnd_dst, mem_ctx, sharename,
|
||||
PRINTER_ALL_ACCESS, cli->user_name, &hnd_dst))
|
||||
PRINTER_ALL_ACCESS, &hnd_dst))
|
||||
goto done;
|
||||
|
||||
/* check for existing dst printer */
|
||||
@ -1997,7 +1992,6 @@ NTSTATUS rpc_printer_migrate_drivers_internals(struct net_context *c,
|
||||
/* open src printer handle */
|
||||
if (!net_spoolss_open_printer_ex(pipe_hnd, mem_ctx, sharename,
|
||||
MAXIMUM_ALLOWED_ACCESS,
|
||||
username,
|
||||
&hnd_src))
|
||||
goto done;
|
||||
|
||||
@ -2183,7 +2177,7 @@ NTSTATUS rpc_printer_migrate_printers_internals(struct net_context *c,
|
||||
|
||||
/* open dst printer handle */
|
||||
if (!net_spoolss_open_printer_ex(pipe_hnd_dst, mem_ctx, sharename,
|
||||
PRINTER_ALL_ACCESS, cli->user_name, &hnd_dst)) {
|
||||
PRINTER_ALL_ACCESS, &hnd_dst)) {
|
||||
|
||||
DEBUG(1,("could not open printer: %s\n", sharename));
|
||||
}
|
||||
@ -2205,7 +2199,7 @@ NTSTATUS rpc_printer_migrate_printers_internals(struct net_context *c,
|
||||
|
||||
/* open src printer handle */
|
||||
if (!net_spoolss_open_printer_ex(pipe_hnd, mem_ctx, sharename,
|
||||
MAXIMUM_ALLOWED_ACCESS, cli->user_name, &hnd_src))
|
||||
MAXIMUM_ALLOWED_ACCESS, &hnd_src))
|
||||
goto done;
|
||||
|
||||
/* getprinter on the src server */
|
||||
@ -2370,12 +2364,12 @@ NTSTATUS rpc_printer_migrate_settings_internals(struct net_context *c,
|
||||
|
||||
/* open src printer handle */
|
||||
if (!net_spoolss_open_printer_ex(pipe_hnd, mem_ctx, sharename,
|
||||
MAXIMUM_ALLOWED_ACCESS, cli->user_name, &hnd_src))
|
||||
MAXIMUM_ALLOWED_ACCESS, &hnd_src))
|
||||
goto done;
|
||||
|
||||
/* open dst printer handle */
|
||||
if (!net_spoolss_open_printer_ex(pipe_hnd_dst, mem_ctx, sharename,
|
||||
PRINTER_ALL_ACCESS, cli_dst->user_name, &hnd_dst))
|
||||
PRINTER_ALL_ACCESS, &hnd_dst))
|
||||
goto done;
|
||||
|
||||
/* check for existing dst printer */
|
||||
|
Loading…
Reference in New Issue
Block a user