Switch to auth-pam.c from OpenSSH to unbreak Kerberos 5 build.
[dragonfly.git] / secure / usr.sbin / sshd / auth-pam.c.patch
1 $DragonFly: src/secure/usr.sbin/sshd/Attic/auth-pam.c.patch,v 1.1 2005/07/14 18:29:48 joerg Exp $
2
3 Index: auth-pam.c
4 ===================================================================
5 RCS file: /home/joerg/wd/repository/dragonflybsd/src/crypto/openssh-4/auth-pam.c,v
6 retrieving revision 1.1
7 diff -u -r1.1 auth-pam.c
8 --- auth-pam.c  14 Jul 2005 13:10:21 -0000      1.1
9 +++ auth-pam.c  14 Jul 2005 17:55:10 -0000
10 @@ -150,6 +150,7 @@
11      void *(*thread_start)(void *), void *arg)
12  {
13         pid_t pid;
14 +       struct pam_ctxt *ctx = arg;
15  
16         sshpam_thread_status = -1;
17         switch ((pid = fork())) {
18 @@ -157,10 +158,14 @@
19                 error("fork(): %s", strerror(errno));
20                 return (-1);
21         case 0:
22 +               close(ctx->pam_psock);
23 +               ctx->pam_psock = -1;
24                 thread_start(arg);
25                 _exit(1);
26         default:
27                 *thread = pid;
28 +               close(ctx->pam_csock);
29 +               ctx->pam_csock = -1;
30                 sshpam_oldsig = signal(SIGCHLD, sshpam_sigchld_handler);
31                 return (0);
32         }
33 @@ -300,7 +305,7 @@
34   * Conversation function for authentication thread.
35   */
36  static int
37 -sshpam_thread_conv(int n, struct pam_message **msg,
38 +sshpam_thread_conv(int n, const struct pam_message **msg,
39      struct pam_response **resp, void *data)
40  {
41         Buffer buffer;
42 @@ -400,7 +405,7 @@
43         u_int i;
44         const char *pam_user;
45  
46 -       pam_get_item(sshpam_handle, PAM_USER, (void **)&pam_user);
47 +       pam_get_item(sshpam_handle, PAM_USER, (const void **)&pam_user);
48         environ[0] = NULL;
49  
50         if (sshpam_authctxt != NULL) {
51 @@ -492,7 +497,7 @@
52  }
53  
54  static int
55 -sshpam_null_conv(int n, struct pam_message **msg,
56 +sshpam_null_conv(int n, const struct pam_message **msg,
57      struct pam_response **resp, void *data)
58  {
59         debug3("PAM: %s entering, %d messages", __func__, n);
60 @@ -502,7 +507,7 @@
61  static struct pam_conv null_conv = { sshpam_null_conv, NULL };
62  
63  static int
64 -sshpam_store_conv(int n, struct pam_message **msg,
65 +sshpam_store_conv(int n, const struct pam_message **msg,
66      struct pam_response **resp, void *data)
67  {
68         struct pam_response *reply;
69 @@ -575,7 +580,7 @@
70         if (sshpam_handle != NULL) {
71                 /* We already have a PAM context; check if the user matches */
72                 sshpam_err = pam_get_item(sshpam_handle,
73 -                   PAM_USER, (void **)&pam_user);
74 +                   PAM_USER, (const void **)&pam_user);
75                 if (sshpam_err == PAM_SUCCESS && strcmp(user, pam_user) == 0)
76                         return (0);
77                 pam_end(sshpam_handle, sshpam_err);
78 @@ -891,7 +896,7 @@
79  }
80  
81  static int
82 -sshpam_tty_conv(int n, struct pam_message **msg,
83 +sshpam_tty_conv(int n, const struct pam_message **msg,
84      struct pam_response **resp, void *data)
85  {
86         char input[PAM_MAX_MSG_SIZE];
87 @@ -1050,7 +1055,7 @@
88   * display.
89   */
90  static int
91 -sshpam_passwd_conv(int n, struct pam_message **msg,
92 +sshpam_passwd_conv(int n, const struct pam_message **msg,
93      struct pam_response **resp, void *data)
94  {
95         struct pam_response *reply;