summaryrefslogtreecommitdiff
path: root/misc/esniper/patches/patch-aa
blob: f5fa45d93b7734537197c64e231f39f4d66bfd11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
$NetBSD: patch-aa,v 1.3 2006/10/22 18:51:32 heinz Exp $

--- auction.c.orig	2005-10-19 13:37:59.000000000 +0200
+++ auction.c
@@ -28,6 +28,7 @@
 #include "buffer.h"
 #include "http.h"
 #include <ctype.h>
+#include <curl/curl.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -749,7 +750,7 @@ parseBidHistory(memBuf_t *mp, auctionInf
 		aip->reserve = 1;
 	else {
 		aip->reserve = 0;
-		if ((foundHeader = !strcmp("User ID", line)))
+		if ((foundHeader = !strcmp("Bidder", line)))
 			/* skip over first line */
 			freeTableRow(getTableRow(mp));
 	}
@@ -762,7 +763,7 @@ parseBidHistory(memBuf_t *mp, auctionInf
 	 *	Single item auction:
 	 *	    Header line:
 	 *		""
-	 *		"User ID"
+	 *		"Bidder"
 	 *		"Bid Amount"
 	 *		"Date of bid"
 	 *		""
@@ -784,7 +785,7 @@ parseBidHistory(memBuf_t *mp, auctionInf
 	 *	Purchase (buy-it-now only):
 	 *	    Header line:
 	 *		""
-	 *		"User ID"
+	 *		"Bidder"
 	 *		"Bid Amount"
 	 *		"Qty"
 	 *		"Date of bid"
@@ -808,7 +809,7 @@ parseBidHistory(memBuf_t *mp, auctionInf
 	 *	Dutch auction:
 	 *	    Header line:
 	 *		""
-	 *		"User ID"
+	 *		"Bidder"
 	 *		"Bid Amount"
 	 *		"Quantity wanted"
 	 *		"Quantity winning"
@@ -841,7 +842,7 @@ parseBidHistory(memBuf_t *mp, auctionInf
 			char *rawHeader = (ncolumns >= 5) ? row[1] : NULL;
 			char *header = getNonTagFromString(rawHeader);
 
-			foundHeader = header && !strcmp(header, "User ID");
+			foundHeader = header && !strcmp(header, "Bidder");
 			freeTableRow(row);
 			free(header);
 		}
@@ -1189,7 +1190,7 @@ ebayLogin(auctionInfo *aip)
 	char *url, *logUrl;
 	pageInfo_t *pp;
 	int ret = 0;
-	char *password;
+	char *password, *escapedPassword;
 
 	if (!(mp = httpGet(LOGIN_1_URL, NULL)))
 		return httpError(aip);
@@ -1198,11 +1199,18 @@ ebayLogin(auctionInfo *aip)
 
 	urlLen = sizeof(LOGIN_2_URL) + strlen(options.username);
 	password = getPassword();
-	url = malloc(urlLen + strlen(password));
+	if ((escapedPassword = curl_escape(password, strlen(password))) == NULL) {
+		log(("ebayLogin(): Could not URL-encode the password"));
+		freePassword(password);
+		return 1;
+	}
+	freePassword(password);
+
+	url = malloc(urlLen + strlen(escapedPassword));
 	logUrl = malloc(urlLen + 5);
 
-	sprintf(url, LOGIN_2_URL, options.username, password);
-	freePassword(password);
+	sprintf(url, LOGIN_2_URL, options.username, escapedPassword);
+	curl_free(escapedPassword);
 	sprintf(logUrl, LOGIN_2_URL, options.username, "*****");
 
 	mp = httpGet(url, logUrl);