FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand)
FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand)
FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand)
-FN_LOCAL_STRING(lp_printername, szPrintername)
+static FN_LOCAL_STRING(_lp_printername, szPrintername)
FN_LOCAL_STRING(lp_driverfile, szDriverFile)
FN_LOCAL_STRING(lp_printerdriver, szPrinterDriver)
FN_LOCAL_STRING(lp_hostsallow, szHostsallow)
/* The [printers] entry MUST be printable. I'm all for flexibility, but */
/* I can't see why you'd want a non-printable printer service... */
- if (strwicmp(iSERVICE(iService).szService, PRINTERS_NAME) == 0)
- if (!iSERVICE(iService).bPrint_ok)
- {
+ if (strwicmp(iSERVICE(iService).szService, PRINTERS_NAME) == 0) {
+ if (!iSERVICE(iService).bPrint_ok) {
DEBUG(0,
("WARNING: [%s] service MUST be printable!\n",
iSERVICE(iService).szService));
iSERVICE(iService).bPrint_ok = True;
}
+ /* [printers] service must also be non-browsable. */
+ if (iSERVICE(iService).bBrowseable)
+ iSERVICE(iService).bBrowseable = False;
+ }
if (iSERVICE(iService).szPath[0] == '\0' &&
strwicmp(iSERVICE(iService).szService, HOMES_NAME) != 0)
return val;
}
+char *lp_printername(int snum)
+{
+ char *ret = _lp_printername(snum);
+ if (ret == NULL || (ret != NULL && *ret == '\0'))
+ ret = lp_servicename(snum);
+
+ return ret;
+}
****************************************************************************/
static void fill_port_1(PORT_INFO_1 *port, char *name)
{
- init_unistr(&(port->port_name), name);
+ init_unistr(&port->port_name, name);
}
/****************************************************************************
****************************************************************************/
static void fill_port_2(PORT_INFO_2 *port, char *name)
{
- init_unistr(&(port->port_name), name);
- init_unistr(&(port->monitor_name), "Moniteur Local");
- init_unistr(&(port->description), "Local Port");
+ init_unistr(&port->port_name, name);
+ init_unistr(&port->monitor_name, "Local Monitor");
+ init_unistr(&port->description, "Local Port");
#define PORT_TYPE_WRITE 1
port->port_type=PORT_TYPE_WRITE;
port->reserved=0x0;
for (snum=0; snum<n_services; snum++) {
if ( lp_browseable(snum) && lp_snum_ok(snum) && lp_print_ok(snum) ) {
+ /*
+ * Ensure this port name is unique.
+ */
+ int j;
+
+ DEBUG(10,("enumports_level_1: port name %s\n", PRINTERNAME(snum)));
+
+ for(j = 0; j < i; j++) {
+ fstring port_name;
+ unistr_to_dos(port_name, (const char *)&ports[j].port_name.buffer[0], sizeof(port_name));
+
+ if (strequal(port_name, PRINTERNAME(snum)))
+ break;
+ }
+
+ if (j < i)
+ continue;
+
DEBUGADD(6,("Filling port number [%d]\n", i));
- fill_port_1(&(ports[i]), lp_servicename(snum));
+ fill_port_1(&ports[i], PRINTERNAME(snum));
i++;
}
}
+ *returned = i;
+
/* check the required size. */
for (i=0; i<*returned; i++) {
DEBUGADD(6,("adding port [%d]'s size\n", i));
- *needed += spoolss_size_port_info_1(&(ports[i]));
+ *needed += spoolss_size_port_info_1(&ports[i]);
}
if (!alloc_buffer_size(buffer, *needed)) {
/* fill the buffer with the ports structures */
for (i=0; i<*returned; i++) {
DEBUGADD(6,("adding port [%d] to buffer\n", i));
- new_smb_io_port_1("", buffer, &(ports[i]), 0);
+ new_smb_io_port_1("", buffer, &ports[i], 0);
}
safe_free(ports);
return NT_STATUS_NO_PROBLEMO;
}
-
/****************************************************************************
enumports level 2.
****************************************************************************/
+
static uint32 enumports_level_2(NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
{
int n_services=lp_numservices();
for (snum=0; snum<n_services; snum++) {
if ( lp_browseable(snum) && lp_snum_ok(snum) && lp_print_ok(snum) ) {
+ /*
+ * Ensure this port name is unique.
+ */
+ int j;
+
+ DEBUG(10,("enumports_level_2: port name %s\n", PRINTERNAME(snum)));
+
+ for(j = 0; j < i; j++) {
+ fstring port_name;
+ unistr_to_dos(port_name, (const char *)&ports[j].port_name.buffer[0], sizeof(port_name));
+
+ if (strequal(port_name, PRINTERNAME(snum)))
+ break;
+ }
+
+ if (j < i)
+ continue;
+
DEBUGADD(6,("Filling port number [%d]\n", i));
- fill_port_2(&(ports[i]), lp_servicename(snum));
+ fill_port_2(&ports[i], PRINTERNAME(snum));
i++;
}
}
+ *returned = i;
+
/* check the required size. */
for (i=0; i<*returned; i++) {
DEBUGADD(6,("adding port [%d]'s size\n", i));
- *needed += spoolss_size_port_info_2(&(ports[i]));
+ *needed += spoolss_size_port_info_2(&ports[i]);
}
if (!alloc_buffer_size(buffer, *needed)) {
/* fill the buffer with the ports structures */
for (i=0; i<*returned; i++) {
DEBUGADD(6,("adding port [%d] to buffer\n", i));
- new_smb_io_port_2("", buffer, &(ports[i]), 0);
+ new_smb_io_port_2("", buffer, &ports[i], 0);
}
safe_free(ports);