summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/include/rpc_misc.h11
-rw-r--r--source3/lib/util.c30
-rw-r--r--source3/param/loadparm.c16
-rw-r--r--source3/printing/printing.c33
-rw-r--r--source3/smbd/ipc.c35
6 files changed, 106 insertions, 22 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ed725b722d..6a64059eb1 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1062,6 +1062,8 @@ char *lp_lpqcommand(int );
char *lp_lprmcommand(int );
char *lp_lppausecommand(int );
char *lp_lpresumecommand(int );
+char *lp_queuepausecommand(int );
+char *lp_queueresumecommand(int );
char *lp_printername(int );
char *lp_printerdriver(int );
char *lp_hostsallow(int );
@@ -1719,6 +1721,7 @@ void del_printqueue(int cnum,int snum,int jobid);
void status_printjob(int cnum,int snum,int jobid,int status);
int printjob_encode(int snum, int job);
void printjob_decode(int jobid, int *snum, int *job);
+void status_printqueue(int cnum,int snum,int status);
/*The following definitions come from quotas.c */
diff --git a/source3/include/rpc_misc.h b/source3/include/rpc_misc.h
index 3e1a6052b5..c03471ebfc 100644
--- a/source3/include/rpc_misc.h
+++ b/source3/include/rpc_misc.h
@@ -27,17 +27,6 @@
#include "rpc_dce.h"
-/* pipe string names */
-#define PIPE_SRVSVC "\\PIPE\\srvsvc"
-#define PIPE_SAMR "\\PIPE\\samr"
-#define PIPE_WINREG "\\PIPE\\winreg"
-#define PIPE_WKSSVC "\\PIPE\\wkssvc"
-#define PIPE_NETLOGON "\\PIPE\\NETLOGON"
-#define PIPE_NTLSA "\\PIPE\\ntlsa"
-#define PIPE_NTSVCS "\\PIPE\\ntsvcs"
-#define PIPE_LSASS "\\PIPE\\lsass"
-#define PIPE_LSARPC "\\PIPE\\lsarpc"
-
/* well-known RIDs - Relative IDs */
/* RIDs - Well-known users ... */
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 905809f111..ec12affe79 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -4038,6 +4038,30 @@ char *client_addr(int fd)
return addr_buf;
}
+#if (defined(NETGROUP) && defined(AUTOMOUNT))
+/******************************************************************
+ Remove any mount options such as -rsize=2048,wsize=2048 etc.
+ Based on a fix from <Thomas.Hepper@icem.de>.
+*******************************************************************/
+
+static void strip_mount_options( pstring *str)
+{
+ if (**str == '-')
+ {
+ char *p = *str;
+ while(*p && !isspace(*p))
+ p++;
+ while(*p && isspace(*p))
+ p++;
+ if(*p) {
+ pstring tmp_str;
+
+ pstrcpy(tmp_str, p);
+ pstrcpy(*str, tmp_str);
+ }
+ }
+}
+
/*******************************************************************
Patch from jkf@soton.ac.uk
Split Luke's automount_server into YP lookup and string splitter
@@ -4045,7 +4069,6 @@ char *client_addr(int fd)
As we may end up doing both, cache the last YP result.
*******************************************************************/
-#if (defined(NETGROUP) && defined(AUTOMOUNT))
#ifdef NISPLUS_HOME
static char *automount_lookup(char *user_name)
{
@@ -4094,6 +4117,9 @@ static char *automount_lookup(char *user_name)
}
nis_freeresult(result);
}
+
+ strip_mount_options(&last_value);
+
DEBUG(4, ("NIS+ Lookup: %s resulted in %s\n", user_name, last_value));
return last_value;
}
@@ -4141,6 +4167,8 @@ static char *automount_lookup(char *user_name)
last_value[nis_result_len] = '\0';
}
+ strip_mount_options(&last_value);
+
DEBUG(4, ("YP Lookup: %s resulted in %s\n", user_name, last_value));
return last_value;
}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index d6ec24ab5b..10b261ed02 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -252,6 +252,8 @@ typedef struct
char *szLprmcommand;
char *szLppausecommand;
char *szLpresumecommand;
+ char *szQueuepausecommand;
+ char *szQueueresumecommand;
char *szPrintername;
char *szPrinterDriver;
char *szPrinterDriverLocation;
@@ -340,6 +342,8 @@ static service sDefault =
NULL, /* szLprmcommand */
NULL, /* szLppausecommand */
NULL, /* szLpresumecommand */
+ NULL, /* szQueuepausecommand */
+ NULL, /* szQueueresumecommand */
NULL, /* szPrintername */
NULL, /* szPrinterDriver - this is set in init_globals() */
NULL, /* szPrinterDriverLocation */
@@ -593,6 +597,9 @@ static struct parm_struct parm_table[] =
{"lprm command", P_STRING, P_LOCAL, &sDefault.szLprmcommand, NULL, NULL, FLAG_PRINT|FLAG_GLOBAL},
{"lppause command", P_STRING, P_LOCAL, &sDefault.szLppausecommand, NULL, NULL, FLAG_GLOBAL},
{"lpresume command", P_STRING, P_LOCAL, &sDefault.szLpresumecommand,NULL, NULL, FLAG_GLOBAL},
+ {"queuepause command", P_STRING, P_LOCAL, &sDefault.szQueuepausecommand, NULL, NULL, FLAG_GLOBAL},
+ {"queueresume command", P_STRING, P_LOCAL, &sDefault.szQueueresumecommand, NULL, NULL, FLAG_GLOBAL},
+
{"printer name", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_PRINT},
{"printer", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, 0},
{"printer driver", P_STRING, P_LOCAL, &sDefault.szPrinterDriver, NULL, NULL, 0},
@@ -911,7 +918,12 @@ static void init_locals(void)
#ifdef SVR4
string_initial(&sDefault.szLppausecommand,"lp -i %p-%j -H hold");
string_initial(&sDefault.szLpresumecommand,"lp -i %p-%j -H resume");
-#endif
+ string_initial(&sDefault.szQueuepausecommand, "lpc stop %p");
+ string_initial(&sDefault.szQueueresumecommand, "lpc start %p");
+#else /* SVR4 */
+ string_initial(&sDefault.szQueuepausecommand, "disable %p");
+ string_initial(&sDefault.szQueueresumecommand, "enable %p");
+#endif /* SVR4 */
break;
case PRINT_QNX:
@@ -1153,6 +1165,8 @@ FN_LOCAL_STRING(lp_lpqcommand,szLpqcommand)
FN_LOCAL_STRING(lp_lprmcommand,szLprmcommand)
FN_LOCAL_STRING(lp_lppausecommand,szLppausecommand)
FN_LOCAL_STRING(lp_lpresumecommand,szLpresumecommand)
+FN_LOCAL_STRING(lp_queuepausecommand,szQueuepausecommand)
+FN_LOCAL_STRING(lp_queueresumecommand,szQueueresumecommand)
FN_LOCAL_STRING(lp_printername,szPrintername)
FN_LOCAL_STRING(lp_printerdriver,szPrinterDriver)
FN_LOCAL_STRING(lp_hostsallow,szHostsallow)
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 2b9c0c7199..6fa7091677 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -1213,3 +1213,36 @@ void printjob_decode(int jobid, int *snum, int *job)
(*snum) = (jobid >> 8) & 0xFF;
(*job) = jobid & 0xFF;
}
+
+/****************************************************************************
+ Change status of a printer queue
+****************************************************************************/
+
+void status_printqueue(int cnum,int snum,int status)
+{
+ char *queuestatus_command = (status==LPSTAT_STOPPED ?
+ lp_queuepausecommand(snum):lp_queueresumecommand(snum));
+ char *printername = PRINTERNAME(snum);
+ pstring syscmd;
+ int ret;
+
+ if (!printername || !*printername) {
+ DEBUG(6,("replacing printer name with service (snum=(%s,%d))\n",
+ lp_servicename(snum),snum));
+ printername = lp_servicename(snum);
+ }
+
+ if (!queuestatus_command || !(*queuestatus_command)) {
+ DEBUG(5,("No queuestatus command to %s job\n",
+ (status==LPSTAT_STOPPED?"pause":"resume")));
+ return;
+ }
+
+ pstrcpy(syscmd,queuestatus_command);
+ string_sub(syscmd,"%p",printername);
+ standard_sub(cnum,syscmd);
+
+ ret = smbrun(syscmd,NULL,False);
+ DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
+ lpq_reset(snum); /* queue has changed */
+}
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index 9c48951e35..cbacca3b83 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -1821,11 +1821,15 @@ static BOOL api_RDosPrintJobDel(int cnum,uint16 vuid, char *param,char *data,
return(True);
}
+/****************************************************************************
+ Purge a print queue - or pause or resume it.
+ ****************************************************************************/
static BOOL api_WPrintQueuePurge(int cnum,uint16 vuid, char *param,char *data,
int mdrcnt,int mprcnt,
char **rdata,char **rparam,
int *rdata_len,int *rparam_len)
{
+ int function = SVAL(param,0);
char *str1 = param+2;
char *str2 = skip_string(str1,1);
char *QueueName = skip_string(str2,1);
@@ -1853,19 +1857,30 @@ static BOOL api_WPrintQueuePurge(int cnum,uint16 vuid, char *param,char *data,
}
if (snum >= 0 && VALID_SNUM(snum)) {
- print_queue_struct *queue=NULL;
- int i, count;
lpq_reset(snum);
- count = get_printqueue(snum,cnum,&queue,NULL);
- for (i = 0; i < count; i++)
- del_printqueue(cnum,snum,queue[i].job);
-
- if (queue) free(queue);
+ switch (function) {
+ case 74: /* Pause queue */
+ case 75: /* Resume queue */
+ status_printqueue(cnum,snum,(function==74?LPSTAT_STOPPED:LPSTAT_OK));
+ DEBUG(3,("Print queue %s, queue=%s\n",
+ (function==74?"pause":"resume"),QueueName));
+ break;
+ case 103: /* Purge */
+ {
+ print_queue_struct *queue=NULL;
+ int i, count;
+ count = get_printqueue(snum,cnum,&queue,NULL);
+ for (i = 0; i < count; i++)
+ del_printqueue(cnum,snum,queue[i].job);
+
+ if (queue) free(queue);
+ DEBUG(3,("Print queue purge, queue=%s\n",QueueName));
+ break;
+ }
+ }
}
- DEBUG(3,("Print queue purge, queue=%s\n",QueueName));
-
return(True);
}
@@ -3490,6 +3505,8 @@ struct
{"NetWkstaGetInfo", 63, api_NetWkstaGetInfo,0},
{"DosPrintQEnum", 69, api_DosPrintQEnum,0},
{"DosPrintQGetInfo", 70, api_DosPrintQGetInfo,0},
+ {"WPrintQueuePause", 74, api_WPrintQueuePurge,0},
+ {"WPrintQueueResume", 75, api_WPrintQueuePurge,0},
{"WPrintJobEnumerate",76, api_WPrintJobEnumerate,0},
{"WPrintJobGetInfo", 77, api_WPrintJobGetInfo,0},
{"RDosPrintJobDel", 81, api_RDosPrintJobDel,0},