1
0
mirror of https://github.com/samba-team/samba.git synced 2025-06-16 11:17:07 +03:00

231 Commits

Author SHA1 Message Date
Jeremy Allison
3fc1ab210b The first of Martin Zielinski <mz@seh.de> Vista printing patches.
Jerry will test and should get into 3.2 final (and the next 3.0.x
release).
Jeremy.
2008-04-24 14:04:47 -07:00
Volker Lendecke
4e6f8a19a6 Fix Coverity ID 504 2008-03-23 19:44:55 +01:00
Volker Lendecke
5c43c38271 Fix Coverity ID 503 2008-03-23 19:44:55 +01:00
Volker Lendecke
bc3bd7a8e7 Remove tiny code duplication
ndr_size_security_descriptor does the same as sec_desc_size
2007-12-29 23:13:26 +01:00
Jeremy Allison
04aecde5cf Make init_unistr2_from_unistr take an explicit talloc context.
Make init_unistr() re-use rpcstr_push_talloc().
Jeremy.
2007-11-27 17:48:44 -08:00
Jeremy Allison
f35a266b3c RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
2007-10-18 17:40:25 -07:00
Jeremy Allison
b4ee924000 r25399: Excise uint - > uint32 (where appropriate) or unsigned int.
Jeremy.
2007-10-10 12:31:02 -05:00
Michael Adam
9a28be220d r25294: Tidy up callers of unistr2_to_ascii() to pass sizeof(target_area) to
the maxeln parameter instead of sizeof(target_area) - 1 (or even
sizeof(fstring) - 1 in some places.

I hope these were really all there were.

Michael
2007-10-10 12:30:58 -05:00
Volker Lendecke
6585ea2cb7 r24809: Consolidate the use of temporary talloc contexts.
This adds the two functions talloc_stackframe() and talloc_tos().

 * When a new talloc stackframe is allocated with talloc_stackframe(), then
 * the TALLOC_CTX returned with talloc_tos() is reset to that new
 * frame. Whenever that stack frame is TALLOC_FREE()'ed, then the reverse
 * happens: The previous talloc_tos() is restored.
 *
 * This API is designed to be robust in the sense that if someone forgets to
 * TALLOC_FREE() a stackframe, then the next outer one correctly cleans up and
 * resets the talloc_tos().

The original motivation for this patch was to get rid of the
sid_string_static & friends buffers. Explicitly passing talloc context
everywhere clutters code too much for my taste, so an implicit
talloc_tos() is introduced here. Many of these static buffers are
replaced by a single static pointer.

The intended use would thus be that low-level functions can rather
freely push stuff to talloc_tos, the upper layers clean up by freeing
the stackframe. The more of these stackframes are used and correctly
freed the more exact the memory cleanup happens.

This patch removes the main_loop_talloc_ctx, tmp_talloc_ctx and
lp_talloc_ctx (did I forget any?)

So, never do a

tmp_ctx = talloc_init("foo");

anymore, instead, use

tmp_ctx = talloc_stackframe()

:-)

Volker
2007-10-10 12:30:24 -05:00
Andrew Tridgell
87c91e4362 r23801: The FSF has moved around a lot. This fixes their Mass Ave address. 2007-10-10 12:28:27 -05:00
Jeremy Allison
407e6e695b r23779: Change from v2 or later to v3 or later.
Jeremy.
2007-10-10 12:28:20 -05:00
Jeremy Allison
a871191395 r23122: Fix bug #4655. We marshall the enumdataex correctly,
but W2K3 doesn't follow our rules when sending data to
us. Ensure we look for the data at the correct offsets
when reading the data.
Too late for 3.0.25a - don't merge.
Jeremy.
2007-10-10 12:22:48 -05:00
Jeremy Allison
9a10736e6f r23080: Fix bug #4637 - we hads missed some cases where
we were calling PRS_ALLOC_MEM with zero count.
Jeremy.
2007-10-10 12:22:43 -05:00
Gerald Carter
f65214be68 r22852: merge fixes for CVE-2007-2446 and CVE-2007-2447 to all branches 2007-10-10 12:22:02 -05:00
Jeremy Allison
8ad13718af r22588: Make all uses of TALLOC_MEMDUP consistent.
Jeremy.
2007-10-10 12:19:48 -05:00
Jeremy Allison
0c8949ff5d r22062: Fix the parsing of info level 3. Flags is not a flags
field, but an offset. Fixed 64-bit display of ACLs on
printers.
Jeremy.
2007-10-10 12:19:07 -05:00
Jeremy Allison
60e26a9039 r21346: FIXME ! Our parsing here is wrong I think,
but for a level3 it makes no sense for
ptr_sec_desc to be NULL. JRA. Based on
a Vista sniff from Martin Zielinski <mz@seh.de>.
Jerry - part of the Vista patchset.
Jeremy.
2007-10-10 12:17:57 -05:00
Jeremy Allison
b35fa5168e r21096: Fix formatting.
Jeremy
2007-10-10 12:17:36 -05:00
Volker Lendecke
d7248b6cfa r19028: Implement getprinterinfo level 6 (only the status) and get rid of snum in the
getprinter calls. Survives the RPC-SAMBA3-SPOOLSS test which I will activate
when the Samba4 build farm has picked it up.

Volker
2007-10-10 12:15:03 -05:00
Jelmer Vernooij
b41c52b9db r18745: Use the Samba4 data structures for security descriptors and security descriptor
buffers.

Make security access masks simply a uint32 rather than a structure
with a uint32 in it.
2007-10-10 12:00:54 -05:00
Jelmer Vernooij
1115745cae r18188: merge 3.0-libndr branch 2007-10-10 11:43:56 -05:00
Jeremy Allison
9dafb7f48c r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need
to do the upper layer directories but this is what
everyone is waiting for....

Jeremy.
2007-10-10 11:19:14 -05:00
Jeremy Allison
05c50d99a4 r16378: Klocwork #1079. Allow BUFFER5 to cope with a NULL
dependentfiles pointer.
Jeremy.
2007-10-10 11:18:50 -05:00
Jeremy Allison
72709a8465 r16377: Klocwork #1077.
Jeremy.
2007-10-10 11:18:50 -05:00
Jeremy Allison
0a1ccfefcf r14778: Fix coverity null deref bugs #268 - #271.
Jeremy.
2007-10-10 11:15:48 -05:00
Volker Lendecke
b9fb3fc0e3 r14298: The other half of Coverity # 217 2007-10-10 11:15:24 -05:00
Volker Lendecke
932d769a32 r14232: Fix Coverity Bug # 218 2007-10-10 11:15:18 -05:00
Volker Lendecke
680bd1b004 r14228: Fix Coverity bug # 217 2007-10-10 11:15:18 -05:00
Jeremy Allison
fc8e1e5c02 r14083: Fix coverity bug #19. Don't deref possible NULL.
Jeremy.
2007-10-10 11:11:11 -05:00
Jeremy Allison
617c5805e5 r14080: Fix Coverity bug #18. Ensure non-null before ref.
Jeremy.
2007-10-10 11:11:10 -05:00
Jeremy Allison
fbf9db6624 r14047: Coverity fix #17. Ensure srv_name and info cannot
be zero before deref.
Jeremy.
2007-10-10 11:11:08 -05:00
Jeremy Allison
1d710d06a2 r13915: Fixed a very interesting class of realloc() bugs found by Coverity.
realloc can return NULL in one of two cases - (1) the realloc failed,
(2) realloc succeeded but the new size requested was zero, in which
case this is identical to a free() call.

The error paths dealing with these two cases should be different,
but mostly weren't. Secondly the standard idiom for dealing with
realloc when you know the new size is non-zero is the following :

 tmp = realloc(p, size);
 if (!tmp) {
    SAFE_FREE(p);
    return error;
 } else {
    p = tmp;
 }

However, there were *many* *many* places in Samba where we were
using the old (broken) idiom of :

 p = realloc(p, size)
 if (!p) {
    return error;
 }

which will leak the memory pointed to by p on realloc fail.

This commit (hopefully) fixes all these cases by moving to
a standard idiom of :

 p = SMB_REALLOC(p, size)
 if (!p) {
    return error;
 }

Where if the realloc returns null due to the realloc failing
or size == 0 we *guarentee* that the storage pointed to by p
has been freed. This allows me to remove a lot of code that
was dealing with the standard (more verbose) method that required
a tmp pointer. This is almost always what you want. When a
realloc fails you never usually want the old memory, you
want to free it and get into your error processing asap.

For the 11 remaining cases where we really do need to keep the
old pointer I have invented the new macro SMB_REALLOC_KEEP_OLD_ON_ERROR,
which can be used as follows :

 tmp = SMB_REALLOC_KEEP_OLD_ON_ERROR(p, size);
 if (!tmp) {
    SAFE_FREE(p);
    return error;
 } else {
    p = tmp;
 }

SMB_REALLOC_KEEP_OLD_ON_ERROR guarentees never to free the
pointer p, even on size == 0 or realloc fail. All this is
done by a hidden extra argument to Realloc(), BOOL free_old_on_error
which is set appropriately by the SMB_REALLOC and SMB_REALLOC_KEEP_OLD_ON_ERROR
macros (and their array counterparts).

It remains to be seen what this will do to our Coverity bug count :-).

Jeremy.
2007-10-10 11:10:59 -05:00
Gerald Carter
c803e1b2af r13878: move PORT_DATA_1 to use static sized UNICODE strings as per MSDN 2007-10-10 11:10:57 -05:00
Volker Lendecke
2c0c40dfb5 r13841: Fix an uninitialized variable warning.
Jerry, this just fixes the warning. This routine does not seem to cope well
with !UNMARSHALLING. You might want to look...

Volker
2007-10-10 11:10:56 -05:00
Gerald Carter
6d74de7a67 r13829: From the "It's not pretty but it works" category
* Finish prototype of the "add port command" implementation
  Format is "addportcommand portname deviceURI"

* DeviceURI is either
  - socket://hostname:port/
  - lpr://hostname/queue
  depending on what the client sent in the request
2007-10-10 11:10:56 -05:00
Gerald Carter
a444aa7f00 r13824: * add api table for Xcv TCPMON and LOCALMON calls starting
with the "MonitorUI" call
* Fix some parsing errors

This gets us to the Add Port Wizard dialog.
2007-10-10 11:10:56 -05:00
Gerald Carter
123e478ce5 r13815: "Into the blind world let us now descend,"
Began the poet, his face as pale as death.
"I will go first, and you will follow me."
---

Adding XcvDataPort() to the spoolss code for remotely
add ports.  The design is to allow an intuitive means
of creating a new CUPS print queue from the Windows 2000/XP
APW without hacks like specifying the deviceURI in the
location field of the printer properties dialog.

Also set 'default devmode = yes' as the new default
since it causes no harm and only is executed when you
have a NULL devmode anyways.
2007-10-10 11:10:55 -05:00
Gerald Carter
ef721333ab r9739: conver the reg_objects (REGSUBKEY_CTR & REGVAL_CTR) to use
the new talloc() features:

 Note that the REGSUB_CTR and REGVAL_CTR objects *must* be talloc()'d
 since the methods use the object pointer as the talloc context for
 internal private data.

 There is no longer a regXXX_ctr_intit() and regXXX_ctr_destroy()
 pair of functions.  Simply TALLOC_ZERO_P() and TALLOC_FREE() the
 object.

Also had to convert the printer_info_2->NT_PRINTER_DATA field
to be talloc()'d as well.  This is just a stop on the road to
cleaning up the printer memory management.
2007-10-10 11:03:25 -05:00
Gerald Carter
353e63ff42 r9086: * fix invalid read in parse_spoolss when writing a devmode to
the wire
* fix dup_a_regval() when size is 0
* ensure we pass a pstring to unlink_internals (fixes delete_driver
  code)
2007-10-10 11:00:25 -05:00
Gerald Carter
f617ca33f4 r8507: BUG 2557: don't give and rpc fault when you get an unsupported SetPrinter() level 2007-10-10 11:00:07 -05:00
Günther Deschner
b532553b06 r8398: Fix segfault in the client addprinterex-call. Found with "net rpc
printer"-functions.

Thanks to Thomas Di Naro (Novell) for the detailed debug-logs.

Guenther
2007-10-10 11:00:04 -05:00
Jeremy Allison
9506b8e145 r7882: Looks like a large patch - but what it actually does is make Samba
safe for using our headers and linking with C++ modules. Stops us
from using C++ reserved keywords in our code.
Jeremy
2007-10-10 10:58:00 -05:00
Gerald Carter
6eaefa1a9a r6683: remove log messages about unknown specversions since I think we are fairly safe at this point 2007-10-10 10:56:51 -05:00
Gerald Carter
f04232cce7 r6491: BUG 2653: patch from Olaf Imig <Olaf.Imig@bifab.de>; allocate memory for user1* in make_spoolss_q_open_printer_ex() 2007-10-10 10:56:43 -05:00
Gerald Carter
4e0ac63c36 r6014: rather large change set....
pulling back all recent rpc changes from trunk into
3.0.  I've tested a compile and so don't think I've missed
any files.  But if so, just mail me and I'll clean backup
in a couple of hours.

Changes include \winreg, \eventlog, \svcctl, and
general parse_misc.c updates.

I am planning on bracketing the event code with an
#ifdef ENABLE_EVENTLOG until I finish merging Marcin's
changes (very soon).
2007-10-10 10:56:15 -05:00
Gerald Carter
1f00602786 r5946: BUG 2497: fix bug in rpcclient's deletedriverex when asking to delete all versions of a driver 2007-10-10 10:56:10 -05:00
Gerald Carter
25121547ca r5805: merging spoolss parsing changes from trunk and cleaning up resulting segvs 2007-10-10 10:56:01 -05:00
Jeremy Allison
620f2e608f r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
functions so we can funnel through some well known functions. Should help greatly with
malloc checking.
HEAD patch to follow.
Jeremy.
2007-10-10 10:53:32 -05:00
Günther Deschner
a24df09386 r3645: Allow deldriverex in rpcclient to delete drivers for a specific
architecture and a specific version.

Guenther
2007-10-10 10:53:11 -05:00
Gerald Carter
cfd51c0244 r3639: patch from Martin Zielinski <mz@seh.de> to add DeleteDriverEx() function to rpcclient 2007-10-10 10:53:11 -05:00