[source] procd: mdns: Support txt values with spaces

LEDE Commits lede-commits at lists.infradead.org
Thu Dec 14 09:45:12 PST 2017


jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/c58e824acc3c5fcac6ce91584eaf704e99be52ef

commit c58e824acc3c5fcac6ce91584eaf704e99be52ef
Author: Karl Palsson <karlp at etactica.com>
AuthorDate: Wed Aug 30 17:44:00 2017 +0000

    procd: mdns: Support txt values with spaces
    
    Properly quote the arguments so that you can register a service with TXT
    entries that contains spaces.
    
    Example:
       procd_add_mdns myservice tcp 9999 "key=descriptive text field 1" \
             "another=something equally verbose"
    
    Output before:
    $ avahi-browse -r -v _myservice._tcp
    _myservice._tcp      local
       hostname = [blah.local]
       address = [192.168.255.74]
       port = [9999]
       txt = ["verbose" "equally" "another=something" "1" "field" "text" "key=descriptive"]
    
    Output now:
    $ avahi-browse -r -v _myservice._tcp
    _myservice._tcp      local
       hostname = [blah.local]
       address = [192.168.255.74]
       port = [9999]
       txt = ["another=something equally verbose" "key=descriptive text field 1"]
    
    Signed-off-by: Karl Palsson <karlp at etactica.com>
    (cherry picked from commit 7a423c389a162d2945901f0b5e7c604d36c64526)
---
 package/system/procd/files/procd.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh
index 9fbf47e..e6ca8a6 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -423,7 +423,7 @@ procd_add_mdns_service() {
 	json_add_int port "$port"
 	[ -n "$1" ] && {
 		json_add_array txt
-		for txt in $@; do json_add_string "" $txt; done
+		for txt in "$@"; do json_add_string "" "$txt"; done
 		json_select ..
 	}
 	json_select ..
@@ -432,7 +432,7 @@ procd_add_mdns_service() {
 procd_add_mdns() {
 	procd_open_data
 	json_add_object "mdns"
-	procd_add_mdns_service $@
+	procd_add_mdns_service "$@"
 	json_close_object
 	procd_close_data
 }



More information about the lede-commits mailing list