________________________________

This e-mail contains privileged and confidential information intended for the 
use of the addressees named above. If you are not the intended recipient of 
this e-mail, you are hereby notified that you must not disseminate, copy or 
take any action in respect of any information contained in it. If you have 
received this e-mail in error, please notify the sender immediately by e-mail 
and immediately destroy this e-mail and its attachments.
From 510dfd76b8c4ee76c73cb3027d0885c964e13398 Mon Sep 17 00:00:00 2001
From: Bill Nagel <wna...@tycoint.com>
Date: Mon, 6 Oct 2014 17:07:19 -0400
Subject: [PATCH 3/4] libcurl: support for the smb protocol

This patch adds SMB/CIFS support to libcurl.
---
 include/curl/curl.h |    2 ++
 lib/Makefile.inc    |    4 ++--
 lib/url.c           |    7 +++++++
 lib/urldata.h       |    5 +++++
 lib/version.c       |    6 ++++++
 5 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/include/curl/curl.h b/include/curl/curl.h
index d40b2db..8836959 100644
--- a/include/curl/curl.h
+++ b/include/curl/curl.h
@@ -803,6 +803,8 @@ typedef enum {
 #define CURLPROTO_RTMPS  (1<<23)
 #define CURLPROTO_RTMPTS (1<<24)
 #define CURLPROTO_GOPHER (1<<25)
+#define CURLPROTO_SMB    (1<<26)
+#define CURLPROTO_SMBS   (1<<27)
 #define CURLPROTO_ALL    (~0) /* enable everything */
 
 /* long may be 32 or 64 bits, but we should never depend on anything else
diff --git a/lib/Makefile.inc b/lib/Makefile.inc
index 462d72a..594e8bc 100644
--- a/lib/Makefile.inc
+++ b/lib/Makefile.inc
@@ -45,7 +45,7 @@ LIB_CFILES = file.c timeval.c base64.c hostip.c progress.c formdata.c	\
   asyn-thread.c curl_gssapi.c curl_ntlm.c curl_ntlm_wb.c		\
   curl_ntlm_core.c curl_ntlm_msgs.c curl_sasl.c curl_multibyte.c	\
   hostcheck.c bundles.c conncache.c pipeline.c dotdot.c x509asn1.c	\
-  http2.c curl_sasl_sspi.c
+  http2.c curl_sasl_sspi.c smb.c
 
 LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h	\
   formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h if2ip.h		\
@@ -63,7 +63,7 @@ LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h	\
   curl_ntlm.h curl_gssapi.h curl_ntlm_wb.h curl_ntlm_core.h		\
   curl_ntlm_msgs.h curl_sasl.h curl_multibyte.h hostcheck.h bundles.h	\
   conncache.h curl_setup_once.h multihandle.h setup-vms.h pipeline.h	\
-  dotdot.h x509asn1.h http2.h sigpipe.h
+  dotdot.h x509asn1.h http2.h sigpipe.h smb.h
 
 LIB_RCFILES = libcurl.rc
 
diff --git a/lib/url.c b/lib/url.c
index da67edf..de0b670 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -215,6 +215,13 @@ static const struct Curl_handler * const protocols[] = {
 #endif
 #endif
 
+#ifndef CURL_DISABLE_SMB
+  &Curl_handler_smb,
+#ifdef USE_SSL
+  &Curl_handler_smbs,
+#endif
+#endif
+
 #ifndef CURL_DISABLE_SMTP
   &Curl_handler_smtp,
 #ifdef USE_SSL
diff --git a/lib/urldata.h b/lib/urldata.h
index 8594c2f..9e0ace4 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -40,6 +40,8 @@
 #define PORT_IMAPS 993
 #define PORT_POP3 110
 #define PORT_POP3S 995
+#define PORT_SMB 445
+#define PORT_SMBS 445
 #define PORT_SMTP 25
 #define PORT_SMTPS 465 /* sometimes called SSMTP */
 #define PORT_RTSP 554
@@ -65,6 +67,7 @@
 #define PROTO_FAMILY_FTP  (CURLPROTO_FTP|CURLPROTO_FTPS)
 #define PROTO_FAMILY_POP3 (CURLPROTO_POP3|CURLPROTO_POP3S)
 #define PROTO_FAMILY_SMTP (CURLPROTO_SMTP|CURLPROTO_SMTPS)
+#define PROTO_FAMILY_SMB  (CURLPROTO_SMB|CURLPROTO_SMBS)
 
 #define DEFAULT_CONNCACHE_SIZE 5
 
@@ -189,6 +192,7 @@
 
 #include "imap.h"
 #include "pop3.h"
+#include "smb.h"
 #include "smtp.h"
 #include "ftp.h"
 #include "file.h"
@@ -1049,6 +1053,7 @@ struct connectdata {
     struct tftp_state_data *tftpc;
     struct imap_conn imapc;
     struct pop3_conn pop3c;
+    struct smb_conn smbc;
     struct smtp_conn smtpc;
     struct rtsp_conn rtspc;
     void *generic; /* RTMP and LDAP use this */
diff --git a/lib/version.c b/lib/version.c
index 788f3e9..0dae1ad 100644
--- a/lib/version.c
+++ b/lib/version.c
@@ -216,6 +216,12 @@ static const char * const protocols[] = {
 #ifdef USE_LIBSSH2
   "sftp",
 #endif
+#ifndef CURL_DISABLE_SMB
+  "smb",
+#endif
+#if defined(USE_SSL) && !defined(CURL_DISABLE_SMB)
+  "smbs",
+#endif
 #ifndef CURL_DISABLE_SMTP
   "smtp",
 #endif
-- 
1.7.9.5

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to