summaryrefslogtreecommitdiff
path: root/sshd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/sshd.c b/sshd.c
index b2cb5a320..ce834e8db 100644
--- a/sshd.c
+++ b/sshd.c
@@ -18,7 +18,7 @@ agent connections.
18*/ 18*/
19 19
20#include "includes.h" 20#include "includes.h"
21RCSID("$Id: sshd.c,v 1.3 1999/10/28 03:20:30 damien Exp $"); 21RCSID("$Id: sshd.c,v 1.4 1999/10/28 04:03:14 damien Exp $");
22 22
23#include "xmalloc.h" 23#include "xmalloc.h"
24#include "rsa.h" 24#include "rsa.h"
@@ -129,7 +129,7 @@ void do_exec_no_pty(const char *command, struct passwd *pw,
129void do_child(const char *command, struct passwd *pw, const char *term, 129void do_child(const char *command, struct passwd *pw, const char *term,
130 const char *display, const char *auth_proto, 130 const char *display, const char *auth_proto,
131 const char *auth_data, const char *ttyname); 131 const char *auth_data, const char *ttyname);
132#ifdef HAVE_PAM 132#ifdef HAVE_LIBPAM
133static int pamconv(int num_msg, const struct pam_message **msg, 133static int pamconv(int num_msg, const struct pam_message **msg,
134 struct pam_response **resp, void *appdata_ptr); 134 struct pam_response **resp, void *appdata_ptr);
135void do_pam_account_and_session(const char *username, const char *password, 135void do_pam_account_and_session(const char *username, const char *password,
@@ -225,7 +225,7 @@ void do_pam_account_and_session(const char *username, const char *password, cons
225 eat_packets_and_disconnect(username); 225 eat_packets_and_disconnect(username);
226 } 226 }
227} 227}
228#endif /* HAVE_PAM */ 228#endif /* HAVE_LIBPAM */
229 229
230/* Signal handler for SIGHUP. Sshd execs itself when it receives SIGHUP; 230/* Signal handler for SIGHUP. Sshd execs itself when it receives SIGHUP;
231 the effect is to reread the configuration file (and to regenerate 231 the effect is to reread the configuration file (and to regenerate
@@ -809,7 +809,7 @@ main(int ac, char **av)
809 /* The connection has been terminated. */ 809 /* The connection has been terminated. */
810 log("Closing connection to %.100s", inet_ntoa(sin.sin_addr)); 810 log("Closing connection to %.100s", inet_ntoa(sin.sin_addr));
811 811
812#ifdef HAVE_PAM 812#ifdef HAVE_LIBPAM
813 { 813 {
814 int retval; 814 int retval;
815 815
@@ -823,7 +823,7 @@ main(int ac, char **av)
823 fatal_remove_cleanup(&pam_cleanup_proc, NULL); 823 fatal_remove_cleanup(&pam_cleanup_proc, NULL);
824 } 824 }
825 } 825 }
826#endif /* HAVE_PAM */ 826#endif /* HAVE_LIBPAM */
827 827
828 packet_close(); 828 packet_close();
829 829
@@ -1135,17 +1135,17 @@ do_authentication(char *user, int privileged_port)
1135 pwcopy.pw_shell = xstrdup(pw->pw_shell); 1135 pwcopy.pw_shell = xstrdup(pw->pw_shell);
1136 pw = &pwcopy; 1136 pw = &pwcopy;
1137 1137
1138#ifdef HAVE_PAM 1138#ifdef HAVE_LIBPAM
1139 if (PAM_SUCCESS != pam_start("ssh", pw->pw_name, &conv, (pam_handle_t**)&pamh)) 1139 if (PAM_SUCCESS != pam_start("opensshd", pw->pw_name, &conv, (pam_handle_t**)&pamh))
1140 { 1140 {
1141 packet_start(SSH_SMSG_FAILURE); 1141 packet_start(SSH_SMSG_FAILURE);
1142 packet_send(); 1142 packet_send();
1143 packet_write_wait(); 1143 packet_write_wait();
1144 packet_disconnect("PAM initialisation failed."); 1144 packet_disconnect("PAM initialisation failed.");
1145 } 1145 }
1146#endif
1147 1146
1148 fatal_add_cleanup(&pam_cleanup_proc, NULL); 1147 fatal_add_cleanup(&pam_cleanup_proc, NULL);
1148#endif
1149 1149
1150 /* If we are not running as root, the user must have the same uid as the 1150 /* If we are not running as root, the user must have the same uid as the
1151 server. */ 1151 server. */
@@ -1289,16 +1289,16 @@ do_authentication(char *user, int privileged_port)
1289 log("Rhosts authentication accepted for %.100s, remote %.100s on %.700s.", 1289 log("Rhosts authentication accepted for %.100s, remote %.100s on %.700s.",
1290 user, client_user, get_canonical_hostname()); 1290 user, client_user, get_canonical_hostname());
1291 authenticated = 1; 1291 authenticated = 1;
1292#ifndef HAVE_PAM 1292#ifndef HAVE_LIBPAM
1293 xfree(client_user); 1293 xfree(client_user);
1294#endif /* HAVE_PAM */ 1294#endif /* HAVE_LIBPAM */
1295 break; 1295 break;
1296 } 1296 }
1297 log("Rhosts authentication failed for %.100s, remote %.100s.", 1297 log("Rhosts authentication failed for %.100s, remote %.100s.",
1298 user, client_user); 1298 user, client_user);
1299#ifndef HAVE_PAM 1299#ifndef HAVE_LIBPAM
1300 xfree(client_user); 1300 xfree(client_user);
1301#endif /* HAVE_PAM */ 1301#endif /* HAVE_LIBPAM */
1302 break; 1302 break;
1303 1303
1304 case SSH_CMSG_AUTH_RHOSTS_RSA: 1304 case SSH_CMSG_AUTH_RHOSTS_RSA:
@@ -1341,18 +1341,18 @@ do_authentication(char *user, int privileged_port)
1341 { 1341 {
1342 /* Authentication accepted. */ 1342 /* Authentication accepted. */
1343 authenticated = 1; 1343 authenticated = 1;
1344#ifndef HAVE_PAM 1344#ifndef HAVE_LIBPAM
1345 xfree(client_user); 1345 xfree(client_user);
1346#endif /* HAVE_PAM */ 1346#endif /* HAVE_LIBPAM */
1347 BN_clear_free(client_host_key_e); 1347 BN_clear_free(client_host_key_e);
1348 BN_clear_free(client_host_key_n); 1348 BN_clear_free(client_host_key_n);
1349 break; 1349 break;
1350 } 1350 }
1351 log("Rhosts authentication failed for %.100s, remote %.100s.", 1351 log("Rhosts authentication failed for %.100s, remote %.100s.",
1352 user, client_user); 1352 user, client_user);
1353#ifndef HAVE_PAM 1353#ifndef HAVE_LIBPAM
1354 xfree(client_user); 1354 xfree(client_user);
1355#endif /* HAVE_PAM */ 1355#endif /* HAVE_LIBPAM */
1356 BN_clear_free(client_host_key_e); 1356 BN_clear_free(client_host_key_e);
1357 BN_clear_free(client_host_key_n); 1357 BN_clear_free(client_host_key_n);
1358 break; 1358 break;
@@ -1403,7 +1403,7 @@ do_authentication(char *user, int privileged_port)
1403 packet_integrity_check(plen, 4 + passw_len, type); 1403 packet_integrity_check(plen, 4 + passw_len, type);
1404 } 1404 }
1405 1405
1406#ifdef HAVE_PAM 1406#ifdef HAVE_LIBPAM
1407 pampasswd = password; 1407 pampasswd = password;
1408 1408
1409 if (PAM_SUCCESS == pam_authenticate((pam_handle_t *)pamh, 0)) 1409 if (PAM_SUCCESS == pam_authenticate((pam_handle_t *)pamh, 0))
@@ -1416,7 +1416,7 @@ do_authentication(char *user, int privileged_port)
1416 log("PAM Password authentication for %.100s failed.", user); 1416 log("PAM Password authentication for %.100s failed.", user);
1417 break; 1417 break;
1418 } 1418 }
1419#else /* HAVE_PAM */ 1419#else /* HAVE_LIBPAM */
1420 /* Try authentication with the password. */ 1420 /* Try authentication with the password. */
1421 if (auth_password(pw, password)) 1421 if (auth_password(pw, password))
1422 { 1422 {
@@ -1432,7 +1432,7 @@ do_authentication(char *user, int privileged_port)
1432 memset(password, 0, strlen(password)); 1432 memset(password, 0, strlen(password));
1433 xfree(password); 1433 xfree(password);
1434 break; 1434 break;
1435#endif /* HAVE_PAM */ 1435#endif /* HAVE_LIBPAM */
1436 1436
1437 case SSH_CMSG_AUTH_TIS: 1437 case SSH_CMSG_AUTH_TIS:
1438 /* TIS Authentication is unsupported */ 1438 /* TIS Authentication is unsupported */
@@ -1470,7 +1470,7 @@ do_authentication(char *user, int privileged_port)
1470 get_canonical_hostname()); 1470 get_canonical_hostname());
1471 } 1471 }
1472 1472
1473#ifdef HAVE_PAM 1473#ifdef HAVE_LIBPAM
1474 do_pam_account_and_session(pw->pw_name, password, client_user, get_canonical_hostname()); 1474 do_pam_account_and_session(pw->pw_name, password, client_user, get_canonical_hostname());
1475 1475
1476 /* Clean up */ 1476 /* Clean up */
@@ -1482,7 +1482,7 @@ do_authentication(char *user, int privileged_port)
1482 memset(password, 0, strlen(password)); 1482 memset(password, 0, strlen(password));
1483 xfree(password); 1483 xfree(password);
1484 } 1484 }
1485#endif /* HAVE_PAM */ 1485#endif /* HAVE_LIBPAM */
1486 1486
1487 /* The user has been authenticated and accepted. */ 1487 /* The user has been authenticated and accepted. */
1488 packet_start(SSH_SMSG_SUCCESS); 1488 packet_start(SSH_SMSG_SUCCESS);