aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokan2012-12-17 23:54:57 +0000
committerokan2012-12-17 23:54:57 +0000
commit3a90166d0b310afb7339b6d1eebd8bb37a80324f (patch)
tree2dc9b5862d221cb20c9c975e5d4eb0f330f7d1fc
parentb5092167190004004d01ad01dd180ded079a0457 (diff)
downloadcwm-3a90166d0b310afb7339b6d1eebd8bb37a80324f.tar.gz
put a default known_hosts into conf
-rw-r--r--calmwm.h3
-rw-r--r--conf.c5
-rw-r--r--kbfunc.c13
3 files changed, 11 insertions, 10 deletions
diff --git a/calmwm.h b/calmwm.h
index 6ee87be..d9f5f29 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: calmwm.h,v 1.172 2012/12/17 23:03:41 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.173 2012/12/17 23:54:57 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -298,6 +298,7 @@ struct conf {
char *menucolor[CWM_COLOR_MENU_MAX];
char termpath[MAXPATHLEN];
char lockpath[MAXPATHLEN];
+ char known_hosts[MAXPATHLEN];
#define CONF_FONT "sans-serif:pixelsize=14:bold"
char *font;
};
diff --git a/conf.c b/conf.c
index b31a32c..a06a3e7 100644
--- a/conf.c
+++ b/conf.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: conf.c,v 1.113 2012/12/17 23:03:41 okan Exp $
+ * $OpenBSD: conf.c,v 1.114 2012/12/17 23:54:57 okan Exp $
*/
#include <sys/param.h>
@@ -193,6 +193,9 @@ conf_init(struct conf *c)
(void)strlcpy(c->termpath, "xterm", sizeof(c->termpath));
(void)strlcpy(c->lockpath, "xlock", sizeof(c->lockpath));
+ (void)snprintf(c->known_hosts, sizeof(c->known_hosts), "%s/%s",
+ homedir, ".ssh/known_hosts");
+
c->font = xstrdup(CONF_FONT);
}
diff --git a/kbfunc.c b/kbfunc.c
index a134999..6300527 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: kbfunc.c,v 1.70 2012/12/17 23:03:41 okan Exp $
+ * $OpenBSD: kbfunc.c,v 1.71 2012/12/17 23:54:57 okan Exp $
*/
#include <sys/param.h>
@@ -33,7 +33,6 @@
#include "calmwm.h"
-#define KNOWN_HOSTS ".ssh/known_hosts"
#define HASH_MARKER "|1|"
extern char **cwm_argv;
@@ -325,17 +324,15 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg)
struct menu_q menuq;
FILE *fp;
char *buf, *lbuf, *p;
- char hostbuf[MAXHOSTNAMELEN], filename[MAXPATHLEN];
+ char hostbuf[MAXHOSTNAMELEN];
char cmd[256];
int l;
size_t len;
- l = snprintf(filename, sizeof(filename), "%s/%s", homedir, KNOWN_HOSTS);
- if (l == -1 || l >= sizeof(filename))
- return;
-
- if ((fp = fopen(filename, "r")) == NULL)
+ if ((fp = fopen(Conf.known_hosts, "r")) == NULL) {
+ warn("kbfunc_ssh: %s", Conf.known_hosts);
return;
+ }
TAILQ_INIT(&menuq);
lbuf = NULL;