Remove hardcoded paths to commands, configs, etc. in source

This commit is contained in:
Philip Prindeville 2023-10-23 13:52:40 -06:00 committed by Olof Hagsand
parent 72db8edf3f
commit b9ed302de1
6 changed files with 48 additions and 14 deletions

View file

@ -68,6 +68,10 @@ sudo clixon_netconf_ssh_callhome -a 127.0.0.1 -c /var/tmp/./test_netconf_ssh_cal
*/
#ifdef HAVE_CONFIG_H
#include "clixon_config.h" /* generated by config & autoconf */
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -79,7 +83,7 @@ sudo clixon_netconf_ssh_callhome -a 127.0.0.1 -c /var/tmp/./test_netconf_ssh_cal
#include <sys/socket.h>
#define NETCONF_CH_SSH 4334
#define SSHDBIN_DEFAULT "/usr/sbin/sshd"
#define SSHDBIN_DEFAULT CLIXON_CONFIG_SBINDIR "/sshd"
#define UTIL_OPTS "hD:f:a:p:s:c:C:"
static int
@ -151,7 +155,7 @@ ssh_server_exec(int s,
int nr;
char *optstr = NULL;
size_t len;
const char *formatstr = "Subsystem netconf /usr/local/bin/clixon_netconf -f %s";
const char *formatstr = "Subsystem netconf " CLIXON_CONFIG_BINDIR "/clixon_netconf -f %s";
if (s < 0){
errno = EINVAL;
@ -237,7 +241,7 @@ usage(char *argv0)
"\t-f ipv4|ipv6 \tSocket address family(inet:ipv4-address default)\n"
"\t-a <addrstr> \tIP address (eg 1.2.3.4) - mandatory\n"
"\t-p <port> \tPort (default 4334)\n"
"\t-c <file> \tClixon config file - (default /usr/local/etc/clixon.xml)\n"
"\t-c <file> \tClixon config file - (default " CLIXON_DEFAULT_CONFIG ")\n"
"\t-C <file> \tSSHD config file - (default /dev/null)\n"
"\t-s <sshd> \tPath to sshd binary, default %s\n"
,
@ -261,7 +265,7 @@ main(int argc,
int s = -1;
char *sshdbin = SSHDBIN_DEFAULT;
char *sshdconfigfile = "/dev/null";
char *clixonconfigfile = "/usr/local/etc/clixon.xml";
char *clixonconfigfile = CLIXON_CONFIG_SYSCONFDIR "/clixon.xml";
optind = 1;
opterr = 0;