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 517acf3dc..f30f7d591 100644
--- a/monitor.c
+++ b/monitor.c
@@ -137,6 +137,7 @@ int mm_answer_sign(int, Buffer *);
137int mm_answer_pwnamallow(int, Buffer *); 137int mm_answer_pwnamallow(int, Buffer *);
138int mm_answer_auth2_read_banner(int, Buffer *); 138int mm_answer_auth2_read_banner(int, Buffer *);
139int mm_answer_authserv(int, Buffer *); 139int mm_answer_authserv(int, Buffer *);
140int mm_answer_authrole(int, Buffer *);
140int mm_answer_authpassword(int, Buffer *); 141int mm_answer_authpassword(int, Buffer *);
141int mm_answer_bsdauthquery(int, Buffer *); 142int mm_answer_bsdauthquery(int, Buffer *);
142int mm_answer_bsdauthrespond(int, Buffer *); 143int mm_answer_bsdauthrespond(int, Buffer *);
@@ -215,6 +216,7 @@ struct mon_table mon_dispatch_proto20[] = {
215 {MONITOR_REQ_SIGN, MON_ONCE, mm_answer_sign}, 216 {MONITOR_REQ_SIGN, MON_ONCE, mm_answer_sign},
216 {MONITOR_REQ_PWNAM, MON_ONCE, mm_answer_pwnamallow}, 217 {MONITOR_REQ_PWNAM, MON_ONCE, mm_answer_pwnamallow},
217 {MONITOR_REQ_AUTHSERV, MON_ONCE, mm_answer_authserv}, 218 {MONITOR_REQ_AUTHSERV, MON_ONCE, mm_answer_authserv},
219 {MONITOR_REQ_AUTHROLE, MON_ONCE, mm_answer_authrole},
218 {MONITOR_REQ_AUTH2_READ_BANNER, MON_ONCE, mm_answer_auth2_read_banner}, 220 {MONITOR_REQ_AUTH2_READ_BANNER, MON_ONCE, mm_answer_auth2_read_banner},
219 {MONITOR_REQ_AUTHPASSWORD, MON_AUTH, mm_answer_authpassword}, 221 {MONITOR_REQ_AUTHPASSWORD, MON_AUTH, mm_answer_authpassword},
220#ifdef USE_PAM 222#ifdef USE_PAM
@@ -699,6 +701,7 @@ mm_answer_pwnamallow(int sock, Buffer *m)
699 else { 701 else {
700 /* Allow service/style information on the auth context */ 702 /* Allow service/style information on the auth context */
701 monitor_permit(mon_dispatch, MONITOR_REQ_AUTHSERV, 1); 703 monitor_permit(mon_dispatch, MONITOR_REQ_AUTHSERV, 1);
704 monitor_permit(mon_dispatch, MONITOR_REQ_AUTHROLE, 1);
702 monitor_permit(mon_dispatch, MONITOR_REQ_AUTH2_READ_BANNER, 1); 705 monitor_permit(mon_dispatch, MONITOR_REQ_AUTH2_READ_BANNER, 1);
703 } 706 }
704 707
@@ -732,14 +735,37 @@ mm_answer_authserv(int sock, Buffer *m)
732 735
733 authctxt->service = buffer_get_string(m, NULL); 736 authctxt->service = buffer_get_string(m, NULL);
734 authctxt->style = buffer_get_string(m, NULL); 737 authctxt->style = buffer_get_string(m, NULL);
735 debug3("%s: service=%s, style=%s", 738 authctxt->role = buffer_get_string(m, NULL);
736 __func__, authctxt->service, authctxt->style); 739 debug3("%s: service=%s, style=%s, role=%s",
740 __func__, authctxt->service, authctxt->style, authctxt->role);
737 741
738 if (strlen(authctxt->style) == 0) { 742 if (strlen(authctxt->style) == 0) {
739 xfree(authctxt->style); 743 xfree(authctxt->style);
740 authctxt->style = NULL; 744 authctxt->style = NULL;
741 } 745 }
742 746
747 if (strlen(authctxt->role) == 0) {
748 xfree(authctxt->role);
749 authctxt->role = NULL;
750 }
751
752 return (0);
753}
754
755int
756mm_answer_authrole(int sock, Buffer *m)
757{
758 monitor_permit_authentications(1);
759
760 authctxt->role = buffer_get_string(m, NULL);
761 debug3("%s: role=%s",
762 __func__, authctxt->role);
763
764 if (strlen(authctxt->role) == 0) {
765 xfree(authctxt->role);
766 authctxt->role = NULL;
767 }
768
743 return (0); 769 return (0);
744} 770}
745 771