RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 14-Sep-2014 07:21:11 Branch: rpm-5_4 Handle: 2014091405210802 Modified files: (Branch: rpm-5_4) rpm CHANGES rpm/rpmio rpmdav.c rpmio.c rpmio.h rpmurl.h Log: - rpmdav: handle NE_REDIRECT, take #1. Summary: Revision Changes Path 1.3501.2.440+1 -0 rpm/CHANGES 2.119.2.7 +219 -105 rpm/rpmio/rpmdav.c 1.230.2.19 +2 -3 rpm/rpmio/rpmio.c 1.97.2.3 +1 -0 rpm/rpmio/rpmio.h 1.41.4.5 +22 -7 rpm/rpmio/rpmurl.h ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.3501.2.439 -r1.3501.2.440 CHANGES --- rpm/CHANGES 13 Sep 2014 17:50:49 -0000 1.3501.2.439 +++ rpm/CHANGES 14 Sep 2014 05:21:08 -0000 1.3501.2.440 @@ -1,4 +1,5 @@ 5.4.15 -> 5.4.16: + - jbj: rpmdav: handle NE_REDIRECT, take #1. - jbj: rpmio: use funopen(3) on *BSD when available (untested). - jbj: rpmct: add %{copy foo bar:} embedding. - jbj: rpmpopt: fix: escaped newline was fubar, grr. @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmdav.c ============================================================================ $ cvs diff -u -r2.119.2.6 -r2.119.2.7 rpmdav.c --- rpm/rpmio/rpmdav.c 12 Sep 2014 19:54:46 -0000 2.119.2.6 +++ rpm/rpmio/rpmdav.c 14 Sep 2014 05:21:09 -0000 2.119.2.7 @@ -86,6 +86,28 @@ #ifdef WITH_NEON /* =============================================================== */ +static int davCheck(void * _req, const char * msg, int err) +{ + if (err || _dav_debug) { + FILE * fp = stderr; +#ifdef NOTYET + char b[256]; + size_t nb = sizeof(b); + const char * syserr = ne_strerror(errno, b, nb); +#endif + + if (msg) { + if (_req) + fprintf(fp, "*** %s(%p):", msg, _req); + else + fprintf(fp, "*** %s:", msg); + } + /* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */ + fprintf(fp, " rc(%d) %s\n", err, ftpStrerror(-err)); + } + return err; +} + int davDisconnect(void * _u) { urlinfo u = (urlinfo) _u; @@ -134,7 +156,7 @@ ne_lockstore_destroy((ne_lock_store *)u->lockstore); u->lockstore = NULL; u->info.status = 0; - ne_sock_exit(); /* XXX refcounted. oneshot? */ + ne_sock_exit(); break; } } @@ -289,6 +311,7 @@ ne_session * sess; const char * id = "fd"; FD_t fd = NULL; + int rc = NE_OK; assert(u != NULL); assert(u->sess != NULL); @@ -297,10 +320,21 @@ assert(sess == u->sess); assert(u == ne_get_session_private(sess, "urlinfo")); + if (status->klass == 3) { + const char * htag = "Location"; + const char * value = ne_get_response_header(req, htag); + if (value) { + u->location = _free(u->location); + u->location = xstrdup(value); + rc = NE_REDIRECT; + } +DAVDEBUG(-1, (stderr, "\t%d Location: %s\n", status->code, value)); + } + fd = (FD_t) ne_get_request_private(req, id); -DAVDEBUG(-1, (stderr, "<-- %s(%p,%p,%p) sess %p %s %p %s\n", __FUNCTION__, req, userdata, status, sess, id, fd, ne_get_error(sess))); - return NE_OK; +DAVDEBUG(-1, (stderr, "<-- %s(%p,%p,%p) rc %d sess %p %s %p %s\n", __FUNCTION__, req, userdata, status, rc, sess, id, fd, ne_get_error(sess))); + return rc; } static void davDestroyRequest(ne_request * req, void * userdata) @@ -438,30 +472,57 @@ if (u->allow & RPMURL_SERVER_OPTIONSDONE) return 0; - u->allow &= ~(RPMURL_SERVER_HASDAVCLASS1 | - RPMURL_SERVER_HASDAVCLASS2 | - RPMURL_SERVER_HASDAVEXEC); + u->allow &= ~(RPMURL_SERVER_DAV_CLASS1 | + RPMURL_SERVER_DAV_CLASS2 | + RPMURL_SERVER_MODDAV_EXEC); /* HACK: perhaps capture Allow: tag, look for PUT permitted. */ /* XXX [hdr] Allow: GET,HEAD,POST,OPTIONS,TRACE */ - rc = ne_options((ne_session *)u->sess, path, (ne_server_capabilities *)u->capabilities); +#ifdef DYING /* XXX fall back for downrev servers? */ + /* XXX filter NE_REDIRECT spewage. */ + rc = davCheck(u->sess, "ne_options", + ne_options((ne_session *)u->sess, path, (ne_server_capabilities *)u->capabilities)); +#else + rc = davCheck(u->sess, "ne_options2", + ne_options2((ne_session *)u->sess, path, &u->caps)); +#endif switch (rc) { case NE_OK: u->allow |= RPMURL_SERVER_OPTIONSDONE; +#ifdef DYING /* XXX fall back for downrev servers? */ { ne_server_capabilities *cap = (ne_server_capabilities *)u->capabilities; if (cap->dav_class1) - u->allow |= RPMURL_SERVER_HASDAVCLASS1; + u->allow |= RPMURL_SERVER_DAV_CLASS1; else - u->allow &= ~RPMURL_SERVER_HASDAVCLASS1; + u->allow &= ~RPMURL_SERVER_DAV_CLASS1; if (cap->dav_class2) - u->allow |= RPMURL_SERVER_HASDAVCLASS2; + u->allow |= RPMURL_SERVER_DAV_CLASS2; else - u->allow &= ~RPMURL_SERVER_HASDAVCLASS2; + u->allow &= ~RPMURL_SERVER_DAV_CLASS2; if (cap->dav_executable) - u->allow |= RPMURL_SERVER_HASDAVEXEC; + u->allow |= RPMURL_SERVER_MODDAV_EXEC; + else + u->allow &= ~RPMURL_SERVER_MODDAV_EXEC; + } +#else + if (u->caps & NE_CAP_DAV_CLASS1) + u->allow |= RPMURL_SERVER_DAV_CLASS1; + else + u->allow &= ~RPMURL_SERVER_DAV_CLASS1; + if (u->caps & NE_CAP_DAV_CLASS2) + u->allow |= RPMURL_SERVER_DAV_CLASS2; + else + u->allow &= ~RPMURL_SERVER_DAV_CLASS2; + if (u->caps & NE_CAP_DAV_CLASS3) + u->allow |= RPMURL_SERVER_DAV_CLASS3; else - u->allow &= ~RPMURL_SERVER_HASDAVEXEC; - } break; + u->allow &= ~RPMURL_SERVER_DAV_CLASS3; + if (u->caps & NE_CAP_MODDAV_EXEC) + u->allow |= RPMURL_SERVER_MODDAV_EXEC; + else + u->allow &= ~RPMURL_SERVER_MODDAV_EXEC; +#endif + break; case NE_ERROR: /* HACK: "501 Not Implemented" if OPTIONS not permitted. */ if (!strncmp("501 ", ne_get_error((ne_session *)u->sess), sizeof("501 ")-1)) { @@ -483,6 +544,10 @@ #endif errno = EIO; /* HACK: more precise errno. */ goto bottom; + case NE_REDIRECT: +assert(u->location); +return (rc); + break; case NE_LOOKUP: errno = ENOENT; /* HACK: errno same as non-existent path. */ goto bottom; @@ -492,7 +557,6 @@ case NE_TIMEOUT: case NE_FAILED: case NE_RETRY: - case NE_REDIRECT: default: bottom: DAVDEBUG(-1, (stderr, "*** Connect to %s:%d failed(%d):\n\t%s\n", u->host, u->port, rc, ne_get_error((ne_session *)u->sess))); @@ -510,8 +574,19 @@ urlinfo u = NULL; int rc = 0; - if (urlSplit(url, &u)) - return -1; /* XXX error returns needed. */ +retry: + /* Chain through redirects looking for a session. */ + do { + if (urlSplit(url, &u)) + return -1; /* XXX error returns needed. */ + if (u->location) { +if (_dav_debug < 0) +fprintf(stderr, "\tREDIRECT %s -> %s\n", url, u->location); + url = u->location; + continue; + } + break; + } while (1); if (u->url != NULL && u->sess == NULL) switch (u->ut) { @@ -521,70 +596,96 @@ case URL_IS_HTTPS: case URL_IS_HTTP: case URL_IS_HKP: - { ne_server_capabilities * capabilities; + { ne_session * sess = NULL; + ne_lock_store * lockstore = NULL; + ne_server_capabilities * capabilities = NULL;; /* HACK: oneshots should be done Somewhere Else Instead. */ rc = ((_dav_debug < 0) ? NE_DBG_HTTP : 0); ne_debug_init(stderr, rc); /* XXX oneshot? */ rc = ne_sock_init(); /* XXX refcounted. oneshot? */ - u->lockstore = ne_lockstore_create(); /* XXX oneshot? */ + lockstore = ne_lockstore_create(); /* XXX oneshot? */ u->capabilities = capabilities = (ne_server_capabilities *) xcalloc(1, sizeof(*capabilities)); - u->sess = ne_session_create(u->scheme, u->host, u->port); + sess = ne_session_create(u->scheme, u->host, u->port); - ne_lockstore_register((ne_lock_store *)u->lockstore, (ne_session *)u->sess); + ne_lockstore_register(lockstore, sess); if (u->proxyh != NULL) - ne_session_proxy((ne_session *)u->sess, u->proxyh, u->proxyp); + ne_session_proxy(sess, u->proxyh, u->proxyp); #if 0 { const ne_inet_addr ** addrs; unsigned int n; - ne_set_addrlist((ne_session *)u->sess, addrs, n); + ne_set_addrlist(sess, addrs, n); } #endif - ne_set_notifier((ne_session *)u->sess, davNotify, u); + ne_set_notifier(sess, davNotify, u); - ne_set_session_flag((ne_session *)u->sess, NE_SESSFLAG_PERSIST, rpmioHttpPersist); - ne_set_connect_timeout((ne_session *)u->sess, rpmioHttpConnectTimeoutSecs); - ne_set_read_timeout((ne_session *)u->sess, rpmioHttpReadTimeoutSecs); - ne_set_useragent((ne_session *)u->sess, + ne_set_session_flag(sess, NE_SESSFLAG_PERSIST, rpmioHttpPersist); + ne_set_connect_timeout(sess, rpmioHttpConnectTimeoutSecs); + ne_set_read_timeout(sess, rpmioHttpReadTimeoutSecs); + ne_set_useragent(sess, (rpmioHttpUserAgent ? rpmioHttpUserAgent : _rpmioHttpUserAgent)); /* XXX check that neon is ssl enabled. */ if (!strcasecmp(u->scheme, "https")) { - ne_ssl_set_verify((ne_session *)u->sess, davVerifyCert, (char *)u->host); + ne_ssl_set_verify(sess, davVerifyCert, (char *)u->host); #ifdef NOTYET - ne_ssl_set_clicert((ne_session *)u->sess, const ne_ssl_client_cert *clicert); - ne_ssl_set_trust_cert((ne_session *)u->sess, const ne_ssl_certifcate *cert); - ne_ssl_set_trust_default_ca((ne_session *)u->sess); - ne_ssl_provide_clicert((ne_session *)u->sess, + ne_ssl_set_clicert(sess, const ne_ssl_client_cert *clicert); + ne_ssl_set_trust_cert(sess, const ne_ssl_certifcate *cert); + ne_ssl_set_trust_default_ca(sess); + ne_ssl_provide_clicert(sess, ne_ssl_provide_fn fn, void *userdata); #endif } - ne_set_session_private((ne_session *)u->sess, "urlinfo", u); + ne_set_session_private(sess, "urlinfo", u); - ne_hook_destroy_session((ne_session *)u->sess, davDestroySession, u); + ne_hook_destroy_session(sess, davDestroySession, u); + + ne_hook_create_request(sess, davCreateRequest, u); + ne_hook_pre_send(sess, davPreSend, u); + ne_hook_post_headers(sess, davPostHeaders, u); + ne_hook_post_send(sess, davPostSend, u); + ne_hook_destroy_request(sess, davDestroyRequest, u); + ne_hook_close_conn(sess, davCloseConn, u); + +#ifdef DYING /* XXX handled by davPostSend */ + ne_redirect_register(sess); +#endif - ne_hook_create_request((ne_session *)u->sess, davCreateRequest, u); - ne_hook_pre_send((ne_session *)u->sess, davPreSend, u); - ne_hook_post_headers((ne_session *)u->sess, davPostHeaders, u); - ne_hook_post_send((ne_session *)u->sess, davPostSend, u); - ne_hook_destroy_request((ne_session *)u->sess, davDestroyRequest, u); - ne_hook_close_conn((ne_session *)u->sess, davCloseConn, u); + u->sess = sess; + u->lockstore = lockstore; + u->capabilities = capabilities; /* HACK: where should server capabilities be read? */ rc = davConnect(u); - if (rc) + switch (rc) { + case NE_OK: + break; + case NE_REDIRECT: + if (u->location) { + urlinfo v = NULL; + rc = davInit(u->location, &v); /* XXX recurse or goto retry? */ + if (rc == 0) { + /* XXX xx = davFree(u); u->lookup is critical?*/ + u = urlLink(v, "davInit REDIRECT"); + } + v = urlFree(v, "urlSplit (davInit REDIRECT)"); + } + break; + default: goto exit; + break; + } } break; } exit: -DAVDEBUG(-1, (stderr, "<-- %s(%s) u->url %s\n", __FUNCTION__, url, u->url)); +DAVDEBUG(-1, (stderr, "<-- %s(%s) rc %d u->url %s\n", __FUNCTION__, url, rc, u->url)); if (uret != NULL) *uret = urlLink(u, "davInit"); u = urlFree(u, "urlSplit (davInit)"); @@ -833,7 +934,8 @@ ne_propfind_set_private(pfh, fetch_create_item, NULL, NULL); - rc = ne_propfind_named(pfh, fetch_props, fetch_results, avx); + rc = davCheck(pfh, "ne_propfind_named", + ne_propfind_named(pfh, fetch_props, fetch_results, avx)); ne_propfind_destroy(pfh); @@ -932,7 +1034,8 @@ /* XXX if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER) handlers? */ - rc = ne_request_dispatch(req); + rc = davCheck(req, "ne_request_dispatch", + ne_request_dispatch(req)); status = ne_get_status(req); /* XXX somewhere else instead? */ @@ -1021,25 +1124,6 @@ return rc; } -static int my_result(const char * msg, int ret, FILE * fp) -{ - /* HACK: don't print unless debugging. */ - if (_dav_debug >= 0) - return ret; - if (fp == NULL) - fp = stderr; - if (msg != NULL) - fprintf(fp, "*** %s: ", msg); - - /* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */ -#ifdef HACK - fprintf(fp, "%s: %s\n", ftpStrerror(-ret), ne_get_error(sess)); -#else - fprintf(fp, "%s\n", ftpStrerror(-ret)); -#endif - return ret; -} - /* XXX TODO move to rpmhtml.c */ typedef struct rpmhtml_s * rpmhtml; #endif /* WITH_NEON */ @@ -1155,7 +1239,7 @@ DAVDEBUG(-1, (stderr, "--> %s(%p) %p[%u]\n", __FUNCTION__, html, b, (unsigned)nb)); /* XXX FIXME: "server awol" segfaults here. gud enuf atm ... */ - rc = ne_read_response_block(html->req, b, nb) ; + rc = ne_read_response_block(html->req, b, nb); if (rc > 0) { html->nb += rc; b += rc; @@ -1379,8 +1463,8 @@ int rc = 0; do { - rc = ne_begin_request(html->req); - rc = my_result("ne_begin_req(html->req)", rc, NULL); + rc = davCheck(html->req, "ne_begin_request", + ne_begin_request(html->req)); switch (rc) { case NE_OK: break; @@ -1402,8 +1486,8 @@ (void) htmlParse(html); /* XXX error code needs handling. */ - rc = ne_end_request(html->req); - rc = my_result("ne_end_req(html->req)", rc, NULL); + rc = davCheck(html->req, "ne_end_request", + ne_end_request(html->req)); } while (rc == NE_RETRY); exit: @@ -1414,7 +1498,6 @@ static int davNLST(rpmavx avx) { urlinfo u = NULL; -const char * u_url = NULL; /* XXX FIXME: urlFind should save current URI */ int rc; int xx; @@ -1423,10 +1506,6 @@ if (rc || u == NULL) goto exit; -if (u_url == NULL) { /* XXX FIXME: urlFind should save current URI */ -u_url = u->url; -u->url = avx->uri; -} /* * Do PROPFIND through davFetch iff server supports. * Otherwise, do HEAD to get Content-length/ETag/Last-Modified, @@ -1470,10 +1549,6 @@ *te = '\0'; u->location = _free(u->location); /* XXX retry here needed iff ContentLength:. */ -if (u_url != NULL) { /* XXX FIXME: urlFind should save current URI */ -u->url = u_url; -u_url = NULL; -} xx = davFree(u); goto retry; break; @@ -1490,16 +1565,12 @@ case NE_RETRY: case NE_REDIRECT: default: -DAVDEBUG(1, (stderr, "*** Fetch from %s:%d failed:\n\t%s\n", - u->host, u->port, ne_get_error((ne_session *)u->sess))); +DAVDEBUG(1, (stderr, "*** Fetch from %s:%d failed rc(%d):\n\t%s\n", + u->host, u->port, rc, ne_get_error((ne_session *)u->sess))); break; } exit: -if (u_url != NULL) { /* XXX FIXME: urlFind should save current URI */ -u->url = u_url; -u_url = NULL; -} /* XXX Destroy the session iff not OK, otherwise persist. */ if (rc) xx = davFree(u); @@ -1519,16 +1590,6 @@ u->allow &= ~RPMURL_SERVER_HASRANGE; } -#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER) -static void davAllHeaders(void * userdata, const char * value) -{ - FD_t ctrl = (FD_t) userdata; - - if (!(ctrl != NULL && value != NULL)) return; -DAVDEBUG(1, (stderr, "<- %s\n", value)); -} -#endif - static void davContentLength(void * userdata, const char * value) { FD_t ctrl = (FD_t) userdata; @@ -1579,14 +1640,41 @@ ctrl->persist = 1; } +static void davLocation(void * userdata, const char * value) +{ + FD_t ctrl = (FD_t) userdata; + urlinfo u; + + if (!(ctrl != NULL && value != NULL)) return; +DAVDEBUG(-1, (stderr, "*** fd %p Location: %s\n", ctrl, value)); + + u = (urlinfo) ctrl->u; + URLSANE(u); + + if (value && u->location == NULL) { + u->location = _free(u->location); + u->location = xstrdup(value); + } +} + +#if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER) +static void davAllHeaders(void * userdata, const char * value) +{ + FD_t ctrl = (FD_t) userdata; + + if (!(ctrl != NULL && value != NULL)) return; +DAVDEBUG(1, (stderr, "<- %s\n", value)); +} +#endif + int davResp(urlinfo u, FD_t ctrl, char *const * str) { int rc = 0; DAVDEBUG(-1, (stderr, "--> %s(%p,%p,%p) sess %p req %p\n", __FUNCTION__, u, ctrl, str, u->sess, ctrl->req)); - rc = ne_begin_request((ne_request *)ctrl->req); - rc = my_result("ne_begin_req(ctrl->req)", rc, NULL); + rc = davCheck(ctrl->req, "ne_begin_request", + ne_begin_request((ne_request *)ctrl->req)); /* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */ if (rc) @@ -1600,6 +1688,8 @@ int davReq(FD_t ctrl, const char * httpCmd, const char * httpArg) { urlinfo u; + const char * path = NULL; + int ut; int rc = 0; assert(ctrl != NULL); @@ -1608,6 +1698,13 @@ DAVDEBUG(-1, (stderr, "--> %s(%p,%s,\"%s\") entry sess %p req %p\n", __FUNCTION__, ctrl, httpCmd, (httpArg ? httpArg : ""), u->sess, ctrl->req)); + ut = urlPath(u->url, &path); + if (strcmp(httpArg, path)) { +if (_dav_debug < 0) +fprintf(stderr, "\tREDIRECT %s -> %s\n", httpArg, path); + httpArg = path; + } + ctrl->persist = (u->httpVersion > 0 ? 1 : 0); ctrl = fdLink(ctrl, "open ctrl (davReq)"); assert(ctrl != NULL); @@ -1629,9 +1726,12 @@ xx = ne_accept_always(void *userdata, (ne_request *)ctrl->req, const ne_status *st); ne_add_response_body_reader((ne_request *)ctrl->req, ne_accept_response accpt, ne_block_reader reader, void *userdata); - ne_set_request_flag((ne_request *)ctrl->req, ne_request_flag flag, int value); #endif + /* XXX NE_REQFLAG_EXPECT100 for "Expect: 100-continue" */ + /* XXX OK for GET, disable for POST */ + ne_set_request_flag((ne_request *)ctrl->req, NE_REQFLAG_IDEMPOTENT, 1); + #if !defined(HAVE_NEON_NE_GET_RESPONSE_HEADER) ne_add_response_header_catcher((ne_request *)ctrl->req, davAllHeaders, ctrl); @@ -1645,6 +1745,8 @@ davLastModified, ctrl); ne_add_response_header_handler((ne_request *)ctrl->req, "Connection", davConnection, ctrl); + ne_add_response_header_handler((ne_request *)ctrl->req, "Location", + Location, ctrl); #endif if (!strcmp(httpCmd, "PUT")) { @@ -1695,6 +1797,8 @@ ne_get_response_header((ne_request *)ctrl->req, "Last-Modified")); davConnection(ctrl, ne_get_response_header((ne_request *)ctrl->req, "Connection")); + davLocation(ctrl, + ne_get_response_header((ne_request *)ctrl->req, "Location")); if (strcmp(httpCmd, "PUT")) davAcceptRanges(u, ne_get_response_header((ne_request *)ctrl->req, "Accept-Ranges")); @@ -1783,8 +1887,8 @@ /* If server has disconnected, then tear down the neon request. */ if (u->info.status == ne_status_disconnected) { int xx; - xx = ne_end_request((ne_request *)fd->req); - xx = my_result("davRead: ne_end_request(req)", xx, NULL); + xx = davCheck(fd->req, "ne_end_request", + ne_end_request((ne_request *)fd->req)); ne_request_destroy((ne_request *)fd->req); fd->req = (void *)-1; } @@ -1850,8 +1954,8 @@ assert(fd->req != NULL); if (fd->req != (void *)-1) { - rc = ne_end_request((ne_request *)fd->req); - rc = my_result("ne_end_request(req)", rc, NULL); + rc = davCheck(fd->req, "ne_end_request", + ne_end_request((ne_request *)fd->req)); ne_request_destroy((ne_request *)fd->req); } @@ -1875,7 +1979,8 @@ (void) urlPath(path, &src); - rc = ne_mkcol((ne_session *)u->sess, path); + rc = davCheck(u->sess, "ne_mkcol", + ne_mkcol((ne_session *)u->sess, path)); if (rc) rc = -1; /* XXX HACK: errno impedance match */ @@ -1901,7 +2006,8 @@ /* XXX HACK: only getrestype(remote) == resr_collection */ - rc = ne_delete((ne_session *)u->sess, path); + rc = davCheck(u->sess, "ne_delete", + ne_delete((ne_session *)u->sess, path)); if (rc) rc = -1; /* XXX HACK: errno impedance match */ @@ -1928,7 +2034,8 @@ /* XXX HACK: only getrestype(remote) != resr_collection */ - rc = ne_move((ne_session *)u->sess, overwrite, src, dst); + rc = davCheck(u->sess, "ne_move", + ne_move((ne_session *)u->sess, overwrite, src, dst)); if (rc) rc = -1; /* XXX HACK: errno impedance match */ @@ -1952,7 +2059,8 @@ /* XXX HACK: only getrestype(remote) != resr_collection */ - rc = ne_delete((ne_session *)u->sess, src); + rc = davCheck(u->sess, "ne_delete", + ne_delete((ne_session *)u->sess, src)); exit: if (rc) rc = -1; /* XXX HACK: errno impedance match */ @@ -2012,6 +2120,12 @@ /* Hash the path to generate a st_ino analogue. */ st->st_ino = hashFunctionString(0, path, 0); + /* XXX HACK: ensure st->st_mode is sane, not 0000 */ + if (st->st_mode == S_IFDIR) + st->st_mode |= 0755; + if (st->st_mode == S_IFREG) + st->st_mode |= 0644; + exit: DAVDEBUG(-1, (stderr, "<-- %s(%s) rc %d\n\t%s\n", __FUNCTION__, path, rc, statstr(st, buf))); avx = rpmavxFree(avx); @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmio.c ============================================================================ $ cvs diff -u -r1.230.2.18 -r1.230.2.19 rpmio.c --- rpm/rpmio/rpmio.c 13 Sep 2014 17:50:51 -0000 1.230.2.18 +++ rpm/rpmio/rpmio.c 14 Sep 2014 05:21:09 -0000 1.230.2.19 @@ -765,10 +765,9 @@ const char * ftpStrerror(int errorNumber) { switch (errorNumber) { - case 0: - return _("Success"); - /* HACK error impediance match, coalesce and rename. */ + case FTPERR_NE_OK: + return ("OK"); case FTPERR_NE_ERROR: return ("NE_ERROR: Generic error."); case FTPERR_NE_LOOKUP: @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmio.h ============================================================================ $ cvs diff -u -r1.97.2.2 -r1.97.2.3 rpmio.h --- rpm/rpmio/rpmio.h 3 Sep 2014 19:28:55 -0000 1.97.2.2 +++ rpm/rpmio/rpmio.h 14 Sep 2014 05:21:10 -0000 1.97.2.3 @@ -662,6 +662,7 @@ */ /*@-typeuse@*/ typedef enum ftperrCode_e { + FTPERR_NE_OK = 0, FTPERR_NE_ERROR = -1, /*!< Generic error. */ FTPERR_NE_LOOKUP = -2, /*!< Hostname lookup failed. */ FTPERR_NE_AUTH = -3, /*!< Server authentication failed. */ @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmurl.h ============================================================================ $ cvs diff -u -r1.41.4.4 -r1.41.4.5 rpmurl.h --- rpm/rpmio/rpmurl.h 9 May 2012 16:17:35 -0000 1.41.4.4 +++ rpm/rpmio/rpmurl.h 14 Sep 2014 05:21:10 -0000 1.41.4.5 @@ -115,15 +115,30 @@ char * buf; /*!< I/O buffer */ int openError; /*!< Type of open failure */ int httpVersion; + unsigned caps; /*!< neon: ne_options2 caps bits */ int allow; -#define RPMURL_SERVER_HASRANGE ( 1 << 0) -#define RPMURL_SERVER_HASDAVCLASS1 ( 1 << 1) -#define RPMURL_SERVER_HASDAVCLASS2 ( 1 << 2) -#define RPMURL_SERVER_HASDAVEXEC ( 1 << 3) +#define RPMURL_SERVER_DAV_CLASS1 (1 << 0) +#define RPMURL_SERVER_DAV_CLASS2 (1 << 1) +#define RPMURL_SERVER_DAV_CLASS3 (1 << 2) +#define RPMURL_SERVER_MODDAV_EXEC (1 << 3) +#define RPMURL_SERVER_DAV_ACL (1 << 4) +#define RPMURL_SERVER_VER_CONTROL (1 << 5) +#define RPMURL_SERVER_CO_IN_PLACE (1 << 6) +#define RPMURL_SERVER_VER_HISTORY (1 << 7) +#define RPMURL_SERVER_WORKSPACE (1 << 8) +#define RPMURL_SERVER_UPDATE (1 << 9) +#define RPMURL_SERVER_LABEL (1 << 10) +#define RPMURL_SERVER_WORK_RESOURCE (1 << 11) +#define RPMURL_SERVER_MERGE (1 << 12) +#define RPMURL_SERVER_BASELINE (1 << 13) +#define RPMURL_SERVER_ACTIVITY (1 << 14) +#define RPMURL_SERVER_VC_COLLECTION (1 << 15) +#define RPMURL_SERVER_EXT_MKCOL (1 << 16) + /* 17 - 23 unused */ +#define RPMURL_SERVER_OPTIONSDONE (1 << 24) +#define RPMURL_SERVER_HASRANGE (1 << 25) -#define RPMURL_SERVER_OPTIONSDONE ( 1 << 8) - -#define RPMURL_SERVER_HASDAV (RPMURL_SERVER_HASDAVCLASS1|RPMURL_SERVER_HASDAVCLASS2|RPMURL_SERVER_HASDAVEXEC) +#define RPMURL_SERVER_HASDAV (RPMURL_SERVER_DAV_CLASS1|RPMURL_SERVER_DAV_CLASS2|RPMURL_SERVER_DAV_CLASS3|RPMURL_SERVER_MODDAV_EXEC) unsigned magic; #if defined(__LCLINT__) /*@refs@*/ @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org