WERROR(*fn) (NT_USER_TOKEN *token, RPC_BUFFER *in, RPC_BUFFER *out, uint32 *needed);
};
+/********************************************************************
+ * Canonicalize servername.
+ ********************************************************************/
+
+static const char *canon_servername(const char *servername)
+{
+ const char *pservername = servername;
+ while (*pservername == '\\') {
+ pservername++;
+ }
+ return pservername;
+}
/* translate between internal status numbers and NT status numbers */
static int nt_printj_status(int v)
/* if it's the last connection, deconnect the IPC$ share */
if (smb_connections==1) {
- cli_shutdown( notify_cli_pipe->cli );
+ cli_shutdown( rpc_pipe_np_smb_conn(notify_cli_pipe) );
notify_cli_pipe = NULL; /* The above call shuts downn the pipe also. */
messaging_deregister(smbd_messaging_context(),
aprinter = handlename;
if ( *handlename == '\\' ) {
- servername = handlename + 2;
- if ( (aprinter = strchr_m( handlename+2, '\\' )) != NULL ) {
+ servername = canon_servername(handlename);
+ if ( (aprinter = strchr_m( servername, '\\' )) != NULL ) {
*aprinter = '\0';
aprinter++;
}
- }
- else {
+ } else {
servername = "";
}
fstrcpy(sname, lp_servicename(snum));
printer = NULL;
- result = get_a_printer( NULL, &printer, 2, sname );
+
+ /* This call doesn't fill in the location or comment from
+ * a CUPS server for efficiency with large numbers of printers.
+ * JRA.
+ */
+
+ result = get_a_printer_search( NULL, &printer, 2, sname );
if ( !W_ERROR_IS_OK(result) ) {
DEBUG(0,("set_printer_hnd_name: failed to lookup printer [%s] -- result [%s]\n",
sname, dos_errstr(result)));
memcpy(r_u, &r_u_ex, sizeof(*r_u));
+ if (W_ERROR_EQUAL(r_u->status, WERR_INVALID_PARAM)) {
+ /* OpenPrinterEx returns this for a bad
+ * printer name. We must return WERR_INVALID_PRINTER_NAME
+ * instead.
+ */
+ r_u->status = WERR_INVALID_PRINTER_NAME;
+ }
return r_u->status;
}
int snum;
Printer_entry *Printer=NULL;
- if ( !q_u->printername )
- return WERR_INVALID_PRINTER_NAME;
+ if (!q_u->printername) {
+ return WERR_INVALID_PARAM;
+ }
/* some sanity check because you can open a printer or a print server */
/* aka: \\server\printer or \\server */
DEBUGADD(3,("checking name: %s\n",name));
- if (!open_printer_hnd(p, handle, name, 0))
- return WERR_INVALID_PRINTER_NAME;
+ if (!open_printer_hnd(p, handle, name, 0)) {
+ return WERR_INVALID_PARAM;
+ }
Printer=find_printer_index_by_hnd(p, handle);
if ( !Printer ) {
DEBUG(0,(" _spoolss_open_printer_ex: logic error. Can't find printer "
"handle we created for printer %s\n", name ));
close_printer_handle(p,handle);
- return WERR_INVALID_PRINTER_NAME;
+ return WERR_INVALID_PARAM;
}
/*
!user_has_privileges(p->pipe_user.nt_user_token,
&se_printop ) &&
!token_contains_name_in_list(
- uidtoname(p->pipe_user.ut.uid), NULL,
+ uidtoname(p->pipe_user.ut.uid),
+ NULL, NULL,
p->pipe_user.nt_user_token,
lp_printer_admin(snum))) {
close_printer_handle(p, handle);
return WERR_ACCESS_DENIED;
}
- if (!user_ok_token(uidtoname(p->pipe_user.ut.uid),
+ if (!user_ok_token(uidtoname(p->pipe_user.ut.uid), NULL,
p->pipe_user.nt_user_token, snum) ||
- !print_access_check(&p->pipe_user, snum,
+ !print_access_check(p->server_info, snum,
printer_default->access_required)) {
DEBUG(3, ("access DENIED for printer open\n"));
close_printer_handle(p, handle);
if ( (p->pipe_user.ut.uid != 0)
&& !user_has_privileges(p->pipe_user.nt_user_token, &se_printop )
- && !token_contains_name_in_list( uidtoname(p->pipe_user.ut.uid),
- NULL, p->pipe_user.nt_user_token, lp_printer_admin(-1)) )
+ && !token_contains_name_in_list(
+ uidtoname(p->pipe_user.ut.uid), NULL,
+ NULL, p->pipe_user.nt_user_token,
+ lp_printer_admin(-1)) )
{
return WERR_ACCESS_DENIED;
}
if ( (p->pipe_user.ut.uid != 0)
&& !user_has_privileges(p->pipe_user.nt_user_token, &se_printop )
- && !token_contains_name_in_list( uidtoname(p->pipe_user.ut.uid),
- NULL, p->pipe_user.nt_user_token, lp_printer_admin(-1)) )
+ && !token_contains_name_in_list(
+ uidtoname(p->pipe_user.ut.uid), NULL, NULL,
+ p->pipe_user.nt_user_token, lp_printer_admin(-1)) )
{
return WERR_ACCESS_DENIED;
}
* Now start the NT Domain stuff :-).
*/
- if ( !(*pp_pipe = cli_rpc_pipe_open_noauth(the_cli, PI_SPOOLSS, &ret)) ) {
+ ret = cli_rpc_pipe_open_noauth(the_cli, &syntax_spoolss, pp_pipe);
+ if (!NT_STATUS_IS_OK(ret)) {
DEBUG(2,("spoolss_connect_to_client: unable to open the spoolss pipe on machine %s. Error was : %s.\n",
remote_machine, nt_errstr(ret)));
cli_shutdown(the_cli);
return False;
}
- /* make sure to save the cli_state pointer. Keep its own talloc_ctx */
-
- (*pp_pipe)->cli = the_cli;
-
return True;
}
!get_printer_snum(p, handle, &snum, NULL) )
return WERR_BADFID;
- if (!interpret_string_addr(&client_ss,
- p->conn->client_address,
- AI_NUMERICHOST)) {
+ if (!interpret_string_addr(&client_ss, p->client_address,
+ AI_NUMERICHOST)) {
return WERR_SERVER_UNAVAILABLE;
}
struct GUID guid;
if (is_printer_published(print_hnd, snum, &guid)) {
- asprintf(&guid_str, "{%s}",
- smb_uuid_string(talloc_tos(), guid));
+ if (asprintf(&guid_str, "{%s}",
+ GUID_string(talloc_tos(), &guid)) == -1) {
+ return false;
+ }
strupper_m(guid_str);
init_unistr(&printer->guid, guid_str);
+ SAFE_FREE(guid_str);
printer->action = SPOOL_DS_PUBLISH;
} else {
init_unistr(&printer->guid, "");
* handle enumeration of printers at level 2
********************************************************************/
-static WERROR enumprinters_level2( uint32 flags, fstring servername,
+static WERROR enumprinters_level2( uint32 flags, const char *servername,
RPC_BUFFER *buffer, uint32 offered,
uint32 *needed, uint32 *returned)
{
- char *s = servername;
-
if (flags & PRINTER_ENUM_LOCAL) {
return enum_all_printers_info_2(buffer, offered, needed, returned);
}
if (flags & PRINTER_ENUM_NAME) {
- if ((servername[0] == '\\') && (servername[1] == '\\'))
- s = servername + 2;
- if (is_myname_or_ipaddr(s))
+ if (is_myname_or_ipaddr(canon_servername(servername)))
return enum_all_printers_info_2(buffer, offered, needed, returned);
else
return WERR_INVALID_NAME;
* handle enumeration of printers at level 5
********************************************************************/
-static WERROR enumprinters_level5( uint32 flags, fstring servername,
+static WERROR enumprinters_level5( uint32 flags, const char *servername,
RPC_BUFFER *buffer, uint32 offered,
uint32 *needed, uint32 *returned)
{
if((printer=SMB_MALLOC_P(PRINTER_INFO_7))==NULL)
return WERR_NOMEM;
- if (!construct_printer_info_7(print_hnd, printer, snum))
- return WERR_NOMEM;
+ if (!construct_printer_info_7(print_hnd, printer, snum)) {
+ result = WERR_NOMEM;
+ goto out;
+ }
/* check the required size. */
*needed += spoolss_size_printer_info_7(printer);
* fill a DRIVER_INFO_1 struct
********************************************************************/
-static void fill_printer_driver_info_1(DRIVER_INFO_1 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, fstring servername, fstring architecture)
+static void fill_printer_driver_info_1(DRIVER_INFO_1 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, const char *servername, fstring architecture)
{
init_unistr( &info->name, driver.info_3->name);
}
* construct_printer_driver_info_1
********************************************************************/
-static WERROR construct_printer_driver_info_1(DRIVER_INFO_1 *info, int snum, fstring servername, fstring architecture, uint32 version)
+static WERROR construct_printer_driver_info_1(DRIVER_INFO_1 *info, int snum, const char *servername, fstring architecture, uint32 version)
{
NT_PRINTER_INFO_LEVEL *printer = NULL;
NT_PRINTER_DRIVER_INFO_LEVEL driver;
* fill a printer_info_2 struct
********************************************************************/
-static void fill_printer_driver_info_2(DRIVER_INFO_2 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, fstring servername)
+static void fill_printer_driver_info_2(DRIVER_INFO_2 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, const char *servername)
{
TALLOC_CTX *ctx = talloc_tos();
char *temp = NULL;
+ const char *cservername = canon_servername(servername);
info->version=driver.info_3->cversion;
init_unistr( &info->name, driver.info_3->name );
init_unistr( &info->architecture, driver.info_3->environment );
-
if (strlen(driver.info_3->driverpath)) {
temp = talloc_asprintf(ctx,
"\\\\%s%s",
- servername,
+ cservername,
driver.info_3->driverpath);
init_unistr( &info->driverpath, temp );
} else {
if (strlen(driver.info_3->datafile)) {
temp = talloc_asprintf(ctx,
"\\\\%s%s",
- servername,
+ cservername,
driver.info_3->datafile);
init_unistr( &info->datafile, temp );
} else
if (strlen(driver.info_3->configfile)) {
temp = talloc_asprintf(ctx,
"\\\\%s%s",
- servername,
+ cservername,
driver.info_3->configfile);
init_unistr( &info->configfile, temp );
} else
* fill a printer_info_2 struct
********************************************************************/
-static WERROR construct_printer_driver_info_2(DRIVER_INFO_2 *info, int snum, fstring servername, fstring architecture, uint32 version)
+static WERROR construct_printer_driver_info_2(DRIVER_INFO_2 *info, int snum, const char *servername, fstring architecture, uint32 version)
{
NT_PRINTER_INFO_LEVEL *printer = NULL;
NT_PRINTER_DRIVER_INFO_LEVEL driver;
if ( servername ) {
line = talloc_asprintf(ctx,
"\\\\%s%s",
- servername,
+ canon_servername(servername),
v);
} else {
line = talloc_strdup(ctx, v);
* fill a printer_info_3 struct
********************************************************************/
-static void fill_printer_driver_info_3(DRIVER_INFO_3 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, fstring servername)
+static void fill_printer_driver_info_3(DRIVER_INFO_3 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, const char *servername)
{
char *temp = NULL;
TALLOC_CTX *ctx = talloc_tos();
+ const char *cservername = canon_servername(servername);
ZERO_STRUCTP(info);
if (strlen(driver.info_3->driverpath)) {
temp = talloc_asprintf(ctx,
"\\\\%s%s",
- servername,
+ cservername,
driver.info_3->driverpath);
init_unistr( &info->driverpath, temp );
} else
if (strlen(driver.info_3->datafile)) {
temp = talloc_asprintf(ctx,
"\\\\%s%s",
- servername,
+ cservername,
driver.info_3->datafile);
init_unistr( &info->datafile, temp );
} else
if (strlen(driver.info_3->configfile)) {
temp = talloc_asprintf(ctx,
"\\\\%s%s",
- servername,
+ cservername,
driver.info_3->configfile);
init_unistr( &info->configfile, temp );
} else
if (strlen(driver.info_3->helpfile)) {
temp = talloc_asprintf(ctx,
"\\\\%s%s",
- servername,
+ cservername,
driver.info_3->helpfile);
init_unistr( &info->helpfile, temp );
} else
init_unistr( &info->defaultdatatype, driver.info_3->defaultdatatype );
info->dependentfiles=NULL;
- init_unistr_array(&info->dependentfiles, driver.info_3->dependentfiles, servername);
+ init_unistr_array(&info->dependentfiles, driver.info_3->dependentfiles, cservername);
}
/********************************************************************
* fill a printer_info_3 struct
********************************************************************/
-static WERROR construct_printer_driver_info_3(DRIVER_INFO_3 *info, int snum, fstring servername, fstring architecture, uint32 version)
+static WERROR construct_printer_driver_info_3(DRIVER_INFO_3 *info, int snum, const char *servername, fstring architecture, uint32 version)
{
NT_PRINTER_INFO_LEVEL *printer = NULL;
NT_PRINTER_DRIVER_INFO_LEVEL driver;
* fill a printer_info_6 struct - we know that driver is really level 3. This sucks. JRA.
********************************************************************/
-static void fill_printer_driver_info_6(DRIVER_INFO_6 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, fstring servername)
+static void fill_printer_driver_info_6(DRIVER_INFO_6 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, const char *servername)
{
char *temp = NULL;
fstring nullstr;
TALLOC_CTX *ctx = talloc_tos();
+ const char *cservername = canon_servername(servername);
ZERO_STRUCTP(info);
memset(&nullstr, '\0', sizeof(fstring));
if (strlen(driver.info_3->driverpath)) {
temp = talloc_asprintf(ctx,
"\\\\%s%s",
- servername,
+ cservername,
driver.info_3->driverpath);
init_unistr( &info->driverpath, temp );
} else
if (strlen(driver.info_3->datafile)) {
temp = talloc_asprintf(ctx,
"\\\\%s%s",
- servername,
+ cservername,
driver.info_3->datafile);
init_unistr( &info->datafile, temp );
} else
if (strlen(driver.info_3->configfile)) {
temp = talloc_asprintf(ctx,
"\\\\%s%s",
- servername,
+ cservername,
driver.info_3->configfile);
init_unistr( &info->configfile, temp );
} else
if (strlen(driver.info_3->helpfile)) {
temp = talloc_asprintf(ctx,
"\\\\%s%s",
- servername,
+ cservername,
driver.info_3->helpfile);
init_unistr( &info->helpfile, temp );
} else
********************************************************************/
static WERROR construct_printer_driver_info_6(DRIVER_INFO_6 *info, int snum,
- fstring servername, fstring architecture, uint32 version)
+ const char *servername, fstring architecture, uint32 version)
{
NT_PRINTER_INFO_LEVEL *printer = NULL;
NT_PRINTER_DRIVER_INFO_LEVEL driver;
/****************************************************************************
****************************************************************************/
-static WERROR getprinterdriver2_level1(fstring servername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed)
+static WERROR getprinterdriver2_level1(const char *servername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed)
{
DRIVER_INFO_1 *info=NULL;
WERROR result;
/****************************************************************************
****************************************************************************/
-static WERROR getprinterdriver2_level2(fstring servername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed)
+static WERROR getprinterdriver2_level2(const char *servername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed)
{
DRIVER_INFO_2 *info=NULL;
WERROR result;
/****************************************************************************
****************************************************************************/
-static WERROR getprinterdriver2_level3(fstring servername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed)
+static WERROR getprinterdriver2_level3(const char *servername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed)
{
DRIVER_INFO_3 info;
WERROR result;
/****************************************************************************
****************************************************************************/
-static WERROR getprinterdriver2_level6(fstring servername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed)
+static WERROR getprinterdriver2_level6(const char *servername, fstring architecture, uint32 version, int snum, RPC_BUFFER *buffer, uint32 offered, uint32 *needed)
{
DRIVER_INFO_6 info;
WERROR result;
jobname = unistr2_to_ascii_talloc(ctx, &info_1->docname);
- Printer->jobid = print_job_start(&p->pipe_user, snum, jobname, Printer->nt_devmode);
+ Printer->jobid = print_job_start(p->server_info, snum, jobname,
+ Printer->nt_devmode);
/* An error occured in print_job_start() so return an appropriate
NT error code. */
switch (command) {
case PRINTER_CONTROL_PAUSE:
- if (print_queue_pause(&p->pipe_user, snum, &errcode)) {
+ if (print_queue_pause(p->server_info, snum, &errcode)) {
errcode = WERR_OK;
}
break;
case PRINTER_CONTROL_RESUME:
case PRINTER_CONTROL_UNPAUSE:
- if (print_queue_resume(&p->pipe_user, snum, &errcode)) {
+ if (print_queue_resume(p->server_info, snum, &errcode)) {
errcode = WERR_OK;
}
break;
case PRINTER_CONTROL_PURGE:
- if (print_queue_purge(&p->pipe_user, snum, &errcode)) {
+ if (print_queue_purge(p->server_info, snum, &errcode)) {
errcode = WERR_OK;
}
break;
if (!get_printer_snum(p, handle, &snum, NULL))
return WERR_BADFID;
- print_job_delete( &p->pipe_user, snum, Printer->jobid, &errcode );
+ print_job_delete(p->server_info, snum, Printer->jobid, &errcode );
return errcode;
}
/* NT seems to like setting the security descriptor even though
nothing may have actually changed. */
- nt_printing_getsec(p->mem_ctx, Printer->sharename, &old_secdesc_ctr);
+ if ( !nt_printing_getsec(p->mem_ctx, Printer->sharename, &old_secdesc_ctr)) {
+ DEBUG(2,("update_printer_sec: nt_printing_getsec() failed\n"));
+ result = WERR_BADFID;
+ goto done;
+ }
if (DEBUGLEVEL >= 10) {
SEC_ACL *the_acl;
PRINTERNAME(snum), the_acl->num_aces));
for (i = 0; i < the_acl->num_aces; i++) {
- fstring sid_str;
-
- sid_to_string(sid_str, &the_acl->aces[i].trustee);
-
- DEBUG(10, ("%s 0x%08x\n", sid_str,
+ DEBUG(10, ("%s 0x%08x\n", sid_string_dbg(
+ &the_acl->aces[i].trustee),
the_acl->aces[i].access_mask));
}
PRINTERNAME(snum), the_acl->num_aces));
for (i = 0; i < the_acl->num_aces; i++) {
- fstring sid_str;
-
- sid_to_string(sid_str, &the_acl->aces[i].trustee);
-
- DEBUG(10, ("%s 0x%08x\n", sid_str,
+ DEBUG(10, ("%s 0x%08x\n", sid_string_dbg(
+ &the_acl->aces[i].trustee),
the_acl->aces[i].access_mask));
}
} else {
char *cmd = lp_addport_cmd();
char *command = NULL;
int ret;
- int fd;
SE_PRIV se_printop = SE_PRINT_OPERATOR;
bool is_print_op = False;
if ( is_print_op )
become_root();
- ret = smbrun(command, &fd);
+ ret = smbrun(command, NULL);
if ( is_print_op )
unbecome_root();
TALLOC_FREE(command);
if ( ret != 0 ) {
- if (fd != -1)
- close(fd);
return WERR_ACCESS_DENIED;
}
numlines = 0;
/* Get lines and convert them back to dos-codepage */
- qlines = fd_lines_load(fd, &numlines, 0);
+ qlines = fd_lines_load(fd, &numlines, 0, NULL);
DEBUGADD(10,("Lines returned = [%d]\n", numlines));
close(fd);
DEBUGADD(6,("Line[0] = [%s]\n", qlines[0]));
}
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
return True;
}
switch (command) {
case JOB_CONTROL_CANCEL:
case JOB_CONTROL_DELETE:
- if (print_job_delete(&p->pipe_user, snum, jobid, &errcode)) {
+ if (print_job_delete(p->server_info, snum, jobid, &errcode)) {
errcode = WERR_OK;
}
break;
case JOB_CONTROL_PAUSE:
- if (print_job_pause(&p->pipe_user, snum, jobid, &errcode)) {
+ if (print_job_pause(p->server_info, snum, jobid, &errcode)) {
errcode = WERR_OK;
}
break;
case JOB_CONTROL_RESTART:
case JOB_CONTROL_RESUME:
- if (print_job_resume(&p->pipe_user, snum, jobid, &errcode)) {
+ if (print_job_resume(p->server_info, snum, jobid, &errcode)) {
errcode = WERR_OK;
}
break;
Enumerates all printer drivers at level 1.
****************************************************************************/
-static WERROR enumprinterdrivers_level1(fstring servername, fstring architecture, RPC_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
+static WERROR enumprinterdrivers_level1(const char *servername, fstring architecture, RPC_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
{
int i;
int ndrivers;
Enumerates all printer drivers at level 2.
****************************************************************************/
-static WERROR enumprinterdrivers_level2(fstring servername, fstring architecture, RPC_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
+static WERROR enumprinterdrivers_level2(const char *servername, fstring architecture, RPC_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
{
int i;
int ndrivers;
Enumerates all printer drivers at level 3.
****************************************************************************/
-static WERROR enumprinterdrivers_level3(fstring servername, fstring architecture, RPC_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
+static WERROR enumprinterdrivers_level3(const char *servername, fstring architecture, RPC_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
{
int i;
int ndrivers;
uint32 offered = q_u->offered;
uint32 *needed = &r_u->needed;
uint32 *returned = &r_u->returned;
-
+ const char *cservername;
fstring servername;
fstring architecture;
unistr2_to_ascii(architecture, &q_u->environment, sizeof(architecture));
unistr2_to_ascii(servername, &q_u->name, sizeof(servername));
- if ( !is_myname_or_ipaddr( servername ) )
+ cservername = canon_servername(servername);
+
+ if (!is_myname_or_ipaddr(cservername))
return WERR_UNKNOWN_PRINTER_DRIVER;
switch (level) {
case 1:
- return enumprinterdrivers_level1(servername, architecture, buffer, offered, needed, returned);
+ return enumprinterdrivers_level1(cservername, architecture, buffer, offered, needed, returned);
case 2:
- return enumprinterdrivers_level2(servername, architecture, buffer, offered, needed, returned);
+ return enumprinterdrivers_level2(cservername, architecture, buffer, offered, needed, returned);
case 3:
- return enumprinterdrivers_level3(servername, architecture, buffer, offered, needed, returned);
+ return enumprinterdrivers_level3(cservername, architecture, buffer, offered, needed, returned);
default:
return WERR_UNKNOWN_LEVEL;
}
}
numlines = 0;
- qlines = fd_lines_load(fd, &numlines, 0);
+ qlines = fd_lines_load(fd, &numlines, 0, NULL);
DEBUGADD(10,("Lines returned = [%d]\n", numlines));
close(fd);
}
result = enumports_hook(talloc_tos(), &numlines, &qlines );
if (!W_ERROR_IS_OK(result)) {
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
return result;
}
if((ports=SMB_MALLOC_ARRAY( PORT_INFO_1, numlines )) == NULL) {
DEBUG(10,("Returning WERR_NOMEM [%s]\n",
dos_errstr(WERR_NOMEM)));
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
return WERR_NOMEM;
}
fill_port_1(&ports[i], qlines[i]);
}
}
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
*returned = numlines;
result = enumports_hook(talloc_tos(), &numlines, &qlines );
if ( !W_ERROR_IS_OK(result)) {
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
return result;
}
if(numlines) {
if((ports=SMB_MALLOC_ARRAY( PORT_INFO_2, numlines)) == NULL) {
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
return WERR_NOMEM;
}
}
}
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
*returned = numlines;
goto done;
}
+ switch(level) {
+ case 3:
+ fstrcpy(driver_name,
+ driver.info_3->name ? driver.info_3->name : "");
+ break;
+ case 6:
+ fstrcpy(driver_name,
+ driver.info_6->name ? driver.info_6->name : "");
+ break;
+ }
+
/*
* I think this is where he DrvUpgradePrinter() hook would be
* be called in a driver's interface DLL on a Windows NT 4.0/2k
char *path = NULL;
char *long_archi = NULL;
char *servername = NULL;
- char *pservername = NULL;
+ const char *pservername = NULL;
const char *short_archi;
DRIVER_DIRECTORY_1 *info=NULL;
WERROR result = WERR_OK;
return WERR_NOMEM;
}
- /* check for beginning double '\'s and that the server
- long enough */
-
- pservername = servername;
- if ( *pservername == '\\' && strlen(servername)>2 ) {
- pservername += 2;
- }
+ pservername = canon_servername(servername);
- if ( !is_myname_or_ipaddr( pservername ) )
+ if ( !is_myname_or_ipaddr(pservername))
return WERR_INVALID_PARAM;
if (!(short_archi = get_short_archi(long_archi)))
/* can't add if builtin */
if (get_a_builtin_ntform(&form->name,&tmpForm)) {
- status = WERR_ALREADY_EXISTS;
+ status = WERR_FILE_EXISTS;
goto done;
}
/* copy data into the reply */
- r_u->ctr.size = r_u->needed;
+ /* mz: Vista x64 returns 0x6f7 (The stub received bad data), if the
+ response buffer size is != the offered buffer size
+
+ r_u->ctr.size = r_u->needed;
+ */
+ r_u->ctr.size = in_size;
r_u->ctr.size_of_array = r_u->returned;
r_u->ctr.values = enum_values;
-
-
done:
if ( printer )
free_a_printer(&printer, 2);