]> git.pld-linux.org Git - packages/rpm.git/blame - rpm-no-neon.patch
- internal file update (for compatibility with *.mgc generated by file-4.14)
[packages/rpm.git] / rpm-no-neon.patch
CommitLineData
aa9c264c
JR
1diff -ur rpm-4.4.1/configure.ac rpm-4.4.1-no-neon/configure.ac
2--- rpm-4.4.1/configure.ac 2005-06-19 20:37:35.675035608 +0200
3+++ rpm-4.4.1-no-neon/configure.ac 2005-06-19 20:34:07.022755576 +0200
4@@ -448,26 +448,6 @@
5 WITH_NEON_SUBDIR=
6 WITH_NEON_INCLUDE=
7 WITH_NEON_LIB=
8-AC_CHECK_HEADER([neon/ne_session.h], [
9- AC_CHECK_LIB(neon, ne_session_create, [
10- AC_DEFINE(HAVE_LIBNEON, 1, [Define to 1 if you have the `neon' library (-lneon).])
11- AC_CHECK_LIB(neon, ne_get_response_header, [
12- AC_DEFINE(HAVE_NEON_NE_GET_RESPONSE_HEADER, 1, [Define to 1 if you have ne_get_response_header() in libneon.])
13- ])
14- AC_CHECK_LIB(neon, ne_send_request_chunk, [
15- AC_DEFINE(HAVE_NEON_NE_SEND_REQUEST_CHUNK, 1, [Define to 1 if you have ne_send_request_chunk() in libneon.])
16- ])
17- WITH_NEON_INCLUDE="-I${includedir}/neon"
18- WITH_NEON_LIB="-lneon"
19- ])
20- ], [
21- if test -d neon ; then
22- AC_DEFINE(HAVE_LIBNEON, 1, [Define to 1 if you have the `neon' library (-lneon).])
23- WITH_NEON_SUBDIR=neon
24- WITH_NEON_INCLUDE="-I\${top_srcdir}/${WITH_NEON_SUBDIR}/src"
25- WITH_NEON_LIB="\${top_builddir}/${WITH_NEON_SUBDIR}/src/libneon.la"
26- fi
27-])
28 AC_SUBST(WITH_NEON_SUBDIR)
29 AC_SUBST(WITH_NEON_INCLUDE)
30 AC_SUBST(WITH_NEON_LIB)
31diff -ur rpm-4.4.1/rpmio/Makefile.am rpm-4.4.1-no-neon/rpmio/Makefile.am
32--- rpm-4.4.1/rpmio/Makefile.am 2005-06-19 20:37:35.322089264 +0200
33+++ rpm-4.4.1-no-neon/rpmio/Makefile.am 2005-06-19 20:34:06.996759528 +0200
34@@ -37,7 +37,7 @@
35 @WITH_LUA_LIB@ \
36 $(top_builddir)/file/src/libmagic.la \
37 @WITH_ZLIB_LIB@ \
48b23ed4
JB
38- -lneon -lpthread @HOME_ETC_LIB@
39+ -lpthread @HOME_ETC_LIB@
aa9c264c
JR
40 librpmio_la_LIBADD = # $(BEECRYPTLOBJS)
41 librpmio_la_DEPENDENCIES = # .created
42
43diff -ur rpm-4.4.1/rpmio/rpmdav.c rpm-4.4.1-no-neon/rpmio/rpmdav.c
44--- rpm-4.4.1/rpmio/rpmdav.c 2005-01-17 19:46:27.000000000 +0100
45+++ rpm-4.4.1-no-neon/rpmio/rpmdav.c 2005-06-19 20:35:12.340825720 +0200
46@@ -9,17 +9,6 @@
47 #include <pthread.h>
48 #endif
49
50-#include <neon/ne_alloc.h>
51-#include <neon/ne_auth.h>
52-#include <neon/ne_basic.h>
53-#include <neon/ne_dates.h>
54-#include <neon/ne_locks.h>
55-#include <neon/ne_props.h>
56-#include <neon/ne_request.h>
57-#include <neon/ne_socket.h>
58-#include <neon/ne_string.h>
59-#include <neon/ne_utils.h>
60-
61 #include <rpmio_internal.h>
62
63 #define _RPMDAV_INTERNAL
64@@ -55,1304 +44,6 @@
65 }
66
67 /* =============================================================== */
68-static int davFree(urlinfo u)
69- /*@globals internalState @*/
70- /*@modifies u, internalState @*/
71-{
72- if (u != NULL && u->sess != NULL) {
73- u->capabilities = _free(u->capabilities);
74- if (u->lockstore != NULL)
75- ne_lockstore_destroy(u->lockstore);
76- u->lockstore = NULL;
77- ne_session_destroy(u->sess);
78- u->sess = NULL;
79- }
80- return 0;
81-}
82-
83-static void davProgress(void * userdata, off_t current, off_t total)
84- /*@*/
85-{
86- urlinfo u = userdata;
87- ne_session * sess;
88-
89-assert(u != NULL);
90- sess = u->sess;
91-assert(sess != NULL);
92-assert(u == ne_get_session_private(sess, "urlinfo"));
93-
94- u->current = current;
95- u->total = total;
96-
97-if (_dav_debug < 0)
98-fprintf(stderr, "*** davProgress(%p,0x%x:0x%x) sess %p u %p\n", userdata, (unsigned int)current, (unsigned int)total, sess, u);
99-}
100-
101-static void davNotify(void * userdata,
102- ne_conn_status connstatus, const char * info)
103- /*@*/
104-{
105- urlinfo u = userdata;
106- ne_session * sess;
107- /*@observer@*/
108- static const char * connstates[] = {
109- "namelookup",
110- "connecting",
111- "connected",
112- "secure",
113- "unknown"
114- };
115-
116-assert(u != NULL);
117- sess = u->sess;
118-assert(sess != NULL);
119-assert(u == ne_get_session_private(sess, "urlinfo"));
120-
121-#ifdef REFERENCE
122-typedef enum {
123- ne_conn_namelookup, /* lookup up hostname (info = hostname) */
124- ne_conn_connecting, /* connecting to host (info = hostname) */
125- ne_conn_connected, /* connected to host (info = hostname) */
126- ne_conn_secure /* connection now secure (info = crypto level) */
127-} ne_conn_status;
128-#endif
129-
130- u->connstatus = connstatus;
131-
132-/*@-boundsread@*/
133-if (_dav_debug < 0)
134-fprintf(stderr, "*** davNotify(%p,%d,%p) sess %p u %p %s\n", userdata, connstatus, info, sess, u, connstates[ (connstatus < 4 ? connstatus : 4)]);
135-/*@=boundsread@*/
136-
137-}
138-
139-static void davCreateRequest(ne_request * req, void * userdata,
140- const char * method, const char * uri)
141- /*@*/
142-{
143- urlinfo u = userdata;
144- ne_session * sess;
145- void * private = NULL;
146- const char * id = "urlinfo";
147-
148-assert(u != NULL);
149-assert(u->sess != NULL);
150-assert(req != NULL);
151- sess = ne_get_session(req);
152-assert(sess == u->sess);
153-assert(u == ne_get_session_private(sess, "urlinfo"));
154-
155-assert(sess != NULL);
156- private = ne_get_session_private(sess, id);
157-assert(u == private);
158-
159-if (_dav_debug < 0)
160-fprintf(stderr, "*** davCreateRequest(%p,%p,%s,%s) %s:%p\n", req, userdata, method, uri, id, private);
161-}
162-
163-static void davPreSend(ne_request * req, void * userdata, ne_buffer * buf)
164-{
165- urlinfo u = userdata;
166- ne_session * sess;
167- const char * id = "fd";
168- FD_t fd = NULL;
169-
170-assert(u != NULL);
171-assert(u->sess != NULL);
172-assert(req != NULL);
173- sess = ne_get_session(req);
174-assert(sess == u->sess);
175-assert(u == ne_get_session_private(sess, "urlinfo"));
176-
177- fd = ne_get_request_private(req, id);
178-
179-if (_dav_debug < 0)
180-fprintf(stderr, "*** davPreSend(%p,%p,%p) sess %p %s %p\n", req, userdata, buf, sess, id, fd);
181-if (_dav_debug)
182-fprintf(stderr, "-> %s\n", buf->data);
183-
184-}
185-
186-static int davPostSend(ne_request * req, void * userdata, const ne_status * status)
187- /*@*/
188-{
189- urlinfo u = userdata;
190- ne_session * sess;
191- const char * id = "fd";
192- FD_t fd = NULL;
193-
194-assert(u != NULL);
195-assert(u->sess != NULL);
196-assert(req != NULL);
197- sess = ne_get_session(req);
198-assert(sess == u->sess);
199-assert(u == ne_get_session_private(sess, "urlinfo"));
200-
201- fd = ne_get_request_private(req, id);
202-
203-/*@-evalorder@*/
204-if (_dav_debug < 0)
205-fprintf(stderr, "*** davPostSend(%p,%p,%p) sess %p %s %p %s\n", req, userdata, status, sess, id, fd, ne_get_error(sess));
206-/*@=evalorder@*/
207- return NE_OK;
208-}
209-
210-static void davDestroyRequest(ne_request * req, void * userdata)
211- /*@*/
212-{
213- urlinfo u = userdata;
214- ne_session * sess;
215- const char * id = "fd";
216- FD_t fd = NULL;
217-
218-assert(u != NULL);
219-assert(u->sess != NULL);
220-assert(req != NULL);
221- sess = ne_get_session(req);
222-assert(sess == u->sess);
223-assert(u == ne_get_session_private(sess, "urlinfo"));
224-
225- fd = ne_get_request_private(req, id);
226-
227-if (_dav_debug < 0)
228-fprintf(stderr, "*** davDestroyRequest(%p,%p) sess %p %s %p\n", req, userdata, sess, id, fd);
229-}
230-
231-static void davDestroySession(void * userdata)
232- /*@*/
233-{
234- urlinfo u = userdata;
235- ne_session * sess;
236- void * private = NULL;
237- const char * id = "urlinfo";
238-
239-assert(u != NULL);
240-assert(u->sess != NULL);
241- sess = u->sess;
242-assert(u == ne_get_session_private(sess, "urlinfo"));
243-
244-assert(sess != NULL);
245- private = ne_get_session_private(sess, id);
246-assert(u == private);
247-
248-if (_dav_debug < 0)
249-fprintf(stderr, "*** davDestroySession(%p) sess %p %s %p\n", userdata, sess, id, private);
250-}
251-
252-static int
253-davVerifyCert(void *userdata, int failures, const ne_ssl_certificate *cert)
254- /*@*/
255-{
256- const char *hostname = userdata;
257-
258-if (_dav_debug < 0)
259-fprintf(stderr, "*** davVerifyCert(%p,%d,%p) %s\n", userdata, failures, cert, hostname);
260-
261- return 0; /* HACK: trust all server certificates. */
262-}
263-
264-static int davConnect(urlinfo u)
265- /*@globals internalState @*/
266- /*@modifies u, internalState @*/
267-{
268- const char * path = NULL;
269- int rc;
270-
271- /* HACK: hkp:// has no steenkin' options */
272- if (!(u->urltype == URL_IS_HTTP || u->urltype == URL_IS_HTTPS))
273- return 0;
274-
275- /* HACK: where should server capabilities be read? */
276- (void) urlPath(u->url, &path);
277- /* HACK: perhaps capture Allow: tag, look for PUT permitted. */
278- rc = ne_options(u->sess, path, u->capabilities);
279- switch (rc) {
280- case NE_OK:
281- break;
282- case NE_ERROR:
283- /* HACK: "301 Moved Permanently" on empty subdir. */
284- if (!strncmp("301 ", ne_get_error(u->sess), sizeof("301 ")-1))
285- break;
286- /*@fallthrough@*/
287- case NE_CONNECT:
288- case NE_LOOKUP:
289- default:
290-if (_dav_debug)
291-fprintf(stderr, "*** Connect to %s:%d failed(%d):\n\t%s\n",
292- u->host, u->port, rc, ne_get_error(u->sess));
293- break;
294- }
295-
296- /* HACK: sensitive to error returns? */
297- u->httpVersion = (ne_version_pre_http11(u->sess) ? 0 : 1);
298-
299- return rc;
300-}
301-
302-static int davInit(const char * url, urlinfo * uret)
303- /*@globals internalState @*/
304- /*@modifies *uret, internalState @*/
305-{
306- urlinfo u = NULL;
307- int rc = 0;
308-
309-/*@-globs@*/ /* FIX: h_errno annoyance. */
310- if (urlSplit(url, &u))
311- return -1; /* XXX error returns needed. */
312-/*@=globs@*/
313-
314- if (u->url != NULL && u->sess == NULL)
315- switch (u->urltype) {
316- default:
317- assert(u->urltype != u->urltype);
318- /*@notreached@*/ break;
319- case URL_IS_HTTPS:
320- case URL_IS_HTTP:
321- case URL_IS_HKP:
322- { ne_server_capabilities * capabilities;
323-
324- /* HACK: oneshots should be done Somewhere Else Instead. */
325-/*@-noeffect@*/
326- rc = ((_dav_debug < 0) ? NE_DBG_HTTP : 0);
327- ne_debug_init(stderr, rc); /* XXX oneshot? */
328-/*@=noeffect@*/
329- rc = ne_sock_init(); /* XXX oneshot? */
330-
331- u->lockstore = ne_lockstore_create(); /* XXX oneshot? */
332-
333- u->capabilities = capabilities = xcalloc(1, sizeof(*capabilities));
334- u->sess = ne_session_create(u->scheme, u->host, u->port);
335-
336- ne_lockstore_register(u->lockstore, u->sess);
337-
338- if (u->proxyh != NULL)
339- ne_session_proxy(u->sess, u->proxyh, u->proxyp);
340-
341-#if 0
342- { const ne_inet_addr ** addrs;
343- unsigned int n;
344- ne_set_addrlist(u->sess, addrs, n);
345- }
346-#endif
347-
348- ne_set_progress(u->sess, davProgress, u);
349- ne_set_status(u->sess, davNotify, u);
350-
351- ne_set_persist(u->sess, 1);
352- ne_set_read_timeout(u->sess, httpTimeoutSecs);
353- ne_set_useragent(u->sess, PACKAGE "/" PACKAGE_VERSION);
354-
355- /* XXX check that neon is ssl enabled. */
356- if (!strcasecmp(u->scheme, "https"))
357- ne_ssl_set_verify(u->sess, davVerifyCert, (char *)u->host);
358-
359- ne_set_session_private(u->sess, "urlinfo", u);
360-
361- ne_hook_destroy_session(u->sess, davDestroySession, u);
362-
363- ne_hook_create_request(u->sess, davCreateRequest, u);
364- ne_hook_pre_send(u->sess, davPreSend, u);
365- ne_hook_post_send(u->sess, davPostSend, u);
366- ne_hook_destroy_request(u->sess, davDestroyRequest, u);
367-
368- /* HACK: where should server capabilities be read? */
369- rc = davConnect(u);
370- if (rc)
371- goto exit;
372- } break;
373- }
374-
375-exit:
376-/*@-boundswrite@*/
377- if (rc == 0 && uret != NULL)
378- *uret = urlLink(u, __FUNCTION__);
379-/*@=boundswrite@*/
380- u = urlFree(u, "urlSplit (davInit)");
381-
382- return rc;
383-}
384-
385-/* =============================================================== */
386-enum fetch_rtype_e {
387- resr_normal = 0,
388- resr_collection,
389- resr_reference,
390- resr_error
391-};
392-
393-struct fetch_resource_s {
394- struct fetch_resource_s *next;
395- char *uri;
396-/*@unused@*/
397- char *displayname;
398- enum fetch_rtype_e type;
399- size_t size;
400- time_t modtime;
401- int is_executable;
402- int is_vcr; /* Is version resource. 0: no vcr, 1 checkin 2 checkout */
403- char *error_reason; /* error string returned for this resource */
404- int error_status; /* error status returned for this resource */
405-};
406-
407-/*@null@*/
408-static void *fetch_destroy_item(/*@only@*/ struct fetch_resource_s *res)
409- /*@modifies res @*/
410-{
411- NE_FREE(res->uri);
412- NE_FREE(res->error_reason);
413- res = _free(res);
414- return NULL;
415-}
416-
417-#ifdef UNUSED
418-/*@null@*/
419-static void *fetch_destroy_list(/*@only@*/ struct fetch_resource_s *res)
420- /*@modifies res @*/
421-{
422- struct fetch_resource_s *next;
423-/*@-branchstate@*/
424- for (; res != NULL; res = next) {
425- next = res->next;
426- res = fetch_destroy_item(res);
427- }
428-/*@=branchstate@*/
429- return NULL;
430-}
431-#endif
432-
433-static void *fetch_create_item(/*@unused@*/ void *userdata, /*@unused@*/ const char *uri)
434- /*@*/
435-{
436- struct fetch_resource_s * res = ne_calloc(sizeof(*res));
437- return res;
438-}
439-
440-/* =============================================================== */
441-struct fetch_context_s {
442-/*@relnull@*/
443- struct fetch_resource_s **resrock;
444- const char *uri;
445- unsigned int include_target; /* Include resource at href */
446-/*@refcounted@*/
447- urlinfo u;
448- int ac;
449- int nalloced;
450- ARGV_t av;
451- mode_t * modes;
452- size_t * sizes;
453- time_t * mtimes;
454-};
455-
456-/*@null@*/
457-static void *fetch_destroy_context(/*@only@*/ /*@null@*/ struct fetch_context_s *ctx)
458- /*@globals internalState @*/
459- /*@modifies ctx, internalState @*/
460-{
461- if (ctx == NULL)
462- return NULL;
463- if (ctx->av != NULL)
464- ctx->av = argvFree(ctx->av);
465- ctx->modes = _free(ctx->modes);
466- ctx->sizes = _free(ctx->sizes);
467- ctx->mtimes = _free(ctx->mtimes);
468- ctx->u = urlFree(ctx->u, __FUNCTION__);
469- ctx->uri = _free(ctx->uri);
470-/*@-boundswrite@*/
471- memset(ctx, 0, sizeof(*ctx));
472-/*@=boundswrite@*/
473- ctx = _free(ctx);
474- return NULL;
475-}
476-
477-/*@null@*/
478-static void *fetch_create_context(const char *uri)
479- /*@globals internalState @*/
480- /*@modifies internalState @*/
481-{
482- struct fetch_context_s * ctx;
483- urlinfo u;
484-
485-/*@-globs@*/ /* FIX: h_errno annoyance. */
486- if (urlSplit(uri, &u))
487- return NULL;
488-/*@=globs@*/
489-
490- ctx = ne_calloc(sizeof(*ctx));
491- ctx->uri = xstrdup(uri);
492- ctx->u = urlLink(u, __FUNCTION__);
493- return ctx;
494-}
495-
496-/*@unchecked@*/ /*@observer@*/
497-static const ne_propname fetch_props[] = {
498- { "DAV:", "getcontentlength" },
499- { "DAV:", "getlastmodified" },
500- { "http://apache.org/dav/props/", "executable" },
501- { "DAV:", "resourcetype" },
502- { "DAV:", "checked-in" },
503- { "DAV:", "checked-out" },
504- { NULL, NULL }
505-};
506-
507-#define ELM_resourcetype (NE_PROPS_STATE_TOP + 1)
508-#define ELM_collection (NE_PROPS_STATE_TOP + 2)
509-
510-/*@unchecked@*/ /*@observer@*/
511-static const struct ne_xml_idmap fetch_idmap[] = {
512- { "DAV:", "resourcetype", ELM_resourcetype },
513- { "DAV:", "collection", ELM_collection }
514-};
515-
516-static int fetch_startelm(void *userdata, int parent,
517- const char *nspace, const char *name,
518- /*@unused@*/ const char **atts)
519- /*@*/
520-{
521- ne_propfind_handler *pfh = userdata;
522- struct fetch_resource_s *r = ne_propfind_current_private(pfh);
523- int state = ne_xml_mapid(fetch_idmap, NE_XML_MAPLEN(fetch_idmap),
524- nspace, name);
525-
526- if (r == NULL ||
527- !((parent == NE_207_STATE_PROP && state == ELM_resourcetype) ||
528- (parent == ELM_resourcetype && state == ELM_collection)))
529- return NE_XML_DECLINE;
530-
531- if (state == ELM_collection) {
532- r->type = resr_collection;
533- }
534-
535- return state;
536-}
537-
538-static int fetch_compare(const struct fetch_resource_s *r1,
539- const struct fetch_resource_s *r2)
540- /*@*/
541-{
542- /* Sort errors first, then collections, then alphabetically */
543- if (r1->type == resr_error) {
544- return -1;
545- } else if (r2->type == resr_error) {
546- return 1;
547- } else if (r1->type == resr_collection) {
548- if (r2->type != resr_collection) {
549- return -1;
550- } else {
551- return strcmp(r1->uri, r2->uri);
552- }
553- } else {
554- if (r2->type != resr_collection) {
555- return strcmp(r1->uri, r2->uri);
556- } else {
557- return 1;
558- }
559- }
560-}
561-
562-static void fetch_results(void *userdata, const char *uri,
563- const ne_prop_result_set *set)
564- /*@*/
565-{
566- struct fetch_context_s *ctx = userdata;
567- struct fetch_resource_s *current, *previous, *newres;
568- const char *clength, *modtime, *isexec;
569- const char *checkin, *checkout;
570- const ne_status *status = NULL;
571- const char * path = NULL;
572-
573- (void) urlPath(uri, &path);
574- if (path == NULL)
575- return;
576-
577- newres = ne_propset_private(set);
578-
579-if (_dav_debug < 0)
580-fprintf(stderr, "==> %s in uri %s\n", path, ctx->uri);
581-
582- if (ne_path_compare(ctx->uri, path) == 0 && !ctx->include_target) {
583- /* This is the target URI */
584-if (_dav_debug < 0)
585-fprintf(stderr, "==> %s skipping target resource.\n", path);
586- /* Free the private structure. */
587- free(newres);
588- return;
589- }
590-
591- newres->uri = ne_strdup(path);
592-
593-/*@-boundsread@*/
594- clength = ne_propset_value(set, &fetch_props[0]);
595- modtime = ne_propset_value(set, &fetch_props[1]);
596- isexec = ne_propset_value(set, &fetch_props[2]);
597- checkin = ne_propset_value(set, &fetch_props[4]);
598- checkout = ne_propset_value(set, &fetch_props[5]);
599-/*@=boundsread@*/
600-
601-/*@-branchstate@*/
602- if (clength == NULL)
603- status = ne_propset_status(set, &fetch_props[0]);
604- if (modtime == NULL)
605- status = ne_propset_status(set, &fetch_props[1]);
606-/*@=branchstate@*/
607-
608- if (newres->type == resr_normal && status != NULL) {
609- /* It's an error! */
610- newres->error_status = status->code;
611-
612- /* Special hack for Apache 1.3/mod_dav */
613- if (strcmp(status->reason_phrase, "status text goes here") == 0) {
614- const char *desc;
615- if (status->code == 401) {
616- desc = _("Authorization Required");
617- } else if (status->klass == 3) {
618- desc = _("Redirect");
619- } else if (status->klass == 5) {
620- desc = _("Server Error");
621- } else {
622- desc = _("Unknown Error");
623- }
624- newres->error_reason = ne_strdup(desc);
625- } else {
626- newres->error_reason = ne_strdup(status->reason_phrase);
627- }
628- newres->type = resr_error;
629- }
630-
631- if (isexec && strcasecmp(isexec, "T") == 0) {
632- newres->is_executable = 1;
633- } else {
634- newres->is_executable = 0;
635- }
636-
637- if (modtime)
638- newres->modtime = ne_httpdate_parse(modtime);
639-
640- if (clength)
641- newres->size = atoi(clength);
642-
643- /* is vcr */
644- if (checkin) {
645- newres->is_vcr = 1;
646- } else if (checkout) {
647- newres->is_vcr = 2;
648- } else {
649- newres->is_vcr = 0;
650- }
651-
652- for (current = *ctx->resrock, previous = NULL; current != NULL;
653- previous = current, current = current->next)
654- {
655- if (fetch_compare(current, newres) >= 0) {
656- break;
657- }
658- }
659- if (previous) {
660- previous->next = newres;
661- } else {
662-/*@-boundswrite@*/
663- *ctx->resrock = newres;
664-/*@=boundswrite@*/
665- }
666- newres->next = current;
667-}
668-
669-static int davFetch(const urlinfo u, struct fetch_context_s * ctx)
670- /*@globals internalState @*/
671- /*@modifies ctx, internalState @*/
672-{
673- const char * path = NULL;
674- int depth = 1; /* XXX passed arg? */
675- unsigned int include_target = 0; /* XXX passed arg? */
676- struct fetch_resource_s * resitem = NULL;
677- struct fetch_resource_s ** resrock = &resitem; /* XXX passed arg? */
678- ne_propfind_handler *pfh;
679- struct fetch_resource_s *current, *next;
680- mode_t st_mode;
681- int rc = 0;
682- int xx;
683-
684- (void) urlPath(u->url, &path);
685- pfh = ne_propfind_create(u->sess, ctx->uri, depth);
686-
687- /* HACK: need to set u->httpHasRange here. */
688-
689- ctx->resrock = resrock;
690- ctx->include_target = include_target;
691-
692- ne_xml_push_handler(ne_propfind_get_parser(pfh),
693- fetch_startelm, NULL, NULL, pfh);
694-
695- ne_propfind_set_private(pfh, fetch_create_item, NULL);
696-
697- rc = ne_propfind_named(pfh, fetch_props, fetch_results, ctx);
698-
699- ne_propfind_destroy(pfh);
700-
701- for (current = resitem; current != NULL; current = next) {
702- const char *s, *se;
703- char * val;
704-
705- next = current->next;
706-
707- /* Collections have trailing '/' that needs trim. */
708- /* The top level collection is returned as well. */
709- se = current->uri + strlen(current->uri);
710- if (se[-1] == '/') {
711- if (strlen(current->uri) <= strlen(path)) {
712- current = fetch_destroy_item(current);
713- continue;
714- }
715- se--;
716- }
717- s = se;
718- while (s > current->uri && s[-1] != '/')
719- s--;
720-
721- val = ne_strndup(s, (se - s));
722-
723-/*@-nullpass@*/
724- val = ne_path_unescape(val);
725-/*@=nullpass@*/
726-
727- xx = argvAdd(&ctx->av, val);
728-if (_dav_debug < 0)
729-fprintf(stderr, "*** argvAdd(%p,\"%s\")\n", &ctx->av, val);
730- NE_FREE(val);
731-
732- while (ctx->ac >= ctx->nalloced) {
733- if (ctx->nalloced <= 0)
734- ctx->nalloced = 1;
735- ctx->nalloced *= 2;
736- ctx->modes = xrealloc(ctx->modes,
737- (sizeof(*ctx->modes) * ctx->nalloced));
738- ctx->sizes = xrealloc(ctx->sizes,
739- (sizeof(*ctx->sizes) * ctx->nalloced));
740- ctx->mtimes = xrealloc(ctx->mtimes,
741- (sizeof(*ctx->mtimes) * ctx->nalloced));
742- }
743-
744- switch (current->type) {
745- case resr_normal:
746- st_mode = S_IFREG;
747- /*@switchbreak@*/ break;
748- case resr_collection:
749- st_mode = S_IFDIR;
750- /*@switchbreak@*/ break;
751- case resr_reference:
752- case resr_error:
753- default:
754- st_mode = 0;
755- /*@switchbreak@*/ break;
756- }
757-/*@-boundswrite@*/
758- ctx->modes[ctx->ac] = st_mode;
759- ctx->sizes[ctx->ac] = current->size;
760- ctx->mtimes[ctx->ac] = current->modtime;
761-/*@=boundswrite@*/
762- ctx->ac++;
763-
764- current = fetch_destroy_item(current);
765- }
766- ctx->resrock = NULL; /* HACK: avoid leaving stack reference. */
767-
768- return rc;
769-}
770-
771-static int davNLST(struct fetch_context_s * ctx)
772- /*@globals internalState @*/
773- /*@modifies ctx, internalState @*/
774-{
775- urlinfo u = NULL;
776- int rc;
777- int xx;
778-
779- rc = davInit(ctx->uri, &u);
780- if (rc || u == NULL)
781- goto exit;
782-
783- rc = davFetch(u, ctx);
784- switch (rc) {
785- case NE_OK:
786- break;
787- case NE_ERROR:
788- /* HACK: "301 Moved Permanently" on empty subdir. */
789- if (!strncmp("301 ", ne_get_error(u->sess), sizeof("301 ")-1))
790- break;
791- /*@fallthrough@*/
792- default:
793-if (_dav_debug)
794-fprintf(stderr, "*** Fetch from %s:%d failed:\n\t%s\n",
795- u->host, u->port, ne_get_error(u->sess));
796- break;
797- }
798-
799-exit:
800- if (rc)
801- xx = davFree(u);
802- return rc;
803-}
804-
805-/* =============================================================== */
806-static int my_result(const char * msg, int ret, /*@null@*/ FILE * fp)
807- /*@modifies *fp @*/
808-{
809- /* HACK: don't print unless debugging. */
810- if (_dav_debug >= 0)
811- return ret;
812- if (fp == NULL)
813- fp = stderr;
814- if (msg != NULL)
815- fprintf(fp, "*** %s: ", msg);
816-
817- /* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */
818-#ifdef HACK
819- fprintf(fp, "%s: %s\n", ftpStrerror(-ret), ne_get_error(sess));
820-#else
821- fprintf(fp, "%s\n", ftpStrerror(-ret));
822-#endif
823- return ret;
824-}
825-
826-#ifdef DYING
827-static void hexdump(const unsigned char * buf, ssize_t len)
828- /*@*/
829-{
830- int i;
831- if (len <= 0)
832- return;
833- for (i = 0; i < len; i++) {
834- if (i != 0 && (i%16) == 0)
835- fprintf(stderr, "\n");
836- fprintf(stderr, " %02X", buf[i]);
837- }
838- fprintf(stderr, "\n");
839-}
840-#endif
841-
842-static void davAcceptRanges(void * userdata, /*@null@*/ const char * value)
843- /*@modifies userdata @*/
844-{
845- urlinfo u = userdata;
846-
847- if (!(u && value)) return;
848-if (_dav_debug < 0)
849-fprintf(stderr, "*** u %p Accept-Ranges: %s\n", u, value);
850- if (!strcmp(value, "bytes"))
851- u->httpHasRange = 1;
852- if (!strcmp(value, "none"))
853- u->httpHasRange = 0;
854-}
855-
856-#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
857-static void davAllHeaders(void * userdata, const char * value)
858-{
859- FD_t ctrl = userdata;
860-
861- if (!(ctrl && value)) return;
862-if (_dav_debug)
863-fprintf(stderr, "<- %s\n", value);
864-}
865-#endif
866-
867-static void davContentLength(void * userdata, /*@null@*/ const char * value)
868- /*@modifies userdata @*/
869-{
870- FD_t ctrl = userdata;
871-
872- if (!(ctrl && value)) return;
873-if (_dav_debug < 0)
874-fprintf(stderr, "*** fd %p Content-Length: %s\n", ctrl, value);
875-/*@-unrecog@*/
876- ctrl->contentLength = strtoll(value, NULL, 10);
877-/*@=unrecog@*/
878-}
879-
880-static void davConnection(void * userdata, /*@null@*/ const char * value)
881- /*@modifies userdata @*/
882-{
883- FD_t ctrl = userdata;
884-
885- if (!(ctrl && value)) return;
886-if (_dav_debug < 0)
887-fprintf(stderr, "*** fd %p Connection: %s\n", ctrl, value);
888- if (!strcasecmp(value, "close"))
889- ctrl->persist = 0;
890- else if (!strcasecmp(value, "Keep-Alive"))
891- ctrl->persist = 1;
892-}
893-
894-/*@-mustmod@*/ /* HACK: stash error in *str. */
895-int davResp(urlinfo u, FD_t ctrl, /*@unused@*/ char *const * str)
896-{
897- int rc = 0;
898-
899- rc = ne_begin_request(ctrl->req);
900- rc = my_result("ne_begin_req(ctrl->req)", rc, NULL);
901-
902-if (_dav_debug < 0)
903-fprintf(stderr, "*** davResp(%p,%p,%p) sess %p req %p rc %d\n", u, ctrl, str, u->sess, ctrl->req, rc);
904-
905- /* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */
906-/*@-observertrans@*/
907- if (rc)
908- fdSetSyserrno(ctrl, errno, ftpStrerror(-rc));
909-/*@=observertrans@*/
910-
911- return rc;
912-}
913-/*@=mustmod@*/
914-
915-int davReq(FD_t ctrl, const char * httpCmd, const char * httpArg)
916-{
917- urlinfo u;
918- int rc = 0;
919-
920-assert(ctrl != NULL);
921- u = ctrl->url;
922- URLSANE(u);
923-
924-if (_dav_debug < 0)
925-fprintf(stderr, "*** davReq(%p,%s,\"%s\") entry sess %p req %p\n", ctrl, httpCmd, (httpArg ? httpArg : ""), u->sess, ctrl->req);
926-
927- ctrl->persist = (u->httpVersion > 0 ? 1 : 0);
928- ctrl = fdLink(ctrl, "open ctrl (davReq)");
929-
930-assert(u->sess != NULL);
931-assert(ctrl->req == NULL);
932-/*@-nullpass@*/
933- ctrl->req = ne_request_create(u->sess, httpCmd, httpArg);
934-/*@=nullpass@*/
935-assert(ctrl->req != NULL);
936-
937- ne_set_request_private(ctrl->req, "fd", ctrl);
938-
939-#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
940- ne_add_response_header_catcher(ctrl->req, davAllHeaders, ctrl);
941-
942- ne_add_response_header_handler(ctrl->req, "Content-Length",
943- davContentLength, ctrl);
944- ne_add_response_header_handler(ctrl->req, "Connection",
945- davConnection, ctrl);
946-#endif
947-
948- if (!strcmp(httpCmd, "PUT")) {
949-#ifdef NOTYET /* XXX HACK no wr_chunked until libneon supports */
950- ctrl->wr_chunked = 1;
951- ne_add_request_header(ctrl->req, "Transfer-Encoding", "chunked");
952- ne_set_request_chunked(ctrl->req, 1);
953- /* HACK: no retries if/when chunking. */
954- rc = davResp(u, ctrl, NULL);
955-#else
956- rc = FTPERR_SERVER_IO_ERROR;
957-#endif
958- } else {
959- /* HACK: possible Last-Modified: Tue, 02 Nov 2004 14:29:36 GMT */
960- /* HACK: possible ETag: "inode-size-mtime" */
961-#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
962- ne_add_response_header_handler(ctrl->req, "Accept-Ranges",
963- davAcceptRanges, u);
964-#endif
965- /* HACK: possible Transfer-Encoding: on GET. */
966-
967- /* HACK: other errors may need retry too. */
968- /* HACK: neon retries once, gud enuf. */
969- /* HACK: retry counter? */
970- do {
971- rc = davResp(u, ctrl, NULL);
972- } while (rc == NE_RETRY);
973- }
974- if (rc)
975- goto errxit;
976-
977-if (_dav_debug < 0)
978-fprintf(stderr, "*** davReq(%p,%s,\"%s\") exit sess %p req %p rc %d\n", ctrl, httpCmd, (httpArg ? httpArg : ""), u->sess, ctrl->req, rc);
979-
980-#if defined(HAVE_NEON_NE_GET_RESPONSE_HEADER)
981- davContentLength(ctrl,
982- ne_get_response_header(ctrl->req, "Content-Length"));
983- davConnection(ctrl,
984- ne_get_response_header(ctrl->req, "Connection"));
985- if (strcmp(httpCmd, "PUT"))
986- davAcceptRanges(u,
987- ne_get_response_header(ctrl->req, "Accept-Ranges"));
988-#endif
989-
990- ctrl = fdLink(ctrl, "open data (davReq)");
991- return 0;
992-
993-errxit:
994-/*@-observertrans@*/
995- fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
996-/*@=observertrans@*/
997-
998- /* HACK balance fd refs. ne_session_destroy to tear down non-keepalive? */
999- ctrl = fdLink(ctrl, "error data (davReq)");
1000-
1001- return rc;
1002-}
1003-
1004-FD_t davOpen(const char * url, /*@unused@*/ int flags,
1005- /*@unused@*/ mode_t mode, /*@out@*/ urlinfo * uret)
1006-{
1007- const char * path = NULL;
1008- urltype urlType = urlPath(url, &path);
1009- urlinfo u = NULL;
1010- FD_t fd = NULL;
1011- int rc;
1012-
1013-#if 0 /* XXX makeTempFile() heartburn */
1014- assert(!(flags & O_RDWR));
1015-#endif
1016-
1017-if (_dav_debug < 0)
1018-fprintf(stderr, "*** davOpen(%s,0x%x,0%o,%p)\n", url, flags, mode, uret);
1019- rc = davInit(url, &u);
1020- if (rc || u == NULL || u->sess == NULL)
1021- goto exit;
1022-
1023- if (u->ctrl == NULL)
1024- u->ctrl = fdNew("persist ctrl (davOpen)");
1025- if (u->ctrl->nrefs > 2 && u->data == NULL)
1026- u->data = fdNew("persist data (davOpen)");
1027-
1028- if (u->ctrl->url == NULL)
1029- fd = fdLink(u->ctrl, "grab ctrl (davOpen persist ctrl)");
1030- else if (u->data->url == NULL)
1031- fd = fdLink(u->data, "grab ctrl (davOpen persist data)");
1032- else
1033- fd = fdNew("grab ctrl (davOpen)");
1034-
1035- if (fd) {
1036- fdSetIo(fd, ufdio);
1037- fd->ftpFileDoneNeeded = 0;
1038- fd->rd_timeoutsecs = httpTimeoutSecs;
1039- fd->contentLength = fd->bytesRemain = -1;
1040- fd->url = urlLink(u, "url (davOpen)");
1041- fd = fdLink(fd, "grab data (davOpen)");
1042-assert(urlType == URL_IS_HTTPS || urlType == URL_IS_HTTP || urlType == URL_IS_HKP);
1043- fd->urlType = urlType;
1044- }
1045-
1046-exit:
1047-/*@-boundswrite@*/
1048- if (uret)
1049- *uret = u;
1050-/*@=boundswrite@*/
1051- /*@-refcounttrans@*/
1052- return fd;
1053- /*@=refcounttrans@*/
1054-}
1055-
1056-ssize_t davRead(void * cookie, /*@out@*/ char * buf, size_t count)
1057-{
1058- FD_t fd = cookie;
1059- ssize_t rc;
1060-
1061-#if 0
1062-assert(count >= 128); /* HACK: see ne_request.h comment */
1063-#endif
1064- rc = ne_read_response_block(fd->req, buf, count);
1065-
1066-if (_dav_debug < 0) {
1067-fprintf(stderr, "*** davRead(%p,%p,0x%x) rc 0x%x\n", cookie, buf, count, (unsigned)rc);
1068-#ifdef DYING
1069-hexdump(buf, rc);
1070-#endif
1071- }
1072-
1073- return rc;
1074-}
1075-
1076-ssize_t davWrite(void * cookie, const char * buf, size_t count)
1077-{
1078-#ifdef NOTYET /* XXX HACK no wr_chunked until libneon supports */
1079- FD_t fd = cookie;
1080- ssize_t rc;
1081- int xx;
1082-
1083-assert(fd->req != NULL);
1084- xx = ne_send_request_chunk(fd->req, buf, count);
1085-
1086- /* HACK: stupid error impedence matching. */
1087- rc = (xx == 0 ? count : -1);
1088-
1089-if (_dav_debug < 0)
1090-fprintf(stderr, "*** davWrite(%p,%p,0x%x) rc 0x%x\n", cookie, buf, count, rc);
1091-#ifdef DYING
1092-if (count > 0)
1093-hexdump(buf, count);
1094-#endif
1095-
1096- return rc;
1097-#else
1098- errno = EIO; /* HACK */
1099- return -1;
1100-#endif
1101-}
1102-
1103-int davSeek(void * cookie, /*@unused@*/ _libio_pos_t pos, int whence)
1104-{
1105-if (_dav_debug < 0)
1106-fprintf(stderr, "*** davSeek(%p,pos,%d)\n", cookie, whence);
1107- return -1;
1108-}
1109-
1110-/*@-mustmod@*/ /* HACK: fd->req is modified. */
1111-int davClose(void * cookie)
1112-{
1113-/*@-onlytrans@*/
1114- FD_t fd = cookie;
1115-/*@=onlytrans@*/
1116- int rc;
1117-
1118-assert(fd->req != NULL);
1119- rc = ne_end_request(fd->req);
1120- rc = my_result("ne_end_request(req)", rc, NULL);
1121-
1122- ne_request_destroy(fd->req);
1123- fd->req = NULL;
1124-
1125-if (_dav_debug < 0)
1126-fprintf(stderr, "*** davClose(%p) rc %d\n", fd, rc);
1127- return rc;
1128-}
1129-/*@=mustmod@*/
1130-
1131-/* =============================================================== */
1132-int davMkdir(const char * path, mode_t mode)
1133-{
1134- urlinfo u = NULL;
1135- const char * src = NULL;
1136- int rc;
1137-
1138- rc = davInit(path, &u);
1139- if (rc)
1140- goto exit;
1141-
1142- (void) urlPath(path, &src);
1143-
1144- rc = ne_mkcol(u->sess, path);
1145-
1146- if (rc) rc = -1; /* XXX HACK: errno impedance match */
1147-
1148- /* XXX HACK: verify getrestype(remote) == resr_collection */
1149-
1150-exit:
1151-if (_dav_debug)
1152-fprintf(stderr, "*** davMkdir(%s,0%o) rc %d\n", path, mode, rc);
1153- return rc;
1154-}
1155-
1156-int davRmdir(const char * path)
1157-{
1158- urlinfo u = NULL;
1159- const char * src = NULL;
1160- int rc;
1161-
1162- rc = davInit(path, &u);
1163- if (rc)
1164- goto exit;
1165-
1166- (void) urlPath(path, &src);
1167-
1168- /* XXX HACK: only getrestype(remote) == resr_collection */
1169-
1170- rc = ne_delete(u->sess, path);
1171-
1172- if (rc) rc = -1; /* XXX HACK: errno impedance match */
1173-
1174-exit:
1175-if (_dav_debug)
1176-fprintf(stderr, "*** davRmdir(%s) rc %d\n", path, rc);
1177- return rc;
1178-}
1179-
1180-int davRename(const char * oldpath, const char * newpath)
1181-{
1182- urlinfo u = NULL;
1183- const char * src = NULL;
1184- const char * dst = NULL;
1185- int overwrite = 1; /* HACK: set this correctly. */
1186- int rc;
1187-
1188- rc = davInit(oldpath, &u);
1189- if (rc)
1190- goto exit;
1191-
1192- (void) urlPath(oldpath, &src);
1193- (void) urlPath(newpath, &dst);
1194-
1195- /* XXX HACK: only getrestype(remote) != resr_collection */
1196-
1197- rc = ne_move(u->sess, overwrite, src, dst);
1198-
1199- if (rc) rc = -1; /* XXX HACK: errno impedance match */
1200-
1201-exit:
1202-if (_dav_debug)
1203-fprintf(stderr, "*** davRename(%s,%s) rc %d\n", oldpath, newpath, rc);
1204- return rc;
1205-}
1206-
1207-int davUnlink(const char * path)
1208-{
1209- urlinfo u = NULL;
1210- const char * src = NULL;
1211- int rc;
1212-
1213- rc = davInit(path, &u);
1214- if (rc)
1215- goto exit;
1216-
1217- (void) urlPath(path, &src);
1218-
1219- /* XXX HACK: only getrestype(remote) != resr_collection */
1220-
1221- rc = ne_delete(u->sess, src);
1222-
1223-exit:
1224- if (rc) rc = -1; /* XXX HACK: errno impedance match */
1225-
1226-if (_dav_debug)
1227-fprintf(stderr, "*** davUnlink(%s) rc %d\n", path, rc);
1228- return rc;
1229-}
1230-
1231-#ifdef NOTYET
1232-static int davChdir(const char * path)
1233- /*@globals h_errno, fileSystem, internalState @*/
1234- /*@modifies fileSystem, internalState @*/
1235-{
1236- return davCommand("CWD", path, NULL);
1237-}
1238-#endif /* NOTYET */
1239-
1240-/* =============================================================== */
1241-
1242-static const char * statstr(const struct stat * st,
1243- /*@returned@*/ /*@out@*/ char * buf)
1244- /*@modifies *buf @*/
1245-{
1246- sprintf(buf,
1247- "*** dev %x ino %x mode %0o nlink %d uid %d gid %d rdev %x size %x\n",
1248- (unsigned)st->st_dev,
1249- (unsigned)st->st_ino,
1250- st->st_mode,
1251- (unsigned)st->st_nlink,
1252- st->st_uid,
1253- st->st_gid,
1254- (unsigned)st->st_rdev,
1255- (unsigned)st->st_size);
1256- return buf;
1257-}
1258-
1259-/*@unchecked@*/
1260-static int dav_st_ino = 0xdead0000;
1261-
1262-/*@-boundswrite@*/
1263-int davStat(const char * path, /*@out@*/ struct stat *st)
1264- /*@globals dav_st_ino, fileSystem, internalState @*/
1265- /*@modifies *st, dav_st_ino, fileSystem, internalState @*/
1266-{
1267- struct fetch_context_s * ctx = NULL;
1268- char buf[1024];
1269- int rc = -1;
1270-
1271-/* HACK: neon really wants collections with trailing '/' */
1272- ctx = fetch_create_context(path);
1273- if (ctx == NULL) {
1274-/* HACK: errno = ??? */
1275- goto exit;
1276- }
1277- rc = davNLST(ctx);
1278- if (rc) {
1279-/* HACK: errno = ??? */
1280- goto exit;
1281- }
1282-
1283- memset(st, 0, sizeof(*st));
1284- st->st_mode = ctx->modes[0];
1285- st->st_size = ctx->sizes[0];
1286- st->st_mtime = ctx->mtimes[0];
1287- if (S_ISDIR(st->st_mode)) {
1288- st->st_nlink = 2;
1289- st->st_mode |= 0755;
1290- } else
1291- if (S_ISREG(st->st_mode)) {
1292- st->st_nlink = 1;
1293- st->st_mode |= 0644;
1294- }
1295-
1296- /* XXX fts(3) needs/uses st_ino, make something up for now. */
1297- if (st->st_ino == 0)
1298- st->st_ino = dav_st_ino++;
1299-if (_dav_debug < 0)
1300-fprintf(stderr, "*** davStat(%s) rc %d\n%s", path, rc, statstr(st, buf));
1301-exit:
1302- ctx = fetch_destroy_context(ctx);
1303- return rc;
1304-}
1305-/*@=boundswrite@*/
1306-
1307-/*@-boundswrite@*/
1308-int davLstat(const char * path, /*@out@*/ struct stat *st)
1309- /*@globals dav_st_ino, fileSystem, internalState @*/
1310- /*@modifies *st, dav_st_ino, fileSystem, internalState @*/
1311-{
1312- struct fetch_context_s * ctx = NULL;
1313- char buf[1024];
1314- int rc = -1;
1315-
1316-/* HACK: neon really wants collections with trailing '/' */
1317- ctx = fetch_create_context(path);
1318- if (ctx == NULL) {
1319-/* HACK: errno = ??? */
1320- goto exit;
1321- }
1322- rc = davNLST(ctx);
1323- if (rc) {
1324-/* HACK: errno = ??? */
1325- goto exit;
1326- }
1327-
1328- memset(st, 0, sizeof(*st));
1329- st->st_mode = ctx->modes[0];
1330- st->st_size = ctx->sizes[0];
1331- st->st_mtime = ctx->mtimes[0];
1332- if (S_ISDIR(st->st_mode)) {
1333- st->st_nlink = 2;
1334- st->st_mode |= 0755;
1335- } else
1336- if (S_ISREG(st->st_mode)) {
1337- st->st_nlink = 1;
1338- st->st_mode |= 0644;
1339- }
1340-
1341- /* XXX fts(3) needs/uses st_ino, make something up for now. */
1342- if (st->st_ino == 0)
1343- st->st_ino = dav_st_ino++;
1344-if (_dav_debug < 0)
1345-fprintf(stderr, "*** davLstat(%s) rc %d\n%s\n", path, rc, statstr(st, buf));
1346-exit:
1347- ctx = fetch_destroy_context(ctx);
1348- return rc;
1349-}
1350-/*@=boundswrite@*/
1351-
1352-#ifdef NOTYET
1353-static int davReadlink(const char * path, /*@out@*/ char * buf, size_t bufsiz)
1354- /*@globals h_errno, fileSystem, internalState @*/
1355- /*@modifies *buf, fileSystem, internalState @*/
1356-{
1357- int rc;
1358- rc = davNLST(path, DO_FTP_READLINK, NULL, buf, bufsiz);
1359-if (_dav_debug < 0)
1360-fprintf(stderr, "*** davReadlink(%s) rc %d\n", path, rc);
1361- return rc;
1362-}
1363-#endif /* NOTYET */
1364-
1365-/* =============================================================== */
1366 /*@unchecked@*/
1367 int avmagicdir = 0x3607113;
1368
1369@@ -1475,172 +166,3 @@
1370 /*@=kepttrans@*/
1371 }
1372 /*@=boundswrite@*/
1373-
1374-/* =============================================================== */
1375-/*@unchecked@*/
1376-int davmagicdir = 0x8440291;
1377-
1378-int davClosedir(/*@only@*/ DIR * dir)
1379-{
1380- DAVDIR avdir = (DAVDIR)dir;
1381-
1382-if (_dav_debug < 0)
1383-fprintf(stderr, "*** davClosedir(%p)\n", avdir);
1384-
1385-#if defined(HAVE_PTHREAD_H)
1386-/*@-moduncon -noeffectuncon @*/
1387- (void) pthread_mutex_destroy(&avdir->lock);
1388-/*@=moduncon =noeffectuncon @*/
1389-#endif
1390-
1391- avdir = _free(avdir);
1392- return 0;
1393-}
1394-
1395-struct dirent * davReaddir(DIR * dir)
1396-{
1397- DAVDIR avdir = (DAVDIR)dir;
1398- struct dirent * dp;
1399- const char ** av;
1400- unsigned char * dt;
1401- int ac;
1402- int i;
1403-
1404- if (avdir == NULL || !ISDAVMAGIC(avdir) || avdir->data == NULL) {
1405- /* XXX TODO: EBADF errno. */
1406- return NULL;
1407- }
1408-
1409- dp = (struct dirent *) avdir->data;
1410- av = (const char **) (dp + 1);
1411- ac = avdir->size;
1412- dt = (char *) (av + (ac + 1));
1413- i = avdir->offset + 1;
1414-
1415-/*@-boundsread@*/
1416- if (i < 0 || i >= ac || av[i] == NULL)
1417- return NULL;
1418-/*@=boundsread@*/
1419-
1420- avdir->offset = i;
1421-
1422- /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
1423-/*@-type@*/
1424- dp->d_ino = i + 1; /* W2DO? */
1425- dp->d_reclen = 0; /* W2DO? */
1426-
1427-#if !defined(hpux) && !defined(sun)
1428-#if !defined(__APPLE__)
1429- dp->d_off = 0; /* W2DO? */
1430-#endif
1431-/*@-boundsread@*/
1432- dp->d_type = dt[i];
1433-/*@=boundsread@*/
1434-#endif
1435-/*@=type@*/
1436-
1437- strncpy(dp->d_name, av[i], sizeof(dp->d_name));
1438-if (_dav_debug < 0)
1439-fprintf(stderr, "*** davReaddir(%p) %p \"%s\"\n", (void *)avdir, dp, dp->d_name);
1440-
1441- return dp;
1442-}
1443-
1444-/*@-boundswrite@*/
1445-DIR * davOpendir(const char * path)
1446-{
1447- struct fetch_context_s * ctx;
1448- DAVDIR avdir;
1449- struct dirent * dp;
1450- size_t nb;
1451- const char ** av, ** nav;
1452- unsigned char * dt;
1453- char * t;
1454- int ac, nac;
1455- int rc;
1456-
1457- /* HACK: glob does not pass dirs with trailing '/' */
1458- nb = strlen(path)+1;
1459-/*@-branchstate@*/
1460- if (path[nb-1] != '/') {
1461- char * npath = alloca(nb+1);
1462- *npath = '\0';
1463- (void) stpcpy( stpcpy(npath, path), "/");
1464- path = npath;
1465- }
1466-/*@=branchstate@*/
1467-
1468-if (_dav_debug < 0)
1469-fprintf(stderr, "*** davOpendir(%s)\n", path);
1470-
1471- /* Load DAV collection into argv. */
1472- ctx = fetch_create_context(path);
1473- if (ctx == NULL) {
1474-/* HACK: errno = ??? */
1475- return NULL;
1476- }
1477- rc = davNLST(ctx);
1478- if (rc) {
1479-/* HACK: errno = ??? */
1480- return NULL;
1481- }
1482-
1483- nb = 0;
1484- ac = 0;
1485- av = ctx->av;
1486- if (av != NULL)
1487- while (av[ac] != NULL)
1488- nb += strlen(av[ac++]) + 1;
1489- ac += 2; /* for "." and ".." */
1490- nb += sizeof(".") + sizeof("..");
1491-
1492- nb += sizeof(*avdir) + sizeof(*dp) + ((ac + 1) * sizeof(*av)) + (ac + 1);
1493- avdir = xcalloc(1, nb);
1494- /*@-abstract@*/
1495- dp = (struct dirent *) (avdir + 1);
1496- nav = (const char **) (dp + 1);
1497- dt = (char *) (nav + (ac + 1));
1498- t = (char *) (dt + ac + 1);
1499- /*@=abstract@*/
1500-
1501- avdir->fd = davmagicdir;
1502-/*@-usereleased@*/
1503- avdir->data = (char *) dp;
1504-/*@=usereleased@*/
1505- avdir->allocation = nb;
1506- avdir->size = ac;
1507- avdir->offset = -1;
1508- avdir->filepos = 0;
1509-
1510-#if defined(HAVE_PTHREAD_H)
1511-/*@-moduncon -noeffectuncon -nullpass @*/
1512- (void) pthread_mutex_init(&avdir->lock, NULL);
1513-/*@=moduncon =noeffectuncon =nullpass @*/
1514-#endif
1515-
1516- nac = 0;
1517-/*@-dependenttrans -unrecog@*/
1518- dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, "."); t++;
1519- dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, ".."); t++;
1520-/*@=dependenttrans =unrecog@*/
1521-
1522- /* Copy DAV items into DIR elments. */
1523- ac = 0;
1524- if (av != NULL)
1525- while (av[ac] != NULL) {
1526- nav[nac] = t;
1527- dt[nac] = (S_ISDIR(ctx->modes[ac]) ? DT_DIR : DT_REG);
1528- t = stpcpy(t, av[ac]);
1529- ac++;
1530- t++;
1531- nac++;
1532- }
1533- nav[nac] = NULL;
1534-
1535- ctx = fetch_destroy_context(ctx);
1536-
1537-/*@-kepttrans@*/
1538- return (DIR *) avdir;
1539-/*@=kepttrans@*/
1540-}
1541-/*@=modfilesys@*/
1542diff -ur rpm-4.4.1/rpmio/rpmdav.h rpm-4.4.1-no-neon/rpmio/rpmdav.h
1543--- rpm-4.4.1/rpmio/rpmdav.h 2005-01-17 19:46:27.000000000 +0100
1544+++ rpm-4.4.1-no-neon/rpmio/rpmdav.h 2005-06-19 20:39:46.034218000 +0200
1545@@ -80,131 +80,6 @@
1546 /*@globals fileSystem, internalState @*/
1547 /*@modifies fileSystem, internalState @*/;
1548
1549-/**
1550- * Send a http request.
1551- * @param ctrl
1552- * @param httpCmd http command
1553- * @param httpArg http command argument (NULL if none)
1554- * @returns 0 on success
1555- */
1556-int davReq(FD_t ctrl, const char * httpCmd, /*@null@*/ const char * httpArg)
1557- /*@globals fileSystem, internalState @*/
1558- /*@modifies ctrl, fileSystem, internalState @*/;
1559-
1560-/**
1561- * Read a http response.
1562- * @param u
1563- * @param cntl
1564- * @retval *str error msg
1565- * @returns 0 on success
1566- */
1567-int davResp(urlinfo u, FD_t ctrl, /*@out@*/ /*@null@*/ char *const * str)
1568- /*@globals fileSystem, internalState @*/
1569- /*@modifies ctrl, *str, fileSystem, internalState @*/;
1570-
1571-/**
1572- */
1573-/*@null@*/
1574-FD_t davOpen(const char * url, /*@unused@*/ int flags,
1575- /*@unused@*/ mode_t mode, /*@out@*/ urlinfo * uret)
1576- /*@globals internalState @*/
1577- /*@modifies *uret, internalState @*/;
1578-
1579-/**
1580- */
1581-/*@-incondefs@*/
1582-ssize_t davRead(void * cookie, /*@out@*/ char * buf, size_t count)
1583- /*@globals fileSystem, internalState @*/
1584- /*@modifies buf, fileSystem, internalState @*/
1585- /*@requires maxSet(buf) >= (count - 1) @*/
1586- /*@ensures maxRead(buf) == result @*/;
1587-/*@=incondefs@*/
1588-
1589-/**
1590- */
1591-ssize_t davWrite(void * cookie, const char * buf, size_t count)
1592- /*@globals fileSystem, internalState @*/
1593- /*@modifies fileSystem, internalState @*/;
1594-
1595-/**
1596- */
1597-int davSeek(void * cookie, _libio_pos_t pos, int whence)
1598- /*@globals fileSystem, internalState @*/
1599- /*@modifies fileSystem, internalState @*/;
1600-
1601-/**
1602- */
1603-int davClose(void * cookie)
1604- /*@globals fileSystem, internalState @*/
1605- /*@modifies cookie, fileSystem, internalState @*/;
1606-
1607-/**
1608- */
1609-int davMkdir(const char * path, mode_t mode)
1610- /*@globals fileSystem, internalState @*/
1611- /*@modifies fileSystem, internalState @*/;
1612-
1613-/**
1614- */
1615-int davRmdir(const char * path)
1616- /*@globals fileSystem, internalState @*/
1617- /*@modifies fileSystem, internalState @*/;
1618-
1619-/**
1620- */
1621-int davRename(const char * oldpath, const char * newpath)
1622- /*@globals fileSystem, internalState @*/
1623- /*@modifies fileSystem, internalState @*/;
1624-
1625-/**
1626- */
1627-int davUnlink(const char * path)
1628- /*@globals fileSystem, internalState @*/
1629- /*@modifies fileSystem, internalState @*/;
1630-
1631-/**
1632- * Close a DAV collection.
1633- * @param dir argv DIR
1634- * @return 0 always
1635- */
1636-int davClosedir(/*@only@*/ DIR * dir)
1637- /*@globals fileSystem @*/
1638- /*@modifies dir, fileSystem @*/;
1639-
1640-/**
1641- * Return next entry from a DAV collection.
1642- * @param dir argv DIR
1643- * @return next entry
1644- */
1645-/*@dependent@*/ /*@null@*/
1646-struct dirent * davReaddir(DIR * dir)
1647- /*@globals fileSystem @*/
1648- /*@modifies fileSystem @*/;
1649-
1650-/**
1651- * Create an argv directory from DAV collection.
1652- * @param path URL for DAV collection path
1653- * @return argv DIR
1654- */
1655-/*@null@*/
1656-DIR * davOpendir(const char * path)
1657- /*@globals fileSystem, internalState @*/
1658- /*@modifies fileSystem, internalState @*/;
1659-
1660-/**
1661- * stat(2) clone.
1662- */
1663-int davStat(const char * path, /*@out@*/ struct stat * st)
1664- /*@globals fileSystem, internalState @*/
1665- /*@modifies *st, fileSystem, internalState @*/;
1666-
1667-/**
1668- * lstat(2) clone.
1669- */
1670-int davLstat(const char * path, /*@out@*/ struct stat * st)
1671- /*@globals fileSystem, internalState @*/
1672- /*@modifies *st, fileSystem, internalState @*/;
1673-
1674 #ifdef __cplusplus
1675 }
1676 #endif
1677diff -ur rpm-4.4.1/rpmio/rpmio.c rpm-4.4.1-no-neon/rpmio/rpmio.c
1678--- rpm-4.4.1/rpmio/rpmio.c 2005-01-26 04:39:58.000000000 +0100
1679+++ rpm-4.4.1-no-neon/rpmio/rpmio.c 2005-06-19 20:34:07.005758160 +0200
1680@@ -104,11 +104,6 @@
1681 /**
1682 */
1683 /*@unchecked@*/
1684-static int httpTimeoutSecs = TIMEOUT_SECS;
1685-
1686-/**
1687- */
1688-/*@unchecked@*/
1689 int _rpmio_debug = 0;
1690
1691 /**
1692@@ -369,13 +364,6 @@
1693
1694 fdstat_enter(fd, FDSTAT_READ);
1695 /*@-boundswrite@*/
1696- /* HACK: flimsy wiring for davRead */
1697- if (fd->req != NULL) {
1698- rc = davRead(fd, buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1699- /* XXX Chunked davRead EOF. */
1700- if (rc == 0)
1701- fd->bytesRemain = 0;
1702- } else
1703 rc = read(fdFileno(fd), buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1704 /*@=boundswrite@*/
1705 fdstat_exit(fd, FDSTAT_READ, rc);
1706@@ -403,10 +391,6 @@
1707
1708 fdstat_enter(fd, FDSTAT_WRITE);
1709 /*@-boundsread@*/
1710- /* HACK: flimsy wiring for davWrite */
1711- if (fd->req != NULL)
1712- rc = davWrite(fd, buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1713- else
1714 rc = write(fdno, buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
1715 /*@=boundsread@*/
1716 fdstat_exit(fd, FDSTAT_WRITE, rc);
1717@@ -453,11 +437,6 @@
1718 fdSetFdno(fd, -1);
1719
1720 fdstat_enter(fd, FDSTAT_CLOSE);
1721- /* HACK: flimsy wiring for davClose */
1722-/*@-branchstate@*/
1723- if (fd->req != NULL)
1724- rc = davClose(fd);
1725- else
1726 rc = ((fdno >= 0) ? close(fdno) : -2);
1727 /*@=branchstate@*/
1728 fdstat_exit(fd, FDSTAT_CLOSE, rc);
1729@@ -509,10 +488,6 @@
1730 FD_ZERO(&wrfds);
1731 #endif
1732
1733- /* HACK: flimsy wiring for davWrite */
1734- if (fd->req != NULL)
1735- return 1;
1736-
1737 if ((fdno = fdFileno(fd)) < 0)
1738 return -1; /* XXX W2DO? */
1739
1740@@ -564,10 +539,6 @@
1741 FD_ZERO(&rdfds);
1742 #endif
1743
1744- /* HACK: flimsy wiring for davRead */
1745- if (fd->req != NULL)
1746- return 1;
1747-
1748 if ((fdno = fdFileno(fd)) < 0)
1749 return -1; /* XXX W2DO? */
1750
1751@@ -1562,152 +1533,6 @@
1752 return rc;
1753 }
1754
1755-static int httpResp(urlinfo u, FD_t ctrl, /*@out@*/ char ** str)
1756- /*@globals fileSystem @*/
1757- /*@modifies ctrl, *str, fileSystem @*/
1758-{
1759- int ec = 0;
1760- int rc;
1761-
1762- URLSANE(u);
1763- rc = checkResponse(u, ctrl, &ec, str);
1764-
1765-if (_ftp_debug && !(rc == 0 && (ec == 200 || ec == 201)))
1766-fprintf(stderr, "*** httpResp: rc %d ec %d\n", rc, ec);
1767-
1768- switch (ec) {
1769- case 200:
1770- case 201: /* 201 Created. */
1771- break;
1772- case 204: /* HACK: if overwriting, 204 No Content. */
1773- case 403: /* 403 Forbidden. */
1774- ctrl->syserrno = EACCES; /* HACK */
1775- rc = FTPERR_UNKNOWN;
1776- break;
1777- default:
1778- rc = FTPERR_FILE_NOT_FOUND;
1779- break;
1780- }
1781- return rc;
1782-}
1783-
1784-static int httpReq(FD_t ctrl, const char * httpCmd, const char * httpArg)
1785- /*@globals h_errno, fileSystem, internalState @*/
1786- /*@modifies ctrl, fileSystem, internalState @*/
1787-{
1788- urlinfo u;
1789- const char * host;
1790- const char * path;
1791- int port;
1792- int rc;
1793- char * req;
1794- size_t len;
1795- int retrying = 0;
1796-
1797-assert(ctrl != NULL);
1798- u = ctrl->url;
1799- URLSANE(u);
1800-
1801- if (((host = (u->proxyh ? u->proxyh : u->host)) == NULL))
1802- return FTPERR_BAD_HOSTNAME;
1803-
1804- if ((port = (u->proxyp > 0 ? u->proxyp : u->port)) < 0) port = 80;
1805- path = (u->proxyh || u->proxyp > 0) ? u->url : httpArg;
1806- /*@-branchstate@*/
1807- if (path == NULL) path = "";
1808- /*@=branchstate@*/
1809-
1810-reopen:
1811- /*@-branchstate@*/
1812- if (fdFileno(ctrl) >= 0 && (rc = fdWritable(ctrl, 0)) < 1) {
1813- /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
1814- }
1815- /*@=branchstate@*/
1816-
1817-/*@-usereleased@*/
1818- if (fdFileno(ctrl) < 0) {
1819- rc = tcpConnect(ctrl, host, port);
1820- if (rc < 0)
1821- goto errxit2;
1822- ctrl = fdLink(ctrl, "open ctrl (httpReq)");
1823- }
1824-
1825- len = sizeof("\
1826-req x HTTP/1.0\r\n\
1827-User-Agent: rpm/3.0.4\r\n\
1828-Host: y:z\r\n\
1829-Accept: text/plain\r\n\
1830-Transfer-Encoding: chunked\r\n\
1831-\r\n\
1832-") + strlen(httpCmd) + strlen(path) + sizeof(VERSION) + strlen(host) + 20;
1833-
1834-/*@-boundswrite@*/
1835- req = alloca(len);
1836- *req = '\0';
1837-
1838- if (!strcmp(httpCmd, "PUT")) {
1839- sprintf(req, "\
1840-%s %s HTTP/1.%d\r\n\
1841-User-Agent: rpm/%s\r\n\
1842-Host: %s:%d\r\n\
1843-Accept: text/plain\r\n\
1844-Transfer-Encoding: chunked\r\n\
1845-\r\n\
1846-", httpCmd, path, (u->httpVersion ? 1 : 0), VERSION, host, port);
1847-} else {
1848- sprintf(req, "\
1849-%s %s HTTP/1.%d\r\n\
1850-User-Agent: rpm/%s\r\n\
1851-Host: %s:%d\r\n\
1852-Accept: text/plain\r\n\
1853-\r\n\
1854-", httpCmd, path, (u->httpVersion ? 1 : 0), VERSION, host, port);
1855-}
1856-/*@=boundswrite@*/
1857-
1858-if (_ftp_debug)
1859-fprintf(stderr, "-> %s", req);
1860-
1861- len = strlen(req);
1862- if (fdWrite(ctrl, req, len) != len) {
1863- rc = FTPERR_SERVER_IO_ERROR;
1864- goto errxit;
1865- }
1866-
1867- /*@-branchstate@*/
1868- if (!strcmp(httpCmd, "PUT")) {
1869- ctrl->wr_chunked = 1;
1870- } else {
1871-
1872- rc = httpResp(u, ctrl, NULL);
1873-
1874- if (rc) {
1875- if (!retrying) { /* not HTTP_OK */
1876- retrying = 1;
1877- /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
1878- goto reopen;
1879- }
1880- goto errxit;
1881- }
1882- }
1883- /*@=branchstate@*/
1884-
1885- ctrl = fdLink(ctrl, "open data (httpReq)");
1886- return 0;
1887-
1888-errxit:
1889- /*@-observertrans@*/
1890- fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
1891- /*@=observertrans@*/
1892-errxit2:
1893- /*@-branchstate@*/
1894- if (fdFileno(ctrl) >= 0)
1895- /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
1896- /*@=branchstate@*/
1897- return rc;
1898-/*@=usereleased@*/
1899-}
1900-
1901 /* XXX DYING: unused */
1902 void * ufdGetUrlinfo(FD_t fd)
1903 {
1904@@ -2064,29 +1889,6 @@
1905 fd->wr_chunked = 0;
1906 }
1907 break;
1908- case URL_IS_HTTPS:
1909- case URL_IS_HTTP:
1910- case URL_IS_HKP:
1911- fd = davOpen(url, flags, mode, &u);
1912- if (fd == NULL || u == NULL)
1913- break;
1914-
1915- cmd = ((flags & O_WRONLY)
1916- ? ((flags & O_APPEND) ? "PUT" :
1917- ((flags & O_CREAT) ? "PUT" : "PUT"))
1918- : "GET");
1919- u->openError = davReq(fd, cmd, path);
1920- if (u->openError < 0) {
1921- /* XXX make sure that we can exit through ufdClose */
1922- fd = fdLink(fd, "error ctrl (ufdOpen HTTP)");
1923- fd = fdLink(fd, "error data (ufdOpen HTTP)");
1924- } else {
1925- fd->bytesRemain = ((!strcmp(cmd, "GET"))
1926- ? fd->contentLength : -1);
1927- fd->wr_chunked = ((!strcmp(cmd, "PUT"))
1928- ? fd->wr_chunked : 0);
1929- }
1930- break;
1931 case URL_IS_DASH:
1932 assert(!(flags & O_RDWR));
1933 fd = fdDup( ((flags & O_WRONLY) ? STDOUT_FILENO : STDIN_FILENO) );
1934@@ -2703,10 +2505,8 @@
1935 if (fd->nfps > 0 && fpno == -1 &&
1936 fd->fps[fd->nfps-1].io == ufdio &&
1937 fd->fps[fd->nfps-1].fp == fp &&
1938- (fd->fps[fd->nfps-1].fdno >= 0 || fd->req != NULL))
1939+ fd->fps[fd->nfps-1].fdno >= 0)
1940 {
1941- int hadreqpersist = (fd->req != NULL);
1942-
1943 if (fp)
1944 rc = fflush(fp);
1945 fd->nfps--;
1946@@ -2716,26 +2516,9 @@
1947 /*@-usereleased@*/
1948 if (fdGetFdno(fd) >= 0)
1949 break;
1950- if (!fd->persist)
1951- hadreqpersist = 0;
1952 fdSetFp(fd, NULL);
1953 fd->nfps++;
1954 if (fp) {
1955- /* HACK: flimsy Keepalive wiring. */
1956- if (hadreqpersist) {
1957- fd->nfps--;
1958-/*@-exposetrans@*/
1959- fdSetFp(fd, fp);
1960-/*@=exposetrans@*/
1961-/*@-refcounttrans@*/
1962- (void) fdClose(fd);
1963-/*@=refcounttrans@*/
1964- fdSetFp(fd, NULL);
1965- fd->nfps++;
1966-/*@-refcounttrans@*/
1967- (void) fdClose(fd);
1968-/*@=refcounttrans@*/
1969- } else
1970 rc = fclose(fp);
1971 }
1972 fdPop(fd);
1973@@ -2984,18 +2767,9 @@
1974 return NULL;
1975 }
1976 } else {
1977- FILE *fp;
1978- int fdno;
1979- int isHTTP = 0;
1980-
1981 /* XXX gzdio and bzdio here too */
1982
1983 switch (urlIsURL(path)) {
1984- case URL_IS_HTTPS:
1985- case URL_IS_HTTP:
1986- case URL_IS_HKP:
1987- isHTTP = 1;
1988- /*@fallthrough@*/
1989 case URL_IS_PATH:
1990 case URL_IS_DASH:
1991 case URL_IS_FTP:
1992@@ -3003,7 +2777,7 @@
1993 if (_rpmio_debug)
1994 fprintf(stderr, "*** Fopen ufdio path %s fmode %s\n", path, fmode);
1995 fd = ufdOpen(path, flags, perms);
1996- if (fd == NULL || !(fdFileno(fd) >= 0 || fd->req != NULL))
1997+ if (fd == NULL || !(fdFileno(fd) >= 0))
1998 return fd;
1999 break;
2000 default:
2001@@ -3012,15 +2786,6 @@
2002 return NULL;
2003 /*@notreached@*/ break;
2004 }
2005-
2006- /* XXX persistent HTTP/1.1 returns the previously opened fp */
2007- if (isHTTP && ((fp = fdGetFp(fd)) != NULL) && ((fdno = fdGetFdno(fd)) >= 0 || fd->req != NULL))
2008- {
2009- /*@+voidabstract@*/
2010- fdPush(fd, fpio, fp, fileno(fp)); /* Push fpio onto stack */
2011- /*@=voidabstract@*/
2012- return fd;
2013- }
2014 }
2015 /*@=branchstate@*/
2016
2017@@ -3056,10 +2821,6 @@
2018 int i, rc = 0;
2019
2020 if (fd == NULL) return -1;
2021- if (fd->req != NULL) {
2022- /* HACK: flimsy wiring for neon errors. */
2023- rc = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0;
2024- } else
2025 for (i = fd->nfps; rc == 0 && i >= 0; i--) {
2026 /*@-boundsread@*/
2027 FDSTACK_t * fps = &fd->fps[i];
2028@@ -3094,9 +2855,6 @@
2029 {
2030 int i, rc = -1;
2031
2032- if (fd->req != NULL)
2033- rc = 123456789; /* HACK: https has no steenkin fileno. */
2034- else
2035 for (i = fd->nfps ; rc == -1 && i >= 0; i--) {
2036 /*@-boundsread@*/
2037 rc = fd->fps[i].fdno;
2038diff -ur rpm-4.4.1/rpmio/rpmio_internal.h rpm-4.4.1-no-neon/rpmio/rpmio_internal.h
2039--- rpm-4.4.1/rpmio/rpmio_internal.h 2005-02-08 18:14:20.000000000 +0100
2040+++ rpm-4.4.1-no-neon/rpmio/rpmio_internal.h 2005-06-19 20:34:07.006758008 +0200
2041@@ -152,7 +152,6 @@
2042 /*@dependent@*/
2043 void * url; /* ufdio: URL info */
2044 /*@relnull@*/
2045- void * req; /* ufdio: HTTP request */
2046
2047 int rd_timeoutsecs; /* ufdRead: per FD_t timer */
2048 ssize_t bytesRemain; /* ufdio: */
2049diff -ur rpm-4.4.1/rpmio/rpmrpc.c rpm-4.4.1-no-neon/rpmio/rpmrpc.c
2050--- rpm-4.4.1/rpmio/rpmrpc.c 2005-01-26 06:16:09.000000000 +0100
2051+++ rpm-4.4.1-no-neon/rpmio/rpmrpc.c 2005-06-19 20:34:07.008757704 +0200
2052@@ -91,10 +91,6 @@
2053 case URL_IS_FTP:
2054 return ftpMkdir(path, mode);
2055 /*@notreached@*/ break;
2056- case URL_IS_HTTPS:
2057- case URL_IS_HTTP:
2058- return davMkdir(path, mode);
2059- /*@notreached@*/ break;
2060 case URL_IS_PATH:
2061 path = lpath;
2062 /*@fallthrough@*/
2063@@ -118,14 +114,6 @@
2064 case URL_IS_FTP:
2065 return ftpChdir(path);
2066 /*@notreached@*/ break;
2067- case URL_IS_HTTPS:
2068- case URL_IS_HTTP:
2069-#ifdef NOTYET
2070- return davChdir(path);
2071-#else
2072- return -2;
2073-#endif
2074- /*@notreached@*/ break;
2075 case URL_IS_PATH:
2076 path = lpath;
2077 /*@fallthrough@*/
2078@@ -149,10 +137,6 @@
2079 case URL_IS_FTP:
2080 return ftpRmdir(path);
2081 /*@notreached@*/ break;
2082- case URL_IS_HTTPS:
2083- case URL_IS_HTTP:
2084- return davRmdir(path);
2085- /*@notreached@*/ break;
2086 case URL_IS_PATH:
2087 path = lpath;
2088 /*@fallthrough@*/
2089@@ -180,10 +164,6 @@
2090
2091 oldut = urlPath(oldpath, &oe);
2092 switch (oldut) {
2093- case URL_IS_HTTPS:
2094- case URL_IS_HTTP:
2095- return davRename(oldpath, newpath);
2096- /*@notreached@*/ break;
2097 case URL_IS_FTP: /* XXX WRONG WRONG WRONG */
2098 case URL_IS_PATH:
2099 case URL_IS_UNKNOWN:
2100@@ -278,10 +258,6 @@
2101 case URL_IS_FTP:
2102 return ftpUnlink(path);
2103 /*@notreached@*/ break;
2104- case URL_IS_HTTPS:
2105- case URL_IS_HTTP:
2106- return davUnlink(path);
2107- /*@notreached@*/ break;
2108 case URL_IS_PATH:
2109 path = lpath;
2110 /*@fallthrough@*/
2111@@ -1280,10 +1256,6 @@
2112 case URL_IS_FTP:
2113 return ftpStat(path, st);
2114 /*@notreached@*/ break;
2115- case URL_IS_HTTPS:
2116- case URL_IS_HTTP:
2117- return davStat(path, st);
2118- /*@notreached@*/ break;
2119 case URL_IS_PATH:
2120 path = lpath;
2121 /*@fallthrough@*/
2122@@ -1309,10 +1281,6 @@
2123 case URL_IS_FTP:
2124 return ftpLstat(path, st);
2125 /*@notreached@*/ break;
2126- case URL_IS_HTTPS:
2127- case URL_IS_HTTP:
2128- return davLstat(path, st);
2129- /*@notreached@*/ break;
2130 case URL_IS_PATH:
2131 path = lpath;
2132 /*@fallthrough@*/
2133@@ -1336,14 +1304,6 @@
2134 case URL_IS_FTP:
2135 return ftpReadlink(path, buf, bufsiz);
2136 /*@notreached@*/ break;
2137- case URL_IS_HTTPS:
2138- case URL_IS_HTTP:
2139-#ifdef NOTYET
2140- return davReadlink(path, buf, bufsiz);
2141-#else
2142- return -2;
2143-#endif
2144- /*@notreached@*/ break;
2145 case URL_IS_PATH:
2146 path = lpath;
2147 /*@fallthrough@*/
2148@@ -1487,10 +1447,6 @@
2149 case URL_IS_FTP:
2150 return ftpOpendir(path);
2151 /*@notreached@*/ break;
2152- case URL_IS_HTTPS:
2153- case URL_IS_HTTP:
2154- return davOpendir(path);
2155- /*@notreached@*/ break;
2156 case URL_IS_PATH:
2157 path = lpath;
2158 /*@fallthrough@*/
2159@@ -1515,8 +1471,6 @@
2160 return NULL;
2161 if (ISAVMAGIC(dir))
2162 return avReaddir(dir);
2163- if (ISDAVMAGIC(dir))
2164- return davReaddir(dir);
2165 return readdir(dir);
2166 }
2167
2168@@ -1528,7 +1482,5 @@
2169 return 0;
2170 if (ISAVMAGIC(dir))
2171 return avClosedir(dir);
2172- if (ISDAVMAGIC(dir))
2173- return davClosedir(dir);
2174 return closedir(dir);
2175 }
2176diff -ur rpm-4.4.1/rpmio/tget.c rpm-4.4.1-no-neon/rpmio/tget.c
2177--- rpm-4.4.1/rpmio/tget.c 2004-11-19 17:52:58.000000000 +0100
2178+++ rpm-4.4.1-no-neon/rpmio/tget.c 2005-06-19 20:34:07.009757552 +0200
2179@@ -9,7 +9,6 @@
2180
2181 static int _debug = 0;
2182
2183-int noNeon;
2184
2185 #define HTTPSPATH "https://localhost/test.txt"
2186 #define HTTPPATH "http://localhost/test.txt"
2187@@ -40,8 +39,6 @@
2188 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2189 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2190 N_("debug protocol data stream"), NULL},
2191- { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2192- N_("disable use of libneon for HTTP"), NULL},
2193 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2194 N_("debug rpmio I/O"), NULL},
2195 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2196diff -ur rpm-4.4.1/rpmio/tglob.c rpm-4.4.1-no-neon/rpmio/tglob.c
2197--- rpm-4.4.1/rpmio/tglob.c 2004-11-19 17:53:05.000000000 +0100
2198+++ rpm-4.4.1-no-neon/rpmio/tglob.c 2005-06-19 20:34:07.010757400 +0200
2199@@ -9,7 +9,6 @@
2200
2201 static int _debug = 0;
2202
2203-int noNeon;
2204
2205 #define HTTPSPATH "https://localhost/rawhide/test/*.rpm"
2206 #if 0
2207@@ -52,8 +51,6 @@
2208 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2209 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2210 N_("debug protocol data stream"), NULL},
2211- { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2212- N_("disable use of libneon for HTTP"), NULL},
2213 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2214 N_("debug rpmio I/O"), NULL},
2215 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2216diff -ur rpm-4.4.1/rpmio/thkp.c rpm-4.4.1-no-neon/rpmio/thkp.c
2217--- rpm-4.4.1/rpmio/thkp.c 2005-01-04 17:35:12.000000000 +0100
2218+++ rpm-4.4.1-no-neon/rpmio/thkp.c 2005-06-19 20:34:07.012757096 +0200
2219@@ -10,7 +10,6 @@
2220 static int _debug = 0;
2221 static int _printing = 0;
2222
2223-int noNeon;
2224
2225 #if 0
2226 #define HKPPATH "hkp://pgp.mit.edu:11371/pks/lookup?op=get&search=0xF5C75256"
2227@@ -95,8 +94,6 @@
2228 N_("debug protocol data stream"), NULL},
2229 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2230 N_("debug protocol data stream"), NULL},
2231- { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2232- N_("disable use of libneon for HTTP"), NULL},
2233 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2234 N_("debug rpmio I/O"), NULL},
2235 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2236diff -ur rpm-4.4.1/rpmio/tput.c rpm-4.4.1-no-neon/rpmio/tput.c
2237--- rpm-4.4.1/rpmio/tput.c 2004-11-19 17:53:11.000000000 +0100
2238+++ rpm-4.4.1-no-neon/rpmio/tput.c 2005-06-19 20:34:07.013756944 +0200
2239@@ -9,7 +9,6 @@
2240
2241 static int _debug = 0;
2242
2243-int noNeon;
2244
2245 #define HTTPSPATH "https://localhost/rawhide/toad/tput.txt"
2246 #define HTTPPATH "http://localhost/rawhide/toad/tput.txt"
2247@@ -100,8 +99,6 @@
2248 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2249 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2250 N_("debug protocol data stream"), NULL},
2251- { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2252- N_("disable use of libneon for HTTP"), NULL},
2253 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2254 N_("debug rpmio I/O"), NULL},
2255 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2256diff -ur rpm-4.4.1/rpmio/tring.c rpm-4.4.1-no-neon/rpmio/tring.c
2257--- rpm-4.4.1/rpmio/tring.c 2004-11-28 21:41:04.000000000 +0100
2258+++ rpm-4.4.1-no-neon/rpmio/tring.c 2005-06-19 20:34:07.013756944 +0200
2259@@ -5,7 +5,6 @@
2260
2261 static int printing = 1;
2262 static int _debug = 0;
2263-int noNeon;
2264
2265 static struct poptOption optionsTable[] = {
2266 { "print", 'p', POPT_ARG_VAL, &printing, 1, NULL, NULL },
2267@@ -13,8 +12,6 @@
2268 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
2269 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
2270 N_("debug protocol data stream"), NULL},
2271- { "noneon", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noNeon, 1,
2272- N_("disable use of libneon for HTTP"), NULL},
2273 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
2274 N_("debug rpmio I/O"), NULL},
2275 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
2276diff -ur rpm-4.4.1/rpmio/url.c rpm-4.4.1-no-neon/rpmio/url.c
2277--- rpm-4.4.1/rpmio/url.c 2004-11-28 21:41:31.000000000 +0100
2278+++ rpm-4.4.1-no-neon/rpmio/url.c 2005-06-19 20:37:11.810663544 +0200
2279@@ -148,7 +148,6 @@
2280 }
2281 if (u->sess != NULL) {
2282 /* HACK: neon include has prototype. */
2283- ne_session_destroy(u->sess);
2284 u->sess = NULL;
2285 }
2286 u->buf = _free(u->buf);
2287@@ -352,9 +351,6 @@
2288 } urlstrings[] = {
2289 { "file://", URL_IS_PATH },
2290 { "ftp://", URL_IS_FTP },
2291- { "hkp://", URL_IS_HKP },
2292- { "http://", URL_IS_HTTP },
2293- { "https://", URL_IS_HTTPS },
2294 { "-", URL_IS_DASH },
2295 { NULL, URL_IS_UNKNOWN }
2296 };
This page took 0.433595 seconds and 4 git commands to generate.