summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-10-04 10:14:21 +0000
committerAndrew Tridgell <tridge@samba.org>1998-10-04 10:14:21 +0000
commit7bd738c30a09a211fd14a8544309efeec17c66f5 (patch)
tree30290bb990f82eb6cbda5a755bfd571a12c1d1eb /source
parent080fb61b69620e26e8122705383dc2bd0468a519 (diff)
downloadsamba-7bd738c30a09a211fd14a8544309efeec17c66f5.tar.gz
samba-7bd738c30a09a211fd14a8544309efeec17c66f5.tar.xz
samba-7bd738c30a09a211fd14a8544309efeec17c66f5.zip
add support for unlink() on printer shares in smbwrapper. unlink()
will remove the job from the pirnt queue.
Diffstat (limited to 'source')
-rw-r--r--source/include/proto.h1
-rw-r--r--source/libsmb/clientgen.c37
-rw-r--r--source/smbwrapper/smbw.c10
-rw-r--r--source/smbwrapper/smbw_stat.c10
4 files changed, 54 insertions, 4 deletions
diff --git a/source/include/proto.h b/source/include/proto.h
index 29803cdbbc9..f2b484ceec1 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -418,6 +418,7 @@ BOOL cli_establish_connection(struct cli_state *cli,
struct nmb_name *calling, struct nmb_name *called,
char *service, char *service_type,
BOOL do_shutdown, BOOL do_tcon);
+int cli_printjob_del(struct cli_state *cli, int job);
int cli_print_queue(struct cli_state *cli,
void (*fn)(struct print_job_info *));
diff --git a/source/libsmb/clientgen.c b/source/libsmb/clientgen.c
index 0e01370f5de..e4aa15c6eb8 100644
--- a/source/libsmb/clientgen.c
+++ b/source/libsmb/clientgen.c
@@ -2495,6 +2495,43 @@ BOOL cli_establish_connection(struct cli_state *cli,
}
+/****************************************************************************
+ cancel a print job
+ ****************************************************************************/
+int cli_printjob_del(struct cli_state *cli, int job)
+{
+ char *rparam = NULL;
+ char *rdata = NULL;
+ char *p;
+ int rdrcnt,rprcnt, ret = -1;
+ pstring param;
+
+ bzero(param,sizeof(param));
+
+ p = param;
+ SSVAL(p,0,81); /* DosPrintJobDel() */
+ p += 2;
+ pstrcpy(p,"W");
+ p = skip_string(p,1);
+ pstrcpy(p,"");
+ p = skip_string(p,1);
+ SSVAL(p,0,job);
+ p += 2;
+
+ if (cli_api(cli,
+ param, PTR_DIFF(p,param), 1024, /* Param, length, maxlen */
+ NULL, 0, CLI_BUFFER_SIZE, /* data, length, maxlen */
+ &rparam, &rprcnt, /* return params, length */
+ &rdata, &rdrcnt)) { /* return data, length */
+ ret = SVAL(rparam,0);
+ }
+
+ if (rparam) free(rparam);
+ if (rdata) free(rdata);
+
+ return ret;
+}
+
/****************************************************************************
call fn() on each entry in a print queue
diff --git a/source/smbwrapper/smbw.c b/source/smbwrapper/smbw.c
index 3a2cbcf5ace..0abe823e299 100644
--- a/source/smbwrapper/smbw.c
+++ b/source/smbwrapper/smbw.c
@@ -756,7 +756,15 @@ int smbw_unlink(const char *fname)
goto failed;
}
- if (!cli_unlink(&srv->cli, path)) {
+ if (strncmp(srv->cli.dev, "LPT", 3) == 0) {
+ int job = smbw_stat_printjob(srv, path, NULL, NULL);
+ if (job == -1) {
+ goto failed;
+ }
+ if (cli_printjob_del(&srv->cli, job) != 0) {
+ goto failed;
+ }
+ } else if (!cli_unlink(&srv->cli, path)) {
errno = smbw_errno(&srv->cli);
goto failed;
}
diff --git a/source/smbwrapper/smbw_stat.c b/source/smbwrapper/smbw_stat.c
index 69ca38a2aeb..d0b0e59b4f2 100644
--- a/source/smbwrapper/smbw_stat.c
+++ b/source/smbwrapper/smbw_stat.c
@@ -100,9 +100,13 @@ int smbw_stat_printjob(struct smbw_server *srv,char *path,
fstrcpy(printjob.name, path);
cli_print_queue(&srv->cli, smbw_printjob_stat);
- *size = printjob.size;
- *m_time = printjob.t;
- return 0;
+ if (size) {
+ *size = printjob.size;
+ }
+ if (m_time) {
+ *m_time = printjob.t;
+ }
+ return printjob.id;
}