[Samba] Samba+CUPS+Drivers autodownload

Dragan Krnic dkrnic at lycos.com
Thu May 29 20:28:33 GMT 2003

Hi Matt,

the problem you referred to is discussed in detail
as bug #82 in Samba's bug tracking tool. It consists
of 2 bugs. One prevents the registration of drivers
and is due to a NULL-pointer passed from that part
of code in rpc_server/srv_spoolss_nt.c which calls 
sys_adminlog function. It begins with the comment


and ends with the comment

   /* END_ADMIN_LOG */

The comments surround the code which should log
that a printer driver has been added, listing
driver's name, its OS, and admin's name. Since
this sys-admin-logging is non-essential for the 
operation of Samba and CUPS you may simply extend
the comment to include the whole code in between
the two comments by removing the first "*/" and
the second "/*" like this:

......... code here commented out ............
      END_ADMIN_LOG */

Samba built with this change will not report
NT_STATUS_UNSUCCESSFUL when you execute "adddriver"
subcommand of rpcclient.

The other bug prevents rpcclient's "enumdrivers"
subcommands from completing and can be fixed by 
changing the line #943 in lib/util_unistr.c so
that it reads:

  src_len = ( src == NULL ? 0 :  strlen_w(src)*2+2 );

instead of just

  src_len = strlen_w(src)*2+2;

So that you may find that part easily, here are the
7 lines surrounding and including the offending line:

940                dest_len=MAXUNI-3;
942        if (flags & STR_TERMINATE) 
943               src_len = strlen_w(src)*2+2;
945        dest_len = MIN((src_len/2), (dest_len-1));
946        unistr_to_ascii(dest, src, dest_len);

Another problem is building a fixed version of Samba.
Somehow, the Linux vendors refrain from disclosing
in full detail the files necessary for the build.

They all more or less build their packages with
"rpm -bb" which requires a ".spec" file. This is a 
kind of script listing all the dependencies, 
prerequisites, and steps to be taken in order to
build an RPM fully automatically. Some of these 
steps consist of patching different original Samba 
files to either fix defects discovered after a major
release came out or that are known to occur only in a 
specific distro, in other words to make it adhere to 
some specifics of a vendor's distro. The patch files
are the correct place to register such changes to
the source code as I mentioned above.

However, vendors just mirror the latest samba source 
and let YOU figure out what is needed to be done in 
order for the software to build and run. In my view 
this is in clear contravention of the GPL!!! The 
vendors are selling the work of others omitting the 
essential information which makes it tick on their 
particular distro. This is a SERIOUS PROBLEM which
has to be raised, unless of course it is just my
inability to locate those informations on the web.

In my case, SuSE 8.2, the vendor did a thorough job
of providing almost all of the pre-requisite files on 
their sites. The missing ones were a few documents and 
a couple of template Samba configuration files which 
were already in their original 2.2.8a offering. It 
wasn't difficult to just copy those files into 
the /usr/src/packages/SOURCES with the rest.

But try that with RedHat! I would really like to 
know which other vendors provide their customer with
such informations in full detail.

What is missing even in SuSE's documentation is a
list of all the devel packages which need to be
installed on a system in order to be able to build
samba. I mean, I ran myself into the problem that 
configure failed and stopped the build when it tried 
to verify if it can use the included popt lib. It 
couldn't compile the test case because I didn't have
"openldap2-deve-l2.1.12-44" installed. My guess is 
that you probably need the following:


but I'm not sure because I've installed all devel 
packages (130 of them) just in case. I would be much
obliged if someone could correct this list, if
something is missing or superfluous.

Matt, I hope this information helps anyone confronted 
with this bug in 2.2.8a. If you happen to have SuSE
8.2 on your system, I might send you a tarball with
.spec and related files for the build. I guess that 
the same files would also work for RedHat and other 
distros but then again I might be wrong.


Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!

More information about the samba mailing list