[PATCH] fix 'net rpc printer driver'

Joerg Pulz Joerg.Pulz at frm2.tum.de
Tue Nov 16 05:39:56 MST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

there is a problem with the 'net rpc printer driver' command.
If you run this command against an Windows Server 2008 R2 64bit it stops 
as soon as an unsupported architecture/environment is found with 
WERR_INVALID_ENVIRONMENT.
I think this is wrong as 'rpcclient's enumdrivers' to the same server just 
reports e.g. "Server does not support environment [Windows NT R4000]" and 
continues with the next one.
As 'net rpc printer driver' stops at the first WERR_INVALID_ENVIRONMENT 
occurence and "Windows x64" is the last in the list, you never get a 
chance to list drivers for this arch/env.
Not sure if migrating a specific driver is affected too.

Attached is a patch for source3/utils/net_rpc_printer.c to get the same 
behavior with 'net rpc printer driver' as seen by 'rpcclient's 
enumdrivers'.
Patch is against samba-3.5.6.

Btw. Two small questions
Q1: Is it possible to migrate only the driver for a specific arch/env
     using 'net rpc printer migrate' and how do i have to call the command
     to achieve this?
Q2: How do i set a specific driver for two different arch/env e.g.
     "Windows NT x86" and "Windows x64"? 'rpcclient's setdriver' only
     supports 'setdriver <printer> <driver>'. So must i assume that the
     driver must have the same name for all arch/env or is there another
     way/command?

Kind regards
Joerg

- -- 
The beginning is the most important part of the work.
 				-Plato
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)

iD8DBQFM4nueSPOsGF+KA+MRAumvAJ96e0dqZ7d75agkeA4Kz7d0lUkWIgCeK+Kb
LTW1LEs2wMo9xaFhzD7cxHE=
=q4D2
-----END PGP SIGNATURE-----
-------------- next part --------------
--- utils/net_rpc_printer.c.orig	2010-11-16 09:53:55.000000000 +0100
+++ utils/net_rpc_printer.c	2010-11-16 13:19:37.000000000 +0100
@@ -973,8 +973,14 @@
 						   count,
 						   info);
 	if (!W_ERROR_IS_OK(result)) {
-		printf(_("cannot enum drivers: %s\n"), win_errstr(result));
-		return false;
+		if (W_ERROR_V(result) != W_ERROR_V(WERR_INVALID_ENVIRONMENT)) {
+			printf(_("cannot enum drivers: %s\n"), env,
+				win_errstr(result));
+			return false;
+		} else {
+			printf(_("Server does not support environment [%s]\n"),
+				env);
+		}
 	}
 
 	return true;


More information about the samba-technical mailing list