[Asterisk-code-review] make build h: handle backslashes in external strings (asterisk[13])
Anonymous Coward
asteriskteam at digium.com
Tue Jan 31 08:32:59 CST 2017
Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/4823 )
Change subject: make_build_h: handle backslashes in external strings
......................................................................
make_build_h: handle backslashes in external strings
LikewiseOpen creates user names with a backslash in them. A gentle
massage with sed(1) allows such strings to be inserted into build.h
properly quoted. I am also adding the same for host name and other
strings used in the script that are more or less user-controlled.
ASTERISK-26754
Change-Id: Iac5ef2b67a68ee58f35ddbf86bb818ba6eabecae
---
M build_tools/make_build_h
1 file changed, 5 insertions(+), 5 deletions(-)
Approvals:
George Joseph: Looks good to me, but someone else must approve; Verified
Joshua Colp: Looks good to me, approved
diff --git a/build_tools/make_build_h b/build_tools/make_build_h
index a7cb6fe..2c8895e 100755
--- a/build_tools/make_build_h
+++ b/build_tools/make_build_h
@@ -1,13 +1,13 @@
#!/bin/sh
-HOSTNAME=`uname -n`
-KERNEL=`uname -r`
-MACHINE=`uname -m`
+HOSTNAME=`uname -n | sed 's/\\\\/\\\\\\\\/g'`
+KERNEL=`uname -r | sed 's/\\\\/\\\\\\\\/g'`
+MACHINE=`uname -m | sed 's/\\\\/\\\\\\\\/g'`
OS=`uname -s`
-USER=`id | awk -F")" '{print $1}'| awk -F"(" '{print $2}'`
+USER=`id | awk -F")" '{print $1}'| awk -F"(" '{print $2}' | sed 's/\\\\/\\\\\\\\/g'`
DATE=`date -u "+%Y-%m-%d %H:%M:%S"`
cat << END
/*
- * build.h
+ * build.h
* Automatically generated
*/
#define BUILD_HOSTNAME "${HOSTNAME}"
--
To view, visit https://gerrit.asterisk.org/4823
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iac5ef2b67a68ee58f35ddbf86bb818ba6eabecae
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Kirill Katsnelson <kkm at smartaction.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
More information about the asterisk-code-review
mailing list