summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-05-15 17:21:32 +0000
committerJeremy Allison <jra@samba.org>2003-05-15 17:21:32 +0000
commita975bc2471dfe83848cd12a9ca757184e0e20612 (patch)
treed546314c2587dcfbdcc29463db5068eec6745363 /source3
parent6203409d2ef442fd7d620ddaa8ea85cc7b6695fd (diff)
downloadsamba-a975bc2471dfe83848cd12a9ca757184e0e20612.tar.gz
samba-a975bc2471dfe83848cd12a9ca757184e0e20612.tar.bz2
samba-a975bc2471dfe83848cd12a9ca757184e0e20612.zip
Ensure sys_adminlog code won't coredump with incorrect client params.
Jeremy. (This used to be commit b754089a2660975c593a6651e5e72b7360a0aba1)
Diffstat (limited to 'source3')
-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 e6129f4ace..95237e979f 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 */