summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2010-06-30 10:25:08 +0200
committerSimo Sorce <idra@samba.org>2010-07-27 10:27:15 -0400
commit1be454538b2e4d242be90e43fab9eb09f0b07a57 (patch)
treebb4128d5dda2bbaf1ba2f6e44684b404609b4169
parentd8c81423aa52f1810cafeefa186f7dd0590cb0de (diff)
downloadsamba-1be454538b2e4d242be90e43fab9eb09f0b07a57.tar.gz
samba-1be454538b2e4d242be90e43fab9eb09f0b07a57.tar.bz2
samba-1be454538b2e4d242be90e43fab9eb09f0b07a57.zip
s3-spoolss: Remove the program global current_user_info.
Signed-off-by: Jim McDonough <jmcd@samba.org>
-rw-r--r--source3/include/nt_printing.h3
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c19
2 files changed, 6 insertions, 16 deletions
diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h
index 0ed0fce1b9..830afb4804 100644
--- a/source3/include/nt_printing.h
+++ b/source3/include/nt_printing.h
@@ -243,7 +243,8 @@ WERROR spoolss_map_to_os2_driver(TALLOC_CTX *mem_ctx, const char **pdrivername);
const char *get_short_archi(const char *long_archi);
bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token,
- struct spoolss_SetPrinterInfo2 *info2);
+ struct spoolss_SetPrinterInfo2 *info2,
+ const char *remote_machine);
bool print_access_check(struct auth_serversupplied_info *server_info, int snum,
int access_type);
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index f93b41aa7f..d44df2a217 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -51,9 +51,6 @@
#define SPOOLSS_BUFFER_OK(val_true,val_false) ((r->in.offered >= *r->out.needed)?val_true:val_false)
-
-extern userdom_struct current_user_info;
-
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
@@ -5533,7 +5530,8 @@ static WERROR add_port_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *p
****************************************************************************/
bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token,
- struct spoolss_SetPrinterInfo2 *info2)
+ struct spoolss_SetPrinterInfo2 *info2,
+ const char *remote_machine)
{
char *cmd = lp_addprinter_cmd();
char **qlines;
@@ -5543,18 +5541,10 @@ bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token,
int fd;
SE_PRIV se_printop = SE_PRINT_OPERATOR;
bool is_print_op = false;
- char *remote_machine = talloc_strdup(ctx, "%m");
if (!remote_machine) {
return false;
}
- remote_machine = talloc_sub_basic(ctx,
- current_user_info.smb_name,
- current_user_info.domain,
- remote_machine);
- if (!remote_machine) {
- return false;
- }
command = talloc_asprintf(ctx,
"%s \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"",
@@ -5589,7 +5579,6 @@ bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token,
DEBUGADD(10,("returned [%d]\n", ret));
TALLOC_FREE(command);
- TALLOC_FREE(remote_machine);
if ( ret != 0 ) {
if (fd != -1)
@@ -5958,7 +5947,7 @@ static WERROR update_printer(pipes_struct *p, struct policy_handle *handle,
{
/* add_printer_hook() will call reload_services() */
if (!add_printer_hook(tmp_ctx, p->server_info->ptok,
- printer) ) {
+ printer, p->client_address) ) {
result = WERR_ACCESS_DENIED;
goto done;
}
@@ -7247,7 +7236,7 @@ static WERROR spoolss_addprinterex_level_2(pipes_struct *p,
if (*lp_addprinter_cmd() ) {
if ( !add_printer_hook(p->mem_ctx, p->server_info->ptok,
- info2) ) {
+ info2, p->client_address) ) {
return WERR_ACCESS_DENIED;
}
} else {