summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorJean-François Micouleau <jfm@samba.org>2000-03-29 14:49:05 +0000
committerJean-François Micouleau <jfm@samba.org>2000-03-29 14:49:05 +0000
commitc475ab51d99ee3aa33f9d2c6eaa2811f2f8ea931 (patch)
tree0d5d77585aaa3721ecea14bfaf1967498d00aa91 /source3/rpc_server
parent6ca0ed9baa7d2a4b4d46ca730d4984f80965d849 (diff)
downloadsamba-c475ab51d99ee3aa33f9d2c6eaa2811f2f8ea931.tar.gz
samba-c475ab51d99ee3aa33f9d2c6eaa2811f2f8ea931.tar.bz2
samba-c475ab51d99ee3aa33f9d2c6eaa2811f2f8ea931.zip
split addprinterex in preparation for level 1 support and to stop it
coredump. J.F. (This used to be commit aea47dee7d85310f35309ecfa91d0b87e632a33f)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index d08571b80b..e55f1fb305 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -3587,7 +3587,7 @@ uint32 _spoolss_enumports( UNISTR2 *name, uint32 level,
/****************************************************************************
****************************************************************************/
-uint32 _spoolss_addprinterex( const UNISTR2 *uni_srv_name, uint32 level,
+static uint32 spoolss_addprinterex_level_2( const UNISTR2 *uni_srv_name,
const SPOOL_PRINTER_INFO_LEVEL *info,
uint32 unk0, uint32 unk1, uint32 unk2, uint32 unk3,
uint32 user_switch, const SPOOL_USER_CTR *user,
@@ -3599,24 +3599,19 @@ uint32 _spoolss_addprinterex( const UNISTR2 *uni_srv_name, uint32 level,
clear_handle(handle);
-/*
- * FIX: JFM: we need to check the user here !!!!
- *
- * as the code is running as root, anybody can add printers to the server
- */
/* NULLify info_2 here */
/* don't put it in convert_printer_info as it's used also with non-NULL values */
printer.info_2=NULL;
/* convert from UNICODE to ASCII */
- convert_printer_info(info, &printer, level);
+ convert_printer_info(info, &printer, 2);
unistr2_to_ascii(share_name, &((info->info_2)->printername), sizeof(share_name)-1);
slprintf(name, sizeof(name)-1, "\\\\%s\\%s", global_myname, share_name);
/* write the ASCII on disk */
- if (add_a_printer(printer, level) != 0x0)
+ if (add_a_printer(printer, 2) != 0x0)
return ERROR_ACCESS_DENIED;
create_printer_hnd(handle);
@@ -3638,6 +3633,31 @@ uint32 _spoolss_addprinterex( const UNISTR2 *uni_srv_name, uint32 level,
/****************************************************************************
****************************************************************************/
+uint32 _spoolss_addprinterex( const UNISTR2 *uni_srv_name, uint32 level,
+ const SPOOL_PRINTER_INFO_LEVEL *info,
+ uint32 unk0, uint32 unk1, uint32 unk2, uint32 unk3,
+ uint32 user_switch, const SPOOL_USER_CTR *user,
+ POLICY_HND *handle)
+{
+ switch (level) {
+ case 1:
+ /* we don't handle yet */
+ /* but I know what to do ... */
+ break;
+ case 2:
+ return spoolss_addprinterex_level_2(uni_srv_name, info,
+ unk0, unk1, unk2, unk3,
+ user_switch, user, handle);
+ break;
+ default:
+ return ERROR_INVALID_LEVEL;
+ break;
+ }
+}
+
+
+/****************************************************************************
+****************************************************************************/
uint32 _spoolss_addprinterdriver( const UNISTR2 *server_name,
uint32 level,
const SPOOL_PRINTER_DRIVER_INFO_LEVEL *info)