summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/client.h7
-rw-r--r--source3/libads/ldap_printer.c3
-rw-r--r--source3/rpc_client/cli_pipe.c34
-rw-r--r--source3/rpc_client/cli_spoolss.c2
-rw-r--r--source3/rpcclient/cmd_spoolss.c39
-rw-r--r--source3/utils/net_rpc_printer.c10
6 files changed, 52 insertions, 43 deletions
diff --git a/source3/include/client.h b/source3/include/client.h
index d866c09cce..3459ae20d0 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -49,6 +49,10 @@ struct print_job_info {
struct cli_pipe_auth_data {
enum pipe_auth_type auth_type; /* switch for the union below. Defined in ntdomain.h */
enum pipe_auth_level auth_level; /* defined in ntdomain.h */
+
+ char *domain;
+ char *user_name;
+
union {
struct schannel_auth_struct *schannel_auth;
NTLMSSP_STATE *ntlmssp_state;
@@ -71,9 +75,6 @@ struct rpc_pipe_client {
char *desthost;
char *srv_name_slash;
- char *domain;
- char *user_name;
-
uint16 max_xmit_frag;
uint16 max_recv_frag;
diff --git a/source3/libads/ldap_printer.c b/source3/libads/ldap_printer.c
index 6682ec24d0..41f23b06a7 100644
--- a/source3/libads/ldap_printer.c
+++ b/source3/libads/ldap_printer.c
@@ -296,7 +296,8 @@ WERROR get_remote_printer_publishing_data(struct rpc_pipe_client *cli,
result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername,
"", MAXIMUM_ALLOWED_ACCESS,
- servername, cli->user_name, &pol);
+ servername, cli->auth->user_name,
+ &pol);
if (!W_ERROR_IS_OK(result)) {
DEBUG(3, ("Unable to open printer %s, error is %s.\n",
printername, dos_errstr(result)));
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 8c540ee6fd..14ee78202a 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -1067,14 +1067,15 @@ static NTSTATUS create_schannel_auth_rpc_bind_req( struct rpc_pipe_client *cli,
/* Use lp_workgroup() if domain not specified */
- if (!cli->domain || !cli->domain[0]) {
- cli->domain = talloc_strdup(cli, lp_workgroup());
- if (cli->domain == NULL) {
+ if (!cli->auth->domain || !cli->auth->domain[0]) {
+ cli->auth->domain = talloc_strdup(cli, lp_workgroup());
+ if (cli->auth->domain == NULL) {
return NT_STATUS_NO_MEMORY;
}
}
- init_rpc_auth_schannel_neg(&schannel_neg, cli->domain, global_myname());
+ init_rpc_auth_schannel_neg(&schannel_neg, cli->auth->domain,
+ global_myname());
/*
* Now marshall the data into the auth parse_struct.
@@ -2235,14 +2236,14 @@ static struct rpc_pipe_client *cli_rpc_pipe_open(struct cli_state *cli, int pipe
result->auth->auth_type = PIPE_AUTH_TYPE_NONE;
result->auth->auth_level = PIPE_AUTH_LEVEL_NONE;
- result->domain = talloc_strdup(result, cli->domain);
- result->user_name = talloc_strdup(result, cli->user_name);
+ result->auth->domain = talloc_strdup(result, cli->domain);
+ result->auth->user_name = talloc_strdup(result, cli->user_name);
result->desthost = talloc_strdup(result, cli->desthost);
result->srv_name_slash = talloc_asprintf_strupper_m(
result, "\\\\%s", result->desthost);
- if ((result->domain == NULL)
- || (result->user_name == NULL)
+ if ((result->auth->domain == NULL)
+ || (result->auth->user_name == NULL)
|| (result->desthost == NULL)
|| (result->srv_name_slash == NULL)) {
*perr = NT_STATUS_NO_MEMORY;
@@ -2349,13 +2350,14 @@ static struct rpc_pipe_client *cli_rpc_pipe_open_ntlmssp_internal(struct cli_sta
result->auth->cli_auth_data_free_func = cli_ntlmssp_auth_free;
- TALLOC_FREE(result->domain);
- TALLOC_FREE(result->user_name);
+ TALLOC_FREE(result->auth->domain);
+ TALLOC_FREE(result->auth->user_name);
- result->domain = talloc_strdup(result, domain);
- result->user_name = talloc_strdup(result, username);
+ result->auth->domain = talloc_strdup(result, domain);
+ result->auth->user_name = talloc_strdup(result, username);
- if ((result->domain == NULL) || (result->user_name == NULL)) {
+ if ((result->auth->domain == NULL)
+ || (result->auth->user_name == NULL)) {
*perr = NT_STATUS_NO_MEMORY;
goto err;
}
@@ -2570,9 +2572,9 @@ struct rpc_pipe_client *cli_rpc_pipe_open_schannel_with_key(struct cli_state *cl
return NULL;
}
- TALLOC_FREE(result->domain);
- result->domain = talloc_strdup(result, domain);
- if (result->domain == NULL) {
+ TALLOC_FREE(result->auth->domain);
+ result->auth->domain = talloc_strdup(result, domain);
+ if (result->auth->domain == NULL) {
TALLOC_FREE(result);
*perr = NT_STATUS_NO_MEMORY;
return NULL;
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c
index 823af6fb4f..223a277d4a 100644
--- a/source3/rpc_client/cli_spoolss.c
+++ b/source3/rpc_client/cli_spoolss.c
@@ -1031,7 +1031,7 @@ WERROR rpccli_spoolss_addprinterex (struct rpc_pipe_client *cli, TALLOC_CTX *mem
strupper_m(client);
strupper_m(server);
- fstrcpy (user, cli->user_name);
+ fstrcpy (user, cli->auth->user_name);
make_spoolss_q_addprinterex( mem_ctx, &in, server, client,
user, level, ctr);
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index c89f987446..5368a0ff4e 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -111,7 +111,7 @@ static WERROR cmd_spoolss_open_printer_ex(struct rpc_pipe_client *cli,
slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
strupper_m(servername);
- fstrcpy(user, cli->user_name);
+ fstrcpy(user, cli->auth->user_name);
fstrcpy(printername, argv[1]);
/* Open the printer handle */
@@ -491,7 +491,7 @@ static WERROR cmd_spoolss_setprinter(struct rpc_pipe_client *cli,
slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
strupper_m(servername);
slprintf(printername, sizeof(servername)-1, "%s\\%s", servername, argv[1]);
- fstrcpy(user, cli->user_name);
+ fstrcpy(user, cli->auth->user_name);
/* get a printer handle */
result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername, "",
@@ -557,7 +557,7 @@ static WERROR cmd_spoolss_setprintername(struct rpc_pipe_client *cli,
slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
strupper_m(servername);
slprintf(printername, sizeof(printername)-1, "%s\\%s", servername, argv[1]);
- fstrcpy(user, cli->user_name);
+ fstrcpy(user, cli->auth->user_name);
/* get a printer handle */
result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername, "",
@@ -620,7 +620,7 @@ static WERROR cmd_spoolss_getprinter(struct rpc_pipe_client *cli,
slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
strupper_m(servername);
slprintf(printername, sizeof(printername)-1, "%s\\%s", servername, argv[1]);
- fstrcpy(user, cli->user_name);
+ fstrcpy(user, cli->auth->user_name);
/* get a printer handle */
@@ -763,7 +763,7 @@ static WERROR cmd_spoolss_getprinterdata(struct rpc_pipe_client *cli,
else
slprintf(printername, sizeof(servername)-1, "%s\\%s",
servername, argv[1]);
- fstrcpy(user, cli->user_name);
+ fstrcpy(user, cli->auth->user_name);
/* get a printer handle */
@@ -830,7 +830,7 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli,
else
slprintf(printername, sizeof(printername)-1, "%s\\%s",
servername, argv[1]);
- fstrcpy(user, cli->user_name);
+ fstrcpy(user, cli->auth->user_name);
/* get a printer handle */
@@ -1001,7 +1001,7 @@ static WERROR cmd_spoolss_getdriver(struct rpc_pipe_client *cli,
/* get the arguments need to open the printer handle */
slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
strupper_m(servername);
- fstrcpy(user, cli->user_name);
+ fstrcpy(user, cli->auth->user_name);
slprintf(printername, sizeof(servername)-1, "%s\\%s", servername, argv[1]);
if (argc == 3)
info_level = atoi(argv[2]);
@@ -1447,7 +1447,7 @@ static WERROR cmd_spoolss_setdriver(struct rpc_pipe_client *cli,
slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
strupper_m(servername);
slprintf(printername, sizeof(printername)-1, "%s\\%s", servername, argv[1]);
- fstrcpy(user, cli->user_name);
+ fstrcpy(user, cli->auth->user_name);
/* Get a printer handle */
@@ -1660,7 +1660,8 @@ static WERROR cmd_spoolss_addform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
werror = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername, "",
PRINTER_ALL_ACCESS,
- servername, cli->user_name, &handle);
+ servername, cli->auth->user_name,
+ &handle);
if (!W_ERROR_IS_OK(werror))
goto done;
@@ -1720,7 +1721,7 @@ static WERROR cmd_spoolss_setform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
werror = rpccli_spoolss_open_printer_ex(
cli, mem_ctx, printername, "", MAXIMUM_ALLOWED_ACCESS,
- servername, cli->user_name, &handle);
+ servername, cli->auth->user_name, &handle);
if (!W_ERROR_IS_OK(werror))
goto done;
@@ -1817,7 +1818,7 @@ static WERROR cmd_spoolss_getform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
werror = rpccli_spoolss_open_printer_ex(
cli, mem_ctx, printername, "", MAXIMUM_ALLOWED_ACCESS,
- servername, cli->user_name, &handle);
+ servername, cli->auth->user_name, &handle);
if (!W_ERROR_IS_OK(werror))
goto done;
@@ -1870,7 +1871,7 @@ static WERROR cmd_spoolss_deleteform(struct rpc_pipe_client *cli,
werror = rpccli_spoolss_open_printer_ex(
cli, mem_ctx, printername, "", MAXIMUM_ALLOWED_ACCESS,
- servername, cli->user_name, &handle);
+ servername, cli->auth->user_name, &handle);
if (!W_ERROR_IS_OK(werror))
goto done;
@@ -1920,7 +1921,7 @@ static WERROR cmd_spoolss_enum_forms(struct rpc_pipe_client *cli,
werror = rpccli_spoolss_open_printer_ex(
cli, mem_ctx, printername, "", MAXIMUM_ALLOWED_ACCESS,
- servername, cli->user_name, &handle);
+ servername, cli->auth->user_name, &handle);
if (!W_ERROR_IS_OK(werror))
goto done;
@@ -1980,7 +1981,7 @@ static WERROR cmd_spoolss_setprinterdata(struct rpc_pipe_client *cli,
slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
strupper_m(servername);
slprintf(printername, sizeof(servername)-1, "%s\\%s", servername, argv[1]);
- fstrcpy(user, cli->user_name);
+ fstrcpy(user, cli->auth->user_name);
value.type = REG_NONE;
@@ -2189,7 +2190,7 @@ static WERROR cmd_spoolss_enum_jobs(struct rpc_pipe_client *cli,
slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
strupper_m(servername);
- fstrcpy(user, cli->user_name);
+ fstrcpy(user, cli->auth->user_name);
printername = talloc_asprintf(mem_ctx, "\\\\%s\\", cli->desthost);
if (!printername) {
return WERR_NOMEM;
@@ -2261,7 +2262,7 @@ static WERROR cmd_spoolss_enum_data( struct rpc_pipe_client *cli,
slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
strupper_m(servername);
- fstrcpy(user, cli->user_name);
+ fstrcpy(user, cli->auth->user_name);
printername = talloc_asprintf(mem_ctx, "\\\\%s\\", cli->desthost);
if (!printername) {
return WERR_NOMEM;
@@ -2331,7 +2332,7 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli,
slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
strupper_m(servername);
- fstrcpy(user, cli->user_name);
+ fstrcpy(user, cli->auth->user_name);
printername = talloc_asprintf(mem_ctx, "\\\\%s\\", cli->desthost);
if (!printername) {
@@ -2404,7 +2405,7 @@ static WERROR cmd_spoolss_enum_printerkey( struct rpc_pipe_client *cli,
slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
strupper_m(servername);
- fstrcpy(user, cli->user_name);
+ fstrcpy(user, cli->auth->user_name);
printername = talloc_asprintf(mem_ctx, "\\\\%s\\", cli->desthost);
if (!printername) {
@@ -2485,7 +2486,7 @@ static WERROR cmd_spoolss_rffpcnex(struct rpc_pipe_client *cli,
result = rpccli_spoolss_open_printer_ex(
cli, mem_ctx, printername, "", MAXIMUM_ALLOWED_ACCESS,
- servername, cli->user_name, &hnd);
+ servername, cli->auth->user_name, &hnd);
if (!W_ERROR_IS_OK(result)) {
printf("Error opening %s\n", argv[1]);
diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c
index 9dc409123e..bdf5b09205 100644
--- a/source3/utils/net_rpc_printer.c
+++ b/source3/utils/net_rpc_printer.c
@@ -994,7 +994,9 @@ 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, pipe_hnd->user_name, &hnd))
+ MAXIMUM_ALLOWED_ACCESS,
+ pipe_hnd->auth->user_name,
+ &hnd))
return False;
if (!net_spoolss_getprinter(pipe_hnd, mem_ctx, &hnd, level, ctr)) {
@@ -1190,7 +1192,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, pipe_hnd->user_name, &hnd))
+ PRINTER_ALL_ACCESS, pipe_hnd->auth->user_name, &hnd))
goto done;
got_hnd = True;
@@ -1838,7 +1840,9 @@ NTSTATUS rpc_printer_migrate_drivers_internals(const DOM_SID *domain_sid,
/* open src printer handle */
if (!net_spoolss_open_printer_ex(pipe_hnd, mem_ctx, sharename,
- MAXIMUM_ALLOWED_ACCESS, pipe_hnd->user_name, &hnd_src))
+ MAXIMUM_ALLOWED_ACCESS,
+ pipe_hnd->auth->user_name,
+ &hnd_src))
goto done;
got_hnd_src = True;