summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Steves <stevesk@pobox.com>2002-07-23 00:44:07 +0000
committerKevin Steves <stevesk@pobox.com>2002-07-23 00:44:07 +0000
commit38b050a0f526d1b7982deb9d19f59c95f7b91b22 (patch)
tree7594cc4c8543dd983ddbafea6170ebcacffa1847
parent446d886fa5b295b03031de840286dbe4b7d904a3 (diff)
- (stevesk) [auth-pam.[ch] session.c] pam_getenvlist() must be
freed by the caller; add free_pam_environment() and use it.
-rw-r--r--ChangeLog4
-rw-r--r--auth-pam.c12
-rw-r--r--auth-pam.h3
-rw-r--r--session.c13
4 files changed, 27 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 0bfeeddeb..b444df906 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@
6 - (bal) [configure.ac] Missing ;; from cray patch. 6 - (bal) [configure.ac] Missing ;; from cray patch.
7 - (bal) [monitor_mm.c openbsd-compat/xmmap.h] Move xmmap() defines 7 - (bal) [monitor_mm.c openbsd-compat/xmmap.h] Move xmmap() defines
8 into it's own header. 8 into it's own header.
9 - (stevesk) [auth-pam.[ch] session.c] pam_getenvlist() must be
10 freed by the caller; add free_pam_environment() and use it.
9 11
1020020721 1220020721
11 - (stevesk) [auth-pam.c] merge cosmetic changes from solar's 13 - (stevesk) [auth-pam.c] merge cosmetic changes from solar's
@@ -1417,4 +1419,4 @@
1417 - (stevesk) entropy.c: typo in debug message 1419 - (stevesk) entropy.c: typo in debug message
1418 - (djm) ssh-keygen -i needs seeded RNG; report from markus@ 1420 - (djm) ssh-keygen -i needs seeded RNG; report from markus@
1419 1421
1420$Id: ChangeLog,v 1.2391 2002/07/23 00:03:33 mouring Exp $ 1422$Id: ChangeLog,v 1.2392 2002/07/23 00:44:07 stevesk Exp $
diff --git a/auth-pam.c b/auth-pam.c
index 79af58a0b..8e1498296 100644
--- a/auth-pam.c
+++ b/auth-pam.c
@@ -38,7 +38,7 @@ extern char *__progname;
38 38
39extern int use_privsep; 39extern int use_privsep;
40 40
41RCSID("$Id: auth-pam.c,v 1.51 2002/07/21 23:59:39 stevesk Exp $"); 41RCSID("$Id: auth-pam.c,v 1.52 2002/07/23 00:44:07 stevesk Exp $");
42 42
43#define NEW_AUTHTOK_MSG \ 43#define NEW_AUTHTOK_MSG \
44 "Warning: Your password has expired, please change it now." 44 "Warning: Your password has expired, please change it now."
@@ -421,6 +421,16 @@ char **fetch_pam_environment(void)
421#endif /* HAVE_PAM_GETENVLIST */ 421#endif /* HAVE_PAM_GETENVLIST */
422} 422}
423 423
424void free_pam_environment(char **env)
425{
426 int i;
427
428 if (env != NULL) {
429 for (i = 0; env[i] != NULL; i++)
430 xfree(env[i]);
431 }
432}
433
424/* Print any messages that have been generated during authentication */ 434/* Print any messages that have been generated during authentication */
425/* or account checking to stderr */ 435/* or account checking to stderr */
426void print_pam_messages(void) 436void print_pam_messages(void)
diff --git a/auth-pam.h b/auth-pam.h
index 215e75282..7881b6b80 100644
--- a/auth-pam.h
+++ b/auth-pam.h
@@ -1,4 +1,4 @@
1/* $Id: auth-pam.h,v 1.15 2002/07/21 23:59:39 stevesk Exp $ */ 1/* $Id: auth-pam.h,v 1.16 2002/07/23 00:44:07 stevesk Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000 Damien Miller. All rights reserved. 4 * Copyright (c) 2000 Damien Miller. All rights reserved.
@@ -35,6 +35,7 @@ void start_pam(const char *user);
35void finish_pam(void); 35void finish_pam(void);
36int auth_pam_password(Authctxt *authctxt, const char *password); 36int auth_pam_password(Authctxt *authctxt, const char *password);
37char **fetch_pam_environment(void); 37char **fetch_pam_environment(void);
38void free_pam_environment(char **env);
38int do_pam_authenticate(int flags); 39int do_pam_authenticate(int flags);
39int do_pam_account(char *username, char *remote_user); 40int do_pam_account(char *username, char *remote_user);
40void do_pam_session(char *username, const char *ttyname); 41void do_pam_session(char *username, const char *ttyname);
diff --git a/session.c b/session.c
index 5fb1ace00..3c759e472 100644
--- a/session.c
+++ b/session.c
@@ -1042,8 +1042,17 @@ do_setup_env(Session *s, const char *shell)
1042 s->authctxt->krb5_ticket_file); 1042 s->authctxt->krb5_ticket_file);
1043#endif 1043#endif
1044#ifdef USE_PAM 1044#ifdef USE_PAM
1045 /* Pull in any environment variables that may have been set by PAM. */ 1045 /*
1046 copy_environment(fetch_pam_environment(), &env, &envsize); 1046 * Pull in any environment variables that may have
1047 * been set by PAM.
1048 */
1049 {
1050 char **p;
1051
1052 p = fetch_pam_environment();
1053 copy_environment(p, &env, &envsize);
1054 free_pam_environment(p);
1055 }
1047#endif /* USE_PAM */ 1056#endif /* USE_PAM */
1048 1057
1049 if (auth_sock_name != NULL) 1058 if (auth_sock_name != NULL)