Bug 13085 - Prevent escape sequence evaluation in test_give_owner.sh
Prevent escape sequence evaluation in test_give_owner.sh
Status: ASSIGNED
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services
unspecified
All All
: P5 normal
: ---
Assigned To: Ralph Böhme
Samba QA Contact
:
Depends on: 7933
Blocks:
  Show dependency treegraph
 
Reported: 2017-10-13 12:32 UTC by Ralph Böhme
Modified: 2017-10-13 12:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Böhme 2017-10-13 12:32:26 UTC
/bin/sh on sn-devel-144 is dash which has a XSI compliant echo builtin. That means echo will always interpret escape sequences in strings, eg

$ /bin/sh -c 'echo -n "\a" | hexdump -C'
00000000  07                                                |.|

There's no way to prevent the echo command from doing this.

In the script test_give_owner.sh echo was used to print an ACE which will contain a DOMAIN\USER substring. If the first character of USER is a valid escape sequence, the resulting string was interpreted as an escape sequence:

$ /bin/sh -c 'echo "FILESERVER\asn"'
FILESERVERsn

The only portable way to print a string without interpreting embedded escape sequences seems to be using printf:

$ /bin/sh -c 'printf "%s\n" "FILESERVER\asn"'
FILESERVER\asn