summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-07-14 14:34:30 +0200
committerGünther Deschner <gd@samba.org>2010-02-18 02:19:33 +0100
commit5cff7e1692e4caa308271581f3df3f72c4f31261 (patch)
treeed63af88d5b79d38948afe6213f9916edf874307 /source3/rpc_server
parent9ff2c1ea64a267bb459eaba4a273c8300bb82c5a (diff)
downloadsamba-5cff7e1692e4caa308271581f3df3f72c4f31261.tar.gz
samba-5cff7e1692e4caa308271581f3df3f72c4f31261.tar.bz2
samba-5cff7e1692e4caa308271581f3df3f72c4f31261.zip
s3-spoolss: add some printer info validation for AddPrinter calls.
Guenther
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 34daf40d8f..66eb59bd40 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -7145,6 +7145,28 @@ static WERROR spoolss_addprinterex_level_2(pipes_struct *p,
return WERR_PRINTER_ALREADY_EXISTS;
}
+ /* validate printer info struct */
+ if (!info_ctr->info.info2->printername ||
+ strlen(info_ctr->info.info2->printername) == 0) {
+ free_a_printer(&printer,2);
+ return WERR_INVALID_PRINTER_NAME;
+ }
+ if (!info_ctr->info.info2->portname ||
+ strlen(info_ctr->info.info2->portname) == 0) {
+ free_a_printer(&printer,2);
+ return WERR_UNKNOWN_PORT;
+ }
+ if (!info_ctr->info.info2->drivername ||
+ strlen(info_ctr->info.info2->drivername) == 0) {
+ free_a_printer(&printer,2);
+ return WERR_UNKNOWN_PRINTER_DRIVER;
+ }
+ if (!info_ctr->info.info2->printprocessor ||
+ strlen(info_ctr->info.info2->printprocessor) == 0) {
+ free_a_printer(&printer,2);
+ return WERR_UNKNOWN_PRINTPROCESSOR;
+ }
+
/* FIXME!!! smbd should check to see if the driver is installed before
trying to add a printer like this --jerry */