summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/monitor.c b/monitor.c
index 6a82936d4..74f7e05b0 100644
--- a/monitor.c
+++ b/monitor.c
@@ -135,6 +135,7 @@ int mm_answer_sign(int, Buffer *);
135int mm_answer_pwnamallow(int, Buffer *); 135int mm_answer_pwnamallow(int, Buffer *);
136int mm_answer_auth2_read_banner(int, Buffer *); 136int mm_answer_auth2_read_banner(int, Buffer *);
137int mm_answer_authserv(int, Buffer *); 137int mm_answer_authserv(int, Buffer *);
138int mm_answer_authrole(int, Buffer *);
138int mm_answer_authpassword(int, Buffer *); 139int mm_answer_authpassword(int, Buffer *);
139int mm_answer_bsdauthquery(int, Buffer *); 140int mm_answer_bsdauthquery(int, Buffer *);
140int mm_answer_bsdauthrespond(int, Buffer *); 141int mm_answer_bsdauthrespond(int, Buffer *);
@@ -213,6 +214,7 @@ struct mon_table mon_dispatch_proto20[] = {
213 {MONITOR_REQ_SIGN, MON_ONCE, mm_answer_sign}, 214 {MONITOR_REQ_SIGN, MON_ONCE, mm_answer_sign},
214 {MONITOR_REQ_PWNAM, MON_ONCE, mm_answer_pwnamallow}, 215 {MONITOR_REQ_PWNAM, MON_ONCE, mm_answer_pwnamallow},
215 {MONITOR_REQ_AUTHSERV, MON_ONCE, mm_answer_authserv}, 216 {MONITOR_REQ_AUTHSERV, MON_ONCE, mm_answer_authserv},
217 {MONITOR_REQ_AUTHROLE, MON_ONCE, mm_answer_authrole},
216 {MONITOR_REQ_AUTH2_READ_BANNER, MON_ONCE, mm_answer_auth2_read_banner}, 218 {MONITOR_REQ_AUTH2_READ_BANNER, MON_ONCE, mm_answer_auth2_read_banner},
217 {MONITOR_REQ_AUTHPASSWORD, MON_AUTH, mm_answer_authpassword}, 219 {MONITOR_REQ_AUTHPASSWORD, MON_AUTH, mm_answer_authpassword},
218#ifdef USE_PAM 220#ifdef USE_PAM
@@ -697,6 +699,7 @@ mm_answer_pwnamallow(int sock, Buffer *m)
697 else { 699 else {
698 /* Allow service/style information on the auth context */ 700 /* Allow service/style information on the auth context */
699 monitor_permit(mon_dispatch, MONITOR_REQ_AUTHSERV, 1); 701 monitor_permit(mon_dispatch, MONITOR_REQ_AUTHSERV, 1);
702 monitor_permit(mon_dispatch, MONITOR_REQ_AUTHROLE, 1);
700 monitor_permit(mon_dispatch, MONITOR_REQ_AUTH2_READ_BANNER, 1); 703 monitor_permit(mon_dispatch, MONITOR_REQ_AUTH2_READ_BANNER, 1);
701 } 704 }
702 705
@@ -730,14 +733,37 @@ mm_answer_authserv(int sock, Buffer *m)
730 733
731 authctxt->service = buffer_get_string(m, NULL); 734 authctxt->service = buffer_get_string(m, NULL);
732 authctxt->style = buffer_get_string(m, NULL); 735 authctxt->style = buffer_get_string(m, NULL);
733 debug3("%s: service=%s, style=%s", 736 authctxt->role = buffer_get_string(m, NULL);
734 __func__, authctxt->service, authctxt->style); 737 debug3("%s: service=%s, style=%s, role=%s",
738 __func__, authctxt->service, authctxt->style, authctxt->role);
735 739
736 if (strlen(authctxt->style) == 0) { 740 if (strlen(authctxt->style) == 0) {
737 xfree(authctxt->style); 741 xfree(authctxt->style);
738 authctxt->style = NULL; 742 authctxt->style = NULL;
739 } 743 }
740 744
745 if (strlen(authctxt->role) == 0) {
746 xfree(authctxt->role);
747 authctxt->role = NULL;
748 }
749
750 return (0);
751}
752
753int
754mm_answer_authrole(int sock, Buffer *m)
755{
756 monitor_permit_authentications(1);
757
758 authctxt->role = buffer_get_string(m, NULL);
759 debug3("%s: role=%s",
760 __func__, authctxt->role);
761
762 if (strlen(authctxt->role) == 0) {
763 xfree(authctxt->role);
764 authctxt->role = NULL;
765 }
766
741 return (0); 767 return (0);
742} 768}
743 769