View | Details | Raw Unified | Return to bug 14 | Differences between
and this patch

Collapse All | Expand All

(-)auth.c.O (-1 / +4 lines)
Lines 49-54 Link Here
49
#include "uidswap.h"
49
#include "uidswap.h"
50
#include "tildexpand.h"
50
#include "tildexpand.h"
51
51
52
/* set when password has expired */
53
int forced_passwd_change = 0;
54
52
/* import */
55
/* import */
53
extern ServerOptions options;
56
extern ServerOptions options;
54
57
Lines 90-96 Link Here
90
		/* Check password expiry */
93
		/* Check password expiry */
91
		if ((spw->sp_lstchg >= 0) && (spw->sp_max >= 0) &&
94
		if ((spw->sp_lstchg >= 0) && (spw->sp_max >= 0) &&
92
		    (days > (spw->sp_lstchg + spw->sp_max)))
95
		    (days > (spw->sp_lstchg + spw->sp_max)))
93
			return 0;
96
			forced_passwd_change = 1;
94
	}
97
	}
95
#else
98
#else
96
	/* Shouldn't be called if pw is NULL, but better safe than sorry... */
99
	/* Shouldn't be called if pw is NULL, but better safe than sorry... */
(-)auth.h.O (+3 lines)
Lines 40-45 Link Here
40
#include <krb5.h>
40
#include <krb5.h>
41
#endif
41
#endif
42
42
43
/* set when password has expired */
44
extern int forced_passwd_change;
45
43
typedef struct Authctxt Authctxt;
46
typedef struct Authctxt Authctxt;
44
typedef struct KbdintDevice KbdintDevice;
47
typedef struct KbdintDevice KbdintDevice;
45
48
(-)session.c.O (-1 / +15 lines)
Lines 656-662 Link Here
656
void
656
void
657
do_exec(Session *s, const char *command)
657
do_exec(Session *s, const char *command)
658
{
658
{
659
	if (forced_command) {
659
	if (forced_passwd_change) {
660
		char *user = s->pw->pw_name;
661
		char *msg;
662
663
		if (s->ttyfd == -1) {
664
			packet_disconnect("Password for %.100s has expired and cannot be changed without a pty", user);
665
			return;
666
		}
667
668
		msg = "Password for %.100s has expired, running 'passwd' to reset it";
669
		command = "passwd";
670
		log(msg, user);
671
		packet_send_debug(msg, user);
672
673
	} else if (forced_command) {
660
		original_command = command;
674
		original_command = command;
661
		command = forced_command;
675
		command = forced_command;
662
		debug("Forced command '%.900s'", command);
676
		debug("Forced command '%.900s'", command);

Return to bug 14