Commit 999198a8aad2bb4d321e727e4ef8ee1371c320e6
Use key property from config
cel authored on 9/4/2018, 5:35:10 AMcel committed on 9/4/2018, 5:36:00 AM
Parent: 2e1180e4bcebb5fce24105133741d3947e5cb492
Files changed
sbotc.1 | changed |
sbotc.c | changed |
sbotc.1 | ||
---|---|---|
@@ -78,9 +78,9 @@ | ||
78 | 78 … | secret-handshake protocol. |
79 | 79 … | .It Pa ~/.ssb/manifest.json |
80 | 80 … | A map of method names to method types. |
81 | 81 … | .It Pa ~/.ssb/config |
82 | -JSON file containing host, port, and SHS cap key to use if the | |
82 … | +JSON file containing key, host, port, and/or SHS cap key to use if the | |
83 | 83 … | .Ar -s , |
84 | 84 … | .Ar -p |
85 | 85 … | or |
86 | 86 … | .Ar -c |
sbotc.c | ||
---|---|---|
@@ -822,11 +822,13 @@ | ||
822 | 822 … | |
823 | 823 … | char config_buf[8192]; |
824 | 824 … | len = read_file(config_buf, sizeof(config_buf), "%s/config", app_dir); |
825 | 825 … | if (len > 0) { |
826 … | + ssize_t key_len = json_get_value(config_buf, "key", &key); | |
826 | 827 … | ssize_t host_len = json_get_value(config_buf, "host", &host); |
827 | 828 … | ssize_t port_len = json_get_value(config_buf, "port", &port); |
828 | 829 … | ssize_t shs_cap_len = json_get_value(config_buf, "caps.shs", &shs_cap_key_str); |
830 … | + if (key_len >= 0) ((char *)key)[key_len] = '\0'; | |
829 | 831 … | if (host_len >= 0) ((char *)host)[host_len] = '\0'; |
830 | 832 … | if (port_len >= 0) ((char *)port)[port_len] = '\0'; |
831 | 833 … | if (shs_cap_len >= 0) ((char *)shs_cap_key_str)[shs_cap_len] = '\0'; |
832 | 834 … | } else if (len < 0 && errno != ENOENT) { |
Built with git-ssb-web