1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-29 11:21:54 +03:00
Commit Graph

1664 Commits

Author SHA1 Message Date
Volker Lendecke
6491aed1ac r14022: Fix Coverity bug # 92
(This used to be commit b824245c4e)
2007-10-10 11:11:06 -05:00
Volker Lendecke
eae063e965 r13991: Fix Coverity bug # 69
(This used to be commit 6dc79e6b12)
2007-10-10 11:11:03 -05:00
Volker Lendecke
03b32953cf r13987: Fix Coverity bug # 74. This tool is good...
Thanks,

Volker
(This used to be commit 86f62484dd)
2007-10-10 11:11:03 -05:00
Jeremy Allison
894358a8f3 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.
(This used to be commit 1d710d06a2)
2007-10-10 11:10:59 -05:00
Jeremy Allison
2d3946b8c4 r13893: Fix for Coverity issue CID #164. The first one that I don't
think is a direct bug, but some code that needs clarification :-).
Jeremy.
(This used to be commit 61901a3f10)
2007-10-10 11:10:59 -05:00
Jeremy Allison
42df51222b r13889: Fix resource leak on error path. Coverity bug CID #73.
Jeremy.
(This used to be commit 46e1098092)
2007-10-10 11:10:58 -05:00
Derrell Lipman
3af5da2e7c r13763: r13223@cabra: derrell | 2006-02-28 20:48:23 -0500
Add the missing comment about needing to save the new share name.
(This used to be commit bb3b15e631)
2007-10-10 11:10:52 -05:00
Derrell Lipman
c52968b35b r13761: r13221@cabra: derrell | 2006-02-28 20:40:56 -0500
When only allowing one connection per server, the cache needs to track which
 share is currently connected, or we never know whether a tdis()/tcon() for the
 new share is required.
(This used to be commit ad0a725ef5)
2007-10-10 11:10:52 -05:00
Gerald Carter
a0ac1d5913 r13676: have to return a value from a non-void function
(This used to be commit 70e7c9de9d)
2007-10-10 11:10:22 -05:00
Gerald Carter
19b22b5c90 r13671: fix return value in (void)fn()
(This used to be commit 249dba0386)
2007-10-10 11:10:22 -05:00
Jeremy Allison
f690a968e7 r13669: Get rid of poor errno mapping table. Bounce through NTSTATUS instead.
DO NOT MERGE FOR 3.0.21c PLEASE.
Jeremy.
(This used to be commit 3de0d9af69)
2007-10-10 11:10:22 -05:00
Jeremy Allison
ffba826a17 r13664: Fix the cli_error codes to always detect a socket error.
This code needs a tidyup and common code with libsmb/errormap.c
merging. Should fix the winbindd crash Jerry found (I hope).
Jeremy.
(This used to be commit e81227d044)
2007-10-10 11:10:22 -05:00
Jeremy Allison
0d7f6d650d r13614: First part of the bugfix for #3510 - net join fails
against server with schannel disabled. Second part
will come tomorrow (fixing net_rpc_join_ok()).
Jeremy.
(This used to be commit 7de1ee1861)
2007-10-10 11:10:19 -05:00
Gerald Carter
fb5362c069 r13571: Replace all calls to talloc_free() with thye TALLOC_FREE()
macro which sets the freed pointer to NULL.
(This used to be commit b65be8874a)
2007-10-10 11:10:14 -05:00
Jeremy Allison
9132acff08 r13553: Fix all our warnings at -O6 on an x86_64 box.
Jeremy.
(This used to be commit ea82958349)
2007-10-10 11:10:13 -05:00
Jeremy Allison
39a572e010 r13539: Add 128 bit creds processing client and server. Thanks to Andrew Bartlett's
Samba4 code.
Jeremy.
(This used to be commit a2fb436fc5)
2007-10-10 11:10:11 -05:00
Jeremy Allison
3e4cf56fa3 r13519: Fix the credentials chaining across netlogon pipe disconnects.
I mean it this time :-).
Jeremy.
(This used to be commit 80f4868944)
2007-10-10 11:10:09 -05:00
Jeremy Allison
8189bb6e4c r13502: Fix error messages for usershares when smbd is not
running. More generic error return cleanup in libsmb/
needs doing (everything returning NTSTATUS not BOOL).
Jeremy
(This used to be commit 654bb9853b)
2007-10-10 11:10:07 -05:00
Günther Deschner
c9b5c9b941 r13495: Derell, I'm removing that double setup_logging(), just a typo.
Guenther
(This used to be commit c0d91f9d19)
2007-10-10 11:10:06 -05:00
Jeremy Allison
3df82f57fc r13489: Fix #3496 from jason@ncac.gwu.edu. Variable set but never used.
Jeremy.
(This used to be commit 4204794cc7)
2007-10-10 11:10:06 -05:00
Volker Lendecke
71247a2f05 r13477: Fix code before declaration
(This used to be commit c15f1d553f)
2007-10-10 11:10:05 -05:00
Jeremy Allison
d672d8fd6b r13473: Back port r13470, r13471, r13472 from Samba4. Thanks Andrew:
-----------------------------------
Thanks to a report from VL:

We were causing mayhem by weakening the keys at the wrong point in time.

I think this is the correct place to do it.  The session key for SMB
signing, and the 'smb session key' (used for encrypting password sets)
is never weakened.

The session key used for bulk data encryption/signing is weakened.

This also makes more sense, when we look at the NTLM2 code.

Andrew Bartlett
-----------------------------------
With more 'try all options' testing, I found this 'simple' but in the
NTLM2 signing code.

Andrew Bartlett
-----------------------------------
After Volker's advise, try every combination of parameters.  This
isn't every parameter on NTLMSSP, but it is most of the important
ones.

This showed up that we had the '128bit && LM_KEY' case messed up.
This isn't supported, so we must look instead at the 56 bit flag.

Andrew Bartlett
-----------------------------------

We should now try retesting with NT4. This should be standalone
enough to port into a SAMBA_3_0_RELEASE branch fix.

Jeremy.
(This used to be commit b9b8cd1752)
2007-10-10 11:10:05 -05:00
Jeremy Allison
ad8b47a2ba r13407: Change the credentials code to be more like the Samba4 structure,
makes fixes much easier to port. Fix the size of dc->sess_key to
be 16 bytes, not 8 bytes - only store 8 bytes in the inter-smbd
store in secrets.tdb though. Should fix some uses of the dc->sess_key
where we where assuming we could read 16 bytes.
Jeremy.
(This used to be commit 5b3c2e63c7)
2007-10-10 11:09:59 -05:00
Jeremy Allison
86358fc10b r13396: Add in userinfo26, re-enable userinfo25 - took the knowledge
from Samba4 on how to decode the 532 byte password buffers.
Getting closer to passing samba4 RPC-SCHANNEL test.
Jeremy.
(This used to be commit 205db6968a)
2007-10-10 11:09:59 -05:00
Jeremy Allison
7f5e36df8d r13331: No I didn't have to change the interface version...
Jeremy.
(This used to be commit 2aed5b3640)
2007-10-10 11:06:25 -05:00
Jeremy Allison
40d3c7ebb2 r13329: Fix libsmbsharemodes.so to work with the stored delete token.
Less trouble than I thought plus it didn't need an interface
change (thank goodness !).
Jeremy.
(This used to be commit dbe2572d1c)
2007-10-10 11:06:25 -05:00
Jeremy Allison
2268658171 r13322: Fix warning time_t != int.
Jeremy.
(This used to be commit 6196446a03)
2007-10-10 11:06:24 -05:00
Gerald Carter
0af1500fc0 r13316: Let the carnage begin....
Sync with trunk as off r13315
(This used to be commit 17e63ac4ed)
2007-10-10 11:06:23 -05:00
Gerald Carter
855e02f164 r13310: first round of server affinity patches for winbindd & net ads join
(This used to be commit 6c3480f9ae)
2007-10-10 11:06:23 -05:00
Jeremy Allison
86c9bac4c3 r13274: Fix for bug #3467. Not a show stopper.
jason qian <jason@infrant.com> was a *fantastic*
help in tracking this down.
Jeremy.
(This used to be commit 9f4a9c70fa)
2007-10-10 11:06:20 -05:00
Jeremy Allison
4699d4741d r13238: Fix from Qiao Yang <qyang@stbernard.com> to ensure we
always update the failed time when we are adding a failed
connection.
Jeremy.
(This used to be commit 6f5af1dd41)
2007-10-10 11:06:19 -05:00
Derrell Lipman
7ed3868780 r13216: r12422@cabra: derrell | 2006-01-28 23:57:35 -0500
Fix cli_setpathinfo() to actually do what it's supposed to.

 Also, get rid of some apparently drug-induced code to deal with create time
 which isn't being manipulated anyway.
(This used to be commit aa25dc1248)
2007-10-10 11:06:18 -05:00
Derrell Lipman
c9811b857a r13214: r12420@cabra: derrell | 2006-01-28 19:10:58 -0500
This should fix bug #3446.

 - The authentication domain provided an an SMB URL was being ignored.  This
   patch fixes that.

 - There were a number of places where string copies were not being confirmed to
   be properly null-terminated.  Now, all string copies in libsmbclient.c are
   properly null-terminated.
(This used to be commit 5fbc2fbb46)
2007-10-10 11:06:18 -05:00
Derrell Lipman
9c15bd311d r13212: r12414@cabra: derrell | 2006-01-28 17:52:17 -0500
lp_load() could not be called multiple times to modify parameter settings based
 on reading from multiple configuration settings.  Each time, it initialized all
 of the settings back to their defaults before reading the specified
 configuration file.

 This patch adds a parameter to lp_load() specifying whether the settings should
 be initialized.  It does, however, still force the settings to be initialized
 the first time, even if the request was to not initialize them.  (Not doing so
 could wreak havoc due to uninitialized values.)
(This used to be commit f2a24de769)
2007-10-10 11:06:18 -05:00
Volker Lendecke
ba611cb036 r13211: Fix remote password changing if password must change is set
The problem was that the ntlmssp bind silently failed in that case, we have to
do it anonymously. Or does anybody have a better idea?

Give a better error message if something else is wrong with the account.

Volker
(This used to be commit 0e24c701ce)
2007-10-10 11:06:18 -05:00
Jeremy Allison
f1022af07b r13176: Fix show-stopper bug for 3.0.21b where 4 leg NTLMSSP SPNEGO
auth was not generating the correct auth header on the 4th
packet. This may fix a lot of Windows client complaints and
is essential for release.
Jeremy.
(This used to be commit 48dd8c732b)
2007-10-10 11:06:16 -05:00
Jeremy Allison
60bcd1bd77 r13147: Raise creds_server_step fail log messages to debug level 2.
These can happen in normal operation (I think - not 100%
sure) and don't want to alarm admins. Jerry please add this
to 3.0.21b.
Jeremy.
(This used to be commit 47178b1b5a)
2007-10-10 11:06:15 -05:00
Jeremy Allison
7756059d38 r13119: Fix for #1779 from William Jojo <jojowil@hvcc.edu>
Jeremy.
(This used to be commit 103cac7dd3)
2007-10-10 11:06:14 -05:00
Günther Deschner
8a30b3226d r13020: Prevent cli_krb5_get_ticket of getting into an infite loop. This whole
area of code needs to be reworked later on.

Guenther
(This used to be commit 088abfcdd1)
2007-10-10 11:06:10 -05:00
Jeremy Allison
2fd79d8bfc r13015: Make logic much clearer. From jpeach.
Jeremy.
(This used to be commit d9b6bdd84a)
2007-10-10 11:06:10 -05:00
Jeremy Allison
90372e1e93 r13012: Fix #3421 - it turns out krb5_kt_get_entry() on MIT
does an implicit open/read/close and blows away an
open keytab handle - so make sure we use a new
handle.
Wonderful analysis from Luke <ldeller@xplantechnology.com>
helped fix this.
Jeremy.
(This used to be commit 9d2f2385ad)
2007-10-10 11:06:10 -05:00
Jeremy Allison
ae4a576f68 r12922: Fix typo.
Jeremy.
(This used to be commit 1c32b352da)
2007-10-10 11:06:08 -05:00
Jeremy Allison
5f4a895cdd r12920: Fix for #3401 from Andrew Bartlett. Original fix from
Yau Lam Yiu <yiuext@cs.ust.hk>.
Jeremy.
(This used to be commit 4776101107)
2007-10-10 11:06:07 -05:00
Derrell Lipman
f396e2248a r12758: r12127@cabra: derrell | 2006-01-03 15:22:18 -0500
remove old superfluous comment and ifdef
(This used to be commit ee7fcb43ad)
2007-10-10 11:06:02 -05:00
Jeremy Allison
2b509f470d r12713: Remove use of uint8_t -> uint8.
Jeremy.
(This used to be commit 4473ac4ef9)
2007-10-10 11:06:01 -05:00
Derrell Lipman
cbc97b4e5a r12579: r12122@cabra: derrell | 2005-12-29 12:03:00 -0500
allow for arbitrary option value types
(This used to be commit 64c8e32b63)
2007-10-10 11:06:00 -05:00
Derrell Lipman
e13d0cb3ec r12576: r12115@cabra: derrell | 2005-12-29 11:16:03 -0500
bug (enhancement) #2651: add option to log debug messages to stderr instead of stdout
(This used to be commit 4182eb99af)
2007-10-10 11:05:59 -05:00
Derrell Lipman
7919fd0ec8 r12570: r12084@cabra: derrell | 2005-12-29 10:05:16 -0500
do not open connection when only looking for cached connection; also, fix crash caused by missing initialization following recent locale changes
(This used to be commit 0070d816ab)
2007-10-10 11:05:59 -05:00
Derrell Lipman
1d49a2956d r12569: r12083@cabra: derrell | 2005-12-29 09:39:45 -0500
fix line length and make formatting/indentation more consistent
(This used to be commit 3d45023368)
2007-10-10 11:05:59 -05:00
Derrell Lipman
44db82065a r12485: r12044@cabra: derrell | 2005-12-25 16:46:47 -0500
When enumerating what could be a server name or a workgroup name, first
 check for an existing server structure.  If none exists, then go through
 the previous determination of whether it's a serrver or a workgroup.  This
 should avoid doing a NetBIOS name query each time, if we've already
 connected to the specified server.  (While we're at it, clean up indenting
 and line length in this area of code.)
(This used to be commit 85e4cab1d9)
2007-10-10 11:05:58 -05:00