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

163 Commits

Author SHA1 Message Date
Volker Lendecke
2ae400b213 Make init_doschar_table() static
It's only called directly before init_valid_table() anyway, so move it there.
(This used to be commit b6d1d24288)
2007-12-16 10:56:58 -08:00
Jeremy Allison
1b92ea5559 Remove pstrings from client/client.c by doing a large rewrite.
Mostly compiles....
Jeremy.
(This used to be commit c87f3eba9a)
2007-12-06 17:16:33 -08:00
Jeremy Allison
755051b569 pull_ascii_pstring is gone.
Jeremy.
(This used to be commit 288aacce4b)
2007-12-04 17:05:33 -08:00
Jeremy Allison
5ea101f048 Allow STR_TERMINATE and -1 src_len for pull_ucs2_base_talloc().
Jeremy.
(This used to be commit 063358d87a)
2007-12-04 15:21:14 -08:00
Jeremy Allison
c049b8157d More trivial pstring removal.
Jeremy.
(This used to be commit bac3bb2f6e)
2007-11-20 15:31:37 -08:00
Jeremy Allison
cf31bb7532 Start to remove some of the pstring functions we're
no longer using.
Jeremy.
(This used to be commit c21e9bdc10)
2007-11-19 17:51:21 -08:00
Jeremy Allison
30191d1a57 RIP BOOL. Convert BOOL -> bool. I found a few interesting
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 f35a266b3c)
2007-10-18 17:40:25 -07:00
Jeremy Allison
3f2939cc16 r25277: Belt-and-braces approach to Volker's fix for RPC-SAMBA3-GETUSERNAME.
If we promise dest is null terminated, ensure we do it even on
fast path exits.
Jeremy.
(This used to be commit 32626e2b97)
2007-10-10 12:30:57 -05:00
Michael Adam
2bb7ebdcb7 r25258: Fix a panic message and remove superfluous return after the call to smb_panic().
Michael
(This used to be commit 8b5c34b7d1)
2007-10-10 12:30:55 -05:00
Jeremy Allison
934b92f5d0 r25238: Make the error returns from the string functions
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 abedd96786)
2007-10-10 12:30:53 -05:00
Jeremy Allison
3d5f029ead r25222: Fix last assumptions that (size_t)-1 can be used
as a special dest_len of sizeof(pstring).
Jeremy.
(This used to be commit 9fc14c83cc)
2007-10-10 12:30:51 -05:00
Jeremy Allison
38ffbd2893 r25199: Remove pstring from strdup_upper - make it the
same as talloc_strdup_upper.
Jeremy.
(This used to be commit db1b629377)
2007-10-10 12:30:51 -05:00
Jeremy Allison
4f051e735b r25195: Fix issue with calling pull_uc2_*alloc with
str_len == 0. We should just return 0 in this
case.
Jeremy.
(This used to be commit 8bb85f3f14)
2007-10-10 12:30:50 -05:00
Volker Lendecke
ad97bcf813 r25184: Fix some C++ warnings and an uninitialized variable
(This used to be commit b64df8a3c5)
2007-10-10 12:30:49 -05:00
Jeremy Allison
eacd314057 r25138: More pstring elimination. Add a TALLOC_CTX parameter
to unix_convert().
Jeremy.
(This used to be commit 39c211a702)
2007-10-10 12:30:44 -05:00
Jeremy Allison
d0de93ca76 r25136: When tallocing a string to uppercase remember the terminating
'\0' in size calculations.
Jeremy.
(This used to be commit 54c658867d)
2007-10-10 12:30:43 -05:00
Jeremy Allison
6716382ec9 r25120: One more warning.
Jeremy.
(This used to be commit 9cc70e3ccf)
2007-10-10 12:30:42 -05:00
Jeremy Allison
12f61e09d9 r25117: The mega-patch Jerry was waiting for. Remove all pstrings from
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 7f0db75fb0)
2007-10-10 12:30:41 -05:00
Jeremy Allison
3a9d382164 r25111: Move to talloced pathnames on most code paths.
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 0c9a8c4dff)
2007-10-10 12:30:41 -05:00
Jeremy Allison
132ee3990a r25009: Large patch discussed with Volker. Move unix_convert to a talloc-based
interface. More development will come on top of this. Remove the
"mangled map" parameter.
Jeremy.
(This used to be commit dee8beba7a)
2007-10-10 12:30:32 -05:00
Volker Lendecke
b62bd05b93 r24133: Explicitly pass flags2 down to push_string_fn
This needs a bit closer review, it also touches the client libs
(This used to be commit 824eb26738)
2007-10-10 12:29:10 -05:00
Volker Lendecke
6eca5f5042 r23865: Fix a type-punned error
(This used to be commit a40d3a566a)
2007-10-10 12:28:35 -05:00
Jeremy Allison
e8dc2ea03d r23858: Added srvstr_pull_buf_talloc() and srvstr_pull_talloc()
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 b4eff3f680)
2007-10-10 12:28:35 -05:00
Andrew Tridgell
5e54558c6d r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
(This used to be commit b0132e94fc)
2007-10-10 12:28:22 -05:00
Jeremy Allison
d824b98f80 r23779: Change from v2 or later to v3 or later.
Jeremy.
(This used to be commit 407e6e695b)
2007-10-10 12:28:20 -05:00
Volker Lendecke
fcda5b5896 r23726: Explicitly pass down the FLAGS2 field to srvstr_pull_buf. The next
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 836782b07b)
2007-10-10 12:23:49 -05:00
Volker Lendecke
ef8706acd1 r23662: According to simo, check_dos_char is needed
(This used to be commit c195eccefe)
2007-10-10 12:23:43 -05:00
Volker Lendecke
971b640e0c r23660: Anybody know what check_dos_char() was used for? It wasn't called at
all, so it's gone. With it 8k bss went away.
(This used to be commit 7e9a4c39a5)
2007-10-10 12:23:43 -05:00
James Peach
b1ce226af8 r23510: Tidy calls to smb_panic by removing trailing newlines. Print the
failed expression in SMB_ASSERT.
(This used to be commit 171dc060e2)
2007-10-10 12:23:23 -05:00
Jeremy Allison
798af9e0c8 r22754: When processing a string, ensure we don't write one past
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 14b167ef6e)
2007-10-10 12:21:54 -05:00
Jeremy Allison
f1964048a5 r18897: Fix valgrind bug found by Volker.
Jeremy.
(This used to be commit db458d3e8b)
2007-10-10 12:14:43 -05:00
Jeremy Allison
3a60a67432 r18793: Fix BE string handling in the auto-generated
code. Should now work again with ASU.
Jeremy.
(This used to be commit 53e97bf928)
2007-10-10 12:00:58 -05:00
Jeremy Allison
f18c9365ca r18787: Fix the strlen_m and strlen_m_term code by merging
in (and using elsewhere) next_codepoint from Samba4.
Jerry please test.
Jeremy.
(This used to be commit ece00b70a4)
2007-10-10 12:00:57 -05:00
Jeremy Allison
fbdcf2663b r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need
to do the upper layer directories but this is what
everyone is waiting for....

Jeremy.
(This used to be commit 9dafb7f48c)
2007-10-10 11:19:14 -05:00
Gerald Carter
bbf666e447 r15003: patch based on code from Arkady Glabek <aglabek@centeris.com> to ensure that global memory is freed when unloading pam_winbind.so (needs more testing on non-linux platforms)
(This used to be commit 1e0b79e591)
2007-10-10 11:15:55 -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
5a4881bf39 r12522: Try and fix bug #2926 by removing setlocale(LC_ALL, "C")
and replace calls to isupper/islower/toupper/tolower with
ASCII equivalents (mapping into _w variants).
Jeremy.
(This used to be commit c2752347eb)
2007-10-10 11:05:58 -05:00
Jeremy Allison
d1f91f7c72 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.
(This used to be commit c65b752604)
2007-10-10 11:05:42 -05:00
Jeremy Allison
442b9f3e87 r5933: We were handling setting of EA's incorrectly - we should be able to set
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 22fca74657)
2007-10-10 10:56:09 -05:00
Jeremy Allison
92a7eb69d3 r4126: Fix from Björn Jacke <bjoern@j3e.de> for bugid #2040 - ensure the locale
is reset to C to get ASCII-compatible toupper/lower functions.
Jeremy.
(This used to be commit 8e1b1693ab)
2007-10-10 10:53:35 -05:00
Jeremy Allison
acf9d61421 r4088: Get medieval on our ass about malloc.... :-). Take control of all our 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 620f2e608f)
2007-10-10 10:53:32 -05:00
Jeremy Allison
b74b9c5037 r3857: Shut up gcc about erroneous "used uninitialised" warning.
Jeremy.
(This used to be commit ac9b91d805)
2007-10-10 10:53:21 -05:00
Jeremy Allison
17ab9e8db1 r2610: Even if we only use the fast-path (ascii only) then
we still need to set errno = E2BIG when we overflow.
Jeremy.
(This used to be commit 7b0560dccc)
2007-10-10 10:52:48 -05:00
Jeremy Allison
fb4c421f1b r2392: Steal the nicer error message from Samba4 :-).
Jeremy.
(This used to be commit afa88868b7)
2007-10-10 10:52:42 -05:00
Jeremy Allison
651daa4b42 r2114: Shameless theft of iconv commit from Samba4 to keep the two libs more in sync :-).
try to cope with a wider range of UTF-16 characters when we are using
an external libiconv library.
Jeremy.
(This used to be commit 5d04cd6804)
2007-10-10 10:52:32 -05:00
Jeremy Allison
16de9d9711 r1684: Patch for bug #1578 based on fix from Alexander E. Patrakov,
<patrakov@ums.usu.ru>. Main change, hardcode replacement char
to '_' as I really don't want a new parameter.
Jeremy.
(This used to be commit db3dde026b)
2007-10-10 10:52:18 -05:00
Gerald Carter
5a3bc12683 r907: fixing browse.dat bug -- don't include the resouce byte from the netbios name when pulling a string from a packet (jra, please double check this
(This used to be commit c9bef86b8b)
2007-10-10 10:51:48 -05:00
Jeremy Allison
fe160f5b72 "Fixing my FORTRAN". Ensure we always have some valid char converter for the
neccessary types before we will run at all. If we can't get one, use ASCII
but complain mightily.
Jeremy.
(This used to be commit 37dd5e52f6)
2004-04-01 19:42:36 +00:00
Jeremy Allison
c66f52a5ac Correctness patch from fumiya@miraclelinux.com to count characters correctly,
doesn't affect what got put on the wire.
Jeremy.
(This used to be commit e8b68ef965)
2004-03-18 17:58:50 +00:00
Jeremy Allison
41ea0d35ae Remove excess logging when probing for the length of the next mb char.
Jeremy.
(This used to be commit 6339c4690a)
2004-03-17 19:23:48 +00:00