mirror of
http://galexander.org/git/simplesshd.git
synced 2025-01-03 19:50:55 +00:00
add conf_path_file() function to generate "/sdcard/ssh/foo" style filenames
This commit is contained in:
parent
0c939b5b24
commit
3f721ae740
@ -19,15 +19,17 @@
|
||||
#define DROPBEAR_DEFADDRESS ""
|
||||
#endif
|
||||
|
||||
extern const char *conf_path_file(const char *fn); /* in jni/interface.c */
|
||||
|
||||
/* Default hostkey paths - these can be specified on the command line */
|
||||
#ifndef DSS_PRIV_FILENAME
|
||||
#define DSS_PRIV_FILENAME "/etc/dropbear/dropbear_dss_host_key"
|
||||
#define DSS_PRIV_FILENAME conf_path_file("dropbear_dss_host_key")
|
||||
#endif
|
||||
#ifndef RSA_PRIV_FILENAME
|
||||
#define RSA_PRIV_FILENAME "/etc/dropbear/dropbear_rsa_host_key"
|
||||
#define RSA_PRIV_FILENAME conf_path_file("dropbear_rsa_host_key")
|
||||
#endif
|
||||
#ifndef ECDSA_PRIV_FILENAME
|
||||
#define ECDSA_PRIV_FILENAME "/etc/dropbear/dropbear_ecdsa_host_key"
|
||||
#define ECDSA_PRIV_FILENAME conf_path_file("dropbear_ecdsa_host_key")
|
||||
#endif
|
||||
|
||||
/* Set NON_INETD_MODE if you require daemon functionality (ie Dropbear listens
|
||||
|
@ -8,7 +8,16 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
const char *conf_path, *conf_shell, *conf_home;
|
||||
const char *conf_path = "", *conf_shell = "", *conf_home = "";
|
||||
|
||||
/* NB - this will leak memory like crazy if called often.... */
|
||||
const char *
|
||||
conf_path_file(const char *fn)
|
||||
{
|
||||
char *ret = malloc(strlen(conf_path)+strlen(fn)+20);
|
||||
sprintf(ret, "%s/%s", conf_path, fn);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* XXX - do i need a function to generate host keys? DROPBEAR_DELAY_HOSTKEY */
|
||||
/* XXX - a C-callable interface to get property strings from the java side (paths, etc) */
|
||||
@ -76,12 +85,11 @@ Java_org_galexander_sshd_SimpleSSHDService_start_1sshd(JNIEnv *env_,
|
||||
if (pid == 0) {
|
||||
char *argv[10] = { "sshd", NULL };
|
||||
int argc = 1;
|
||||
char *logfn;
|
||||
const char *logfn;
|
||||
int logfd;
|
||||
int retval;
|
||||
|
||||
logfn = malloc(strlen(conf_path)+20);
|
||||
sprintf(logfn, "%s/dropbear.err", conf_path);
|
||||
logfn = conf_path_file("dropbear.err");
|
||||
unlink(logfn);
|
||||
logfd = open(logfn, O_CREAT|O_WRONLY, 0666);
|
||||
if (logfd != -1) {
|
||||
|
Loading…
Reference in New Issue
Block a user