diff options
author | Begley Brothers Inc <begleybrothers@gmail.com> | 2020-07-09 22:06:26 +1000 |
---|---|---|
committer | Begley Brothers Inc <begleybrothers@gmail.com> | 2020-07-09 22:06:26 +1000 |
commit | 3725b42fe95ef0b47b69d658dc875e980070b62d (patch) | |
tree | a89f35f740387fd5c1aacff19650f48ac163ce75 | |
parent | 12f6b153afffb2abc955496958e5ae51cf428d85 (diff) | |
download | dropbear-3725b42fe95ef0b47b69d658dc875e980070b62d.tar.gz |
Expand home path for MOTD file
Patch modified by Matt Johnston
Signed-off-by: Begley Brothers Inc <begleybrothers@gmail.com>
-rw-r--r-- | svr-chansession.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/svr-chansession.c b/svr-chansession.c index 0e86fb4..35631e9 100644 --- a/svr-chansession.c +++ b/svr-chansession.c @@ -873,9 +873,11 @@ static int ptycommand(struct Channel *channel, struct ChanSess *chansess) { snprintf(hushpath, len, "%s/.hushlogin", ses.authstate.pw_dir); if (stat(hushpath, &sb) < 0) { + char *expand_path = NULL; /* more than a screenful is stupid IMHO */ motdbuf = buf_new(80 * 25); - if (buf_readfile(motdbuf, MOTD_FILENAME) == DROPBEAR_SUCCESS) { + expand_path = expand_homedir_path(MOTD_FILENAME); + if (buf_readfile(motdbuf, expand_path) == DROPBEAR_SUCCESS) { buf_setpos(motdbuf, 0); while (motdbuf->pos != motdbuf->len) { len = motdbuf->len - motdbuf->pos; @@ -884,7 +886,9 @@ static int ptycommand(struct Channel *channel, struct ChanSess *chansess) { buf_incrpos(motdbuf, len); } } + m_free(expand_path); buf_free(motdbuf); + } m_free(hushpath); } |