summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-05-15 17:21:28 +0000
committerJeremy Allison <jra@samba.org>2003-05-15 17:21:28 +0000
commit88b1670e8c0b084388f0f5b99af9a76175274263 (patch)
treef763a30af84f56cbe44696179ae42720c42360d4 /source3/rpc_server
parentc62e546efd2ac351cca48d0f9b5736f5adeb4a1e (diff)
downloadsamba-88b1670e8c0b084388f0f5b99af9a76175274263.tar.gz
samba-88b1670e8c0b084388f0f5b99af9a76175274263.tar.bz2
samba-88b1670e8c0b084388f0f5b99af9a76175274263.zip
Ensure sys_adminlog code won't coredump with incorrect client params.
Jeremy. (This used to be commit 0f7f762a1e1aa86afc2a740dcce83c8384d8d53b)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 026484d96d..51cfacf86a 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -48,6 +48,13 @@ static const char * drv_ver_to_os[] = {
"WIN2K", /* driver version/cversion 3 */
};
+static const char *get_drv_ver_to_os(int ver)
+{
+ if (ver < 0 || ver > 3)
+ return "";
+ return drv_ver_to_os[ver];
+}
+
struct table_node {
const char *long_archi;
const char *short_archi;
@@ -7464,14 +7471,14 @@ WERROR _spoolss_addprinterdriver(pipes_struct *p, SPOOL_Q_ADDPRINTERDRIVER *q_u,
/* BEGIN_ADMIN_LOG */
switch(level) {
case 3:
+ fstrcpy(driver_name, driver.info_3->name ? driver.info_3->name : "");
sys_adminlog(LOG_INFO,"Added printer driver. Print driver name: %s. Print driver OS: %s. Administrator name: %s.",
- driver.info_3->name,drv_ver_to_os[driver.info_3->cversion],uidtoname(user.uid));
- fstrcpy(driver_name, driver.info_3->name);
+ driver_name, get_drv_ver_to_os(driver.info_3->cversion),uidtoname(user.uid));
break;
case 6:
+ fstrcpy(driver_name, driver.info_6->name ? driver.info_6->name : "");
sys_adminlog(LOG_INFO,"Added printer driver. Print driver name: %s. Print driver OS: %s. Administrator name: %s.",
- driver.info_6->name,drv_ver_to_os[driver.info_6->version],uidtoname(user.uid));
- fstrcpy(driver_name, driver.info_6->name);
+ driver_name, get_drv_ver_to_os(driver.info_6->version),uidtoname(user.uid));
break;
}
/* END_ADMIN_LOG */