mirror of
https://github.com/clearml/dropbear
synced 2025-05-14 16:45:59 +00:00
Expand home path for MOTD file
Patch modified by Matt Johnston Signed-off-by: Begley Brothers Inc <begleybrothers@gmail.com>
This commit is contained in:
parent
8b202f86e2
commit
0de8d44297
@ -873,9 +873,11 @@ static int ptycommand(struct Channel *channel, struct ChanSess *chansess) {
|
|||||||
snprintf(hushpath, len, "%s/.hushlogin", ses.authstate.pw_dir);
|
snprintf(hushpath, len, "%s/.hushlogin", ses.authstate.pw_dir);
|
||||||
|
|
||||||
if (stat(hushpath, &sb) < 0) {
|
if (stat(hushpath, &sb) < 0) {
|
||||||
|
char *expand_path = NULL;
|
||||||
/* more than a screenful is stupid IMHO */
|
/* more than a screenful is stupid IMHO */
|
||||||
motdbuf = buf_new(80 * 25);
|
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);
|
buf_setpos(motdbuf, 0);
|
||||||
while (motdbuf->pos != motdbuf->len) {
|
while (motdbuf->pos != motdbuf->len) {
|
||||||
len = motdbuf->len - motdbuf->pos;
|
len = motdbuf->len - motdbuf->pos;
|
||||||
@ -884,7 +886,9 @@ static int ptycommand(struct Channel *channel, struct ChanSess *chansess) {
|
|||||||
buf_incrpos(motdbuf, len);
|
buf_incrpos(motdbuf, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_free(expand_path);
|
||||||
buf_free(motdbuf);
|
buf_free(motdbuf);
|
||||||
|
|
||||||
}
|
}
|
||||||
m_free(hushpath);
|
m_free(hushpath);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user