1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-10 13:57:47 +03:00

684 Commits

Author SHA1 Message Date
Jeremy Allison
4fbeae1a3a r16424: Fix possible null deref and a memory leak found by
examining Klockwork #1519. get_printer_subkeys()
could return zero without initializing it's return
pointer arg. Fixed this. Added free of subkey pointer
return in registry/reg_printing.c (interesting that
neithe Coverity or Klocwork found this one).
Jeremy.
2007-10-10 11:18:52 -05:00
Jeremy Allison
c9a4ce51ed r16393: Klocwork #1164. Null deref.
Jeremy.
2007-10-10 11:18:51 -05:00
Jeremy Allison
cab256d72a r16392: Klockwork #1168. Protect against null deref.
Jeremy.
2007-10-10 11:18:51 -05:00
Jeremy Allison
b581fee982 r16367: Missed one, Klocwork #915.
Jeremy.
2007-10-10 11:18:49 -05:00
Jeremy Allison
fe05769a1a r16365: Fix Klocwork #895, #898, #899, #915, #932, #938 and a
few other problems Klocwork missed.
Jeremy.
2007-10-10 11:18:49 -05:00
Jeremy Allison
66275bd3bc r16243: Fix Klocwork bugs #581 and #706, ensure we check
the end of array first in the loop. Reformat to
modern standards.
Jeremy.
2007-10-10 11:17:27 -05:00
Jeremy Allison
6c61dc8ed6 r16230: Fix Klocwork #861 and others. localtime and asctime
can return NULL. Ensure we check all returns correctly.
Jeremy.
2007-10-10 11:17:26 -05:00
Jeremy Allison
e6aacb1426 r16216: Add debug messages to make it possible to try and
debug why a job pause or resume command is not being
done.
Jeremy.
2007-10-10 11:17:26 -05:00
Volker Lendecke
5787bd0ee9 r15569: Fix Coverity bug # 287. Jerry, can you check if WERR_NOMEM is a correct error
code here?

Thanks,

Volker
2007-10-10 11:17:01 -05:00
Gerald Carter
4c4ea7b20f r15543: New implementation of 'net ads join' to be more like Windows XP.
The motivating factor is to not require more privileges for
the user account than Windows does when joining a domain.

The points of interest are

* net_ads_join() uses same rpc mechanisms as net_rpc_join()
* Enable CLDAP queries for filling in the majority of the
  ADS_STRUCT->config information
* Remove ldap_initialized() from sam/idmap_ad.c and
  libads/ldap.c
* Remove some unnecessary fields from ADS_STRUCT
* Manually set the dNSHostName and servicePrincipalName attribute
  using the machine account after the join

Thanks to Guenther and Simo for the review.

Still to do:

* Fix the userAccountControl for DES only systems
* Set the userPrincipalName in order to support things like
  'kinit -k' (although we might be able to just use the sAMAccountName
  instead)
* Re-add support for pre-creating the machine account in
  a specific OU
2007-10-10 11:16:57 -05:00
Gerald Carter
037f9f831e r15309: normalize printing keys when deleting 2007-10-10 11:16:34 -05:00
Volker Lendecke
b9c6e3f556 r15101: Little step towards getting Samba4 tdb into 3: tdb_lock_bystring does not
have the timeout argument in Samba4. Add a new routine
tdb_lock_bystring_with_timeout.

Volker
2007-10-10 11:16:23 -05:00
Jeremy Allison
a64976b944 r15025: Fix exit_server_cleanly call.
Jeremy.
2007-10-10 11:15:57 -05:00
James Peach
56bc02d644 r14898: This change is an attempt to improve the quality of the information that
is produced when a process exits abnormally.

First, we coalesce the core dumping code so that we greatly improve our
odds of being able to produce a core file, even in the case of a memory
fault. I've removed duplicates of dump_core() and split it in two to
reduce the amount of work needed to actually do the dump.

Second, we refactor the exit_server code path to always log an explanation
and a stack trace. My goal is to always produce enough log information
for us to be able to explain any server exit, though there is a risk
that this could produce too much log information on a flaky network.

Finally, smbcontrol has gained a smbd fault injection operation to test
the changes above. This is only enabled for developer builds.
2007-10-10 11:15:53 -05:00
Günther Deschner
aae8f8ae7a r14506: Remove remaining references to a KCM credential cache type.
Guenther
2007-10-10 11:15:35 -05:00
Jeremy Allison
2703df7a8f r14489: Guard against coverity reversion. #181 is a false positive
but make the intent clearer.
Jeremy.
2007-10-10 11:15:34 -05:00
Jeremy Allison
d2be8163f2 r14273: Fix coverity bug #202. Memory leak on error path.
Jeremy.
2007-10-10 11:15:22 -05:00
Jeremy Allison
21b70035f3 r14221: Fix coverity #76. My previous change wasn't quite enough :-).
Jeremy.
2007-10-10 11:15:17 -05:00
Jeremy Allison
c76092a066 r14184: Coverity fix #56. Ensure we can't deref null.
Jeremy.
2007-10-10 11:15:15 -05:00
Jeremy Allison
9c55bf74ca r14023: My last bug fix still left a potential null deref.
C- "must try harder" :-).
Jeremy.
2007-10-10 11:11:06 -05:00
Jeremy Allison
f9a75d7654 r14003: Clarify code that lead to Coverity report #13.
Not a bug, but better to remove false positives.
Jeremy.
2007-10-10 11:11:04 -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
Günther Deschner
b2eac2e6eb r13622: Allow to rename machine accounts in a Samba Domain. This still uses the
"rename user script" to do the rename of the posix machine account (this
might be changed later). Fixes #2331.

Guenther
2007-10-10 11:10:19 -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
Günther Deschner
cf86d4c9f0 r13408: Remove C++ comments (# 3494)
Guenther
2007-10-10 11:09:59 -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
Gerald Carter
bcce3b69f8 r12889: BUG 3380: fix crash when changing printer drivers caused by accessing a previously freed pointer 2007-10-10 11:06:06 -05:00
Gerald Carter
017775f287 r11855: patch from Aruna Prabakar for checking that the spooler si running on HP-UX 2007-10-10 11:05:30 -05:00
Jeremy Allison
4cd8e2a96b r11420: Fix issue pointed out by Dina Fine <dina@exanet.com>. We can
only tell at parse time from the wire if an incoming name
has wildcards or not. If it's a mangled name and we demangle
the demangled name may contain wildcard characters. Ensure
these are ignored.
Jeremy.
2007-10-10 11:05:15 -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
Gerald Carter
88998fa0b9 r10555: a few compile warnings from jason Mader 2007-10-10 11:04:47 -05:00
Gerald Carter
39369c8041 r10554: * BUG 3057: assume x64 drivers are v3 drivers
* BUG 3087: allow smbspool to establisha geust connection
  using a username with no password
2007-10-10 11:04:47 -05:00
Jeremy Allison
155dc2d52a r10371: Adding iPrint printing backend written by Joel J. Smith @ Novell.
Jeremy.
2007-10-10 11:03:41 -05:00
Günther Deschner
daa61ef75b r10154: Fix crash bug on security descriptor upgrade (as seen on x86_64).
Guenther
2007-10-10 11:03:35 -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
Jeremy Allison
bf80edeea7 r9244: Fix bugs found by Coverity.
Jeremy.
2007-10-10 11:00:28 -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
Günther Deschner
dccf777f42 r8686: Revert %LOGONSERVER%-substitution. The substition is done on the client,
not on the server.

We now preserve this windows variable (important for vampired setups)
and correctly substitute only the "%L"s in strings like:

        "%LOGONSERVER% %L %lOgOnSeRvEr% %L".

Guenther
2007-10-10 11:00:15 -05:00
Gerald Carter
9e50d696c3 r8543: merge volker's nt_printing_init() fix from trunk (r8526)
but make sure to write the new version to the ntdrivers.tdb.
2007-10-10 11:00:08 -05:00
Gerald Carter
2f5de718a9 r8506: BUG 2853: don't strip out characters like '$' from printer names
when substituting for the lpq command.
2007-10-10 11:00:07 -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
Jeremy Allison
c7fe18761e r8219: Merge the new open code from HEAD to 3.0. Haven't yet run the torture
tests on this as it's very late NY time (just wanted to get this work
into the tree). I'll test this over the weekend....
Jerry - in looking at the difference between the two trees there
seem to be some printing/ntprinting.c and registry changes we might
want to examine to try keep in sync.
Jeremy.
2007-10-10 10:58:18 -05:00
Gerald Carter
d3427960b0 r8089: successfully delete printer subkeys via the registry....now for values 2007-10-10 10:58:10 -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
4aec5dce5c r8025: *how* can this code have been around so long and
nver normalized the string used for printer and
sec_desc key lookups ?????

normalized sharename to lower case before storing/fetching
from tdb.

Need to look at drivers and forms tdb as well (perhaps).
2007-10-10 10:58:09 -05:00
Gerald Carter
5f4a3f61a3 r7983: clean up some use of un-initialized variables found by valgrind 2007-10-10 10:58:06 -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
ada1d326ae r7829: fix unitialized printer status field that was breaking migration of print queues 2007-10-10 10:57:58 -05:00
Gerald Carter
a091b37d59 r7692: start versioning the registry.tdb file since it can be modified now 2007-10-10 10:57:19 -05:00