Mercurial > dropbear
comparison svr-chansession.c @ 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 | 284c3837891c |
children | 299f4f19ba19 |
comparison
equal
deleted
inserted
replaced
1922:70f05f7d4d11 | 1923:ffa0f666fde2 |
---|---|
871 | 871 |
872 hushpath = m_malloc(len); | 872 hushpath = m_malloc(len); |
873 snprintf(hushpath, len, "%s/.hushlogin", ses.authstate.pw_dir); | 873 snprintf(hushpath, len, "%s/.hushlogin", ses.authstate.pw_dir); |
874 | 874 |
875 if (stat(hushpath, &sb) < 0) { | 875 if (stat(hushpath, &sb) < 0) { |
876 char *expand_path = NULL; | |
876 /* more than a screenful is stupid IMHO */ | 877 /* more than a screenful is stupid IMHO */ |
877 motdbuf = buf_new(80 * 25); | 878 motdbuf = buf_new(80 * 25); |
878 if (buf_readfile(motdbuf, MOTD_FILENAME) == DROPBEAR_SUCCESS) { | 879 expand_path = expand_homedir_path(MOTD_FILENAME); |
880 if (buf_readfile(motdbuf, expand_path) == DROPBEAR_SUCCESS) { | |
879 buf_setpos(motdbuf, 0); | 881 buf_setpos(motdbuf, 0); |
880 while (motdbuf->pos != motdbuf->len) { | 882 while (motdbuf->pos != motdbuf->len) { |
881 len = motdbuf->len - motdbuf->pos; | 883 len = motdbuf->len - motdbuf->pos; |
882 len = write(STDOUT_FILENO, | 884 len = write(STDOUT_FILENO, |
883 buf_getptr(motdbuf, len), len); | 885 buf_getptr(motdbuf, len), len); |
884 buf_incrpos(motdbuf, len); | 886 buf_incrpos(motdbuf, len); |
885 } | 887 } |
886 } | 888 } |
889 m_free(expand_path); | |
887 buf_free(motdbuf); | 890 buf_free(motdbuf); |
891 | |
888 } | 892 } |
889 m_free(hushpath); | 893 m_free(hushpath); |
890 } | 894 } |
891 #endif /* DO_MOTD */ | 895 #endif /* DO_MOTD */ |
892 | 896 |