Bug 7804 - argument based client stubs: convert out charset strings to ref pointers
Summary: argument based client stubs: convert out charset strings to ref pointers
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: PIDL and libndr (show other bugs)
Version: unspecified
Hardware: Other Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-19 12:07 UTC by Guenther Deschner
Modified: 2019-04-01 21:20 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Guenther Deschner 2010-11-19 12:07:12 UTC
argument based client stubs: convert out charset strings to ref pointers
Comment 1 Jelmer Vernooij 2010-11-29 06:42:56 UTC
Can you give some more context, perhaps an example?

Also, is there a particular reason this bug is private ?
Comment 2 Stefan Metzmacher 2011-01-18 08:35:32 UTC
In the current argument based client bindings a caller needs to pass in
an allocated string if it's an [out,ref] array with charset() used.

But the caller can't know how long the string will be in "unix" charset.
Currently we have very strict tests before we do a memcpy of the returned
string into the caller provided buffer.

void function([in] uint32 length,
              [out,ref,size_is(length)] [charset(UTF16)] uint16 *string
              );

In this example we currently generate this.

void function(struct some_context *, uint32_t length, const char *string);

Notice length is the length of uint16 units on the wire,
but the caller has no chance to know how long the string will
be in unix charset. so we can only generate truncated string
or return an error if the returned low level string can't
be copied completely into the given string.

The new code should look like this.

void function(struct some_context *, uint32_t length, const char **string);

This way function can just allocate the string and return it.
Comment 3 Guenther Deschner 2011-05-17 08:38:01 UTC
This bug still exists but it has become less blocking as we simply were able to switch using the struct based pidl generated rpc client calls (where we do not suffer from this issue). So, effectively, we dont currently use any other rpc calls in samba3 where this problem is an issue. Lowering severity and making this not a blocker issue for 3.6.0.
Comment 4 Andrew Bartlett 2019-04-01 21:20:47 UTC
Moving PIDL bugs into Samba as we do not release PIDL separately.