/* go ahead and re-read the services immediately */
become_root();
- reload_services(msg_ctx, false);
+ reload_services(msg_ctx, smbd_server_fd(), false);
unbecome_root();
if ( lp_servicenumber( sharename ) > 0 )
/* check smb.conf parameters and the the sec_desc */
- if ( !check_access(get_client_fd(), lp_hostsallow(snum), lp_hostsdeny(snum)) ) {
+ if (!allow_access(lp_hostsdeny(snum), lp_hostsallow(snum),
+ p->client_id->name, p->client_id->addr)) {
DEBUG(3, ("access DENIED (hosts allow/deny) for printer open\n"));
ZERO_STRUCTP(r->out.handle);
return WERR_ACCESS_DENIED;
return WERR_BADFID;
DEBUG(10,("_spoolss_RemoteFindFirstPrinterChangeNotifyEx: "
- "client_address is %s\n", p->client_address));
+ "client_address is %s\n", p->client_id->addr));
- if (!interpret_string_addr(&client_ss, p->client_address,
+ if (!interpret_string_addr(&client_ss, p->client_id->addr,
AI_NUMERICHOST)) {
return WERR_SERVER_UNAVAILABLE;
}
*
********************************************************************/
-static bool construct_notify_printer_info(Printer_entry *print_hnd,
+static bool construct_notify_printer_info(struct messaging_context *msg_ctx,
+ Printer_entry *print_hnd,
struct spoolss_NotifyInfo *info,
struct spoolss_PrinterInfo2 *pinfo2,
int snum,
notify_info_data_table[j].name, snum,
pinfo2->printername));
- notify_info_data_table[j].fn(server_messaging_context(),
- snum, current_data, queue,
- pinfo2, mem_ctx);
+ notify_info_data_table[j].fn(msg_ctx, snum, current_data,
+ queue, pinfo2, mem_ctx);
info->count++;
}
*
********************************************************************/
-static bool construct_notify_jobs_info(print_queue_struct *queue,
+static bool construct_notify_jobs_info(struct messaging_context *msg_ctx,
+ print_queue_struct *queue,
struct spoolss_NotifyInfo *info,
struct spoolss_PrinterInfo2 *pinfo2,
int snum,
current_data=&(info->notifies[info->count]);
construct_info_data(current_data, type, field, id);
- notify_info_data_table[j].fn(server_messaging_context(),
- snum, current_data, queue,
- pinfo2, mem_ctx);
+ notify_info_data_table[j].fn(msg_ctx, snum, current_data,
+ queue, pinfo2, mem_ctx);
info->count++;
}
}
- construct_notify_printer_info(Printer, info,
+ construct_notify_printer_info(p->msg_ctx,
+ Printer, info,
pinfo2, snum,
&option_type, snum,
mem_ctx);
switch (option_type.type) {
case PRINTER_NOTIFY_TYPE:
- if (construct_notify_printer_info(Printer, info,
+ if (construct_notify_printer_info(p->msg_ctx,
+ Printer, info,
pinfo2, snum,
&option_type, id,
mem_ctx)) {
&status);
for (j=0; j<count; j++) {
- construct_notify_jobs_info(&queue[j], info,
+ construct_notify_jobs_info(p->msg_ctx,
+ &queue[j], info,
pinfo2, snum,
&option_type,
queue[j].job,
********************************************************************/
static WERROR construct_printer_info2(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg_ctx,
const struct spoolss_PrinterInfo2 *info2,
struct spoolss_PrinterInfo2 *r,
int snum)
int count;
print_status_struct status;
- count = print_queue_length(server_messaging_context(), snum, &status);
+ count = print_queue_length(msg_ctx, snum, &status);
r->servername = talloc_strdup(mem_ctx, info2->servername);
W_ERROR_HAVE_NO_MEMORY(r->servername);
********************************************************************/
static WERROR construct_printer_info6(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg_ctx,
const struct spoolss_PrinterInfo2 *info2,
struct spoolss_PrinterInfo6 *r,
int snum)
int count;
print_status_struct status;
- count = print_queue_length(server_messaging_context(), snum, &status);
+ count = print_queue_length(msg_ctx, snum, &status);
r->status = nt_printq_status(status.status);
&info[count].info1, snum);
break;
case 2:
- result = construct_printer_info2(info, info2,
+ result = construct_printer_info2(info, msg_ctx, info2,
&info[count].info2, snum);
break;
case 4:
&r->out.info->info1, snum);
break;
case 2:
- result = construct_printer_info2(p->mem_ctx, info2,
+ result = construct_printer_info2(p->mem_ctx, p->msg_ctx, info2,
&r->out.info->info2, snum);
break;
case 3:
&r->out.info->info5, snum);
break;
case 6:
- result = construct_printer_info6(p->mem_ctx, info2,
+ result = construct_printer_info6(p->mem_ctx, p->msg_ctx, info2,
&r->out.info->info6, snum);
break;
case 7:
return WERR_BADFID;
}
- werr = print_job_start(p->server_info, p->msg_ctx, snum,
+ werr = print_job_start(p->server_info, p->msg_ctx,
+ p->client_id->name, snum,
info_1->document_name, info_1->output_file,
Printer->devmode, &Printer->jobid);
buffer_written = print_job_write(server_event_context(),p->msg_ctx,
snum, Printer->jobid,
(const char *)r->in.data.data,
- (SMB_OFF_T)-1,
(size_t)r->in._data_size);
if (buffer_written == (ssize_t)-1) {
*r->out.num_written = 0;
/* reload our services immediately */
become_root();
- reload_services(msg_ctx, false);
+ reload_services(msg_ctx, smbd_server_fd(), false);
unbecome_root();
numlines = 0;
{
/* add_printer_hook() will call reload_services() */
if (!add_printer_hook(tmp_ctx, p->server_info->ptok,
- printer, p->client_address,
+ printer, p->client_id->addr,
p->msg_ctx)) {
result = WERR_ACCESS_DENIED;
goto done;
****************************************************************/
static WERROR spoolss_setjob_1(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg_ctx,
const char *printer_name,
uint32_t job_id,
struct spoolss_SetJobInfo1 *r)
return WERR_OK;
}
- if (!print_job_set_name(server_event_context(),
- server_messaging_context(),
+ if (!print_job_set_name(server_event_context(), msg_ctx,
printer_name, job_id, r->document_name)) {
return WERR_BADFID;
}
switch (r->in.ctr->level) {
case 1:
- errcode = spoolss_setjob_1(p->mem_ctx, lp_const_servicename(snum),
+ errcode = spoolss_setjob_1(p->mem_ctx, p->msg_ctx,
+ lp_const_servicename(snum),
r->in.job_id,
r->in.ctr->info.info1);
break;
if (*lp_addprinter_cmd() ) {
if ( !add_printer_hook(p->mem_ctx, p->server_info->ptok,
- info2, p->client_address,
+ info2, p->client_id->addr,
p->msg_ctx) ) {
return WERR_ACCESS_DENIED;
}