aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/examples/imap-append.c3
-rw-r--r--docs/examples/imap-copy.c3
-rw-r--r--docs/examples/imap-create.c3
-rw-r--r--docs/examples/imap-delete.c3
-rw-r--r--docs/examples/imap-examine.c3
-rw-r--r--docs/examples/imap-fetch.c5
-rw-r--r--docs/examples/imap-list.c5
-rw-r--r--docs/examples/imap-search.c3
-rw-r--r--docs/examples/imap-store.c3
-rw-r--r--docs/examples/pop3s.c9
-rw-r--r--docs/examples/pop3slist.c9
-rw-r--r--docs/examples/smtp-multi.c6
-rw-r--r--docs/examples/smtp-tls.c15
13 files changed, 41 insertions, 29 deletions
diff --git a/docs/examples/imap-append.c b/docs/examples/imap-append.c
index ce8d0421b..8f0ebcb3b 100644
--- a/docs/examples/imap-append.c
+++ b/docs/examples/imap-append.c
@@ -84,7 +84,8 @@ int main(void)
curl = curl_easy_init();
if(curl) {
/* Set username and password */
- curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
/* This will create a new message 100. Note that you should perform an
* EXAMINE command to obtain the UID of the next message to create and a
diff --git a/docs/examples/imap-copy.c b/docs/examples/imap-copy.c
index 6c2db6f91..fe2d91c1b 100644
--- a/docs/examples/imap-copy.c
+++ b/docs/examples/imap-copy.c
@@ -36,7 +36,8 @@ int main(void)
curl = curl_easy_init();
if(curl) {
/* Set username and password */
- curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
/* This is source mailbox folder to select */
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX");
diff --git a/docs/examples/imap-create.c b/docs/examples/imap-create.c
index 3b55d7e79..65ddede6c 100644
--- a/docs/examples/imap-create.c
+++ b/docs/examples/imap-create.c
@@ -36,7 +36,8 @@ int main(void)
curl = curl_easy_init();
if(curl) {
/* Set username and password */
- curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
/* This is just the server URL */
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com");
diff --git a/docs/examples/imap-delete.c b/docs/examples/imap-delete.c
index 2358012ef..5113be9ab 100644
--- a/docs/examples/imap-delete.c
+++ b/docs/examples/imap-delete.c
@@ -36,7 +36,8 @@ int main(void)
curl = curl_easy_init();
if(curl) {
/* Set username and password */
- curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
/* This is just the server URL */
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com");
diff --git a/docs/examples/imap-examine.c b/docs/examples/imap-examine.c
index eb245267b..a7b41c58a 100644
--- a/docs/examples/imap-examine.c
+++ b/docs/examples/imap-examine.c
@@ -36,7 +36,8 @@ int main(void)
curl = curl_easy_init();
if(curl) {
/* Set username and password */
- curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
/* This is just the server URL */
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com");
diff --git a/docs/examples/imap-fetch.c b/docs/examples/imap-fetch.c
index aa1f833e0..831d0dcf3 100644
--- a/docs/examples/imap-fetch.c
+++ b/docs/examples/imap-fetch.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -36,7 +36,8 @@ int main(void)
curl = curl_easy_init();
if(curl) {
/* Set username and password */
- curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
/* This will fetch message 1 from the user's inbox */
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX/;UID=1");
diff --git a/docs/examples/imap-list.c b/docs/examples/imap-list.c
index 45f311d52..4223052e4 100644
--- a/docs/examples/imap-list.c
+++ b/docs/examples/imap-list.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -36,7 +36,8 @@ int main(void)
curl = curl_easy_init();
if(curl) {
/* Set username and password */
- curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
/* This will list the folders within the user's mailbox. If you want to
* list the folders within a specific folder, for example the inbox, then
diff --git a/docs/examples/imap-search.c b/docs/examples/imap-search.c
index fcc5c528d..0c1d26734 100644
--- a/docs/examples/imap-search.c
+++ b/docs/examples/imap-search.c
@@ -36,7 +36,8 @@ int main(void)
curl = curl_easy_init();
if(curl) {
/* Set username and password */
- curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
/* This is mailbox folder to select */
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX");
diff --git a/docs/examples/imap-store.c b/docs/examples/imap-store.c
index ed38db5c8..8f5e7d5b2 100644
--- a/docs/examples/imap-store.c
+++ b/docs/examples/imap-store.c
@@ -36,7 +36,8 @@ int main(void)
curl = curl_easy_init();
if(curl) {
/* Set username and password */
- curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
/* This is the mailbox folder to select */
curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/INBOX");
diff --git a/docs/examples/pop3s.c b/docs/examples/pop3s.c
index 44d7c80d0..368d61f2b 100644
--- a/docs/examples/pop3s.c
+++ b/docs/examples/pop3s.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -30,7 +30,8 @@ int main(void)
curl = curl_easy_init();
if(curl) {
/* Set username and password */
- curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
/* This will only fetch the message with ID "1" of the given mailbox */
curl_easy_setopt(curl, CURLOPT_URL, "pop3s://user@pop.example.com/1");
@@ -61,13 +62,15 @@ int main(void)
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
+
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
- /* always cleanup */
+ /* Always cleanup */
curl_easy_cleanup(curl);
}
+
return 0;
}
diff --git a/docs/examples/pop3slist.c b/docs/examples/pop3slist.c
index 9d9668fa0..cc31bfd07 100644
--- a/docs/examples/pop3slist.c
+++ b/docs/examples/pop3slist.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -30,7 +30,8 @@ int main(void)
curl = curl_easy_init();
if(curl) {
/* Set username and password */
- curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
/* This will list every message of the given mailbox */
curl_easy_setopt(curl, CURLOPT_URL, "pop3s://user@pop.example.com/");
@@ -61,13 +62,15 @@ int main(void)
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
+
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
- /* always cleanup */
+ /* Always cleanup */
curl_easy_cleanup(curl);
}
+
return 0;
}
diff --git a/docs/examples/smtp-multi.c b/docs/examples/smtp-multi.c
index 612508f31..7394f1ea8 100644
--- a/docs/examples/smtp-multi.c
+++ b/docs/examples/smtp-multi.c
@@ -29,8 +29,6 @@
/*
* This is the list of basic details you need to tweak to get things right.
*/
-#define USERNAME "user@example.com"
-#define PASSWORD "123qwerty"
#define SERVER "smtp.example.com"
#define PORT ":587" /* it is a colon+port string, but you can set it
to "" to use the default port */
@@ -126,8 +124,8 @@ int main(void)
recipients = curl_slist_append(recipients, CC);
curl_easy_setopt(curl, CURLOPT_URL, "smtp://" SERVER PORT);
- curl_easy_setopt(curl, CURLOPT_USERNAME, USERNAME);
- curl_easy_setopt(curl, CURLOPT_PASSWORD, PASSWORD);
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
diff --git a/docs/examples/smtp-tls.c b/docs/examples/smtp-tls.c
index 1ab7e205b..15f946586 100644
--- a/docs/examples/smtp-tls.c
+++ b/docs/examples/smtp-tls.c
@@ -24,8 +24,9 @@
#include <curl/curl.h>
/* This is a simple example showing how to send mail using libcurl's SMTP
- * capabilities. It builds on the smtp-send.c example, adding some
- * authentication and transport security.
+ * capabilities. It builds on the smtp-send.c example to add authentication
+ * and, more importantly, transport security to protect the authentication
+ * details from being snooped.
*/
#define FROM "<sender@example.org>"
@@ -84,6 +85,10 @@ int main(void)
curl = curl_easy_init();
if(curl) {
+ /* Set username and password */
+ curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
+ curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
+
/* This is the URL for your mailserver. Note the use of port 587 here,
* instead of the normal SMTP port (25). Port 587 is commonly used for
* secure mail submission (see RFC4403), but you should use whatever
@@ -110,12 +115,6 @@ int main(void)
* docs/SSLCERTS for more information. */
curl_easy_setopt(curl, CURLOPT_CAINFO, "/path/to/certificate.pem");
- /* A common reason for requiring transport security is to protect
- * authentication details (user names and passwords) from being "snooped"
- * on the network. Here is how the user name and password are provided: */
- curl_easy_setopt(curl, CURLOPT_USERNAME, "user@example.net");
- curl_easy_setopt(curl, CURLOPT_PASSWORD, "P@ssw0rd");
-
/* Value for envelope reverse-path */
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM);