summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'session.c')
-rw-r--r--session.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/session.c b/session.c
index 92870a111..0571c2f64 100644
--- a/session.c
+++ b/session.c
@@ -607,6 +607,29 @@ do_exec(Session *s, const char *command)
607 original_command = NULL; 607 original_command = NULL;
608} 608}
609 609
610/*
611 * Check for quiet login, either .hushlogin or command given.
612 */
613static int
614check_quietlogin(Session *s, const char *command)
615{
616 char buf[256];
617 struct passwd * pw = s->pw;
618 struct stat st;
619
620 /* Return 1 if .hushlogin exists or a command given. */
621 if (command != NULL)
622 return 1;
623 snprintf(buf, sizeof(buf), "%.200s/.hushlogin", pw->pw_dir);
624#ifdef HAVE_LOGIN_CAP
625 if (login_getcapbool(lc, "hushlogin", 0) || stat(buf, &st) >= 0)
626 return 1;
627#else
628 if (stat(buf, &st) >= 0)
629 return 1;
630#endif
631 return 0;
632}
610 633
611/* administrative, login(1)-like work */ 634/* administrative, login(1)-like work */
612void 635void
@@ -706,31 +729,6 @@ do_motd(void)
706 } 729 }
707} 730}
708 731
709
710/*
711 * Check for quiet login, either .hushlogin or command given.
712 */
713int
714check_quietlogin(Session *s, const char *command)
715{
716 char buf[256];
717 struct passwd * pw = s->pw;
718 struct stat st;
719
720 /* Return 1 if .hushlogin exists or a command given. */
721 if (command != NULL)
722 return 1;
723 snprintf(buf, sizeof(buf), "%.200s/.hushlogin", pw->pw_dir);
724#ifdef HAVE_LOGIN_CAP
725 if (login_getcapbool(lc, "hushlogin", 0) || stat(buf, &st) >= 0)
726 return 1;
727#else
728 if (stat(buf, &st) >= 0)
729 return 1;
730#endif
731 return 0;
732}
733
734/* 732/*
735 * Sets the value of the given variable in the environment. If the variable 733 * Sets the value of the given variable in the environment. If the variable
736 * already exists, its value is overriden. 734 * already exists, its value is overriden.