mirror of
http://galexander.org/git/simplesshd.git
synced 2025-01-05 20:50:59 +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 ""
|
#define DROPBEAR_DEFADDRESS ""
|
||||||
#endif
|
#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 */
|
/* Default hostkey paths - these can be specified on the command line */
|
||||||
#ifndef DSS_PRIV_FILENAME
|
#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
|
#endif
|
||||||
#ifndef RSA_PRIV_FILENAME
|
#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
|
#endif
|
||||||
#ifndef ECDSA_PRIV_FILENAME
|
#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
|
#endif
|
||||||
|
|
||||||
/* Set NON_INETD_MODE if you require daemon functionality (ie Dropbear listens
|
/* Set NON_INETD_MODE if you require daemon functionality (ie Dropbear listens
|
||||||
|
@ -8,7 +8,16 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.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 - 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) */
|
/* 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) {
|
if (pid == 0) {
|
||||||
char *argv[10] = { "sshd", NULL };
|
char *argv[10] = { "sshd", NULL };
|
||||||
int argc = 1;
|
int argc = 1;
|
||||||
char *logfn;
|
const char *logfn;
|
||||||
int logfd;
|
int logfd;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
logfn = malloc(strlen(conf_path)+20);
|
logfn = conf_path_file("dropbear.err");
|
||||||
sprintf(logfn, "%s/dropbear.err", conf_path);
|
|
||||||
unlink(logfn);
|
unlink(logfn);
|
||||||
logfd = open(logfn, O_CREAT|O_WRONLY, 0666);
|
logfd = open(logfn, O_CREAT|O_WRONLY, 0666);
|
||||||
if (logfd != -1) {
|
if (logfd != -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user