diff options
author | Damien Miller <djm@mindrot.org> | 1999-12-28 15:09:35 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 1999-12-28 15:09:35 +1100 |
commit | beb4ba5a68dbfa478bcc375cc885a047a8301c0d (patch) | |
tree | f612c8142e3891e40e68797c00a339a8efde0a40 /sshd.c | |
parent | 4ff2b9bf429f40cb4d8119108cd7c4aa76c081ee (diff) |
- Portability fixes for Irix 5.3 (now compiles OK!)
- autoconf and other misc cleanups
Diffstat (limited to 'sshd.c')
-rw-r--r-- | sshd.c | 52 |
1 files changed, 26 insertions, 26 deletions
@@ -11,7 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include "includes.h" | 13 | #include "includes.h" |
14 | RCSID("$Id: sshd.c,v 1.45 1999/12/26 23:55:23 damien Exp $"); | 14 | RCSID("$Id: sshd.c,v 1.46 1999/12/28 04:09:36 damien Exp $"); |
15 | 15 | ||
16 | #ifdef HAVE_POLL_H | 16 | #ifdef HAVE_POLL_H |
17 | # include <poll.h> | 17 | # include <poll.h> |
@@ -143,7 +143,7 @@ void do_child(const char *command, struct passwd * pw, const char *term, | |||
143 | const char *display, const char *auth_proto, | 143 | const char *display, const char *auth_proto, |
144 | const char *auth_data, const char *ttyname); | 144 | const char *auth_data, const char *ttyname); |
145 | 145 | ||
146 | #ifdef HAVE_LIBPAM | 146 | #ifdef USE_PAM |
147 | static int pamconv(int num_msg, const struct pam_message **msg, | 147 | static int pamconv(int num_msg, const struct pam_message **msg, |
148 | struct pam_response **resp, void *appdata_ptr); | 148 | struct pam_response **resp, void *appdata_ptr); |
149 | int do_pam_auth(const char *user, const char *password); | 149 | int do_pam_auth(const char *user, const char *password); |
@@ -301,7 +301,7 @@ void do_pam_session(char *username, char *ttyname) | |||
301 | if (pam_retval != PAM_SUCCESS) | 301 | if (pam_retval != PAM_SUCCESS) |
302 | fatal("PAM session setup failed: %.200s", PAM_STRERROR((pam_handle_t *)pamh, pam_retval)); | 302 | fatal("PAM session setup failed: %.200s", PAM_STRERROR((pam_handle_t *)pamh, pam_retval)); |
303 | } | 303 | } |
304 | #endif /* HAVE_LIBPAM */ | 304 | #endif /* USE_PAM */ |
305 | 305 | ||
306 | /* | 306 | /* |
307 | * Signal handler for SIGHUP. Sshd execs itself when it receives SIGHUP; | 307 | * Signal handler for SIGHUP. Sshd execs itself when it receives SIGHUP; |
@@ -952,7 +952,7 @@ main(int ac, char **av) | |||
952 | /* The connection has been terminated. */ | 952 | /* The connection has been terminated. */ |
953 | verbose("Closing connection to %.100s", remote_ip); | 953 | verbose("Closing connection to %.100s", remote_ip); |
954 | 954 | ||
955 | #ifdef HAVE_LIBPAM | 955 | #ifdef USE_PAM |
956 | { | 956 | { |
957 | int retval; | 957 | int retval; |
958 | 958 | ||
@@ -967,7 +967,7 @@ main(int ac, char **av) | |||
967 | fatal_remove_cleanup(&pam_cleanup_proc, NULL); | 967 | fatal_remove_cleanup(&pam_cleanup_proc, NULL); |
968 | } | 968 | } |
969 | } | 969 | } |
970 | #endif /* HAVE_LIBPAM */ | 970 | #endif /* USE_PAM */ |
971 | 971 | ||
972 | packet_close(); | 972 | packet_close(); |
973 | exit(0); | 973 | exit(0); |
@@ -1285,7 +1285,7 @@ do_authentication(char *user) | |||
1285 | pwcopy.pw_shell = xstrdup(pw->pw_shell); | 1285 | pwcopy.pw_shell = xstrdup(pw->pw_shell); |
1286 | pw = &pwcopy; | 1286 | pw = &pwcopy; |
1287 | 1287 | ||
1288 | #ifdef HAVE_LIBPAM | 1288 | #ifdef USE_PAM |
1289 | { | 1289 | { |
1290 | int pam_retval; | 1290 | int pam_retval; |
1291 | 1291 | ||
@@ -1313,11 +1313,11 @@ do_authentication(char *user) | |||
1313 | #ifdef KRB4 | 1313 | #ifdef KRB4 |
1314 | (!options.kerberos_authentication || options.kerberos_or_local_passwd) && | 1314 | (!options.kerberos_authentication || options.kerberos_or_local_passwd) && |
1315 | #endif /* KRB4 */ | 1315 | #endif /* KRB4 */ |
1316 | #ifdef HAVE_LIBPAM | 1316 | #ifdef USE_PAM |
1317 | do_pam_auth(pw->pw_name, "")) { | 1317 | do_pam_auth(pw->pw_name, "")) { |
1318 | #else /* HAVE_LIBPAM */ | 1318 | #else /* USE_PAM */ |
1319 | auth_password(pw, "")) { | 1319 | auth_password(pw, "")) { |
1320 | #endif /* HAVE_LIBPAM */ | 1320 | #endif /* USE_PAM */ |
1321 | /* Authentication with empty password succeeded. */ | 1321 | /* Authentication with empty password succeeded. */ |
1322 | log("Login for user %s from %.100s, accepted without authentication.", | 1322 | log("Login for user %s from %.100s, accepted without authentication.", |
1323 | pw->pw_name, get_remote_ipaddr()); | 1323 | pw->pw_name, get_remote_ipaddr()); |
@@ -1457,9 +1457,9 @@ do_authloop(struct passwd * pw) | |||
1457 | authenticated = auth_rhosts(pw, client_user); | 1457 | authenticated = auth_rhosts(pw, client_user); |
1458 | 1458 | ||
1459 | snprintf(user, sizeof user, " ruser %s", client_user); | 1459 | snprintf(user, sizeof user, " ruser %s", client_user); |
1460 | #ifndef HAVE_LIBPAM | 1460 | #ifndef USE_PAM |
1461 | xfree(client_user); | 1461 | xfree(client_user); |
1462 | #endif /* HAVE_LIBPAM */ | 1462 | #endif /* USE_PAM */ |
1463 | break; | 1463 | break; |
1464 | 1464 | ||
1465 | case SSH_CMSG_AUTH_RHOSTS_RSA: | 1465 | case SSH_CMSG_AUTH_RHOSTS_RSA: |
@@ -1492,9 +1492,9 @@ do_authloop(struct passwd * pw) | |||
1492 | BN_clear_free(client_host_key_n); | 1492 | BN_clear_free(client_host_key_n); |
1493 | 1493 | ||
1494 | snprintf(user, sizeof user, " ruser %s", client_user); | 1494 | snprintf(user, sizeof user, " ruser %s", client_user); |
1495 | #ifndef HAVE_LIBPAM | 1495 | #ifndef USE_PAM |
1496 | xfree(client_user); | 1496 | xfree(client_user); |
1497 | #endif /* HAVE_LIBPAM */ | 1497 | #endif /* USE_PAM */ |
1498 | break; | 1498 | break; |
1499 | 1499 | ||
1500 | case SSH_CMSG_AUTH_RSA: | 1500 | case SSH_CMSG_AUTH_RSA: |
@@ -1523,13 +1523,13 @@ do_authloop(struct passwd * pw) | |||
1523 | password = packet_get_string(&dlen); | 1523 | password = packet_get_string(&dlen); |
1524 | packet_integrity_check(plen, 4 + dlen, type); | 1524 | packet_integrity_check(plen, 4 + dlen, type); |
1525 | 1525 | ||
1526 | #ifdef HAVE_LIBPAM | 1526 | #ifdef USE_PAM |
1527 | /* Do PAM auth with password */ | 1527 | /* Do PAM auth with password */ |
1528 | authenticated = do_pam_auth(pw->pw_name, password); | 1528 | authenticated = do_pam_auth(pw->pw_name, password); |
1529 | #else /* HAVE_LIBPAM */ | 1529 | #else /* USE_PAM */ |
1530 | /* Try authentication with the password. */ | 1530 | /* Try authentication with the password. */ |
1531 | authenticated = auth_password(pw, password); | 1531 | authenticated = auth_password(pw, password); |
1532 | #endif /* HAVE_LIBPAM */ | 1532 | #endif /* USE_PAM */ |
1533 | memset(password, 0, strlen(password)); | 1533 | memset(password, 0, strlen(password)); |
1534 | xfree(password); | 1534 | xfree(password); |
1535 | break; | 1535 | break; |
@@ -1595,13 +1595,13 @@ do_authloop(struct passwd * pw) | |||
1595 | get_remote_port(), | 1595 | get_remote_port(), |
1596 | user); | 1596 | user); |
1597 | 1597 | ||
1598 | #ifndef HAVE_LIBPAM | 1598 | #ifndef USE_PAM |
1599 | if (authenticated) | 1599 | if (authenticated) |
1600 | return; | 1600 | return; |
1601 | 1601 | ||
1602 | if (attempt > AUTH_FAIL_MAX) | 1602 | if (attempt > AUTH_FAIL_MAX) |
1603 | packet_disconnect(AUTH_FAIL_MSG, pw->pw_name); | 1603 | packet_disconnect(AUTH_FAIL_MSG, pw->pw_name); |
1604 | #else /* HAVE_LIBPAM */ | 1604 | #else /* USE_PAM */ |
1605 | if (authenticated) { | 1605 | if (authenticated) { |
1606 | do_pam_account(pw->pw_name, client_user); | 1606 | do_pam_account(pw->pw_name, client_user); |
1607 | 1607 | ||
@@ -1617,7 +1617,7 @@ do_authloop(struct passwd * pw) | |||
1617 | 1617 | ||
1618 | packet_disconnect(AUTH_FAIL_MSG, pw->pw_name); | 1618 | packet_disconnect(AUTH_FAIL_MSG, pw->pw_name); |
1619 | } | 1619 | } |
1620 | #endif /* HAVE_LIBPAM */ | 1620 | #endif /* USE_PAM */ |
1621 | 1621 | ||
1622 | /* Send a message indicating that the authentication attempt failed. */ | 1622 | /* Send a message indicating that the authentication attempt failed. */ |
1623 | packet_start(SSH_SMSG_FAILURE); | 1623 | packet_start(SSH_SMSG_FAILURE); |
@@ -1823,10 +1823,10 @@ do_authenticated(struct passwd * pw) | |||
1823 | /* Indicate that we now have a pty. */ | 1823 | /* Indicate that we now have a pty. */ |
1824 | have_pty = 1; | 1824 | have_pty = 1; |
1825 | 1825 | ||
1826 | #ifdef HAVE_LIBPAM | 1826 | #ifdef USE_PAM |
1827 | /* do the pam_open_session since we have the pty */ | 1827 | /* do the pam_open_session since we have the pty */ |
1828 | do_pam_session(pw->pw_name,ttyname); | 1828 | do_pam_session(pw->pw_name,ttyname); |
1829 | #endif /* HAVE_LIBPAM */ | 1829 | #endif /* USE_PAM */ |
1830 | 1830 | ||
1831 | break; | 1831 | break; |
1832 | 1832 | ||
@@ -2194,7 +2194,7 @@ do_exec_pty(const char *command, int ptyfd, int ttyfd, | |||
2194 | snprintf(line, sizeof line, "%.200s/.hushlogin", pw->pw_dir); | 2194 | snprintf(line, sizeof line, "%.200s/.hushlogin", pw->pw_dir); |
2195 | quiet_login = stat(line, &st) >= 0; | 2195 | quiet_login = stat(line, &st) >= 0; |
2196 | 2196 | ||
2197 | #ifdef HAVE_LIBPAM | 2197 | #ifdef USE_PAM |
2198 | /* output the results of the pamconv() */ | 2198 | /* output the results of the pamconv() */ |
2199 | if (!quiet_login && pamconv_msg != NULL) | 2199 | if (!quiet_login && pamconv_msg != NULL) |
2200 | fprintf(stderr, pamconv_msg); | 2200 | fprintf(stderr, pamconv_msg); |
@@ -2382,7 +2382,7 @@ do_child(const char *command, struct passwd * pw, const char *term, | |||
2382 | struct stat st; | 2382 | struct stat st; |
2383 | char *argv[10]; | 2383 | char *argv[10]; |
2384 | 2384 | ||
2385 | #ifndef HAVE_LIBPAM /* pam_nologin handles this */ | 2385 | #ifndef USE_PAM /* pam_nologin handles this */ |
2386 | /* Check /etc/nologin. */ | 2386 | /* Check /etc/nologin. */ |
2387 | f = fopen("/etc/nologin", "r"); | 2387 | f = fopen("/etc/nologin", "r"); |
2388 | if (f) { | 2388 | if (f) { |
@@ -2393,7 +2393,7 @@ do_child(const char *command, struct passwd * pw, const char *term, | |||
2393 | if (pw->pw_uid != 0) | 2393 | if (pw->pw_uid != 0) |
2394 | exit(254); | 2394 | exit(254); |
2395 | } | 2395 | } |
2396 | #endif /* HAVE_LIBPAM */ | 2396 | #endif /* USE_PAM */ |
2397 | 2397 | ||
2398 | #ifdef HAVE_SETLOGIN | 2398 | #ifdef HAVE_SETLOGIN |
2399 | /* Set login name in the kernel. */ | 2399 | /* Set login name in the kernel. */ |
@@ -2498,7 +2498,7 @@ do_child(const char *command, struct passwd * pw, const char *term, | |||
2498 | } | 2498 | } |
2499 | #endif /* KRB4 */ | 2499 | #endif /* KRB4 */ |
2500 | 2500 | ||
2501 | #ifdef HAVE_LIBPAM | 2501 | #ifdef USE_PAM |
2502 | /* Pull in any environment variables that may have been set by PAM. */ | 2502 | /* Pull in any environment variables that may have been set by PAM. */ |
2503 | { | 2503 | { |
2504 | char *equals, var_name[512], var_val[512]; | 2504 | char *equals, var_name[512], var_val[512]; |
@@ -2517,7 +2517,7 @@ do_child(const char *command, struct passwd * pw, const char *term, | |||
2517 | } | 2517 | } |
2518 | } | 2518 | } |
2519 | } | 2519 | } |
2520 | #endif /* HAVE_LIBPAM */ | 2520 | #endif /* USE_PAM */ |
2521 | 2521 | ||
2522 | if (xauthfile) | 2522 | if (xauthfile) |
2523 | child_set_env(&env, &envsize, "XAUTHORITY", xauthfile); | 2523 | child_set_env(&env, &envsize, "XAUTHORITY", xauthfile); |