summaryrefslogtreecommitdiff
path: root/auth-pam.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2019-05-17 13:14:12 +1000
committerDarren Tucker <dtucker@dtucker.net>2019-05-17 13:14:12 +1000
commit606077ee1e77af5908431d003fb28461ef7be092 (patch)
treefb1d182fb9853804612e5b7e47609b9ee2f1503b /auth-pam.c
parent1ac98be8724c9789d770ddb8e7f0dbf1b55e05a0 (diff)
Add no-op implementation of pam_putenv.
Some platforms such as HP-UX do not have pam_putenv. Currently the calls are ifdef'ed out, but a new one was recently added. Remove the ifdefs and add a no-op implementation. bz#3008, ok djm.
Diffstat (limited to 'auth-pam.c')
-rw-r--r--auth-pam.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/auth-pam.c b/auth-pam.c
index bde0a8f56..289d9f4f7 100644
--- a/auth-pam.c
+++ b/auth-pam.c
@@ -266,6 +266,14 @@ pam_getenvlist(pam_handle_t *pamh)
266} 266}
267#endif 267#endif
268 268
269#ifndef HAVE_PAM_PUTENV
270static int
271pam_putenv(pam_handle_t *pamh, const char *name_value)
272{
273 return PAM_SUCCESS;
274}
275#endif /* HAVE_PAM_PUTENV */
276
269/* 277/*
270 * Some platforms, notably Solaris, do not enforce password complexity 278 * Some platforms, notably Solaris, do not enforce password complexity
271 * rules during pam_chauthtok() if the real uid of the calling process 279 * rules during pam_chauthtok() if the real uid of the calling process
@@ -360,13 +368,11 @@ import_environments(struct sshbuf *b)
360 for (i = 0; i < num_env; i++) { 368 for (i = 0; i < num_env; i++) {
361 if ((r = sshbuf_get_cstring(b, &env, NULL)) != 0) 369 if ((r = sshbuf_get_cstring(b, &env, NULL)) != 0)
362 fatal("%s: buffer error: %s", __func__, ssh_err(r)); 370 fatal("%s: buffer error: %s", __func__, ssh_err(r));
363#ifdef HAVE_PAM_PUTENV
364 /* Errors are not fatal here */ 371 /* Errors are not fatal here */
365 if ((r = pam_putenv(sshpam_handle, env)) != PAM_SUCCESS) { 372 if ((r = pam_putenv(sshpam_handle, env)) != PAM_SUCCESS) {
366 error("PAM: pam_putenv: %s", 373 error("PAM: pam_putenv: %s",
367 pam_strerror(sshpam_handle, r)); 374 pam_strerror(sshpam_handle, r));
368 } 375 }
369#endif
370 /* XXX leak env? */ 376 /* XXX leak env? */
371 } 377 }
372#endif 378#endif
@@ -1205,7 +1211,6 @@ int
1205do_pam_putenv(char *name, char *value) 1211do_pam_putenv(char *name, char *value)
1206{ 1212{
1207 int ret = 1; 1213 int ret = 1;
1208#ifdef HAVE_PAM_PUTENV
1209 char *compound; 1214 char *compound;
1210 size_t len; 1215 size_t len;
1211 1216
@@ -1215,7 +1220,6 @@ do_pam_putenv(char *name, char *value)
1215 snprintf(compound, len, "%s=%s", name, value); 1220 snprintf(compound, len, "%s=%s", name, value);
1216 ret = pam_putenv(sshpam_handle, compound); 1221 ret = pam_putenv(sshpam_handle, compound);
1217 free(compound); 1222 free(compound);
1218#endif
1219 1223
1220 return (ret); 1224 return (ret);
1221} 1225}