summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r13975: Re-fix Coverity #156 - I had left the hidden arg. inconsistentJeremy Allison1-3/+3
between Realloc and realloc_array. Jeremy. (This used to be commit 841c9b1847ae12656b827e3d35b8bf0c3f68b8b4)
2007-10-10r13915: Fixed a very interesting class of realloc() bugs found by Coverity.Jeremy Allison1-28/+71
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 1d710d06a214f3f1740e80e0bffd6aab44aac2b0)
2007-10-10r13571: Replace all calls to talloc_free() with thye TALLOC_FREE()Gerald Carter1-2/+2
macro which sets the freed pointer to NULL. (This used to be commit b65be8874a2efe5a4b167448960a4fcf6bd995e2)
2007-10-10r13316: Let the carnage begin....Gerald Carter1-4/+4
Sync with trunk as off r13315 (This used to be commit 17e63ac4ed8325c0d44fe62b2442449f3298559f)
2007-10-10r12279: unix_mask_match has been broken for *ever*... (How).Jeremy Allison1-1/+2
Ensure it returns a BOOL. Jerry (and anyone else) please check this, I think all uses are now correct but could do with another set of eyes. Essential for 3.0.21 release. Jeremy. (This used to be commit 0c7b8a7637e760fcb6629092f36b610b8c71f5c9)
2007-10-10r11446: Remove unused fn. Remove unneeded strncpy use.Jeremy Allison1-7/+2
Jeremy. (This used to be commit d202aae3c821f3d78ff063d867bac1f84dca3548)
2007-10-10r11159: Added some const to fix warnings.Jeremy Allison1-2/+2
Jeremy. (This used to be commit de27b0eef2eb021f28e8bf300c4dd524e30fc7ed)
2007-10-10r11137: Compile with only 2 warnings (I'm still working on that code) on a gcc4Jeremy Allison1-7/+7
x86_64 box. Jeremy. (This used to be commit d720867a788c735e56d53d63265255830ec21208)
2007-10-10r10656: BIG merge from trunk. Features not copied overGerald Carter1-3/+67
* \PIPE\unixinfo * winbindd's {group,alias}membership new functions * winbindd's lookupsids() functionality * swat (trunk changes to be reverted as per discussion with Deryck) (This used to be commit 939c3cb5d78e3a2236209b296aa8aba8bdce32d3)
2007-10-10r9536: Fix one more DIR -> SMB_STRUCT_DIR typo.Jeremy Allison1-1/+1
Jeremy. (This used to be commit c5b79a6709a1333d1d69d9216620b1f06fdfd5d3)
2007-10-10r9325: Remember to ignore FILE_SHARE_DELETE when mapping to old shareJeremy Allison1-2/+1
modes for display. Jeremy. (This used to be commit f00d41a9dcd03033c59a399090058c76b5ce14c1)
2007-10-10r8219: Merge the new open code from HEAD to 3.0. Haven't yet run the tortureJeremy Allison1-0/+22
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. (This used to be commit c7fe18761e2c753afbffd3a78abff46472a9b8eb)
2007-10-10r7882: Looks like a large patch - but what it actually does is make SambaJeremy Allison1-3/+3
safe for using our headers and linking with C++ modules. Stops us from using C++ reserved keywords in our code. Jeremy (This used to be commit 9506b8e145982b1160a2f0aee5c9b7a54980940a)
2007-10-10r7842: With the patch I sent Steve yesterday this gives us complete POSIX ↵Jeremy Allison1-0/+6
pathnames. ie. files containing : and \ can be accessed from Linux. Jeremy. (This used to be commit e9b8d23d6138d909a65ea70b2e801881e8333b38)
2007-10-10r7415: * big change -- volker's new async winbindd from trunkGerald Carter1-0/+23
(This used to be commit a0ac9a8ffd4af31a0ebc423b4acbb2f043d865b8)
2007-10-10r6942: * merging the registry changes back to the 3.0 treeGerald Carter1-38/+0
* removing the testprns tool (This used to be commit 81ffb0dbbbd244623507880c323a3c37e2b8dc4d)
2007-10-10r6890: Refactor printing interface to take offset into job. Fixes bugJeremy Allison1-0/+40
where large print jobs can have out-of-order offsets. Bug found by Arcady Chernyak <Arcady.Chernyak@efi.com> Jeremy. (This used to be commit 482f7e0e3706098b71aa0b31a134994acb1e9fcf)
2007-10-10r6550: Move function make_dir_struct from util to dir.cJeremy Allison1-34/+0
Jeremy. (This used to be commit 5b86e3dcdf31dec61449d2faede61d24c3a8d79f)
2007-10-10r6502: add LOCKING debug class - pull PRINTINGDB class definition from trunkHerb Lewis1-0/+6
so our numbers don't get out of sync (This used to be commit 58e307664e02ebf0415f19ed625d2f166d9cb1cc)
2007-10-10r6495: Bugfix for #2596 by James Peach @ SGI. Fix become_root link issues ↵Jeremy Allison1-1/+1
and one IRIX stack backtrace bug. Jeremy. (This used to be commit c0b99c692b7e23a2bfe12c7230fd539771020750)
2007-10-10r6445: Make us survive the PARANOID_MALLOC_CHECKER. Should we enable that forVolker Lendecke1-10/+17
--enable-developer=yes? Volker (This used to be commit 61d40ac60dd9c8c9bbcf92e4fc57fe1d706bc721)
2007-10-10r6351: This is quite a large and intrusive patch, but there are not many ↵Volker Lendecke1-0/+50
pieces that can be taken out of it, so I decided to commit this in one lump. It changes the passdb enumerating functions to use ldap paged results where possible. In particular the samr calls querydispinfo, enumdomusers and friends have undergone significant internal changes. I have tested this extensively with rpcclient and a bit with usrmgr.exe. More tests and the merge to trunk will follow later. The code is based on a first implementation by Günther Deschner, but has evolved quite a bit since then. Volker (This used to be commit f0bb44ac58e190e19eb4e92928979b0446e611c9)
2007-10-10r6225: get rid of warnings from my compiler about nested externsHerb Lewis1-4/+5
(This used to be commit efea76ac71412f8622cd233912309e91b9ea52da)
2007-10-10r6106: Fix bug #2551. It turns out that the incoming flags2 flag ↵Jeremy Allison1-3/+3
FLAGS2_LONG_PATH_COMPONENTS determines if a reply is uppercased on a SMBsearch request, not the protocol level. This could clear up quite a few hacks going forward I think. Jeremy. (This used to be commit 8c64cd368fdd2c5a4b361904855c135ade3f449e)
2007-10-10r6080: Port some of the non-critical changes from HEAD to 3_0. The main one ↵Volker Lendecke1-3/+7
is the change in pdb_enum_alias_memberships to match samr.idl a bit closer. Volker (This used to be commit 3a6786516957d9f67af6d53a3167c88aa272972f)
2007-10-10r6049: Ensure "dos filetime" checks file ACLs correctly. May fix Excel ↵Jeremy Allison1-18/+0
"read-only" issue. Jeremy. (This used to be commit 80e788143a6c3d973d3b8e57d91ca5c4a83605b2)
2007-10-10r6044: Ensure the old search calls always ask mask_match to translateJeremy Allison1-1/+17
patterns like ????????.??? - even if using an NT1 protocol. Matches W2K3 behavior. Jeremy. (This used to be commit 67f6473f50f3284b9ccbe6f983f23cd42b3b7c9f)
2007-10-10r6022: Fix for bug #2533. Incorrect dir listings from OS/2 clients.Jeremy Allison1-1/+3
Jeremy. (This used to be commit cf8949f684ee9adcd35d56d923b2f5733efc05ac)
2007-10-10r6014: rather large change set....Gerald Carter1-0/+4
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). (This used to be commit 4e0ac63c36527cd8c52ef720cae17e84f67e7221)
2007-10-10r5100: We should only care about case-sensitivity when *reading* an incomingJeremy Allison1-2/+2
filename, not returning one. Makes us pass one more Samba4 RAW-SEARCH test. Jeremy. (This used to be commit 228d1e1649a0b4952eb5603cb5e1851cdc8f0c72)
2007-10-10r5066: A couple of small fixes from James Peach @ SGI.Jeremy Allison1-0/+5
Jeremy. (This used to be commit 9d131e94195df79e07c8fad20e12ba1b67441a81)
2007-10-10r4581: From Derrell.Lipman@UnwiredUniverse.com. Use nanosleep instead of selectJeremy Allison1-1/+14
when we have it in smb_msleep. Jeremy. (This used to be commit 465c207ffbcd5ee859faee282ef220a6c72e4eeb)
2007-10-10r4120: Never, ever, doubt valgrind :-). Fix order of evaluation bug that's ↵Jeremy Allison1-9/+3
been in the bitmap code for ever. Remove silly extra space in paranoid malloc. Jeremy. (This used to be commit 0a7d17bc9b178628da371e627014412e9bef5d42)
2007-10-10r4088: Get medieval on our ass about malloc.... :-). Take control of all our ↵Jeremy Allison1-27/+132
allocation functions so we can funnel through some well known functions. Should help greatly with malloc checking. HEAD patch to follow. Jeremy. (This used to be commit 620f2e608f70ba92f032720c031283d295c5c06a)
2007-10-10r3946: Fix for bugid #2085 reported by Jason Mader <jason@ncac.gwu.edu>. Use ↵Jeremy Allison1-1/+1
consistent enum type for Protocol extern. Jeremy. (This used to be commit 65dfae7ea45d4c9452b2a08efa09b01d870142f3)
2007-10-10r3650: Allow to call spoolss-server as "localhost".Günther Deschner1-1/+6
Guenther (This used to be commit 14a0292250ee9975618b68701a48c72195286d85)
2007-10-10r2868: Well, I'm not quite sure what I'm doing back in Samba 3.0, but anyway...Andrew Bartlett1-0/+22
I've been grumbling about under-efficient calls in SAMR, and finally got around to fixing some of them. We now call sys_getgroups() (which in turn calls initgroups(), until glibc 3.4 is released) to figure out a user's group membership. This is far, far more efficient than scanning all the groups looking for a match, and is still the 'posix way', just using an effiecient call. The seperate issue of 'who is in this group' remains, but this one has been biting some people. I need to talk to VL about how best to exersise nasty corner cases, but my initial tests hold strong. (The code is also much simpiler than before, which has to count for something :-) Andrew Bartlett (This used to be commit dc19f161698dab5b71d61fa2bacc7e7b8da5fbba)
2007-10-10r2824: restored the is_case_sensitive option to ms_fnmatch() in Samba3. It isAndrew Tridgell1-1/+1
very rarely used, but we sohuldn't be removing a feature in a minor release of this kind. (This used to be commit 4ce0505bc369243aa77013519ce4e4f6e50f5a48)
2007-10-10r2813: Fix the build.Rafal Szczesniak1-1/+1
At least temporarily, since I've got the impression that _real_ fix is more complex... rafal (This used to be commit 982912f0c8547b0f0edc8d0b26e36e9701cdee82)
2007-10-10r2768: BUG 1519: save the hostname used in the open_printer_ex() for later ↵Gerald Carter1-7/+45
reuse when filling in the spolss replies (also gets rid of get_called_name() (This used to be commit 57db8ca91f52329c7f8985c04463b6b69015b0c4)
2007-10-10r2133: Several fixes:Gerald Carter1-6/+2
* BUG 1627: fix for NIS compiles on HPUX 11.00, AIX 4.3 and 5.1 patch from Olaf Flebbe <o.flebbe@science-computing.de>. Will need to watch this one in the build farm. * Fix bug found by rwf@loonybin.net where the PRINT_ATTRIBUTE_PUBLISHED was getting reset by attempts to sanitize the defined attributes (PRINTER_ATTRIBUTE_SAMBA) * Resolve name conflict on DEC OSF-5.1 (inspired by patch from Adharsh Praveen <rprav@india.hp.com>) * Work around parsing error in the print change notify code (not that the alignment bug is still there but reording the entries in the array works around it). * remove duplicate declaration of getprintprocdir from rpcclient. (This used to be commit 7474c6a446037f3ca2546cb6984d800bfc524029)
2007-10-10r1890: Cut down on debug messages from is_in_path. paulgPaul Green1-3/+2
(This used to be commit 8b1c2126af3f29a3708b6823616ecec43ce63b95)
2007-10-10r1215: Intermediate checkin of the new keytab code. I need to make sure IJeremy Allison1-0/+15
haven't broken krb5 ticket verification in the mainline code path, also need to check with valgrind. Everything now compiles (MIT, need to also check Heimdal) and the "net keytab" utility code will follow. Jeremy. (This used to be commit f0f2e28958cb9abfed216c71f291f19ea346d630)
2007-10-10r1156: Ensure new remote arch of CIFSFS is seen.Jeremy Allison1-0/+3
Jeremy. (This used to be commit 33fa4b8b27427874ac70af00908d97709c1cddc7)
2007-10-10r647: fix for setting the called name to by our IP if the called name was ↵Gerald Carter1-18/+0
*SMBSERVER and *SMBSERV -- fixes issue with connecting to printers via \ip.ad.dr.ess\printer UNC path (This used to be commit 8ee268f0ed0c2f75ded9c2ddd66e0953f443c79e)
2007-10-10r645: Patch from kawasa_r@itg.hitachi.co.jp to correctly enable core dumps.Jeremy Allison1-0/+3
Jeremy. (This used to be commit ea41d694270264557f740cd40ccc69b4acaa57e9)
2007-10-10r570: Remove lots of globals to handle case issues - move themJeremy Allison1-15/+2
to connection struct entries (as they should have been from the start). Jerry, once you've cut over to 3.0.4 release branch I'll add this to 3.0 also. - Jerry cut over :-). Jeremy. (This used to be commit 578a508509d21226ad3332fc54c3ab54cd8ae452)
2004-03-21Given how often a panic has to do with malloc() problems, don't temptAndrew Bartlett1-1/+1
things more by calling SAFE_FREE() just before we exit our panic handler. Andrew Bartlett (This used to be commit d0b820562b8a7f8e5d0224926d46590b9f1ca9a3)
2004-03-18Merge from HEAD for Amanda group.Jeremy Allison1-0/+14
Apply Craig Barratt's fixes to allow multiple exlusion files and patterns. Jeremy. (This used to be commit 0272fac8ca40b3d4ea4de8ac8a2e371d450d12e6)
2004-03-09Added strstr_m() function. Use in all places where we might run into mbJeremy Allison1-2/+2
(should fix the mb service name problem, can't remember the bugid). Jeremy. (This used to be commit 94a272b9a881ec0004c5da2a7242b0a818da5630)