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 ef46938c4..5305911a4 100644
--- a/monitor.c
+++ b/monitor.c
@@ -134,6 +134,7 @@ int mm_answer_sign(int, Buffer *);
134int mm_answer_pwnamallow(int, Buffer *); 134int mm_answer_pwnamallow(int, Buffer *);
135int mm_answer_auth2_read_banner(int, Buffer *); 135int mm_answer_auth2_read_banner(int, Buffer *);
136int mm_answer_authserv(int, Buffer *); 136int mm_answer_authserv(int, Buffer *);
137int mm_answer_authrole(int, Buffer *);
137int mm_answer_authpassword(int, Buffer *); 138int mm_answer_authpassword(int, Buffer *);
138int mm_answer_bsdauthquery(int, Buffer *); 139int mm_answer_bsdauthquery(int, Buffer *);
139int mm_answer_bsdauthrespond(int, Buffer *); 140int mm_answer_bsdauthrespond(int, Buffer *);
@@ -206,6 +207,7 @@ struct mon_table mon_dispatch_proto20[] = {
206 {MONITOR_REQ_SIGN, MON_ONCE, mm_answer_sign}, 207 {MONITOR_REQ_SIGN, MON_ONCE, mm_answer_sign},
207 {MONITOR_REQ_PWNAM, MON_ONCE, mm_answer_pwnamallow}, 208 {MONITOR_REQ_PWNAM, MON_ONCE, mm_answer_pwnamallow},
208 {MONITOR_REQ_AUTHSERV, MON_ONCE, mm_answer_authserv}, 209 {MONITOR_REQ_AUTHSERV, MON_ONCE, mm_answer_authserv},
210 {MONITOR_REQ_AUTHROLE, MON_ONCE, mm_answer_authrole},
209 {MONITOR_REQ_AUTH2_READ_BANNER, MON_ONCE, mm_answer_auth2_read_banner}, 211 {MONITOR_REQ_AUTH2_READ_BANNER, MON_ONCE, mm_answer_auth2_read_banner},
210 {MONITOR_REQ_AUTHPASSWORD, MON_AUTH, mm_answer_authpassword}, 212 {MONITOR_REQ_AUTHPASSWORD, MON_AUTH, mm_answer_authpassword},
211#ifdef USE_PAM 213#ifdef USE_PAM
@@ -673,6 +675,7 @@ mm_answer_pwnamallow(int sock, Buffer *m)
673 else { 675 else {
674 /* Allow service/style information on the auth context */ 676 /* Allow service/style information on the auth context */
675 monitor_permit(mon_dispatch, MONITOR_REQ_AUTHSERV, 1); 677 monitor_permit(mon_dispatch, MONITOR_REQ_AUTHSERV, 1);
678 monitor_permit(mon_dispatch, MONITOR_REQ_AUTHROLE, 1);
676 monitor_permit(mon_dispatch, MONITOR_REQ_AUTH2_READ_BANNER, 1); 679 monitor_permit(mon_dispatch, MONITOR_REQ_AUTH2_READ_BANNER, 1);
677 } 680 }
678 681
@@ -706,14 +709,37 @@ mm_answer_authserv(int sock, Buffer *m)
706 709
707 authctxt->service = buffer_get_string(m, NULL); 710 authctxt->service = buffer_get_string(m, NULL);
708 authctxt->style = buffer_get_string(m, NULL); 711 authctxt->style = buffer_get_string(m, NULL);
709 debug3("%s: service=%s, style=%s", 712 authctxt->role = buffer_get_string(m, NULL);
710 __func__, authctxt->service, authctxt->style); 713 debug3("%s: service=%s, style=%s, role=%s",
714 __func__, authctxt->service, authctxt->style, authctxt->role);
711 715
712 if (strlen(authctxt->style) == 0) { 716 if (strlen(authctxt->style) == 0) {
713 xfree(authctxt->style); 717 xfree(authctxt->style);
714 authctxt->style = NULL; 718 authctxt->style = NULL;
715 } 719 }
716 720
721 if (strlen(authctxt->role) == 0) {
722 xfree(authctxt->role);
723 authctxt->role = NULL;
724 }
725
726 return (0);
727}
728
729int
730mm_answer_authrole(int sock, Buffer *m)
731{
732 monitor_permit_authentications(1);
733
734 authctxt->role = buffer_get_string(m, NULL);
735 debug3("%s: role=%s",
736 __func__, authctxt->role);
737
738 if (strlen(authctxt->role) == 0) {
739 xfree(authctxt->role);
740 authctxt->role = NULL;
741 }
742
717 return (0); 743 return (0);
718} 744}
719 745