|
Lines 101-106
Link Here
|
| 101 |
int mm_answer_auth2_read_banner(int, Buffer *); |
101 |
int mm_answer_auth2_read_banner(int, Buffer *); |
| 102 |
int mm_answer_authserv(int, Buffer *); |
102 |
int mm_answer_authserv(int, Buffer *); |
| 103 |
int mm_answer_authpassword(int, Buffer *); |
103 |
int mm_answer_authpassword(int, Buffer *); |
|
|
104 |
#ifdef KRB4 |
| 105 |
int mm_answer_authkrb4(int, Buffer *); |
| 106 |
#endif |
| 107 |
#ifdef KRB5 |
| 108 |
int mm_answer_authkrb5(int, Buffer *); |
| 109 |
#endif |
| 104 |
int mm_answer_bsdauthquery(int, Buffer *); |
110 |
int mm_answer_bsdauthquery(int, Buffer *); |
| 105 |
int mm_answer_bsdauthrespond(int, Buffer *); |
111 |
int mm_answer_bsdauthrespond(int, Buffer *); |
| 106 |
int mm_answer_skeyquery(int, Buffer *); |
112 |
int mm_answer_skeyquery(int, Buffer *); |
|
Lines 188-193
Link Here
|
| 188 |
{MONITOR_REQ_KEYALLOWED, MON_ISAUTH, mm_answer_keyallowed}, |
199 |
{MONITOR_REQ_KEYALLOWED, MON_ISAUTH, mm_answer_keyallowed}, |
| 189 |
{MONITOR_REQ_RSACHALLENGE, MON_ONCE, mm_answer_rsa_challenge}, |
200 |
{MONITOR_REQ_RSACHALLENGE, MON_ONCE, mm_answer_rsa_challenge}, |
| 190 |
{MONITOR_REQ_RSARESPONSE, MON_ONCE|MON_AUTHDECIDE, mm_answer_rsa_response}, |
201 |
{MONITOR_REQ_RSARESPONSE, MON_ONCE|MON_AUTHDECIDE, mm_answer_rsa_response}, |
|
|
202 |
#ifdef KRB4 |
| 203 |
{MONITOR_REQ_AUTHKRB4, MON_AUTH, mm_answer_authkrb4}, |
| 204 |
#endif |
| 205 |
#ifdef KRB5 |
| 206 |
{MONITOR_REQ_AUTHKRB5, MON_AUTH, mm_answer_authkrb5}, |
| 207 |
#endif |
| 191 |
#ifdef BSD_AUTH |
208 |
#ifdef BSD_AUTH |
| 192 |
{MONITOR_REQ_BSDAUTHQUERY, MON_ISAUTH, mm_answer_bsdauthquery}, |
209 |
{MONITOR_REQ_BSDAUTHQUERY, MON_ISAUTH, mm_answer_bsdauthquery}, |
| 193 |
{MONITOR_REQ_BSDAUTHRESPOND, MON_AUTH,mm_answer_bsdauthrespond}, |
210 |
{MONITOR_REQ_BSDAUTHRESPOND, MON_AUTH,mm_answer_bsdauthrespond}, |
|
Lines 719-724
Link Here
|
| 719 |
} |
746 |
} |
| 720 |
#endif |
747 |
#endif |
| 721 |
|
748 |
|
|
|
749 |
#ifdef KRB4 |
| 750 |
int |
| 751 |
mm_answer_authkrb4(int socket, Buffer *m) |
| 752 |
{ |
| 753 |
KTEXT_ST auth; |
| 754 |
KTEXT_ST reply; |
| 755 |
char *localuser, *auth_tmp; |
| 756 |
int authenticated, authlen; |
| 757 |
|
| 758 |
reply.length = auth.length = 0; |
| 759 |
|
| 760 |
auth_tmp = buffer_get_string(m, &authlen); |
| 761 |
if (authlen >= MAX_KTXT_LEN) |
| 762 |
fatal("%s: received too large KRB4 auth from privsep", __func__); |
| 763 |
memcpy(auth.dat, auth_tmp, authlen); |
| 764 |
auth.length = authlen; |
| 765 |
memset(auth_tmp,0, authlen); |
| 766 |
xfree(auth_tmp); |
| 767 |
/* Only authenticate if the context is valid */ |
| 768 |
authenticated = options.kerberos_authentication && |
| 769 |
authctxt->valid && |
| 770 |
auth_krb4(authctxt, &auth, &localuser, &reply); |
| 771 |
|
| 772 |
memset(auth.dat, 0, authlen); |
| 773 |
|
| 774 |
buffer_clear(m); |
| 775 |
buffer_put_int(m, authenticated); |
| 776 |
if(authenticated) { |
| 777 |
buffer_put_cstring(m, localuser); |
| 778 |
buffer_put_string(m, reply.dat, reply.length); |
| 779 |
} |
| 780 |
|
| 781 |
if (reply.length) |
| 782 |
memset(reply.dat, 0, reply.length); |
| 783 |
|
| 784 |
debug3("%s: sending result %d", __func__, authenticated); |
| 785 |
mm_request_send(socket, MONITOR_ANS_AUTHKRB4, m); |
| 786 |
|
| 787 |
auth_method = "KRB4.klogin"; |
| 788 |
|
| 789 |
/* Causes monitor loop to terminate if authenticated */ |
| 790 |
return (authenticated); |
| 791 |
} |
| 792 |
#endif /* KRB4 */ |
| 793 |
|
| 794 |
#ifdef KRB5 |
| 795 |
int |
| 796 |
mm_answer_authkrb5(int socket, Buffer *m) |
| 797 |
{ |
| 798 |
krb5_data auth; |
| 799 |
krb5_data reply; |
| 800 |
char *localuser; |
| 801 |
int authenticated; |
| 802 |
|
| 803 |
reply.length = 0; |
| 804 |
reply.data = NULL; |
| 805 |
|
| 806 |
auth.data = buffer_get_string(m, &auth.length); |
| 807 |
|
| 808 |
/* Only authenticate if the context is valid */ |
| 809 |
authenticated = options.kerberos_authentication && |
| 810 |
authctxt->valid && |
| 811 |
auth_krb5(authctxt, &auth, &localuser, &reply); |
| 812 |
|
| 813 |
memset(auth.data, 0, auth.length); |
| 814 |
xfree(auth.data); |
| 815 |
|
| 816 |
buffer_clear(m); |
| 817 |
buffer_put_int(m, authenticated); |
| 818 |
if(authenticated) { |
| 819 |
buffer_put_cstring(m, localuser); |
| 820 |
buffer_put_string(m, reply.data, reply.length); |
| 821 |
} |
| 822 |
|
| 823 |
memset(reply.data, 0, reply.length); |
| 824 |
xfree(reply.data); |
| 825 |
|
| 826 |
debug3("%s: sending result %d", __func__, authenticated); |
| 827 |
mm_request_send(socket, MONITOR_ANS_AUTHKRB5, m); |
| 828 |
|
| 829 |
auth_method = "KRB5.klogin"; |
| 830 |
|
| 831 |
/* Causes monitor loop to terminate if authenticated */ |
| 832 |
return (authenticated); |
| 833 |
} |
| 834 |
#endif /* KRB5 */ |
| 835 |
|
| 722 |
#ifdef USE_PAM |
836 |
#ifdef USE_PAM |
| 723 |
int |
837 |
int |
| 724 |
mm_answer_pam_start(int socket, Buffer *m) |
838 |
mm_answer_pam_start(int socket, Buffer *m) |