#include "util_tdb.h"
#include "libsmb/libsmb.h"
#include "printing/printer_list.h"
+#include "../lib/tsocket/tsocket.h"
+#include "rpc_client/cli_winreg_spoolss.h"
/* macros stolen from s4 spoolss server */
#define SPOOLSS_BUFFER_UNION(fn,info,level) \
/* this does not need a become root since the access check has been
done on the handle already */
- result = winreg_delete_printer_key(p->mem_ctx,
+ result = winreg_delete_printer_key_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
Printer->sharename,
continue;
}
- result = winreg_get_printer(mem_ctx,
+ result = winreg_get_printer_internal(mem_ctx,
session_info,
msg_ctx,
sname,
const char *drivername;
int snum;
int n_services = lp_numservices();
+ struct dcerpc_binding_handle *b = NULL;
tmp_ctx = talloc_new(NULL);
if (!tmp_ctx) return;
continue;
}
- result = winreg_get_printer(tmp_ctx, session_info, msg,
+ if (b == NULL) {
+ result = winreg_printer_binding_handle(tmp_ctx,
+ session_info,
+ msg,
+ &b);
+ if (!W_ERROR_IS_OK(result)) {
+ break;
+ }
+ }
+
+ result = winreg_get_printer(tmp_ctx, b,
lp_const_servicename(snum),
&pinfo2);
DEBUG(6,("Updating printer [%s]\n", pinfo2->printername));
/* all we care about currently is the change_id */
- result = winreg_printer_update_changeid(tmp_ctx,
- session_info,
- msg,
+ result = winreg_printer_update_changeid(tmp_ctx, b,
pinfo2->printername);
if (!W_ERROR_IS_OK(result)) {
struct spoolss_OpenPrinterEx *r)
{
int snum;
+ char *raddr;
+ char *rhost;
struct printer_handle *Printer=NULL;
WERROR result;
+ int rc;
if (!r->in.printername) {
return WERR_INVALID_PARAM;
}
/* check smb.conf parameters and the the sec_desc */
+ raddr = tsocket_address_inet_addr_string(p->remote_address,
+ p->mem_ctx);
+ if (raddr == NULL) {
+ return WERR_NOMEM;
+ }
+
+ rc = get_remote_hostname(p->remote_address,
+ &rhost,
+ p->mem_ctx);
+ if (rc < 0) {
+ return WERR_NOMEM;
+ }
+ if (strequal(rhost, "UNKNOWN")) {
+ rhost = raddr;
+ }
if (!allow_access(lp_hostsdeny(snum), lp_hostsallow(snum),
- p->client_id->name, p->client_id->addr)) {
+ rhost, raddr)) {
DEBUG(3, ("access DENIED (hosts allow/deny) for printer open\n"));
ZERO_STRUCTP(r->out.handle);
return WERR_ACCESS_DENIED;
DEBUG(4,("Setting printer access = %s\n", (r->in.access_mask == PRINTER_ACCESS_ADMINISTER)
? "PRINTER_ACCESS_ADMINISTER" : "PRINTER_ACCESS_USE" ));
- winreg_create_printer(p->mem_ctx,
+ winreg_create_printer_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
lp_const_servicename(snum));
}
if (get_printer_snum(p, r->in.handle, &snum, NULL)) {
- winreg_delete_printer_key(p->mem_ctx,
+ winreg_delete_printer_key_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
lp_const_servicename(snum),
struct spoolss_DriverInfo8 *info_win2k = NULL;
int version;
WERROR status;
+ struct dcerpc_binding_handle *b;
/* if the user is not root, doesn't have SE_PRINT_OPERATOR privilege,
and not a printer admin, then fail */
if ((version = get_version_id(r->in.architecture)) == -1)
return WERR_INVALID_ENVIRONMENT;
- status = winreg_get_driver(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_printer_binding_handle(p->mem_ctx,
+ get_session_info_system(),
+ p->msg_ctx,
+ &b);
+ if (!W_ERROR_IS_OK(status)) {
+ return status;
+ }
+
+ status = winreg_get_driver(p->mem_ctx, b,
r->in.architecture, r->in.driver,
version, &info);
if (!W_ERROR_IS_OK(status)) {
if ( version == 2 ) {
version = 3;
- status = winreg_get_driver(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_get_driver(p->mem_ctx, b,
r->in.architecture,
r->in.driver,
version, &info);
}
if (version == 2) {
- status = winreg_get_driver(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_get_driver(p->mem_ctx, b,
r->in.architecture,
r->in.driver, 3, &info_win2k);
if (W_ERROR_IS_OK(status)) {
/* if we get to here, we now have 2 driver info structures to remove */
/* remove the Win2k driver first*/
- status = winreg_del_driver(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_del_driver(p->mem_ctx, b,
info_win2k, 3);
talloc_free(info_win2k);
}
}
- status = winreg_del_driver(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_del_driver(p->mem_ctx, b,
info, version);
done:
int version;
bool delete_files;
WERROR status;
+ struct dcerpc_binding_handle *b;
/* if the user is not root, doesn't have SE_PRINT_OPERATOR privilege,
and not a printer admin, then fail */
if (r->in.delete_flags & DPD_DELETE_SPECIFIC_VERSION)
version = r->in.version;
- status = winreg_get_driver(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_printer_binding_handle(p->mem_ctx,
+ get_session_info_system(),
+ p->msg_ctx,
+ &b);
+ if (!W_ERROR_IS_OK(status)) {
+ return status;
+ }
+
+ status = winreg_get_driver(p->mem_ctx, b,
r->in.architecture,
r->in.driver,
version,
/* try for Win2k driver if "Windows NT x86" */
version = 3;
- status = winreg_get_driver(info,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_get_driver(info, b,
r->in.architecture,
r->in.driver,
version, &info);
/* also check for W32X86/3 if necessary; maybe we already have? */
if ( (version == 2) && ((r->in.delete_flags & DPD_DELETE_SPECIFIC_VERSION) != DPD_DELETE_SPECIFIC_VERSION) ) {
- status = winreg_get_driver(info,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_get_driver(info, b,
r->in.architecture,
r->in.driver, 3, &info_win2k);
if (W_ERROR_IS_OK(status)) {
/* if we get to here, we now have 2 driver info structures to remove */
/* remove the Win2k driver first*/
- status = winreg_del_driver(info,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_del_driver(info, b,
info_win2k,
3);
}
}
- status = winreg_del_driver(info,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_del_driver(info, b,
info,
version);
if (!W_ERROR_IS_OK(status)) {
int snum = -1;
struct spoolss_NotifyOption *option = r->in.notify_options;
struct sockaddr_storage client_ss;
+ socklen_t client_len;
/* store the notify value in the printer struct */
return WERR_BADFID;
DEBUG(10,("_spoolss_RemoteFindFirstPrinterChangeNotifyEx: "
- "client_address is %s\n", p->client_id->addr));
+ "remote_address is %s\n",
+ tsocket_address_string(p->remote_address, p->mem_ctx)));
if (!lp_print_notify_backchannel(snum)) {
DEBUG(10, ("_spoolss_RemoteFindFirstPrinterChangeNotifyEx: "
return WERR_SERVER_UNAVAILABLE;
}
- if (!interpret_string_addr(&client_ss, p->client_id->addr,
- AI_NUMERICHOST)) {
- return WERR_SERVER_UNAVAILABLE;
+ client_len = tsocket_address_bsd_sockaddr(p->remote_address,
+ (struct sockaddr *) &client_ss,
+ sizeof(struct sockaddr_storage));
+ if (client_len < 0) {
+ return WERR_NOMEM;
}
if(!srv_spoolss_replyopenprinter(snum, Printer->notify.localmachine,
}
/* Maybe we should use the SYSTEM session_info here... */
- result = winreg_get_printer(mem_ctx,
+ result = winreg_get_printer_internal(mem_ctx,
get_session_info_system(),
p->msg_ctx,
lp_servicename(snum),
}
/* Maybe we should use the SYSTEM session_info here... */
- result = winreg_get_printer(mem_ctx,
+ result = winreg_get_printer_internal(mem_ctx,
get_session_info_system(),
p->msg_ctx,
lp_servicename(snum), &pinfo2);
r->high_part_total_bytes = 0x0;
/* ChangeID in milliseconds*/
- winreg_printer_get_changeid(mem_ctx, session_info, msg_ctx,
+ winreg_printer_get_changeid_internal(mem_ctx, session_info, msg_ctx,
info2->sharename, &r->change_id);
r->last_error = WERR_OK;
union spoolss_PrinterInfo *info = NULL;
uint32_t count = 0;
WERROR result = WERR_OK;
+ struct dcerpc_binding_handle *b = NULL;
*count_p = 0;
*info_p = NULL;
DEBUG(4,("Found a printer in smb.conf: %s[%x]\n",
printer, snum));
- result = winreg_create_printer(mem_ctx,
- session_info,
- msg_ctx,
+ if (b == NULL) {
+ result = winreg_printer_binding_handle(mem_ctx,
+ session_info,
+ msg_ctx,
+ &b);
+ if (!W_ERROR_IS_OK(result)) {
+ goto out;
+ }
+ }
+
+ result = winreg_create_printer(mem_ctx, b,
printer);
if (!W_ERROR_IS_OK(result)) {
goto out;
goto out;
}
- result = winreg_get_printer(mem_ctx, session_info, msg_ctx,
+ result = winreg_get_printer(mem_ctx, b,
printer, &info2);
if (!W_ERROR_IS_OK(result)) {
goto out;
return WERR_BADFID;
}
- result = winreg_get_printer(p->mem_ctx,
+ result = winreg_get_printer_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
lp_const_servicename(snum),
struct spoolss_PrinterInfo2 *pinfo2 = NULL;
struct spoolss_DriverInfo8 *driver;
WERROR result;
+ struct dcerpc_binding_handle *b;
if (level == 101) {
return WERR_UNKNOWN_LEVEL;
}
- result = winreg_get_printer(mem_ctx,
- session_info,
- msg_ctx,
+ result = winreg_printer_binding_handle(mem_ctx,
+ session_info,
+ msg_ctx,
+ &b);
+ if (!W_ERROR_IS_OK(result)) {
+ return result;
+ }
+
+ result = winreg_get_printer(mem_ctx, b,
lp_const_servicename(snum),
&pinfo2);
return WERR_INVALID_PRINTER_NAME;
}
- result = winreg_get_driver(mem_ctx, session_info, msg_ctx,
+ result = winreg_get_driver(mem_ctx, b,
architecture,
pinfo2->drivername, version, &driver);
/* Yes - try again with a WinNT driver. */
version = 2;
- result = winreg_get_driver(mem_ctx, session_info, msg_ctx,
+ result = winreg_get_driver(mem_ctx, b,
architecture,
pinfo2->drivername,
version, &driver);
int snum;
struct printer_handle *Printer = find_printer_index_by_hnd(p, r->in.handle);
WERROR werr;
+ char *rhost;
+ int rc;
if (!Printer) {
DEBUG(2,("_spoolss_StartDocPrinter: "
return WERR_BADFID;
}
+ rc = get_remote_hostname(p->remote_address,
+ &rhost,
+ p->mem_ctx);
+ if (rc < 0) {
+ return WERR_NOMEM;
+ }
+ if (strequal(rhost,"UNKNOWN")) {
+ rhost = tsocket_address_inet_addr_string(p->remote_address,
+ p->mem_ctx);
+ if (rhost == NULL) {
+ return WERR_NOMEM;
+ }
+ }
+
werr = print_job_start(p->session_info,
p->msg_ctx,
- p->client_id->name,
+ rhost,
snum,
info_1->document_name,
info_1->output_file,
const char *printer;
WERROR result;
int snum;
-
struct printer_handle *Printer = find_printer_index_by_hnd(p, handle);
+ struct dcerpc_binding_handle *b;
if (!Printer || !get_printer_snum(p, handle, &snum, NULL)) {
DEBUG(2,("update_printer_sec: Invalid handle (%s:%u:%u)\n",
goto done;
}
+ result = winreg_printer_binding_handle(p->mem_ctx,
+ get_session_info_system(),
+ p->msg_ctx,
+ &b);
+ if (!W_ERROR_IS_OK(result)) {
+ goto done;
+ }
+
/* NT seems to like setting the security descriptor even though
nothing may have actually changed. */
- result = winreg_get_printer_secdesc(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ result = winreg_get_printer_secdesc(p->mem_ctx, b,
printer,
&old_secdesc);
if (!W_ERROR_IS_OK(result)) {
- DEBUG(2,("update_printer_sec: winreg_get_printer_secdesc() failed\n"));
+ DEBUG(2,("update_printer_sec: winreg_get_printer_secdesc_internal() failed\n"));
result = WERR_BADFID;
goto done;
}
goto done;
}
- result = winreg_set_printer_secdesc(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ result = winreg_set_printer_secdesc(p->mem_ctx, b,
printer,
new_secdesc);
const char *spooling;
DATA_BLOB buffer;
WERROR result = WERR_OK;
+ struct dcerpc_binding_handle *b;
+
+ result = winreg_printer_binding_handle(mem_ctx,
+ session_info,
+ msg_ctx,
+ &b);
+ if (!W_ERROR_IS_OK(result)) {
+ return result;
+ }
if (force_update || !strequal(printer->drivername, old_printer->drivername)) {
push_reg_sz(mem_ctx, &buffer, printer->drivername);
- winreg_set_printer_dataex(mem_ctx,
- session_info,
- msg_ctx,
+ winreg_set_printer_dataex(mem_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_DRIVERNAME,
if (force_update || !strequal(printer->comment, old_printer->comment)) {
push_reg_sz(mem_ctx, &buffer, printer->comment);
- winreg_set_printer_dataex(mem_ctx,
- session_info,
- msg_ctx,
+ winreg_set_printer_dataex(mem_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_DESCRIPTION,
if (force_update || !strequal(printer->sharename, old_printer->sharename)) {
push_reg_sz(mem_ctx, &buffer, printer->sharename);
- winreg_set_printer_dataex(mem_ctx,
- session_info,
- msg_ctx,
+ winreg_set_printer_dataex(mem_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PRINTSHARENAME,
}
push_reg_sz(mem_ctx, &buffer, p);
- winreg_set_printer_dataex(mem_ctx,
- session_info,
- msg_ctx,
+ winreg_set_printer_dataex(mem_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PRINTERNAME,
if (force_update || !strequal(printer->portname, old_printer->portname)) {
push_reg_sz(mem_ctx, &buffer, printer->portname);
- winreg_set_printer_dataex(mem_ctx,
- session_info,
- msg_ctx,
+ winreg_set_printer_dataex(mem_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PORTNAME,
if (force_update || !strequal(printer->location, old_printer->location)) {
push_reg_sz(mem_ctx, &buffer, printer->location);
- winreg_set_printer_dataex(mem_ctx,
- session_info,
- msg_ctx,
+ winreg_set_printer_dataex(mem_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_LOCATION,
if (force_update || !strequal(printer->sepfile, old_printer->sepfile)) {
push_reg_sz(mem_ctx, &buffer, printer->sepfile);
- winreg_set_printer_dataex(mem_ctx,
- session_info,
- msg_ctx,
+ winreg_set_printer_dataex(mem_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PRINTSEPARATORFILE,
if (force_update || printer->starttime != old_printer->starttime) {
buffer = data_blob_talloc(mem_ctx, NULL, 4);
SIVAL(buffer.data, 0, printer->starttime);
- winreg_set_printer_dataex(mem_ctx,
- session_info,
- msg_ctx,
+ winreg_set_printer_dataex(mem_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PRINTSTARTTIME,
if (force_update || printer->untiltime != old_printer->untiltime) {
buffer = data_blob_talloc(mem_ctx, NULL, 4);
SIVAL(buffer.data, 0, printer->untiltime);
- winreg_set_printer_dataex(mem_ctx,
- session_info,
- msg_ctx,
+ winreg_set_printer_dataex(mem_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PRINTENDTIME,
if (force_update || printer->priority != old_printer->priority) {
buffer = data_blob_talloc(mem_ctx, NULL, 4);
SIVAL(buffer.data, 0, printer->priority);
- winreg_set_printer_dataex(mem_ctx,
- session_info,
- msg_ctx,
+ winreg_set_printer_dataex(mem_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PRIORITY,
buffer = data_blob_talloc(mem_ctx, NULL, 4);
SIVAL(buffer.data, 0, (printer->attributes &
PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS));
- winreg_set_printer_dataex(mem_ctx,
- session_info,
- msg_ctx,
+ winreg_set_printer_dataex(mem_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PRINTKEEPPRINTEDJOBS,
spooling = "unknown";
}
push_reg_sz(mem_ctx, &buffer, spooling);
- winreg_set_printer_dataex(mem_ctx,
- session_info,
- msg_ctx,
+ winreg_set_printer_dataex(mem_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PRINTSPOOLING,
}
push_reg_sz(mem_ctx, &buffer, lp_netbios_name());
- winreg_set_printer_dataex(mem_ctx,
- session_info,
- msg_ctx,
+ winreg_set_printer_dataex(mem_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_SHORTSERVERNAME,
}
push_reg_sz(mem_ctx, &buffer, longname);
- winreg_set_printer_dataex(mem_ctx,
- session_info,
- msg_ctx,
+ winreg_set_printer_dataex(mem_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_SERVERNAME,
uncname = talloc_asprintf(mem_ctx, "\\\\%s\\%s",
lp_netbios_name(), printer->sharename);
push_reg_sz(mem_ctx, &buffer, uncname);
- winreg_set_printer_dataex(mem_ctx,
- session_info,
- msg_ctx,
+ winreg_set_printer_dataex(mem_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_UNCNAME,
int snum;
WERROR result = WERR_OK;
TALLOC_CTX *tmp_ctx;
+ struct dcerpc_binding_handle *b;
DEBUG(8,("update_printer\n"));
goto done;
}
- result = winreg_get_printer(tmp_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ result = winreg_printer_binding_handle(tmp_ctx,
+ get_session_info_system(),
+ p->msg_ctx,
+ &b);
+ if (!W_ERROR_IS_OK(result)) {
+ goto done;
+ }
+
+ result = winreg_get_printer(tmp_ctx, b,
lp_const_servicename(snum),
&old_printer);
if (!W_ERROR_IS_OK(result)) {
!strequal(printer->portname, old_printer->portname) ||
!strequal(printer->location, old_printer->location)) )
{
+ char *raddr;
+
+ raddr = tsocket_address_inet_addr_string(p->remote_address,
+ p->mem_ctx);
+ if (raddr == NULL) {
+ return WERR_NOMEM;
+ }
+
/* add_printer_hook() will call reload_services() */
if (!add_printer_hook(tmp_ctx, p->session_info->security_token,
- printer, p->client_id->addr,
+ printer, raddr,
p->msg_ctx)) {
result = WERR_ACCESS_DENIED;
goto done;
if (devmode == NULL) {
printer_mask &= ~SPOOLSS_PRINTER_INFO_DEVMODE;
}
- result = winreg_update_printer(tmp_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ result = winreg_update_printer(tmp_ctx, b,
printer->sharename,
printer_mask,
printer,
if (!get_printer_snum(p, handle, &snum, NULL))
return WERR_BADFID;
- result = winreg_get_printer(p->mem_ctx,
+ result = winreg_get_printer_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
lp_servicename(snum),
return WERR_ACCESS_DENIED;
}
- return winreg_update_printer(p->mem_ctx,
+ return winreg_update_printer_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
lp_const_servicename(snum),
return WERR_BADFID;
}
- result = winreg_get_printer(p->mem_ctx,
+ result = winreg_get_printer_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
lp_const_servicename(snum),
WERROR result = WERR_OK;
uint32_t num_drivers;
const char **drivers;
+ struct dcerpc_binding_handle *b;
*count_p = 0;
*info_p = NULL;
+ result = winreg_printer_binding_handle(mem_ctx,
+ session_info,
+ msg_ctx,
+ &b);
+ if (!W_ERROR_IS_OK(result)) {
+ goto out;
+ }
+
for (version=0; version<DRIVER_MAX_VERSION; version++) {
- result = winreg_get_driver_list(mem_ctx, session_info, msg_ctx,
+ result = winreg_get_driver_list(mem_ctx, b,
architecture, version,
&num_drivers, &drivers);
if (!W_ERROR_IS_OK(result)) {
for (i = 0; i < num_drivers; i++) {
DEBUG(5, ("\tdriver: [%s]\n", drivers[i]));
- result = winreg_get_driver(mem_ctx, session_info,
- msg_ctx,
+ result = winreg_get_driver(mem_ctx, b,
architecture, drivers[i],
version, &driver);
if (!W_ERROR_IS_OK(result)) {
switch (r->in.level) {
case 1:
- result = winreg_printer_enumforms1(p->mem_ctx,
+ result = winreg_printer_enumforms1_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
r->out.count,
switch (r->in.level) {
case 1:
- result = winreg_printer_getform1(p->mem_ctx,
+ result = winreg_printer_getform1_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
r->in.form_name,
trying to add a printer like this --jerry */
if (*lp_addprinter_cmd() ) {
+ char *raddr;
+
+ raddr = tsocket_address_inet_addr_string(p->remote_address,
+ p->mem_ctx);
+ if (raddr == NULL) {
+ return WERR_NOMEM;
+ }
+
if ( !add_printer_hook(p->mem_ctx, p->session_info->security_token,
- info2, p->client_id->addr,
+ info2, raddr,
p->msg_ctx) ) {
return WERR_ACCESS_DENIED;
}
info2,
NULL);
- err = winreg_update_printer(p->mem_ctx,
+ err = winreg_update_printer_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
info2->sharename,
goto done;
}
- err = winreg_add_driver(p->mem_ctx,
+ err = winreg_add_driver_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
r->in.info_ctr,
struct spoolss_AddFormInfo1 *form = r->in.info.info1;
int snum = -1;
WERROR status = WERR_OK;
-
struct printer_handle *Printer = find_printer_index_by_hnd(p, r->in.handle);
+ struct dcerpc_binding_handle *b;
DEBUG(5,("_spoolss_AddForm\n"));
return WERR_INVALID_PARAM;
}
- status = winreg_printer_addform1(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_printer_binding_handle(p->mem_ctx,
+ get_session_info_system(),
+ p->msg_ctx,
+ &b);
+ if (!W_ERROR_IS_OK(status)) {
+ return status;
+ }
+
+ status = winreg_printer_addform1(p->mem_ctx, b,
form);
if (!W_ERROR_IS_OK(status)) {
return status;
return WERR_BADFID;
}
- status = winreg_printer_update_changeid(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_printer_update_changeid(p->mem_ctx, b,
lp_const_servicename(snum));
if (!W_ERROR_IS_OK(status)) {
return status;
struct printer_handle *Printer = find_printer_index_by_hnd(p, r->in.handle);
int snum = -1;
WERROR status = WERR_OK;
+ struct dcerpc_binding_handle *b;
DEBUG(5,("_spoolss_DeleteForm\n"));
return WERR_ACCESS_DENIED;
}
- status = winreg_printer_deleteform1(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_printer_binding_handle(p->mem_ctx,
+ get_session_info_system(),
+ p->msg_ctx,
+ &b);
+ if (!W_ERROR_IS_OK(status)) {
+ return status;
+ }
+
+ status = winreg_printer_deleteform1(p->mem_ctx, b,
form_name);
if (!W_ERROR_IS_OK(status)) {
return status;
return WERR_BADFID;
}
- status = winreg_printer_update_changeid(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_printer_update_changeid(p->mem_ctx, b,
lp_const_servicename(snum));
if (!W_ERROR_IS_OK(status)) {
return status;
const char *form_name = r->in.form_name;
int snum = -1;
WERROR status = WERR_OK;
+ struct dcerpc_binding_handle *b;
struct printer_handle *Printer = find_printer_index_by_hnd(p, r->in.handle);
return WERR_ACCESS_DENIED;
}
- status = winreg_printer_setform1(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_printer_binding_handle(p->mem_ctx,
+ get_session_info_system(),
+ p->msg_ctx,
+ &b);
+ if (!W_ERROR_IS_OK(status)) {
+ return status;
+ }
+
+ status = winreg_printer_setform1(p->mem_ctx, b,
form_name,
form);
if (!W_ERROR_IS_OK(status)) {
return WERR_BADFID;
}
- status = winreg_printer_update_changeid(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_printer_update_changeid(p->mem_ctx, b,
lp_const_servicename(snum));
if (!W_ERROR_IS_OK(status)) {
return status;
return WERR_BADFID;
}
- result = winreg_get_printer(p->mem_ctx,
+ result = winreg_get_printer_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
lp_const_servicename(snum),
enum winreg_Type val_type = REG_NONE;
uint8_t *val_data = NULL;
uint32_t val_size = 0;
-
+ struct dcerpc_binding_handle *b;
DEBUG(4,("_spoolss_GetPrinterDataEx\n"));
return WERR_INVALID_PARAM;
}
+ result = winreg_printer_binding_handle(p->mem_ctx,
+ get_session_info_system(),
+ p->msg_ctx,
+ &b);
+ if (!W_ERROR_IS_OK(result)) {
+ return result;
+ }
+
/* XP sends this and wants the ChangeID value from PRINTER_INFO_0 */
if (strequal(r->in.key_name, SPOOL_PRINTERDATA_KEY) &&
strequal(r->in.value_name, "ChangeId")) {
if (r->in.offered >= *r->out.needed) {
uint32_t changeid = 0;
- result = winreg_printer_get_changeid(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ result = winreg_printer_get_changeid(p->mem_ctx, b,
printer,
&changeid);
if (!W_ERROR_IS_OK(result)) {
goto done;
}
- result = winreg_get_printer_dataex(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ result = winreg_get_printer_dataex(p->mem_ctx, b,
printer,
r->in.key_name,
r->in.value_name,
WERROR result = WERR_OK;
struct printer_handle *Printer = find_printer_index_by_hnd(p, r->in.handle);
char *oid_string;
+ struct dcerpc_binding_handle *b;
DEBUG(4,("_spoolss_SetPrinterDataEx\n"));
return WERR_ACCESS_DENIED;
}
- result = winreg_get_printer(Printer,
- get_session_info_system(),
- p->msg_ctx,
+ result = winreg_printer_binding_handle(p->mem_ctx,
+ get_session_info_system(),
+ p->msg_ctx,
+ &b);
+ if (!W_ERROR_IS_OK(result)) {
+ return result;
+ }
+
+ result = winreg_get_printer(Printer, b,
lp_servicename(snum),
&pinfo2);
if (!W_ERROR_IS_OK(result)) {
/* save the registry data */
- result = winreg_set_printer_dataex(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ result = winreg_set_printer_dataex(p->mem_ctx, b,
pinfo2->sharename,
r->in.key_name,
r->in.value_name,
* previous set_printer_dataex() call. I have no idea if
* this is right. --jerry
*/
- winreg_set_printer_dataex(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ winreg_set_printer_dataex(p->mem_ctx, b,
pinfo2->sharename,
str,
r->in.value_name,
strlen(oid_string) + 1);
}
- result = winreg_printer_update_changeid(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ result = winreg_printer_update_changeid(p->mem_ctx, b,
lp_const_servicename(snum));
}
}
printer = lp_const_servicename(snum);
- status = winreg_delete_printer_dataex(p->mem_ctx,
+ status = winreg_delete_printer_dataex_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
printer,
r->in.key_name,
r->in.value_name);
if (W_ERROR_IS_OK(status)) {
- status = winreg_printer_update_changeid(p->mem_ctx,
+ status = winreg_printer_update_changeid_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
printer);
return WERR_BADFID;
}
- result = winreg_enum_printer_key(p->mem_ctx,
+ result = winreg_enum_printer_key_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
lp_const_servicename(snum),
int snum=0;
WERROR status;
const char *printer;
+ struct dcerpc_binding_handle *b;
DEBUG(5,("_spoolss_DeletePrinterKey\n"));
printer = lp_const_servicename(snum);
+ status = winreg_printer_binding_handle(p->mem_ctx,
+ get_session_info_system(),
+ p->msg_ctx,
+ &b);
+ if (!W_ERROR_IS_OK(status)) {
+ return status;
+ }
+
/* delete the key and all subkeys */
- status = winreg_delete_printer_key(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_delete_printer_key(p->mem_ctx, b,
printer,
r->in.key_name);
if (W_ERROR_IS_OK(status)) {
- status = winreg_printer_update_changeid(p->mem_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ status = winreg_printer_update_changeid(p->mem_ctx, b,
printer);
}
}
/* now look for a match on the key name */
- result = winreg_enum_printer_dataex(p->mem_ctx,
+ result = winreg_enum_printer_dataex_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
lp_const_servicename(snum),