summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl/lib/krb5.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-08-03 18:26:53 (GMT)
committerBrad King <brad.king@kitware.com>2016-08-03 18:26:53 (GMT)
commitf53f4a8a2d215dac634effea575a27e000dfcb29 (patch)
tree5782e71da9e12ab6081e47f8eaf8eeb908e1428a /Utilities/cmcurl/lib/krb5.c
parente1c11352f231ae310339cd539ed59cb302bd4dbe (diff)
parent202adcfe056681109fe61569ecdb3bd69f0b4f97 (diff)
downloadCMake-f53f4a8a2d215dac634effea575a27e000dfcb29.zip
CMake-f53f4a8a2d215dac634effea575a27e000dfcb29.tar.gz
CMake-f53f4a8a2d215dac634effea575a27e000dfcb29.tar.bz2
Merge branch 'upstream-curl' into update-curl
* upstream-curl: curl 2016-08-03 (f2cb3a01)
Diffstat (limited to 'Utilities/cmcurl/lib/krb5.c')
-rw-r--r--Utilities/cmcurl/lib/krb5.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/Utilities/cmcurl/lib/krb5.c b/Utilities/cmcurl/lib/krb5.c
index ad7dd67..87ce8ee 100644
--- a/Utilities/cmcurl/lib/krb5.c
+++ b/Utilities/cmcurl/lib/krb5.c
@@ -2,7 +2,7 @@
*
* Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
- * Copyright (c) 2004 - 2015 Daniel Stenberg
+ * Copyright (c) 2004 - 2016 Daniel Stenberg
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -47,15 +47,12 @@
#include "sendf.h"
#include "curl_sec.h"
#include "warnless.h"
-#include "curl_printf.h"
-/* The last #include files should be: */
+/* The last 3 #include files should be in this order */
+#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
-#define LOCAL_ADDR (&conn->local_addr)
-#define REMOTE_ADDR conn->ip_addr->ai_addr
-
static int
krb5_init(void *app_data)
{
@@ -153,28 +150,31 @@ krb5_auth(void *app_data, struct connectdata *conn)
const char *host = conn->host.name;
ssize_t nread;
curl_socklen_t l = sizeof(conn->local_addr);
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
CURLcode result;
- const char *service = "ftp", *srv_host = "host";
+ const char *service = data->set.str[STRING_SERVICE_NAME] ?
+ data->set.str[STRING_SERVICE_NAME] :
+ "ftp";
+ const char *srv_host = "host";
gss_buffer_desc input_buffer, output_buffer, _gssresp, *gssresp;
OM_uint32 maj, min;
gss_name_t gssname;
gss_ctx_id_t *context = app_data;
struct gss_channel_bindings_struct chan;
size_t base64_sz = 0;
+ struct sockaddr_in **remote_addr =
+ (struct sockaddr_in **)&conn->ip_addr->ai_addr;
if(getsockname(conn->sock[FIRSTSOCKET],
- (struct sockaddr *)LOCAL_ADDR, &l) < 0)
+ (struct sockaddr *)&conn->local_addr, &l) < 0)
perror("getsockname()");
chan.initiator_addrtype = GSS_C_AF_INET;
chan.initiator_address.length = l - 4;
- chan.initiator_address.value =
- &((struct sockaddr_in *)LOCAL_ADDR)->sin_addr.s_addr;
+ chan.initiator_address.value = &conn->local_addr.sin_addr.s_addr;
chan.acceptor_addrtype = GSS_C_AF_INET;
chan.acceptor_address.length = l - 4;
- chan.acceptor_address.value =
- &((struct sockaddr_in *)REMOTE_ADDR)->sin_addr.s_addr;
+ chan.acceptor_address.value = &(*remote_addr)->sin_addr.s_addr;
chan.application_data.length = 0;
chan.application_data.value = NULL;
@@ -183,9 +183,9 @@ krb5_auth(void *app_data, struct connectdata *conn)
/* this really shouldn't be repeated here, but can't help it */
if(service == srv_host) {
result = Curl_ftpsendf(conn, "AUTH GSSAPI");
-
if(result)
return -2;
+
if(Curl_GetFTPResponse(&nread, conn, NULL))
return -1;