1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-14 20:23:54 +03:00
Commit Graph

443 Commits

Author SHA1 Message Date
Jeremy Allison
9f676603aa r15334: Fix warning. This table and function not used anymore. Jerry please
check.
Jeremy.
2007-10-10 11:16:36 -05:00
Gerald Carter
037f9f831e r15309: normalize printing keys when deleting 2007-10-10 11:16:34 -05:00
Jeremy Allison
0217f7d7bf r14788: Fix coverity bug #276. null deref.
Jeremy.
2007-10-10 11:15:48 -05:00
Jeremy Allison
363d31c9ec r14786: Fix coverity #275. null deref.
Jeremy.
2007-10-10 11:15:48 -05:00
Gerald Carter
69f816e9f8 r14482: Fixes for spoolss code (after coverity fixes) when the
client sends a NULL RPC_BUFFER*
2007-10-10 11:15:33 -05:00
Jeremy Allison
f65d7afe19 r14387: Try and fix the coverity issues (#53, #54) with negative
sink by ensuring all uses of rpcstr_push are consistent
with a size_t dest size arg.
Jeremy.
2007-10-10 11:15:27 -05:00
Jeremy Allison
338538410d r14353: Fix coverity bugs #61 and #62. Remember to divide by
the size of the data table. Clean up the struct a little.
Jeremy.
2007-10-10 11:15:26 -05:00
Jeremy Allison
f71aa3ab8f r14303: Fix coverity #223. In a loop we were forgetting to free
resources on error exit path.
Jeremy.
2007-10-10 11:15:24 -05:00
Jeremy Allison
f1a5e5aefe r14301: Fix coverity #224. In a loop we were forgetting to free
resources on error exit path.
Jeremy.
2007-10-10 11:15:24 -05:00
Jeremy Allison
1c0b4ed0ac r14299: Fix coverity #225. In a loop we were forgetting to free
resources on error exit path.
Jeremy.
2007-10-10 11:15:24 -05:00
Jeremy Allison
d9e1d6fed0 r14289: Fix coverity #101, resource leak on error code path.
Jeremy.
2007-10-10 11:15:23 -05:00
Jeremy Allison
f458596b0e r14286: Similar clarifiction fix for coverity #102.
Jeremy.
2007-10-10 11:15:23 -05:00
Jeremy Allison
6621acc68f r14284: Fix coverity bug #103. Make code clearer - probably
not a real issue but this code is easier to read.
Jeremy.
2007-10-10 11:15:23 -05:00
Jeremy Allison
5f74e56b86 r14268: Fix coverity error #204. Resource leak on error path.
Jeremy.
2007-10-10 11:15:22 -05:00
Jeremy Allison
23d69758bb r14266: Fix coverity #205. Resource leak on error path.
Jeremy.
2007-10-10 11:15:21 -05:00
Jeremy Allison
0429b6e8c3 r14264: Fix coverity #207. Resource leak on error path.
Jeremy.
2007-10-10 11:15:21 -05:00
Jeremy Allison
ca96c7be77 r14250: Fix coverity bug #107. Resource leak on error path.
Jeremy.
2007-10-10 11:15:20 -05:00
Volker Lendecke
0dc3030bce r14233: Fix Coverity bug # 206 2007-10-10 11:15:18 -05:00
Jeremy Allison
e83515afd2 r14178: Clarify code for Coverity #49. Ensure we know we
can't have an uninitialized *returned val.
Jeremy.
2007-10-10 11:15:15 -05:00
Jeremy Allison
d993797191 r13994: Belt and braces - ensure RPC_BUFFER is valid.
Jeremy.
2007-10-10 11:11:03 -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
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
a34ab5c827 r13821: replacing some strings with macros 2007-10-10 11:10:56 -05:00
Gerald Carter
ba9cdd88a0 r13820: * Start fleshing out the XcvDataPort() server implementation
* Add support for the "Local Port" monitor as well through this API
2007-10-10 11:10:55 -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
117d9fd9e1 r13547: add earlier checks to deny deleting a printer driver. The previous
code relied upon file permissions alone.  Now we check that
the user is a printer administrator and that the share has not been
marked read only for that user.
2007-10-10 11:10:12 -05:00
Gerald Carter
17e63ac4ed r13316: Let the carnage begin....
Sync with trunk as off r13315
2007-10-10 11:06:23 -05:00
Jeremy Allison
23f16cbc2e r13293: Rather a big patch I'm afraid, but this should fix bug #3347
by saving the UNIX token used to set a delete on close flag,
and using it when doing the delete. libsmbsharemodes.so still
needs updating to cope with this change.
Samba4 torture tests to follow.
Jeremy.
2007-10-10 11:06:21 -05:00
Jeremy Allison
c65b752604 r12043: It's amazing the warnings you find when compiling on a 64-bit
box with gcc4 and -O6...
Fix a bunch of C99 dereferencing type-punned pointer will break
strict-aliasing rules errors. Also added prs_int32 (not uint32...)
as it's needed in one place. Find places where prs_uint32 was being
used to marshall/unmarshall a time_t (a big no no on 64-bits).
More warning fixes to come.
Thanks to Volker for nudging me to compile like this.
Jeremy.
2007-10-10 11:05:42 -05:00
Gerald Carter
46bf28c81c r11860: BUG 3156: don't use find_service() when explicitly looking for a printer as the username map might get in the way 2007-10-10 11:05:31 -05:00
Gerald Carter
18400f9662 r11240: * fix invalid read reported by valgrind in the
spoolss backchannel connection by rewriting
  spoolss_connect_to_client().  Ensure that we
  save the cli_state* in the rpc_pipe_client struct.

* fix typo in debug message in cli_start_connection"
2007-10-10 11:05:09 -05:00
Gerald Carter
f6f78877b4 r11235: fix segfault in addprinter due to mixing talloc() and malloc()'d memory 2007-10-10 11:05:08 -05:00
Gerald Carter
7ada5da8e9 r11135: should fix seg fault in addprinter code reported by Marcin. Allocate memory in convert_printer_info() if necessary 2007-10-10 11:05:02 -05:00
Gerald Carter
939c3cb5d7 r10656: BIG merge from trunk. Features not copied over
* \PIPE\unixinfo
* winbindd's {group,alias}membership new functions
* winbindd's lookupsids() functionality
* swat (trunk changes to be reverted as per discussion with Deryck)
2007-10-10 11:04:48 -05:00
Günther Deschner
12029e9022 r9945: fix typos.
Guenther
2007-10-10 11:03:28 -05:00
Gerald Carter
050364ef34 r9752: figured out why talloc_steal() is a bad idea for SEC_DESC*
Add a comment so someone else doesn't get bitten by this as well.
2007-10-10 11:03:25 -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
bfebbc86fc r9264: fix valgrind invalid write error in enumprinterdata() 2007-10-10 11:00:29 -05:00
Günther Deschner
06bfe789d5 r9021: Fix smbd-crash bug in openprinter (found by samba4 smbtorture
RPC-SPOOLSS).

Guenther
2007-10-10 11:00:23 -05:00
Gerald Carter
b527b86ae8 r8916: should fix the valgrind invalid read of size 1 onthe
GetPrinterData("OSVersion") abartlet saw when browsing from
Vista client.
2007-10-10 11:00:20 -05:00
Jeremy Allison
86f8368c99 r8617: Be very explicit if addprinterex is called that the "addprinter command"
must be defined in smb.conf.
Jeremy.
2007-10-10 11:00:13 -05:00
Gerald Carter
d07179de2f r8501: * disable printer handle object cache (was mostly used
for NT4 clients enumerating printer data on slow CPUs)
* fix pinter and secdesc record upgrade to normalize the key
  (rev'd printer tdb version)
* fixed problem that was normalizing the printername name field

in general, this should fix the issues upgrading print servers
from 3.0.14a to 3.0.20
2007-10-10 11:00:06 -05:00
Gerald Carter
0689851a90 r8326: factor out the delete printer code to a delete_printer_hook() for reuse 2007-10-10 10:58:20 -05:00
Gerald Carter
9a27f7181a r8324: * initial cut at creating printers via the registry API
Need to add delete_key support
2007-10-10 10:58:19 -05:00
Gerald Carter
a872ea5f0e r8322: * get RegSetValue() working for printer subkey values
(not immediate values below the <printer name> key yet.
2007-10-10 10:58:19 -05:00
Gerald Carter
00bce2b3bb r8066: * had to modify the printer data storage slightly in ntprinters.tdb
when packing values.  It is a compatible change though and will
  not require a tdb version upgrade
* Can successfully create new printer subkeys via winreg that
  are immediately available via spoolss calls.  Still cannot delete
  keys yet though.  That comes next.
2007-10-10 10:58:10 -05:00
Gerald Carter
0d6352da48 r7995: * privileges are local except when they're *not*
printmig.exe assumes that the LUID of the SeBackupPrivlege
  on the target server matches the LUID of the privilege
  on the local client.  Even though an LUID is never guaranteed
  to be the same across reboots.  How *awful*!  My cat could
  write better code! (more on my cat later....)

* Set the privelege LUID in the global PRIVS[] array

* Rename RegCreateKey() to RegCreateKeyEx() to better match MSDN

* Rename the unknown field in RegCreateKeyEx() to disposition
  (guess according to MSDN)

* Add the capability to define REG_TDB_ONLY for using the reg_db.c
  functions and stress the RegXXX() rpc functions.
2007-10-10 10:58:07 -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