Mercurial > dropbear
changeset 1923:ffa0f666fde2
Expand home path for MOTD file
Patch modified by Matt Johnston
Signed-off-by: Begley Brothers Inc <[email protected]>
author | Begley Brothers Inc <begleybrothers@gmail.com> |
---|---|
date | Thu, 09 Jul 2020 22:06:26 +1000 |
parents | 70f05f7d4d11 |
children | 667937351c31 |
files | svr-chansession.c |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/svr-chansession.c Thu Jul 09 17:51:07 2020 +1000 +++ b/svr-chansession.c Thu Jul 09 22:06:26 2020 +1000 @@ -873,9 +873,11 @@ 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 @@ buf_incrpos(motdbuf, len); } } + m_free(expand_path); buf_free(motdbuf); + } m_free(hushpath); }