# HG changeset patch # User Begley Brothers Inc # Date 1594296386 -36000 # Node ID ffa0f666fde29ea1c7d0d8c8585c7544787b0a78 # Parent 70f05f7d4d119a0e896db21a7ca925162ee902a9 Expand home path for MOTD file Patch modified by Matt Johnston Signed-off-by: Begley Brothers Inc diff -r 70f05f7d4d11 -r ffa0f666fde2 svr-chansession.c --- 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); }