summaryrefslogtreecommitdiff
path: root/source3/lib/charcnv.c
AgeCommit message (Collapse)AuthorFilesLines
2008-10-16Fix bug 5826 - Directory/Filenames get truncated when 3.2.0 client acesses ↵Jeremy Allison1-13/+45
old server. There was some code in pull_ucs2_base_talloc() to cope with this case which hadn't been added to pull_ascii_base_talloc(). The older Samba returns non unicode names which is why you are seeing this codepath being executed. Unify the logic in pull_ascii_base_talloc() and pull_ucs2_base_talloc(). Jeremy.
2008-08-12Fix bug 5686 - libsmbclient segfaults with more than one SMBCCTX.Jeremy Allison1-3/+3
Here is a patch to allow many subsystems to be re-initialized. The only functional change I made was to remove the null context tracking, as the memory allocated here is designed to be left for the complete lifetime of the program. Freeing this early (when all smb contexts are destroyed) could crash other users of talloc. Jeremy. (This used to be commit 8c630efd25cf17aff59448ca05c1b44a41964b16)
2008-05-20Cleanup size_t return values in callers of convert_string_allocateTim Prouty1-124/+143
This patch is the second iteration of an inside-out conversion to cleanup functions in charcnv.c returning size_t == -1 to indicate failure. (This used to be commit 6b189dabc562d86dcaa685419d0cb6ea276f100d)
2008-04-11Cleanup size_t return values in convert_string_allocateTim Prouty1-58/+76
This patch is the first iteration of an inside-out conversion to cleanup functions in charcnv.c returning size_t == -1 to indicate failure. (This used to be commit 59124382d2894a1b194b48dd82bc5f956959eb48)
2008-04-10charcnv: add talloc_strdup_lower() - talloc variant of strdup_lower().Michael Adam1-0/+26
Michael (This used to be commit 5f6c730cbeddd1ac2f515bd985c08ceb4ca9bc47)
2008-02-01Ensure that convert_string_allocate() allocates 2 extraJeremy Allison1-6/+14
bytes and null terminates them to ensure NDR wire-reads of string types are always null terminated. Bug found by Volker after great pain :-). Jeremy. (This used to be commit aab736e6079729b3f3ab653674834e3f1305d456)
2008-01-09Fixup hot paths - add macro for toupper (c < 0x80).Jeremy Allison1-6/+12
This now matches 3.0.x on my micro-tests. Jeremy. (This used to be commit 329b924cba8225002ca40db26c45b31d141a0925)
2007-12-16Make init_doschar_table() staticVolker Lendecke1-1/+0
It's only called directly before init_valid_table() anyway, so move it there. (This used to be commit b6d1d2428866712a550a354732e2386b4f87b67b)
2007-12-06Remove pstrings from client/client.c by doing a large rewrite.Jeremy Allison1-4/+9
Mostly compiles.... Jeremy. (This used to be commit c87f3eba9aa52f4ab25d77e2167262bf5c43b1a6)
2007-12-04pull_ascii_pstring is gone.Jeremy Allison1-6/+0
Jeremy. (This used to be commit 288aacce4b56d159218be311019cb951e5a232fd)
2007-12-04Allow STR_TERMINATE and -1 src_len for pull_ucs2_base_talloc().Jeremy Allison1-1/+7
Jeremy. (This used to be commit 063358d87ac9a1d948c8d4b6358e926dd14bb3ac)
2007-11-20More trivial pstring removal.Jeremy Allison1-1/+1
Jeremy. (This used to be commit bac3bb2f6e9e15b3a9a6a6511c484f8509918ca1)
2007-11-19Start to remove some of the pstring functions we'reJeremy Allison1-11/+1
no longer using. Jeremy. (This used to be commit c21e9bdc1059268adbd14207e74097349676439e)
2007-10-18RIP BOOL. Convert BOOL -> bool. I found a few interestingJeremy Allison1-6/+6
bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f)
2007-10-10r25277: Belt-and-braces approach to Volker's fix for RPC-SAMBA3-GETUSERNAME.Jeremy Allison1-4/+7
If we promise dest is null terminated, ensure we do it even on fast path exits. Jeremy. (This used to be commit 32626e2b9770eb6b15c191a8feb881f81ed6c57a)
2007-10-10r25258: Fix a panic message and remove superfluous return after the call to ↵Michael Adam1-2/+1
smb_panic(). Michael (This used to be commit 8b5c34b7d141c44d65622f44f9432723230cea47)
2007-10-10r25238: Make the error returns from the string functionsJeremy Allison1-20/+20
always consistent. Return -1 on error, and ensure we check for this. In cases where the dest is already specified and we've been asked to terminate with a null, ensure we always do so even on error. Jeremy. (This used to be commit abedd967869ade9a43c3a8e1b889c60d4aca81cf)
2007-10-10r25222: Fix last assumptions that (size_t)-1 can be usedJeremy Allison1-18/+36
as a special dest_len of sizeof(pstring). Jeremy. (This used to be commit 9fc14c83cc5e3a360464c33e26b1073db63763d7)
2007-10-10r25199: Remove pstring from strdup_upper - make it theJeremy Allison1-14/+31
same as talloc_strdup_upper. Jeremy. (This used to be commit db1b6293771755f20660b071aac0284638dbed46)
2007-10-10r25195: Fix issue with calling pull_uc2_*alloc withJeremy Allison1-0/+8
str_len == 0. We should just return 0 in this case. Jeremy. (This used to be commit 8bb85f3f141f0f45b06d28f004cb2cf18252d4e1)
2007-10-10r25184: Fix some C++ warnings and an uninitialized variableVolker Lendecke1-1/+1
(This used to be commit b64df8a3c504ab7749c21ffb26e4771a9a0a328f)
2007-10-10r25138: More pstring elimination. Add a TALLOC_CTX parameterJeremy Allison1-8/+33
to unix_convert(). Jeremy. (This used to be commit 39c211a702e91c34c1a5a689e1b0c4530ea8a1ac)
2007-10-10r25136: When tallocing a string to uppercase remember the terminatingJeremy Allison1-1/+1
'\0' in size calculations. Jeremy. (This used to be commit 54c658867db3b6c602080d60936abab3af26e112)
2007-10-10r25120: One more warning.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 9cc70e3ccff9c3b20076572235d9dcbfd23e97e5)
2007-10-10r25117: The mega-patch Jerry was waiting for. Remove all pstrings fromJeremy Allison1-1/+5
the main server code paths. We should now be able to cope with paths up to PATH_MAX length now. Final job will be to add the TALLOC_CTX * parameter to unix_convert to make it explicit (for Volker). Jeremy. (This used to be commit 7f0db75fb0f24873577dcb758a2ecee74fdc4297)
2007-10-10r25111: Move to talloced pathnames on most code paths.Jeremy Allison1-1/+15
There are now ony 17 pstrings left in reply.c, and these will be easy to remove (and I'll be doing that shortly). Had to fix an interesting bug in pull_ucs2_base_talloc() when a source string is not null terminated :-). Jeremy. (This used to be commit 0c9a8c4dff10974dbffd2a302ae982896122fcc0)
2007-10-10r25009: Large patch discussed with Volker. Move unix_convert to a talloc-basedJeremy Allison1-0/+65
interface. More development will come on top of this. Remove the "mangled map" parameter. Jeremy. (This used to be commit dee8beba7a92b8a3f68bbcc59fd0a827f68c7736)
2007-10-10r24133: Explicitly pass flags2 down to push_string_fnVolker Lendecke1-2/+5
This needs a bit closer review, it also touches the client libs (This used to be commit 824eb26738d64af1798d319d339582cf047521f0)
2007-10-10r23865: Fix a type-punned errorVolker Lendecke1-1/+1
(This used to be commit a40d3a566af88464fc6afd2c6e6e8b6e3a98aac2)
2007-10-10r23858: Added srvstr_pull_buf_talloc() and srvstr_pull_talloc()Jeremy Allison1-16/+234
calls and converted reply_tcon and reply_tconX to use them - to show the boilerplate usage (valgrind tested). In conjunction with Volker's srvstr_get_path_talloc() work this should allow us to start eliminating all pstrings/fstrings out of the main path processing code. I'll watch the build farm tonight... Jeremy. (This used to be commit b4eff3f68089f082781afcf90d43faa317949566)
2007-10-10r23784: use the GPLv3 boilerplate as recommended by the FSF and the license textAndrew Tridgell1-2/+1
(This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07)
2007-10-10r23779: Change from v2 or later to v3 or later.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3)
2007-10-10r23726: Explicitly pass down the FLAGS2 field to srvstr_pull_buf. The nextVolker Lendecke1-2/+10
checkin will pull this up to srvstr_get_path. At that point we can get more independent of the inbuf, the base_ptr in pull_string will only be used to satisfy UCS2 alignment constraints. (This used to be commit 836782b07bf133e9b2598c4a089f1c810e4c7754)
2007-10-10r23662: According to simo, check_dos_char is neededVolker Lendecke1-0/+1
(This used to be commit c195eccefea69c17169c350a13bbfe845fc6fc44)
2007-10-10r23660: Anybody know what check_dos_char() was used for? It wasn't called atVolker Lendecke1-1/+0
all, so it's gone. With it 8k bss went away. (This used to be commit 7e9a4c39a5ce620f8eac74d0ae4dd80b96c81aca)
2007-10-10r23510: Tidy calls to smb_panic by removing trailing newlines. Print theJames Peach1-1/+1
failed expression in SMB_ASSERT. (This used to be commit 171dc060e2a576d724eed1ca65636bdafffd7713)
2007-10-10r22754: When processing a string, ensure we don't write one pastJeremy Allison1-6/+15
the terminating NULL if we've already processed the null in iconv. Jerry, once I get confirmation from Thomas Bork this needs to be in 3.0.25 final. Tests fine with valgrind here. Jeremy. (This used to be commit 14b167ef6e0f2100bd9cdd05c4457e57e952fa5e)
2007-10-10r18897: Fix valgrind bug found by Volker.Jeremy Allison1-1/+5
Jeremy. (This used to be commit db458d3e8bdd11812cea34128df6a3c29baa59c3)
2007-10-10r18793: Fix BE string handling in the auto-generatedJeremy Allison1-36/+49
code. Should now work again with ASU. Jeremy. (This used to be commit 53e97bf92817b6cfc3f93c999a81ef8ad49a1609)
2007-10-10r18787: Fix the strlen_m and strlen_m_term code by mergingJeremy Allison1-23/+76
in (and using elsewhere) next_codepoint from Samba4. Jerry please test. Jeremy. (This used to be commit ece00b70a4621633f1ac9e576c4bbe332031de09)
2007-10-10r16945: Sync trunk -> 3.0 for 3.0.24 code. Still needJeremy Allison1-7/+11
to do the upper layer directories but this is what everyone is waiting for.... Jeremy. (This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8)
2007-10-10r15003: patch based on code from Arkady Glabek <aglabek@centeris.com> to ↵Gerald Carter1-0/+17
ensure that global memory is freed when unloading pam_winbind.so (needs more testing on non-linux platforms) (This used to be commit 1e0b79e591d70352a96e0a0487d8f394dc7b36ba)
2007-10-10r13915: Fixed a very interesting class of realloc() bugs found by Coverity.Jeremy Allison1-13/+12
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-10r12522: Try and fix bug #2926 by removing setlocale(LC_ALL, "C")Jeremy Allison1-10/+1
and replace calls to isupper/islower/toupper/tolower with ASCII equivalents (mapping into _w variants). Jeremy. (This used to be commit c2752347eb2deeb2798c580ec7fc751a847717e9)
2007-10-10r12043: It's amazing the warnings you find when compiling on a 64-bitJeremy Allison1-1/+1
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. (This used to be commit c65b752604f8f58abc4e7ae8514dc2c7f086271c)
2007-10-10r5933: We were handling setting of EA's incorrectly - we should be able to setJeremy Allison1-0/+15
a list. Also not converting names from DOS CP to UNIX CP correctly. This code doesn't quite work yet but it's a work in progress to be fixed tomorrow (don't want to lose it). Jeremy. (This used to be commit 22fca746576810c5408540031a9603625a66cd75)
2007-10-10r4126: Fix from Björn Jacke <bjoern@j3e.de> for bugid #2040 - ensure the localeJeremy Allison1-0/+9
is reset to C to get ASCII-compatible toupper/lower functions. Jeremy. (This used to be commit 8e1b1693abf1e6eb46b23a5fa56776fc2ede7982)
2007-10-10r4088: Get medieval on our ass about malloc.... :-). Take control of all our ↵Jeremy Allison1-5/+5
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-10r3857: Shut up gcc about erroneous "used uninitialised" warning.Jeremy Allison1-3/+3
Jeremy. (This used to be commit ac9b91d805c3ee68119d4b25ab05ed043f0ab8f1)
2007-10-10r2610: Even if we only use the fast-path (ascii only) thenJeremy Allison1-0/+21
we still need to set errno = E2BIG when we overflow. Jeremy. (This used to be commit 7b0560dcccbd44f1f7b67ba1d46f6a5680b6b47c)