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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
--- kdelibs-3.5.7/kdeprint/cups/cupsdconf2/cups-util.c.orig 2007-08-23 14:53:00.000000000 -0300
+++ kdelibs-3.5.7/kdeprint/cups/cupsdconf2/cups-util.c 2007-08-23 17:40:02.000000000 -0300
@@ -13,6 +13,9 @@
static char pwdstring[33];
static int cups_local_auth(http_t *http);
+const char* cupsGetConf( void );
+int cupsPutConf( const char* );
+
const char * /* O - Filename for PPD file */
cupsGetConf(void)
{
@@ -29,6 +32,8 @@
char prompt[1024]; /* Prompt string */
int digest_tries; /* Number of tries with Digest */
static char filename[HTTP_MAX_URI]; /* Local filename */
+ char fqdn[ HTTP_MAX_URI ]; /* Server name buffer */
+
/*
* Connect to the correct server as needed...
@@ -108,15 +113,15 @@
* See if we should retry the current digest password...
*/
- if (strncmp(cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Basic", 5) == 0 ||
+ if (strncmp( httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ), "Basic", 5) == 0 ||
digest_tries > 1 || !pwdstring[0])
{
/*
* Nope - get a password from the user...
*/
+ httpGetHostname( cups_server, fqdn, sizeof( fqdn ) );
- snprintf(prompt, sizeof(prompt), "Password for %s on %s? ", cupsUser(),
- cups_server->hostname);
+ snprintf(prompt, sizeof(prompt), "Password for %s on %s? ", cupsUser(), fqdn );
if ((password = cupsGetPassword(prompt)) == NULL)
break;
@@ -135,7 +140,7 @@
* Got a password; encode it for the server...
*/
- if (strncmp(cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Basic", 5) == 0)
+ if (strncmp( httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ), "Basic", 5) == 0)
{
/*
* Basic authentication...
@@ -210,7 +215,7 @@
* OK, we need to copy the file...
*/
- while ((bytes = httpRead(cups_server, buffer, sizeof(buffer))) > 0)
+ while ((bytes = httpRead2(cups_server, buffer, sizeof(buffer))) > 0)
{
write(fd, buffer, bytes);
}
@@ -235,6 +240,7 @@
http_status_t status; /* HTTP status from server */
char prompt[1024]; /* Prompt string */
int digest_tries; /* Number of tries with Digest */
+ char fqdn[ HTTP_MAX_URI ]; /* Server name buffer */
if (name == NULL)
return 0;
@@ -305,11 +311,11 @@
break;
}
else
- httpWrite(cups_server, buffer, bytes);
+ httpWrite2(cups_server, buffer, bytes);
if (status == HTTP_CONTINUE)
{
- httpWrite(cups_server, buffer, 0);
+ httpWrite2(cups_server, buffer, 0);
while ((status = httpUpdate(cups_server)) == HTTP_CONTINUE);
}
@@ -334,15 +340,16 @@
* See if we should retry the current digest password...
*/
- if (strncmp(cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Basic", 5) == 0 ||
+ if (strncmp( httpGetField ( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ), "Basic", 5) == 0 ||
digest_tries > 1 || !pwdstring[0])
{
/*
* Nope - get a password from the user...
*/
- snprintf(prompt, sizeof(prompt), "Password for %s on %s? ", cupsUser(),
- cups_server->hostname);
+
+ httpGetHostname( cups_server, fqdn, sizeof( fqdn ) );
+ snprintf(prompt, sizeof(prompt), "Password for %s on %s? ", cupsUser(), fqdn );
if ((password = cupsGetPassword(prompt)) == NULL)
break;
@@ -361,7 +368,7 @@
* Got a password; encode it for the server...
*/
- if (strncmp(cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Basic", 5) == 0)
+ if (strncmp(httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ), "Basic", 5) == 0)
{
/*
* Basic authentication...
@@ -492,3 +499,4 @@
return (1);
}
+
--- kdelibs-3.5.7/kdeprint/cups/ipprequest.cpp.orig 2007-08-23 17:56:12.000000000 -0300
+++ kdelibs-3.5.7/kdeprint/cups/ipprequest.cpp 2007-08-23 17:57:53.000000000 -0300
@@ -310,7 +310,7 @@
}
#ifdef HAVE_CUPS_NO_PWD_CACHE
- strncpy( HTTP->authstring, cups_authstring.data(), HTTP_MAX_VALUE );
+ httpSetAuthString( HTTP, NULL, cups_authstring.data() );
#endif
if (dump_ > 0)
@@ -320,7 +320,7 @@
request_ = cupsDoFileRequest(HTTP, request_, (res.isEmpty() ? "/" : res.latin1()), (filename.isEmpty() ? NULL : filename.latin1()));
#ifdef HAVE_CUPS_NO_PWD_CACHE
- cups_authstring = HTTP->authstring;
+ cups_authstring = httpGetAuthString( HTTP );
#endif
httpClose(HTTP);
|