The branch, v4-2-test has been updated via 923827c vfs_fruit: mmap under FreeBSD needs PROT_READ via e3d7893 vfs_fruit: fix base_fsp name conversion via eaeeb51 s3-libads: Fix a possible segfault in kerberos_fetch_pac(). via ec80439 lib/util: Avoid collision which alread defined consumer DEBUG macro. via a756e65 spoolss: clear PrinterInfo on GetPrinter error via 4e3e5e7 spoolss: clear info on GetPrinterDriverDirectory error via d2d2f8a spoolss: clear info on GetPrintProcessorDirectory error via e9e576a spoolss: clear FormInfo on GetForm error via 9762d72 spoolss: clear DriverInfo on GetPrinterDriver2 error via 2141975 spoolss: clear JobInfo on GetJob error via f0040c6 [PATCH] vfs: Add glusterfs manpage. via 92b34c5 net: Fix sam addgroupmem via 561eb6c s3:passdb: fix logic in pdb_set_pw_history() via bdc182f s3-util: Fix authentication with long hostnames. from d196b54 winbind: Retry after SESSION_EXPIRED error in ping-dc
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-2-test - Log ----------------------------------------------------------------- commit 923827c2f7b4e7b1f3fd15c6fee2d22b36712c6f Author: Volker Lendecke <v...@samba.org> Date: Thu Jan 8 17:14:37 2015 +0100 vfs_fruit: mmap under FreeBSD needs PROT_READ We memmove, which does read Bug: https://bugzilla.samba.org/show_bug.cgi?id=11040 Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Ralph Böhme <r...@sernet.de> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit 56e2384dfe29fd8f16b9d0cf7264f9bb8ed38966) Autobuild-User(v4-2-test): Karolin Seeger <ksee...@samba.org> Autobuild-Date(v4-2-test): Thu Jan 15 16:16:51 CET 2015 on sn-devel-104 commit e3d7893c6d566c43bceff79eeb7782659699a47d Author: Volker Lendecke <v...@samba.org> Date: Tue Jan 6 15:55:15 2015 +0000 vfs_fruit: fix base_fsp name conversion Bug: https://bugzilla.samba.org/show_bug.cgi?id=11039 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Volker Lendecke <v...@samba.org> (cherry picked from commit d9c22a3af2ac319d075a952c71496b6b76c83fcf) commit eaeeb5132658717644bc1008c71d33cfc3e04629 Author: Andreas Schneider <a...@samba.org> Date: Wed Jan 7 17:12:54 2015 +0100 s3-libads: Fix a possible segfault in kerberos_fetch_pac(). BUG: https://bugzilla.samba.org/show_bug.cgi?id=11037 Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit a13e29cc4345d85ab6fe4482119386b87e4e8673) commit ec8043974019a9b2d9b507c2cf1f3611b66e7605 Author: Andreas Schneider <a...@samba.org> Date: Thu Jan 8 10:24:36 2015 +0100 lib/util: Avoid collision which alread defined consumer DEBUG macro. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11033 Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Martin Schwenke <mar...@meltin.net> (cherry picked from commit 87c176563baea3458c5322f1e3dfae6cf074b4b4) Signed-off-by: Andreas Schneider <a...@samba.org> commit a756e6551c87f3457fbac77a651075dab58c503a Author: David Disseldorp <dd...@samba.org> Date: Wed Dec 17 16:54:42 2014 +0100 spoolss: clear PrinterInfo on GetPrinter error If an error is returned without zeroing a pre-allocated @info pointer, then marshalling of the response will fail. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10984 Signed-off-by: David Disseldorp <dd...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> (cherry picked from commit a11e97b79645ff0d9e7d20f5318a979194a858fe) commit 4e3e5e7c91844246b92819bbb777a2657ed3d0f9 Author: David Disseldorp <dd...@samba.org> Date: Wed Dec 17 16:47:50 2014 +0100 spoolss: clear info on GetPrinterDriverDirectory error If an error is returned without zeroing a pre-allocated @info pointer, then marshalling of the response will fail. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10984 Signed-off-by: David Disseldorp <dd...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> (cherry picked from commit c9fccb5018f9a19bb654b9ad79aa716e37a274d6) commit d2d2f8a24f08e71238ecb742979fcbcb921c11cb Author: David Disseldorp <dd...@samba.org> Date: Wed Dec 17 15:54:22 2014 +0100 spoolss: clear info on GetPrintProcessorDirectory error If an error is returned without zeroing a pre-allocated @info pointer, then marshalling of the response will fail. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10984 Signed-off-by: David Disseldorp <dd...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> (cherry picked from commit 679c781112ce6b7cffca11c28e58ae5f9a0d717d) commit e9e576a5fb12f8402ff0025ed348cee9325be7b6 Author: David Disseldorp <dd...@samba.org> Date: Wed Dec 17 15:29:52 2014 +0100 spoolss: clear FormInfo on GetForm error In handling a spoolss GetForm request, the handler may return an immediate error if one of the input parameters is invalid. If this is done without zeroing the pre-allocated @info pointer, then marshalling of the response will fail. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10984 Signed-off-by: David Disseldorp <dd...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> (cherry picked from commit b113ed6043622cdec68f3a70631b363594f3a8d0) commit 9762d72188a75171bcf10b7de06d3e2ea16a4152 Author: David Disseldorp <dd...@samba.org> Date: Wed Dec 17 15:21:33 2014 +0100 spoolss: clear DriverInfo on GetPrinterDriver2 error In handling a spoolss GetPrinterDriver2 request, the handler may return an immediate error if one of the input parameters is invalid. If this is done without zeroing the pre-allocated @info pointer, then marshalling of the response will fail. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10984 Signed-off-by: David Disseldorp <dd...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> (cherry picked from commit fb9ecb044ee986ab3496da6cbad162a224378475) commit 2141975a8039a6e85cf9b2a2a8aec3bcd3954e3e Author: David Disseldorp <dd...@samba.org> Date: Thu Dec 4 20:03:39 2014 +0100 spoolss: clear JobInfo on GetJob error In handling a spoolss GetJob request, the _spoolss_GetJob() handler may return an immediate error if one of the input parameters is invalid. If this is done without zeroing the pre-allocated @info pointer, then api_spoolss_GetJob() will attempt to marshall @info, which in the case of an @offered value of zero results in a marshalling error: ndr_push_error(7): Bad subcontext (PUSH) content_size 64 is larger than size_is(0) Bug: https://bugzilla.samba.org/show_bug.cgi?id=10984 Signed-off-by: David Disseldorp <dd...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> (cherry picked from commit 89869e090c56a3f83b451b437f9c3f40a231dd24) commit f0040c6168f1cf35fbbc448946d27391acff22a4 Author: Günther Deschner <g...@samba.org> Date: Wed Jan 14 21:44:50 2015 +0100 [PATCH] vfs: Add glusterfs manpage. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10240 Guenther Signed-off-by: Günther Deschner <g...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> Autobuild-User(master): Günther Deschner <g...@samba.org> Autobuild-Date(master): Wed Jan 7 20:57:57 CET 2015 on sn-devel-104 commit 92b34c59dd2182fb5878c93e7b39524621b388cc Author: Volker Lendecke <v...@samba.org> Date: Tue Jan 13 12:51:13 2015 +0100 net: Fix sam addgroupmem Domain local groups come across as SID_TYPE_ALIAS and are sent to us in the PAC/Info3 struct. We should allow this in net sam addgroupmem. Volker Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> Bug: https://bugzilla.samba.org/show_bug.cgi?id=11051 Autobuild-User(master): Günther Deschner <g...@samba.org> Autobuild-Date(master): Tue Jan 13 15:28:16 CET 2015 on sn-devel-104 commit 561eb6cf51020a91d6552cd082a92e5cc9d21a29 Author: Stefan Metzmacher <me...@samba.org> Date: Wed Dec 24 13:58:12 2014 +0100 s3:passdb: fix logic in pdb_set_pw_history() Bug: https://bugzilla.samba.org/show_bug.cgi?id=10940 Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Volker Lendecke <v...@samba.org> Autobuild-User(master): Volker Lendecke <v...@samba.org> Autobuild-Date(master): Mon Jan 5 16:51:30 CET 2015 on sn-devel-104 (cherry picked from commit c5948040805f2585dd9da3a6955f605d8d9fa70c) commit bdc182f4a363a60f700b2f9dbbf14be3e5e0fec7 Author: Andreas Schneider <a...@samba.org> Date: Mon Jan 12 18:12:13 2015 +0100 s3-util: Fix authentication with long hostnames. If the hostname is longer than MAX_NETBIOSNAME_LEN we fail to correctly check the hostname. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11008 Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit da2611adef32107f5a0eec97501c01232ab72efc) Signed-off-by: Andreas Schneider <a...@samba.org> ----------------------------------------------------------------------- Summary of changes: docs-xml/manpages/vfs_glusterfs.8.xml | 151 ++++++++++++++++++++++++++++ docs-xml/wscript_build | 1 + lib/util/debug.h | 6 +- lib/util/fault.h | 5 + source3/lib/util.c | 4 +- source3/libads/authdata.c | 26 ++--- source3/modules/vfs_fruit.c | 4 +- source3/passdb/pdb_get_set.c | 15 +-- source3/rpc_server/spoolss/srv_spoolss_nt.c | 78 +++++++++----- source3/utils/net_sam.c | 8 +- 10 files changed, 243 insertions(+), 55 deletions(-) create mode 100644 docs-xml/manpages/vfs_glusterfs.8.xml Changeset truncated at 500 lines: diff --git a/docs-xml/manpages/vfs_glusterfs.8.xml b/docs-xml/manpages/vfs_glusterfs.8.xml new file mode 100644 index 0000000..83032cc --- /dev/null +++ b/docs-xml/manpages/vfs_glusterfs.8.xml @@ -0,0 +1,151 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc"> +<refentry id="vfs_glusterfs.8"> + +<refmeta> + <refentrytitle>vfs_glusterfs</refentrytitle> + <manvolnum>8</manvolnum> + <refmiscinfo class="source">Samba</refmiscinfo> + <refmiscinfo class="manual">System Administration tools</refmiscinfo> + <refmiscinfo class="version">4.2</refmiscinfo> +</refmeta> + + +<refnamediv> + <refname>vfs_glusterfs</refname> + <refpurpose> + Utilize features provided by GlusterFS + </refpurpose> +</refnamediv> + +<refsynopsisdiv> + <cmdsynopsis> + <command>vfs objects = glusterfs</command> + </cmdsynopsis> +</refsynopsisdiv> + +<refsect1> + <title>DESCRIPTION</title> + + <para>This VFS module is part of the + <citerefentry><refentrytitle>samba</refentrytitle> + <manvolnum>8</manvolnum></citerefentry> suite.</para> + + <para> + The <command>vfs_glusterfs</command> VFS module exposes + GlusterFS specific features for use by Samba. + </para> + + <para> + GlusterFS is a clustered file system, capable of scaling + to several peta-bytes. It aggregates various storage bricks + over Infiniband RDMA or TCP/IP and interconnect into one large + parallel network file system. Storage bricks can be made of any + commodity hardware, such as x86-64 server with SATA-II RAID and + Infiniband HBA. + + GlusterFS is fully POSIX compliant file system. It supports + standard clients running standard applications over any standard + IP network and also FUSE. It works seemlessly on + different operating systems, currently supported on GNU/Linux + and Solaris. + </para> + + <para> + This module is stackable, provided glusterfs lies in the bottom + of the stack. + </para> +</refsect1> + +<refsect1> + <title>CONFIGURATION</title> + + <para> + <command>vfs_glusterfs</command> requires that the underlying share + path is a Gluster filesystem. + </para> + + <programlisting> + <smbconfsection name="[share]"/> + <smbconfoption name="vfs objects">glusterfs</smbconfoption> + </programlisting> +</refsect1> + +<refsect1> + <title>OPTIONS</title> + + <variablelist> + + <varlistentry> + <term>glusterfs:logfile = path</term> + <listitem> + <para> + Defines whether and where to store a vfs_glusterfs specific + logfile. Client variable substitution is supported (i.e. + %M, %m, %I), hence per client log file can be + %specified. + </para> + <para> + Example: glusterfs:logfile = + %/var/log/samba/glusterfs-vol2.%M.log + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>glusterfs:loglevel = 0-9</term> + <listitem> + <para> + Defines the level of logging, with higher numbers corresponding to more verbosity. + 0 - No logs; 9 - Trace log level; 7 being the info log level is preferred. + </para> + <para> + If this option is not defined with an explicit loglevel, + the glusterfs default is used (currently loglevel 7). + </para> + </listitem> + </varlistentry> + + + <varlistentry> + <term>glusterfs:volfile_server = servername</term> + <listitem> + <para> + Defines which volfile server to use, defaults to + localhost. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>glusterfs:volume = volumename</term> + <listitem> + <para> + Defines the glusterfs volumename to use for this share. + </para> + </listitem> + + </varlistentry> + </variablelist> + +</refsect1> + +<refsect1> + <title>VERSION</title> + + <para> + This man page is correct for version 4.2.0 of the Samba suite. + </para> +</refsect1> + +<refsect1> + <title>AUTHOR</title> + + <para>The original Samba software and related utilities + were created by Andrew Tridgell. Samba is now developed + by the Samba Team as an Open Source project similar + to the way the Linux kernel is developed.</para> + +</refsect1> + +</refentry> diff --git a/docs-xml/wscript_build b/docs-xml/wscript_build index f7d0db8..0bc3f54 100644 --- a/docs-xml/wscript_build +++ b/docs-xml/wscript_build @@ -62,6 +62,7 @@ manpages=''' manpages/vfs_fileid.8 manpages/vfs_fruit.8 manpages/vfs_full_audit.8 + manpages/vfs_glusterfs.8 manpages/vfs_gpfs.8 manpages/vfs_linux_xfs_sgid.8 manpages/vfs_media_harmony.8 diff --git a/lib/util/debug.h b/lib/util/debug.h index 27c319b..fa07d40 100644 --- a/lib/util/debug.h +++ b/lib/util/debug.h @@ -20,8 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef _DEBUG_H -#define _DEBUG_H +#ifndef _SAMBA_DEBUG_H +#define _SAMBA_DEBUG_H #include <stdbool.h> #include <stddef.h> @@ -262,4 +262,4 @@ typedef void (*debug_callback_fn)(void *private_ptr, int level, const char *msg) */ void debug_set_callback(void *private_ptr, debug_callback_fn fn); -#endif +#endif /* _SAMBA_DEBUG_H */ diff --git a/lib/util/fault.h b/lib/util/fault.h index 98a24a3..aa10a71 100644 --- a/lib/util/fault.h +++ b/lib/util/fault.h @@ -24,11 +24,15 @@ #include <sys/types.h> #include "attr.h" + +#ifndef DEBUG #include "debug.h" +#endif /* DEBUG */ /** * assert macros */ +#ifdef _SAMBA_DEBUG_H #define SMB_ASSERT(b) \ do { \ if (!(b)) { \ @@ -37,6 +41,7 @@ do { \ smb_panic("assert failed: " #b); \ } \ } while(0) +#endif /* _SAMBA_DEBUG_H */ extern const char *panic_action; diff --git a/source3/lib/util.c b/source3/lib/util.c index 7b2afa8..bd57db2 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1195,7 +1195,9 @@ bool is_myname(const char *s) bool ret = False; for (n=0; my_netbios_names(n); n++) { - if (strequal(my_netbios_names(n), s)) { + const char *nbt_name = my_netbios_names(n); + + if (strncasecmp_m(nbt_name, s, strlen(nbt_name)) == 0) { ret=True; break; } diff --git a/source3/libads/authdata.c b/source3/libads/authdata.c index 18a2e4f..d3a0992 100644 --- a/source3/libads/authdata.c +++ b/source3/libads/authdata.c @@ -61,7 +61,7 @@ static NTSTATUS kerberos_fetch_pac(struct auth4_context *auth_ctx, return NT_STATUS_NO_MEMORY; } - if (pac_blob) { + if (pac_blob != NULL) { status = kerberos_decode_pac(tmp_ctx, *pac_blob, NULL, @@ -73,22 +73,22 @@ static NTSTATUS kerberos_fetch_pac(struct auth4_context *auth_ctx, if (!NT_STATUS_IS_OK(status)) { goto done; } - } - pac_data_ctr = talloc(mem_ctx, struct PAC_DATA_CTR); - if (pac_data_ctr == NULL) { - status = NT_STATUS_NO_MEMORY; - goto done; - } + pac_data_ctr = talloc(mem_ctx, struct PAC_DATA_CTR); + if (pac_data_ctr == NULL) { + status = NT_STATUS_NO_MEMORY; + goto done; + } - talloc_set_name_const(pac_data_ctr, "struct PAC_DATA_CTR"); + talloc_set_name_const(pac_data_ctr, "struct PAC_DATA_CTR"); - pac_data_ctr->pac_data = talloc_steal(pac_data_ctr, pac_data); - pac_data_ctr->pac_blob = data_blob_talloc(pac_data_ctr, - pac_blob->data, - pac_blob->length); + pac_data_ctr->pac_data = talloc_steal(pac_data_ctr, pac_data); + pac_data_ctr->pac_blob = data_blob_talloc(pac_data_ctr, + pac_blob->data, + pac_blob->length); - auth_ctx->private_data = talloc_steal(auth_ctx, pac_data_ctr); + auth_ctx->private_data = talloc_steal(auth_ctx, pac_data_ctr); + } *session_info = talloc_zero(mem_ctx, struct auth_session_info); if (!*session_info) { diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 23a7f16..3588d56 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -651,7 +651,7 @@ static int ad_convert(struct adouble *ad, int fd) ad_getentrylen(ad, ADEID_RFORK); /* FIXME: direct use of mmap(), vfs_aio_fork does it too */ - map = mmap(NULL, origlen, PROT_WRITE, MAP_SHARED, fd, 0); + map = mmap(NULL, origlen, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); if (map == MAP_FAILED) { DEBUG(2, ("mmap AppleDouble: %s\n", strerror(errno))); rc = -1; @@ -2876,7 +2876,7 @@ static int fruit_fstat(vfs_handle_struct *handle, files_struct *fsp, smb_fname_str_dbg(fsp->fsp_name))); if (fsp->base_fsp) { - tmp_base_name = fsp->fsp_name->base_name; + tmp_base_name = fsp->base_fsp->fsp_name->base_name; /* fsp_name is not converted with vfs_catia */ status = SMB_VFS_TRANSLATE_NAME( handle->conn, diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c index 1b716f4..5e162db 100644 --- a/source3/passdb/pdb_get_set.c +++ b/source3/passdb/pdb_get_set.c @@ -872,19 +872,20 @@ bool pdb_set_lanman_passwd(struct samu *sampass, const uint8 pwd[LM_HASH_LEN], e bool pdb_set_pw_history(struct samu *sampass, const uint8 *pwd, uint32_t historyLen, enum pdb_value_state flag) { + DATA_BLOB new_nt_pw_his = {}; + if (historyLen && pwd){ - DATA_BLOB *old_nt_pw_his = &(sampass->nt_pw_his); - sampass->nt_pw_his = data_blob_talloc(sampass, - pwd, historyLen*PW_HISTORY_ENTRY_LEN); - data_blob_free(old_nt_pw_his); - if (!sampass->nt_pw_his.length) { + new_nt_pw_his = data_blob_talloc(sampass, + pwd, historyLen*PW_HISTORY_ENTRY_LEN); + if (new_nt_pw_his.length == 0) { DEBUG(0, ("pdb_set_pw_history: data_blob_talloc() failed!\n")); return False; } - } else { - sampass->nt_pw_his = data_blob_talloc(sampass, NULL, 0); } + data_blob_free(&sampass->nt_pw_his); + sampass->nt_pw_his = new_nt_pw_his; + return pdb_set_init_flags(sampass, PDB_PWHISTORY, flag); } diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 1226ec1..115af2d 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -4778,17 +4778,20 @@ WERROR _spoolss_GetPrinter(struct pipes_struct *p, /* that's an [in out] buffer */ if (!r->in.buffer && (r->in.offered != 0)) { - return WERR_INVALID_PARAM; + result = WERR_INVALID_PARAM; + goto err_info_free; } *r->out.needed = 0; if (Printer == NULL) { - return WERR_BADFID; + result = WERR_BADFID; + goto err_info_free; } if (!get_printer_snum(p, r->in.handle, &snum, NULL)) { - return WERR_BADFID; + result = WERR_BADFID; + goto err_info_free; } result = winreg_get_printer_internal(p->mem_ctx, @@ -4797,7 +4800,7 @@ WERROR _spoolss_GetPrinter(struct pipes_struct *p, lp_const_servicename(snum), &info2); if (!W_ERROR_IS_OK(result)) { - goto out; + goto err_info_free; } switch (r->in.level) { @@ -4857,12 +4860,10 @@ WERROR _spoolss_GetPrinter(struct pipes_struct *p, } TALLOC_FREE(info2); - out: if (!W_ERROR_IS_OK(result)) { DEBUG(0, ("_spoolss_GetPrinter: failed to construct printer info level %d - %s\n", r->in.level, win_errstr(result))); - TALLOC_FREE(r->out.info); - return result; + goto err_info_free; } *r->out.needed = SPOOLSS_BUFFER_UNION(spoolss_PrinterInfo, @@ -4870,6 +4871,10 @@ WERROR _spoolss_GetPrinter(struct pipes_struct *p, r->out.info = SPOOLSS_BUFFER_OK(r->out.info, NULL); return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER); + +err_info_free: + TALLOC_FREE(r->out.info); + return result; } /******************************************************************** @@ -5686,14 +5691,16 @@ WERROR _spoolss_GetPrinterDriver2(struct pipes_struct *p, /* that's an [in out] buffer */ if (!r->in.buffer && (r->in.offered != 0)) { - return WERR_INVALID_PARAM; + result = WERR_INVALID_PARAM; + goto err_info_free; } DEBUG(4,("_spoolss_GetPrinterDriver2\n")); if (!(printer = find_printer_index_by_hnd(p, r->in.handle))) { DEBUG(0,("_spoolss_GetPrinterDriver2: invalid printer handle!\n")); - return WERR_INVALID_PRINTER_NAME; + result = WERR_INVALID_PRINTER_NAME; + goto err_info_free; } *r->out.needed = 0; @@ -5701,7 +5708,8 @@ WERROR _spoolss_GetPrinterDriver2(struct pipes_struct *p, *r->out.server_minor_version = 0; if (!get_printer_snum(p, r->in.handle, &snum, NULL)) { - return WERR_BADFID; + result = WERR_BADFID; + goto err_info_free; } if (r->in.client_major_version == SPOOLSS_DRIVER_VERSION_2012) { @@ -5718,8 +5726,7 @@ WERROR _spoolss_GetPrinterDriver2(struct pipes_struct *p, r->in.architecture, version); if (!W_ERROR_IS_OK(result)) { - TALLOC_FREE(r->out.info); - return result; + goto err_info_free; } *r->out.needed = SPOOLSS_BUFFER_UNION(spoolss_DriverInfo, @@ -5727,6 +5734,10 @@ WERROR _spoolss_GetPrinterDriver2(struct pipes_struct *p, r->out.info = SPOOLSS_BUFFER_OK(r->out.info, NULL); return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER); + +err_info_free: + TALLOC_FREE(r->out.info); + return result; } @@ -7847,6 +7858,7 @@ WERROR _spoolss_GetForm(struct pipes_struct *p, /* that's an [in out] buffer */ if (!r->in.buffer && (r->in.offered != 0)) { + TALLOC_FREE(r->out.info); return WERR_INVALID_PARAM; } @@ -8537,6 +8549,7 @@ WERROR _spoolss_GetPrinterDriverDirectory(struct pipes_struct *p, /* that's an [in out] buffer */ if (!r->in.buffer && (r->in.offered != 0)) { + TALLOC_FREE(r->out.info); return WERR_INVALID_PARAM; } @@ -9484,7 +9497,8 @@ WERROR _spoolss_GetJob(struct pipes_struct *p, /* that's an [in out] buffer */ if (!r->in.buffer && (r->in.offered != 0)) { - return WERR_INVALID_PARAM; + result = WERR_INVALID_PARAM; + goto err_jinfo_free; } DEBUG(5,("_spoolss_GetJob\n")); @@ -9492,12 +9506,14 @@ WERROR _spoolss_GetJob(struct pipes_struct *p, *r->out.needed = 0; if (!get_printer_snum(p, r->in.handle, &snum, NULL)) { - return WERR_BADFID; + result = WERR_BADFID; + goto err_jinfo_free; } svc_name = lp_const_servicename(snum); if (svc_name == NULL) { - return WERR_INVALID_PARAM; + result = WERR_INVALID_PARAM; + goto err_jinfo_free; } result = winreg_get_printer_internal(p->mem_ctx, @@ -9506,22 +9522,22 @@ WERROR _spoolss_GetJob(struct pipes_struct *p, svc_name, &pinfo2); if (!W_ERROR_IS_OK(result)) { - return result; + goto err_jinfo_free; } pdb = get_print_db_byname(svc_name); if (pdb == NULL) { -- Samba Shared Repository