[PATCH] Allow py_smb_savefile() to except utf text

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] Allow py_smb_savefile() to except utf text

Samba - samba-technical mailing list
Hi,

This patch allows the smb python bindings to write utf encoded text to a
file. Without this patch, py_smb_savefile() can only write ascii.
Writing ascii to a utf-16 encoded file would leave trailing utf-16 chars
at the end of the file, and trying to pass utf-16 to the savefile
function would throw an exception.

Andrew and Garming,

This is related to the GPO patches. This is needed in order to write to
files in sysvol (since GptTmpl.inf, for example, is utf-16 encoded).
I've written a tool for modifying GPO policies. Please review.

Thanks!

--
David Mulder
SUSE Labs Software Engineer - Samba
[hidden email]
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)


0001-Allow-py_smb_savefile-to-except-utf-text.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] Allow py_smb_savefile() to except utf text

Samba - samba-technical mailing list
On Fri, 2017-07-28 at 09:04 -0600, David Mulder via samba-technical
wrote:

> Hi,
>
> This patch allows the smb python bindings to write utf encoded text to a
> file. Without this patch, py_smb_savefile() can only write ascii.
> Writing ascii to a utf-16 encoded file would leave trailing utf-16 chars
> at the end of the file, and trying to pass utf-16 to the savefile
> function would throw an exception.
>
> Andrew and Garming,
>
> This is related to the GPO patches. This is needed in order to write to
> files in sysvol (since GptTmpl.inf, for example, is utf-16 encoded).
> I've written a tool for modifying GPO policies. Please review.

Any chance of a test?

This just feels like the kind of thing that we need to be really
careful to have a test for giving future conversions to python3 where
the string behaviour changes.

Thanks,

Andrew Bartlett

--
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] Allow py_smb_savefile() to except utf text

Samba - samba-technical mailing list
Do you of any instructions in the wiki on how to write a torture test
via python? I can't find any.

On 07/28/2017 04:27 PM, Andrew Bartlett wrote:

> On Fri, 2017-07-28 at 09:04 -0600, David Mulder via samba-technical
> wrote:
>> Hi,
>>
>> This patch allows the smb python bindings to write utf encoded text to a
>> file. Without this patch, py_smb_savefile() can only write ascii.
>> Writing ascii to a utf-16 encoded file would leave trailing utf-16 chars
>> at the end of the file, and trying to pass utf-16 to the savefile
>> function would throw an exception.
>>
>> Andrew and Garming,
>>
>> This is related to the GPO patches. This is needed in order to write to
>> files in sysvol (since GptTmpl.inf, for example, is utf-16 encoded).
>> I've written a tool for modifying GPO policies. Please review.
> Any chance of a test?
>
> This just feels like the kind of thing that we need to be really
> careful to have a test for giving future conversions to python3 where
> the string behaviour changes.
>
> Thanks,
>
> Andrew Bartlett
>

--
David Mulder
SUSE Labs Software Engineer - Samba
[hidden email]
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)


Loading...