qpid-proton git commit: PROTON-1535: allow plugins to set the hostname sent out in sasl-int frames

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

qpid-proton git commit: PROTON-1535: allow plugins to set the hostname sent out in sasl-int frames

gsim
Repository: qpid-proton
Updated Branches:
  refs/heads/master 79309b030 -> 46f3007c4


PROTON-1535: allow plugins to set the hostname sent out in sasl-int frames


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/46f3007c
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/46f3007c
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/46f3007c

Branch: refs/heads/master
Commit: 46f3007c4cad01891a2993e368f92222b12e02aa
Parents: 79309b0
Author: Gordon Sim <[hidden email]>
Authored: Fri Aug 11 20:33:31 2017 +0100
Committer: Gordon Sim <[hidden email]>
Committed: Fri Aug 11 20:33:38 2017 +0100

----------------------------------------------------------------------
 proton-c/include/proton/sasl-plugin.h |  1 +
 proton-c/src/sasl/sasl-internal.h     |  1 +
 proton-c/src/sasl/sasl.c              | 12 ++++++++++--
 3 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/46f3007c/proton-c/include/proton/sasl-plugin.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/sasl-plugin.h b/proton-c/include/proton/sasl-plugin.h
index cbc6684..a6bdc85 100644
--- a/proton-c/include/proton/sasl-plugin.h
+++ b/proton-c/include/proton/sasl-plugin.h
@@ -125,6 +125,7 @@ PN_EXTERN const char *pnx_sasl_get_selected_mechanism(pn_transport_t *transport)
 PN_EXTERN void  pnx_sasl_set_bytes_out(pn_transport_t *transport, pn_bytes_t bytes);
 PN_EXTERN void  pnx_sasl_set_desired_state(pn_transport_t *transport, enum pnx_sasl_state desired_state);
 PN_EXTERN void  pnx_sasl_set_selected_mechanism(pn_transport_t *transport, const char *mechanism);
+PN_EXTERN void  pnx_sasl_set_local_hostname(pn_transport_t * transport, const char * fqdn);
 PN_EXTERN void  pnx_sasl_succeed_authentication(pn_transport_t *transport, const char *username);
 PN_EXTERN void  pnx_sasl_fail_authentication(pn_transport_t *transport);
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/46f3007c/proton-c/src/sasl/sasl-internal.h
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/sasl-internal.h b/proton-c/src/sasl/sasl-internal.h
index fc141b4..aade2e0 100644
--- a/proton-c/src/sasl/sasl-internal.h
+++ b/proton-c/src/sasl/sasl-internal.h
@@ -46,6 +46,7 @@ struct pni_sasl_t {
   const char *username;
   char *password;
   const char *remote_fqdn;
+  char *local_fqdn;
   char *external_auth;
   int external_ssf;
   size_t max_encrypt_size;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/46f3007c/proton-c/src/sasl/sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/sasl.c b/proton-c/src/sasl/sasl.c
index a39e602..1469c51 100644
--- a/proton-c/src/sasl/sasl.c
+++ b/proton-c/src/sasl/sasl.c
@@ -439,8 +439,8 @@ static void pni_post_sasl_frame(pn_transport_t *transport)
   while (sasl->desired_state > sasl->last_state) {
     switch (desired_state) {
     case SASL_POSTED_INIT:
-      pn_post_frame(transport, SASL_FRAME_TYPE, 0, "DL[sz]", SASL_INIT, sasl->selected_mechanism,
-                    out.size, out.start);
+      pn_post_frame(transport, SASL_FRAME_TYPE, 0, "DL[szS]", SASL_INIT, sasl->selected_mechanism,
+                    out.size, out.start, sasl->local_fqdn);
       pni_emit(transport);
       break;
     case SASL_POSTED_MECHANISMS: {
@@ -699,6 +699,7 @@ pn_sasl_t *pn_sasl(pn_transport_t *transport)
     sasl->username = NULL;
     sasl->password = NULL;
     sasl->remote_fqdn = NULL;
+    sasl->local_fqdn = NULL;
     sasl->external_auth = NULL;
     sasl->external_ssf = 0;
     sasl->outcome = PN_SASL_NONE;
@@ -726,6 +727,7 @@ void pn_sasl_free(pn_transport_t *transport)
       free(sasl->included_mechanisms);
       free(sasl->password);
       free(sasl->external_auth);
+      free(sasl->local_fqdn);
 
       if (sasl->impl_context) {
         pni_sasl_impl_free(transport);
@@ -743,6 +745,12 @@ void pni_sasl_set_remote_hostname(pn_transport_t * transport, const char * fqdn)
   sasl->remote_fqdn = fqdn;
 }
 
+void pnx_sasl_set_local_hostname(pn_transport_t * transport, const char * fqdn)
+{
+  pni_sasl_t *sasl = transport->sasl;
+  sasl->local_fqdn = pn_strdup(fqdn);
+}
+
 void pni_sasl_set_user_password(pn_transport_t *transport, const char *user, const char *password)
 {
   pni_sasl_t *sasl = transport->sasl;


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...