]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
krb5: Moved host from Curl_auth_create_gssapi_user_message() to be argument
authorSteve Holme <steve_holme@hotmail.com>
Sat, 2 Apr 2016 05:15:29 +0000 (06:15 +0100)
committerSteve Holme <steve_holme@hotmail.com>
Sat, 2 Apr 2016 05:15:29 +0000 (06:15 +0100)
For consistency with the spnego and oauth2 code moved the setting of
the host name outside of the Curl_auth_create_gssapi_user_messag()
function.

This will allow us to more easily override it in the future.

lib/curl_sasl.c
lib/vauth/krb5_gssapi.c
lib/vauth/krb5_sspi.c
lib/vauth/vauth.h

index 32c8534e7ce25fa1ce223799589ee6a9771af767..a4568d6d37d621dcde8b8118d542284f7de75bd6 100644 (file)
@@ -295,6 +295,8 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn,
         result = Curl_auth_create_gssapi_user_message(data, conn->user,
                                                       conn->passwd,
                                                       sasl->params->service,
+                                                      data->easy_conn->
+                                                            host.name,
                                                       sasl->mutual_auth,
                                                       NULL, &conn->krb5,
                                                       &resp, &len);
@@ -496,6 +498,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn,
     result = Curl_auth_create_gssapi_user_message(data, conn->user,
                                                   conn->passwd,
                                                   sasl->params->service,
+                                                  data->easy_conn->host.name,
                                                   sasl->mutual_auth, NULL,
                                                   &conn->krb5,
                                                   &resp, &len);
@@ -506,7 +509,8 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn,
     if(sasl->mutual_auth) {
       /* Decode the user token challenge and create the optional response
          message */
-      result = Curl_auth_create_gssapi_user_message(data, NULL, NULL, NULL,
+      result = Curl_auth_create_gssapi_user_message(data, NULL, NULL,
+                                                    NULL, NULL,
                                                     sasl->mutual_auth,
                                                     serverdata, &conn->krb5,
                                                     &resp, &len);
index 87accd13e8d42b8012304afd4164ab87a2195595..56cfc362150bf35714f98fba03b50f11e4f22183 100644 (file)
@@ -53,6 +53,7 @@
  * userp       [in]     - The user name.
  * passdwp     [in]     - The user's password.
  * service     [in]     - The service type such as www, smtp, pop or imap.
+ * host        [in[     - The host name.
  * mutual_auth [in]     - Flag specifing whether or not mutual authentication
  *                        is enabled.
  * chlg64      [in]     - Pointer to the optional base64 encoded challenge
@@ -68,6 +69,7 @@ CURLcode Curl_auth_create_gssapi_user_message(struct SessionHandle *data,
                                               const char *userp,
                                               const char *passwdp,
                                               const char *service,
+                                              const char *host,
                                               const bool mutual_auth,
                                               const char *chlg64,
                                               struct kerberos5data *krb5,
@@ -88,8 +90,7 @@ CURLcode Curl_auth_create_gssapi_user_message(struct SessionHandle *data,
 
   if(krb5->context == GSS_C_NO_CONTEXT) {
     /* Generate our SPN */
-    char *spn = Curl_auth_build_gssapi_spn(service,
-                                           data->easy_conn->host.name);
+    char *spn = Curl_auth_build_gssapi_spn(service, host);
     if(!spn)
       return CURLE_OUT_OF_MEMORY;
 
index a1d438f50829f60358c8ca6785ed1ed0013795d0..6afd83dde7e1f7683b0be1fd07ff6ff46855f4cc 100644 (file)
@@ -51,6 +51,7 @@
  * userp       [in]     - The user name in the format User or Domain\User.
  * passdwp     [in]     - The user's password.
  * service     [in]     - The service type such as www, smtp, pop or imap.
+ * host        [in]     - The host name.
  * mutual_auth [in]     - Flag specifing whether or not mutual authentication
  *                        is enabled.
  * chlg64      [in]     - The optional base64 encoded challenge message.
@@ -65,6 +66,7 @@ CURLcode Curl_auth_create_gssapi_user_message(struct SessionHandle *data,
                                               const char *userp,
                                               const char *passwdp,
                                               const char *service,
+                                              const char *host,
                                               const bool mutual_auth,
                                               const char *chlg64,
                                               struct kerberos5data *krb5,
@@ -103,7 +105,7 @@ CURLcode Curl_auth_create_gssapi_user_message(struct SessionHandle *data,
       return CURLE_OUT_OF_MEMORY;
 
     /* Generate our SPN */
-    krb5->spn = Curl_auth_build_spn(service, data->easy_conn->host.name);
+    krb5->spn = Curl_auth_build_spn(service, host);
     if(!krb5->spn)
       return CURLE_OUT_OF_MEMORY;
 
index 161cb14b70845621224aca83609845f6cb045177..0047b3cf77a445c9c78baeed338cebcc06bbb056 100644 (file)
@@ -148,6 +148,7 @@ CURLcode Curl_auth_create_gssapi_user_message(struct SessionHandle *data,
                                               const char *userp,
                                               const char *passwdp,
                                               const char *service,
+                                              const char *host,
                                               const bool mutual,
                                               const char *chlg64,
                                               struct kerberos5data *krb5,