8 #if defined(HAVE_MACHINE_TYPES_H)
9 # include <machine/types.h>
12 #if defined(HAVE_SYS_SOCKET_H)
13 # include <sys/socket.h>
17 #define NI_MAXHOST 1025
20 #if defined(__LCLINT__)
28 struct sockaddr *ai_addr;
30 struct addrinfo *ai_next;
34 extern int getaddrinfo (
__const char *__restrict __name,
35 __const char *__restrict __service,
36 __const struct addrinfo *__restrict __req,
37 struct addrinfo **__restrict __pai)
40 extern int getnameinfo (
__const struct sockaddr *__restrict __sa,
41 socklen_t __salen,
char *__restrict __host,
42 socklen_t __hostlen,
char *__restrict __serv,
43 socklen_t __servlen,
unsigned int __flags)
46 extern void freeaddrinfo (
struct addrinfo *__ai)
53 #include <netinet/in.h>
54 #include <arpa/inet.h>
56 #if defined(HAVE_NETINET_IN_SYSTM_H)
57 # include <sys/types.h>
58 # include <netinet/in_systm.h>
86 #define _RPMHKP_INTERNAL
93 #if defined(HAVE_LIBIO_H) && defined(_G_IO_IO_FILE_VERSION)
98 #if !defined(HAVE_HERRNO) && (defined(hpux) || defined(__hpux) || defined(__LCLINT__))
104 #define IPPORT_FTP 21
107 #define IPPORT_HTTP 80
110 #if !defined(HAVE_INET_ATON)
111 #define inet_aton(cp,inp) rpm_inet_aton(cp,inp)
117 addr = inet_addr(cp);
118 if (addr == ((
long) -1))
return 0;
120 memcpy(inp, &addr,
sizeof(addr));
125 #if defined(USE_ALT_DNS) && USE_ALT_DNS
132 #define fdOpen __fdOpen
134 #define fdRead __fdRead
136 #define fdWrite __fdWrite
138 #define fdClose __fdClose
152 #define FDTO(fd) (fd ? ((FD_t)fd)->rd_timeoutsecs : -99)
153 #define FDCPIOPOS(fd) (fd ? ((FD_t)fd)->fd_cpioPos : -99)
155 #define FDONLY(fd) assert(fdGetIo(fd) == fdio)
159 #define fdGetFILE(_fd) ((FILE *)fdGetFp(_fd))
170 #define TIMEOUT_SECS 60
201 static char buf[BUFSIZ];
210 sprintf(be,
"fd %p", fd); be += strlen(be);
221 strcpy(be,
" chunked");
225 for (i = fd->
nfps; i >= 0; i--) {
232 sprintf(be,
"FD %d fp %p", fps->
fdno, fps->
fp);
234 sprintf(be,
"UFD %d fp %p", fps->
fdno, fps->
fp);
235 #if defined(WITH_ZLIB)
237 sprintf(be,
"GZD %p fdno %d", fps->
fp, fps->
fdno);
239 #if defined(WITH_BZIP2)
241 sprintf(be,
"BZD %p fdno %d", fps->
fp, fps->
fdno);
245 sprintf(be,
"LZD %p fdno %d", fps->
fp, fps->
fdno);
247 sprintf(be,
"XZD %p fdno %d", fps->
fp, fps->
fdno);
249 }
else if (fps->
io ==
fpio) {
251 sprintf(be,
"%s %p(%d) fdno %d",
252 (fps->
fdno < 0 ?
"LIBIO" :
"FP"),
253 fps->
fp, fileno(((FILE *)fps->
fp)), fps->
fdno);
256 sprintf(be,
"??? io %p fp %p fdno %d ???",
271 if ((nfdno = dup(fdno)) < 0)
273 if (fcntl(nfdno, F_SETFD, FD_CLOEXEC)) {
277 fd =
fdNew(
"open (fdDup)");
280 DBGIO(fd, (stderr,
"<-- fdDup(%d) fd %p %s\n", fdno, (fd ? fd : NULL),
fdbg(fd)));
308 for (i = fd->
ndigests - 1; i >= 0; i--) {
326 fprintf(stderr,
"*** %s: fd->req %p\n", __FUNCTION__, fd->
req);
329 assert(fd->
req == NULL);
345 if (_fdPool == NULL) {
351 memset(((
char *)fd)+
sizeof(fd->
_item), 0,
sizeof(*fd)-
sizeof(fd->
_item));
366 memset(fd->
fps, 0,
sizeof(fd->
fps));
369 fd->
fps[0].
fp = NULL;
403 static ssize_t
fdRead(
void * cookie,
char * buf,
size_t count)
415 if (fd->
req != NULL) {
417 if (fd->
req != (
void *)-1)
428 if (fd->
xar != NULL) {
440 DBGIO(fd, (stderr,
"<--\tfdRead(%p,%p,%ld) rc %ld %s\n", cookie, buf, (
long)count, (
long)rc,
fdbg(fd)));
445 static ssize_t
fdWrite(
void * cookie,
const char * buf,
size_t count)
457 if (count == 0)
return 0;
463 if (fd->
req != (
void *)-1)
474 DBGIO(fd, (stderr,
"<--\tfdWrite(%p,%p,%ld) rc %ld %s\n", cookie, buf, (
long)count, (
long)rc,
fdbg(fd)));
483 #ifdef USE_COOKIE_SEEK_POINTER
493 rc = lseek(
fdFileno(fd), p, whence);
496 DBGIO(fd, (stderr,
"<--\tfdSeek(%p,%ld,%d) rc %lx %s\n", cookie, (
long)p, whence, (
unsigned long)rc,
fdbg(fd)));
509 if (cookie == NULL)
return -2;
524 rc = ((fdno >= 0) ? close(fdno) : -2);
527 DBGIO(fd, (stderr,
"<--\tfdClose(%p) rc %lx %s\n", (fd ? fd : NULL), (
unsigned long)rc,
fdbg(fd)));
529 fd =
fdFree(fd,
"open (fdClose)");
540 fdno = open(path, flags, mode);
541 if (fdno < 0)
return NULL;
542 if (fcntl(fdno, F_SETFD, FD_CLOEXEC)) {
546 fd =
fdNew(
"open (fdOpen)");
551 DBGIO(fd, (stderr,
"<--\tfdOpen(\"%s\",%x,0%o) %s\n", path, (
unsigned)flags, (
unsigned)mode,
fdbg(fd)));
556 FILE *fdFdopen(
void * cookie,
const char *fmode)
562 if (fmode == NULL)
return NULL;
564 if (fdno < 0)
return NULL;
565 fp = fdopen(fdno, fmode);
566 DBGIO(fd, (stderr,
"<-- fdFdopen(%p,\"%s\") fdno %d -> fp %p fdno %d\n", cookie, fmode, fdno, fp, fileno(fp)));
567 fd =
fdFree(fd,
"open (fdFdopen)");
584 #if defined(HAVE_POLL_H)
585 int msecs = (secs >= 0 ? (1000 *
secs) : -1);
588 struct timeval timeout, *tvp = (secs >= 0 ? &timeout : NULL);
595 return (fd->
req == (
void *)-1 ? -1 : 1);
601 #if defined(HAVE_POLL_H)
603 wrfds.events = POLLOUT;
605 rc = poll(&wrfds, 1, msecs);
611 FD_SET(fdno, &wrfds);
613 rc = select(fdno + 1, NULL, &wrfds, NULL, tvp);
619 fprintf(stderr,
"*** fdWritable fdno %d rc %d %s\n", fdno, rc, strerror(
errno));
639 #if defined(HAVE_POLL_H)
640 int msecs = (secs >= 0 ? (1000 *
secs) : -1);
643 struct timeval timeout, *tvp = (secs >= 0 ? &timeout : NULL);
650 return (fd->
req == (
void *)-1 ? -1 : 1);
656 #if defined(HAVE_POLL_H)
658 rdfds.events = POLLIN;
660 rc = poll(&rdfds, 1, msecs);
666 FD_SET(fdno, &rdfds);
668 rc = select(fdno + 1, &rdfds, NULL, NULL, tvp);
693 char lastchar =
'\0';
719 rc =
fdRead(fd, buf + nb, 1);
721 rc = (int)read(
fdFileno(fd), buf + nb, 1);
733 fprintf(stderr,
"*** read: fd %p rc %d errno %d %s \"%s\"\n", fd, rc,
errno, strerror(
errno), buf);
736 }
else if (rc == 0) {
738 fprintf(stderr,
"*** read: fd %p rc %d EOF errno %d %s \"%s\"\n", fd, rc,
errno, strerror(
errno), buf);
743 lastchar = buf[nb - 1];
745 }
while (ec == 0 && nb < len && lastchar !=
'\n');
747 return (ec >= 0 ? (
int)nb : ec);
755 switch (errorNumber) {
761 return (
"NE_ERROR: Generic error.");
763 return (
"NE_LOOKUP: Hostname lookup failed.");
765 return (
"NE_AUTH: Server authentication failed.");
767 return (
"NE_PROXYAUTH: Proxy authentication failed.");
769 return (
"NE_CONNECT: Could not connect to server.");
771 return (
"NE_TIMEOUT: Connection timed out.");
773 return (
"NE_FAILED: The precondition failed.");
775 return (
"NE_RETRY: Retry request.");
777 return (
"NE_REDIRECT: Redirect received.");
780 return _(
"Bad server response");
782 return _(
"Server I/O error");
784 return _(
"Server timeout");
786 return _(
"Unable to lookup server host address");
788 return _(
"Unable to lookup server host name");
790 return _(
"Failed to connect to server");
792 return _(
"Failed to establish data connection to server");
794 return _(
"I/O error to local file");
796 return _(
"Error setting remote server to passive mode");
798 return _(
"File not found on server");
800 return _(
"Abort in progress");
804 return _(
"Unknown or unexpected error");
821 retstr =
_(
"Malformed URL");
825 retstr = strerror(
errno);
831 #if !defined(HAVE_GETADDRINFO)
832 #if !defined(USE_ALT_DNS) || !USE_ALT_DNS
834 struct in_addr * address)
838 struct hostent * hostinfo;
841 hostinfo = gethostbyname(host);
843 if (!hostinfo)
return 1;
845 memcpy(address, hostinfo->h_addr_list[0],
sizeof(*address));
856 if (!strcmp(host,
"localhost")) {
886 #ifdef HAVE_GETADDRINFO
888 struct addrinfo hints, *res, *res0;
890 #define NI_MAXSERV 32
895 memset(&hints, 0,
sizeof(hints));
896 hints.ai_family = AF_UNSPEC;
897 hints.ai_socktype = SOCK_STREAM;
898 sprintf(pbuf,
"%d", port);
899 pbuf[
sizeof(pbuf)-1] =
'\0';
901 if (getaddrinfo(host, pbuf, &hints, &res0) == 0) {
902 for (res = res0; res != NULL; res = res->ai_next) {
903 if ((fdno = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) < 0)
905 if (connect(fdno, res->ai_addr, (
int)res->ai_addrlen) < 0) {
915 xx = getnameinfo(res->ai_addr, res->ai_addrlen, hbuf,
sizeof(hbuf),
916 NULL, 0, NI_NUMERICHOST);
917 fprintf(stderr,
"++ connect [%s]:%d on fdno %d\n",
928 struct sockaddr_in sin;
930 memset(&sin, 0,
sizeof(sin));
931 sin.sin_family = AF_INET;
932 sin.sin_port = htons(port);
933 sin.sin_addr.s_addr = INADDR_ANY;
939 if ((fdno = socket(sin.sin_family, SOCK_STREAM, IPPROTO_IP)) < 0) {
945 if (connect(fdno, (
struct sockaddr *) &sin,
sizeof(sin))) {
956 fprintf(stderr,
"++ connect %s:%d on fdno %d\n",
958 inet_ntoa(sin.sin_addr)
960 (
int)ntohs(sin.sin_port), fdno);
963 fdSetFdno(ctrl, (fdno >= 0 ? fdno : -1));
976 int *ecp,
char **
str)
1007 se = buf + bufLength;
1009 rc =
fdFgets(ctrl, se, (bufAlloced - bufLength));
1013 }
else if (rc == 0 ||
fdWritable(ctrl, 0) < 1)
1019 for (s = se; *s !=
'\0'; s = se) {
1022 while (*se && *se !=
'\n') se++;
1024 if (se > s && se[-1] ==
'\r')
1030 fprintf(stderr,
"<- %s\n", s);
1040 if (!strncmp(s,
"HTTP",
sizeof(
"HTTP")-1)) {
1042 if ((e = strchr(s,
'.')) != NULL) {
1050 if ((e = strchr(s,
' ')) != NULL) {
1052 if (strchr(
"0123456789", *e))
1053 strncpy(errorCode, e, 3);
1054 errorCode[3] =
'\0';
1060 for (e = s; *e && !(*e ==
' ' || *e ==
':'); e++)
1062 if (e > s && *e++ ==
':') {
1063 size_t ne = (e - s);
1064 while (*e && *e ==
' ') e++;
1066 if (!strncmp(s,
"Date:", ne)) {
1068 if (!strncmp(s,
"Server:", ne)) {
1070 if (!strncmp(s,
"Last-Modified:", ne)) {
1072 if (!strncmp(s,
"ETag:", ne)) {
1075 if (!strncmp(s,
"Accept-Ranges:", ne)) {
1076 if (!strcmp(e,
"bytes"))
1078 if (!strcmp(e,
"none"))
1081 if (!strncmp(s,
"Content-Length:", ne)) {
1082 if (strchr(
"0123456789", *e))
1085 if (!strncmp(s,
"Connection:", ne)) {
1086 if (!strcmp(e,
"close"))
1091 if (!strncmp(s,
"Content-Type:", ne)) {
1093 if (!strncmp(s,
"Transfer-Encoding:", ne)) {
1094 if (!strcmp(e,
"chunked"))
1099 if (!strncmp(s,
"Allow:", ne)) {
1106 if (!strncmp(s,
"<TITLE>",
sizeof(
"<TITLE>")-1))
1107 s +=
sizeof(
"<TITLE>") - 1;
1110 if (strchr(
"0123456789", *s)) {
1111 if (errorCode[0] !=
'\0') {
1112 if (!strncmp(s, errorCode,
sizeof(
"123")-1) && s[3] ==
' ')
1115 strncpy(errorCode, s,
sizeof(
"123")-1);
1116 errorCode[3] =
'\0';
1123 if (moretodo && se > s) {
1124 bufLength = se - s - 1;
1126 memmove(buf, s, bufLength);
1130 }
while (moretodo && ec == 0);
1132 if (str) *str = buf;
1133 if (ecp) *ecp = atoi(errorCode);
1156 if (ec >= 400 && ec <= 599) {
1170 const char * s, * t;
1176 while ((s = va_arg(ap,
const char *)) != NULL) {
1180 len +=
sizeof(
"\r\n")-1;
1183 t = te = (
char *)
alloca(len + 1);
1186 while ((s = va_arg(ap,
const char *)) != NULL) {
1187 if (te > t) *te++ =
' ';
1194 fprintf(stderr,
"-> %s", t);
1208 const char * password;
1225 if ((password = u->
password) == NULL) {
1226 uid_t uid = getuid();
1228 if (uid && (pw = getpwuid(uid)) != NULL) {
1229 char *myp = (
char *)
alloca(strlen(pw->pw_name) +
sizeof(
"@"));
1230 strcpy(myp, pw->pw_name);
1251 if ((rc =
ftpCommand(u, NULL,
"USER", user, NULL)))
1254 if ((rc =
ftpCommand(u, NULL,
"PASS", password, NULL)))
1257 if ((rc =
ftpCommand(u, NULL,
"TYPE",
"I", NULL)))
1281 struct sockaddr_in dataAddress;
1297 cmdlen = strlen(ftpCmd) + (ftpArg ? 1+strlen(ftpArg) : 0) +
sizeof(
"\r\n");
1298 cmd = (
char *)
alloca(cmdlen);
1299 chptr =
stpcpy(cmd, ftpCmd);
1302 chptr =
stpcpy(chptr, ftpArg);
1304 chptr =
stpcpy(chptr,
"\r\n");
1305 cmdlen = chptr -
cmd;
1310 if (!strncmp(cmd,
"RETR", 4)) {
1314 rc =
ftpCommand(u, &passReply,
"SIZE", ftpArg, NULL);
1317 if (sscanf(passReply,
"%d %u", &rc, &cl) != 2) {
1327 #ifdef HAVE_GETNAMEINFO
1328 rc =
ftpCommand(u, &passReply,
"EPSV", NULL);
1330 #ifdef HAVE_GETADDRINFO
1331 struct sockaddr_storage ss;
1333 struct sockaddr_in ss;
1335 socklen_t sslen =
sizeof(ss);
1338 if ((getpeername(
fdFileno(
c2f(u->
ctrl)), (
struct sockaddr *)&ss, &sslen) == 0)
1339 && (getnameinfo((
struct sockaddr *)&ss, sslen,
1340 remoteIP,
sizeof(remoteIP),
1341 NULL, 0, NI_NUMERICHOST) == 0))
1346 rc =
ftpCommand(u, &passReply,
"ABOR", NULL);
1355 rc =
ftpCommand(u, &passReply,
"PASV", NULL);
1362 assert(chptr != NULL);
1363 while (*chptr && *chptr !=
'(') chptr++;
1367 while (*chptr && *chptr !=
')') chptr++;
1373 if(sscanf(passReply,
"%*c%*c%*c%d%*c",&i) != 1) {
1380 while (*chptr && *chptr !=
',') chptr--;
1383 while (*chptr && *chptr !=
',') chptr--;
1391 if (sscanf(chptr,
"%d,%d", &i, &j) != 2) {
1395 port = (((unsigned)i) << 8) + j;
1399 while (*chptr++ !=
'\0') {
1400 if (*chptr ==
',') *chptr =
'.';
1402 sprintf(remoteIP,
"%s", passReply);
1405 #ifdef HAVE_GETADDRINFO
1408 struct addrinfo hints, *res, *res0;
1412 memset(&hints, 0,
sizeof(hints));
1413 hints.ai_family = AF_UNSPEC;
1414 hints.ai_socktype = SOCK_STREAM;
1415 hints.ai_flags = AI_NUMERICHOST;
1417 hints.ai_flags |= AI_IDN;
1419 sprintf(pbuf,
"%d", port);
1420 pbuf[
sizeof(pbuf)-1] =
'\0';
1421 if (getaddrinfo(remoteIP, pbuf, &hints, &res0)) {
1426 for (res = res0; res != NULL; res = res->ai_next) {
1427 rc = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
1438 data =
fdLink(data,
"open data (ftpReq)");
1446 while (connect(
fdFileno(data), res->ai_addr, (
int)res->ai_addrlen) < 0) {
1472 memset(&dataAddress, 0,
sizeof(dataAddress));
1473 dataAddress.sin_family = AF_INET;
1474 dataAddress.sin_port = htons(port);
1477 if (!
inet_aton(remoteIP, &dataAddress.sin_addr)) {
1483 rc = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
1489 data =
fdLink(data,
"open data (ftpReq)");
1496 while (connect(
fdFileno(data), (
struct sockaddr *) &dataAddress,
1497 sizeof(dataAddress)) < 0)
1508 fprintf(stderr,
"-> %s", cmd);
1509 if ((
size_t)
fdWrite(u->
ctrl, cmd, cmdlen) != cmdlen) {
1537 static void * _urlNotifyData = NULL;
1540 static int _urlNotifyCount = -1;
1542 static void urlSetCallback(
rpmCallbackFunction notify,
void *notifyData,
int notifyCount) {
1543 _urlNotify = notify;
1544 _urlNotifyData = notifyData;
1545 _urlNotifyCount = (notifyCount >= 0) ? notifyCount : 4096;
1553 int itemsCopied = 0;
1561 0, 0, NULL, _urlNotifyData);
1567 rc = (int)
Fread(buf,
sizeof(buf[0]),
sizeof(buf), sfd);
1575 rc = (int)
Fwrite(buf,
sizeof(buf[0]), itemsRead, tfd);
1578 if (rc != itemsRead) {
1583 itemsCopied += itemsRead;
1585 if (_urlNotify && _urlNotifyCount > 0) {
1586 int n = itemsCopied/_urlNotifyCount;
1587 if (n != notifier) {
1590 itemsCopied, 0, NULL, _urlNotifyData);
1598 DBGIO(sfd, (stderr,
"++ copied %d bytes: %s\n", itemsCopied,
1605 itemsCopied, itemsCopied, NULL, _urlNotifyData);
1626 if ((fd = u->
ctrl) == NULL) {
1627 fd = u->
ctrl =
fdNew(
"persist ctrl (urlConnect FTP)");
1639 fd =
fdLink(fd,
"grab ctrl (urlConnect FTP)");
1648 u->
ctrl =
fdFree(fd,
"grab ctrl (urlConnect FTP)");
1655 *uret =
urlLink(u,
"urlConnect");
1656 u =
urlFree(u,
"urlSplit (urlConnect)");
1674 int ftpCmd(
const char *
cmd,
const char * url,
const char * arg2)
1685 rc =
ftpCommand(u, NULL, cmd, path, arg2, NULL);
1692 #define IAC ((unsigned char)255)
1695 #define IP ((unsigned char)244)
1698 #define DM ((unsigned char)242)
1700 #if !defined(SHUT_RDWR)
1701 #define SHUT_RDWR 1+1
1708 static unsigned char ipbuf[3] = {
IAC,
IP,
IAC };
1723 DBGIO(0, (stderr,
"-> ABOR\n"));
1726 if (send(
fdFileno(ctrl), ipbuf,
sizeof(ipbuf), MSG_OOB) !=
sizeof(ipbuf)) {
1731 sprintf(u->
buf,
"%cABOR\r\n",(
char)
DM);
1755 assert(u->
ctrl != NULL);
1797 if (
_ftp_debug && !(rc == 0 && (ec == 200 || ec == 201)))
1798 fprintf(stderr,
"*** httpResp: rc %d ec %d\n", rc, ec);
1816 static int httpReq(
FD_t ctrl,
const char * httpCmd,
const char * httpArg)
1830 assert(ctrl != NULL);
1836 if (strchr(host,
':'))
1837 sprintf(hthost,
"[%s]", host);
1839 strcpy(hthost, host);
1843 if (path == NULL) path =
"";
1855 ctrl =
fdLink(ctrl,
"open ctrl (httpReq)");
1860 User-Agent: rpm/3.0.4\r\n\
1862 Accept: text/plain\r\n\
1863 Transfer-Encoding: chunked\r\n\
1865 ") + strlen(httpCmd) + strlen(path) +
sizeof(
VERSION) + strlen(hthost) + 20;
1870 if (!strcmp(httpCmd,
"PUT")) {
1872 %s %s HTTP/1.%d\r\n\
1873 User-Agent: rpm/%s\r\n\
1875 Accept: text/plain\r\n\
1876 Transfer-Encoding: chunked\r\n\
1881 %s %s HTTP/1.%d\r\n\
1882 User-Agent: rpm/%s\r\n\
1884 Accept: text/plain\r\n\
1890 fprintf(stderr,
"-> %s", req);
1893 if (
fdWrite(ctrl, req, len) != (ssize_t)len) {
1898 if (!strcmp(httpCmd,
"PUT")) {
1914 ctrl =
fdLink(ctrl,
"open data (httpReq)");
1936 return urlLink(fd->
u,
"ufdGetUrlinfo");
1941 static ssize_t
ufdRead(
void * cookie,
char * buf,
size_t count)
1953 (void) fstat(fdno, &sb);
1954 if (S_ISREG(sb.st_mode))
1955 return fdRead(fd, buf, count);
1961 for (total = 0; total < count; total += bytesRead) {
1974 return (ssize_t) total;
1980 rc = (int)
fdRead(fd, buf + total, count - total);
1991 fprintf(stderr,
"*** read: rc %d errno %d %s \"%s\"\n", rc,
errno, strerror(
errno), buf);
1994 }
else if (rc == 0) {
1995 return (ssize_t) total;
1998 bytesRead = (size_t) rc;
2001 return (ssize_t) count;
2004 static ssize_t
ufdWrite(
void * cookie,
const char * buf,
size_t count)
2009 size_t bytesWritten;
2016 if (S_ISREG(sb.st_mode))
2017 return fdWrite(fd, buf, count);
2023 for (total = 0; total < count; total += bytesWritten) {
2031 fprintf(stderr,
"*** ufdWrite fd %p WRITE PAST END OF CONTENT\n", fd);
2032 return (ssize_t) total;
2039 return (ssize_t) total;
2045 rc = (int)
fdWrite(fd, buf + total, count - total);
2056 fprintf(stderr,
"*** write: rc %d errno %d %s \"%s\"\n", rc,
errno, strerror(
errno), buf);
2059 }
else if (rc == 0) {
2060 return (ssize_t) total;
2063 bytesWritten = (size_t) rc;
2066 return (ssize_t) count;
2089 return fdSeek(cookie, pos, whence);
2104 fd = u->
data =
fdFree(fd,
"grab data (ufdClose persist)");
2106 fd =
fdFree(fd,
"grab data (ufdClose)");
2108 (void)
urlFree(fd->
u,
"url (ufdClose)");
2166 && (!strncmp(u->
scheme,
"http",
sizeof(
"http")-1) || !strncmp(u->
scheme,
"hkp",
sizeof(
"hkp")-1)))
2179 fd = u->
ctrl =
fdFree(fd,
"open data (ufdClose HTTP persist ctrl)");
2180 else if (fd == u->
data)
2181 fd = u->
data =
fdFree(fd,
"open data (ufdClose HTTP persist data)");
2183 fd =
fdFree(fd,
"open data (ufdClose HTTP)");
2220 assert(!(flags & O_RDWR));
2225 if (u->
data == NULL)
2226 u->
data =
fdNew(
"persist data (ftpOpen)");
2228 assert(u->
data != NULL);
2230 if (u->
data->
u == NULL)
2231 fd = u->
data =
fdLink(u->
data,
"grab data (ftpOpen persist data)");
2233 fd =
fdNew(
"grab data (ftpOpen)");
2243 fd->
u =
urlLink(u,
"url (ufdOpen FTP)");
2267 fprintf(stderr,
"*** ufdOpen(%s,0x%x,0%o)\n", url, (
unsigned)flags, (
unsigned)mode);
2272 fd =
ftpOpen(url, flags, mode, &u);
2273 if (fd == NULL || u == NULL)
2277 cmd = ((flags & O_WRONLY)
2278 ? ((flags & O_APPEND) ?
"APPE" :
2279 ((flags & O_CREAT) ?
"STOR" :
"STOR"))
2280 : ((flags & O_CREAT) ?
"STOR" :
"RETR"));
2284 fd =
fdLink(fd,
"error data (ufdOpen FTP)");
2295 fd =
davOpen(url, flags, mode, &u);
2297 fd =
httpOpen(url, flags, mode, &u);
2299 if (fd == NULL || u == NULL)
2302 cmd = ((flags & O_WRONLY)
2303 ? ((flags & O_APPEND) ?
"PUT" :
2304 ((flags & O_CREAT) ?
"PUT" :
"PUT"))
2313 fd =
fdLink(fd,
"error ctrl (ufdOpen HTTP)");
2314 fd =
fdLink(fd,
"error data (ufdOpen HTTP)");
2325 assert(!(flags & O_RDWR));
2326 fd =
fdDup( ((flags & O_WRONLY) ? STDOUT_FILENO : STDIN_FILENO) );
2337 fd =
fdOpen(path, flags, mode);
2346 if (fd == NULL)
return NULL;
2352 DBGIO(fd, (stderr,
"<--\tufdOpen(\"%s\",%x,0%o) %s\n", url, (
unsigned)flags, (
unsigned)mode,
fdbg(fd)));
2369 const char *
errstr = NULL;
2371 #if defined(WITH_ZLIB)
2377 #if defined(WITH_BZIP2)
2383 #if defined(WITH_XZ)
2409 #define FDIOVEC(_fd, _vec) \
2410 ((fdGetIo(_fd) && fdGetIo(_fd)->_vec) ? fdGetIo(_fd)->_vec : NULL)
2417 DBGIO(fd, (stderr,
"==> Fread(%p,%u,%u,%p) %s\n", buf, (
unsigned)size, (
unsigned)nmemb, (fd ? fd : NULL),
fdbg(fd)));
2421 rc = (int) fread(buf, size, nmemb,
fdGetFILE(fd));
2430 rc = (int) (_read ? (*_read) (fd, (
char *)buf, size * nmemb) : -2);
2440 DBGIO(fd, (stderr,
"==> Fwrite(%p,%u,%u,%p) %s\n", buf, (
unsigned)size, (
unsigned)nmemb, (fd ? fd : NULL),
fdbg(fd)));
2444 rc = (int) fwrite(buf, size, nmemb,
fdGetFILE(fd));
2453 rc = (int) (_write ? _write(fd, (
const char *)buf, size * nmemb) : -2);
2460 #ifdef USE_COOKIE_SEEK_POINTER
2461 off64_t o64 = offset;
2470 DBGIO(fd, (stderr,
"==> Fseek(%p,%ld,%d) %s\n", fd, (
long)offset, whence,
fdbg(fd)));
2473 return fseek(
fdGetFILE(fd), (
long)offset, whence);
2479 rc = (_seek ? _seek(fd, pos, whence) : -2);
2493 DBGIO(fd, (stderr,
"<== Ftell(%p) rc %ld %s\n", fd, rc,
fdbg(fd)));
2500 DBGIO(fd, (stderr,
"==> Rewind(%p) %s\n", fd,
fdbg(fd)));
2516 DBGIO(fd, (stderr,
"<== Fgetpos(%p,%p) rc %d %s\n", fd, pos, rc,
fdbg(fd)));
2530 DBGIO(fd, (stderr,
"<== Fsetpos(%p,%p) rc %d %s\n", fd, pos, rc,
fdbg(fd)));
2539 DBGIO(fd, (stderr,
"==> Fclose(%p) %s\n", (fd ? fd : NULL),
fdbg(fd)));
2542 fd =
fdLink(fd,
"Fclose");
2544 while (fd->
nfps >= 0) {
2556 if (fd->
nfps > 0 && fpno == -1 &&
2561 int hadreqpersist = (fd->
req != NULL);
2577 if (hadreqpersist) {
2604 fd =
fdFree(fd,
"fopencookie (Fclose)");
2614 if (fd == NULL || fd->
nfps == 0)
2620 fd =
fdFree(fd,
"Fclose");
2644 char *stdio,
size_t nstdio,
2645 char *other,
size_t nother,
2646 const char **end,
int * f, mode_t *
mode)
2657 flags |= O_WRONLY | O_CREAT | O_APPEND;
2658 if (--nstdio > 0) *stdio++ = *m;
2661 flags |= O_WRONLY | O_CREAT | O_TRUNC;
2662 if (--nstdio > 0) *stdio++ = *m;
2666 if (--nstdio > 0) *stdio++ = *m;
2669 if (mode) *mode = 0;
2678 while ((c = *m++) !=
'\0') {
2683 flags &= ~(O_RDONLY|O_WRONLY);
2685 if (--nstdio > 0) *stdio++ = c;
2693 #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 3
2694 if (--nstdio > 0) *stdio++ = c;
2699 if (--nstdio > 0) *stdio++ = c;
2703 if (--nother > 0) *other++ = c;
2711 *stdio = *other =
'\0';
2713 *end = (*m !=
'\0' ? m : NULL);
2719 #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 0
2721 typedef _IO_cookie_io_functions_t cookie_io_functions_t;
2727 char stdio[20], other[20], zstdio[40+1];
2728 const char *end = NULL;
2733 fprintf(stderr,
"*** Fdopen(%p,%s) %s\n", fd, fmode,
fdbg(fd));
2739 cvtfmode(fmode, stdio,
sizeof(stdio), other,
sizeof(other), &end, NULL, NULL);
2740 if (stdio[0] ==
'\0')
2745 if (end == NULL && other[0] ==
'\0')
2749 if (!strcmp(end,
"fdio")) {
2751 #if defined(WITH_ZLIB)
2752 }
else if (!strcmp(end,
"gzdio")) {
2755 fd = iof->
_fdopen(fd, zstdio);
2758 #if defined(WITH_BZIP2)
2759 }
else if (!strcmp(end,
"bzdio")) {
2762 fd = iof->
_fdopen(fd, zstdio);
2765 #if defined(WITH_XZ)
2766 }
else if (!strcmp(end,
"lzdio")) {
2768 fd = iof->
_fdopen(fd, zstdio);
2769 }
else if (!strcmp(end,
"xzdio")) {
2771 fd = iof->
_fdopen(fd, zstdio);
2773 }
else if (!strcmp(end,
"ufdio")) {
2775 }
else if (!strcmp(end,
"fpio")) {
2779 FILE * fp = fdopen(fdno, stdio);
2782 fprintf(stderr,
"*** Fdopen fpio fp %p\n", (
void *)fp);
2794 }
else if (other[0] !=
'\0') {
2795 for (end = other; *end && strchr(
"0123456789fh", *end); end++)
2798 #if defined(WITH_ZLIB)
2801 fd = iof->
_fdopen(fd, zstdio);
2813 { cookie_io_functions_t ciof;
2814 ciof.read = iof->
read;
2815 ciof.write = iof->
write;
2816 ciof.seek = iof->
seek;
2817 ciof.close = iof->
close;
2818 fp = fopencookie(fd, stdio, ciof);
2819 DBGIO(fd, (stderr,
"<-- fopencookie(%p,\"%s\",*%p) returns fp %p\n", fd, stdio, iof, fp));
2830 fd =
fdLink(fd,
"fopencookie");
2835 DBGIO(fd, (stderr,
"<== Fdopen(%p,\"%s\") returns fd %p %s\n", ofd, fmode, (fd ? fd : NULL),
fdbg(fd)));
2842 const char * fmode = NULL;
2843 char stdio[20], other[20];
2844 const char *end = NULL;
2849 if (path == NULL || _fmode == NULL)
2856 fprintf(stderr,
"==> Fopen(%s, %s)\n", path, fmode);
2859 cvtfmode(fmode, stdio,
sizeof(stdio), other,
sizeof(other), &end, &flags, &perms);
2860 if (stdio[0] ==
'\0')
2863 if (end && !strcmp(end,
"fdio")) {
2864 fd =
fdOpen(path, flags, perms);
2887 fd =
ufdOpen(path, flags, perms);
2888 if (fd == NULL || !(
fdFileno(fd) >= 0 || fd->
req != NULL)) {
2903 if (isHTTP && ((fp = (FILE *)
fdGetFp(fd)) != NULL)
2918 fprintf(stderr,
"<== Fopen(%s, %s) fd %p\n", path, fmode, fd);
2919 fmode =
_free(fmode);
2926 if (fd == NULL)
return -1;
2933 #if defined(WITH_ZLIB)
2937 #if defined(WITH_BZIP2)
2941 #if defined(WITH_XZ)
2955 if (fd == NULL)
return -1;
2956 if (fd->
req != NULL) {
2960 for (i = fd->
nfps; rc == 0 && i >= 0; i--) {
2968 #if defined(WITH_ZLIB)
2969 }
else if (fps->
io ==
gzdio) {
2973 #if defined(WITH_BZIP2)
2974 }
else if (fps->
io ==
bzdio) {
2978 #if defined(WITH_XZ)
2979 }
else if (fps->
io ==
lzdio) {
2982 }
else if (fps->
io ==
xzdio) {
2994 DBGIO(fd, (stderr,
"<== Ferror(%p) rc %d %s\n", fd, rc,
fdbg(fd)));
3004 if (fd->
req != NULL)
3007 for (i = fd->
nfps ; rc == -1 && i >= 0; i--) {
3011 DBGIO(fd, (stderr,
"<== Fileno(%p) rc %d %s\n", (fd ? fd : NULL), rc,
fdbg(fd)));
3018 return fcntl(
Fileno(fd), op, lip);
3030 if (path == NULL || *path ==
'\0')
3032 d = (
char *)
alloca(strlen(path)+2);
3035 for (de = d; *de !=
'\0'; de++) {
3039 while (*de && *de !=
'/') de++;
3052 rc =
Mkdir(d, mode);
3056 if (!(uid == (uid_t) -1 && gid == (gid_t) -1)) {
3057 rc =
Chown(d, uid, gid);
3061 }
else if (!S_ISDIR(st.st_mode)) {
3069 path, (
unsigned)mode);
3073 #define _PATH "/bin:/usr/bin:/sbin:/usr/sbin"
3077 #define alloca_strdup(_s) strcpy((char *)alloca(strlen(_s)+1), (_s))
3089 if (FN == NULL || *FN ==
'\0')
3097 for (t = bn; t && *t; t++) {
3110 && strchr(
"Rr_", bn[0]) != NULL
3111 && strchr(
"Ww_", bn[1]) != NULL
3112 && strchr(
"Xx_", bn[2]) != NULL) {
3114 if (strchr(
"Rr", bn[0]) != NULL)
3116 if (strchr(
"Ww", bn[1]) != NULL)
3118 if (strchr(
"Xx", bn[2]) != NULL)
3122 }
else if (!strcmp(bn,
"exists"))
3124 else if (!strcmp(bn,
"executable"))
3126 else if (!strcmp(bn,
"readable"))
3128 else if (!strcmp(bn,
"writable"))
3132 te = bn + strlen(t) - 1;
3145 rc = (
Access(bn, mode) != 0 ? 1 : 0);
3147 fprintf(stderr,
"*** rpmioAccess(\"%s\", 0x%x) rc %d\n", bn, mode, rc);
3162 for (r =
alloca_strdup(path); r != NULL && *r !=
'\0'; r = re) {
3165 for (re = r; (re = strchr(re,
':')) != NULL; re++) {
3166 if (!(re[1] ==
'/' && re[2] ==
'/'))
3169 if (re && *re ==
':')
3178 if (r[0] ==
'~' && r[1] ==
'/') {
3179 const char * home =
getenv(
"HOME");
3182 if (strlen(home) > (
sizeof(fn) - strlen(r)))
3188 if (t[-1] !=
'/' && *bn !=
'/')
3196 rc = (
Access(t, mode) != 0 ? 1 : 0);
3198 fprintf(stderr,
"*** rpmioAccess(\"%s\", 0x%x) rc %d\n", t, mode, rc);
3211 #if defined(WITH_NSS) && !defined(__LCLINT__)
3216 #ifdef HAVE_NSS_INITCONTEXT
3217 extern void NSS_ShutdownContext(
void * _nss_context);
3219 extern void NSS_Shutdown(
void);
3221 extern void PL_ArenaFinish(
void);
3222 extern void PR_Cleanup(
void);
3229 int _rpmnss_init = 0;
3232 void * _rpmnss_context = NULL;
3289 #if defined(WITH_LUA)
3292 #if defined(WITH_NEON)
3295 #if defined(WITH_NSS) && !defined(__LCLINT__)
3297 #ifdef HAVE_NSS_INITCONTEXT
3298 if (_rpmnss_context != NULL)
3299 (void) NSS_ShutdownContext(_rpmnss_context);
3301 (void) NSS_Shutdown();
3305 _rpmnss_context = NULL;
3323 _rpmmrbI = rpmmrbFree(_rpmmrbI);
3327 _rpmjniI = rpmjniFree(_rpmjniI);
3349 _rpmnixI = rpmnixFree(_rpmnixI);
int davDisconnect(void *_u)
Close active neon transfer(s) (if any).
const char const double d
static int fdSeekNot(void *cookie, _libio_pos_t pos, int whence)
int ufdCopy(FD_t sfd, FD_t tfd)
int ftpCmd(const char *cmd, const char *url, const char *arg2)
rpmsm rpmsmFree(rpmsm sm)
Destroy a semanage wrapper.
static int mygethostbyname(const char *host, struct in_addr *address)
int fdWritable(FD_t fd, int secs)
mongo_error_t const char * errstr
int Fcntl(FD_t fd, int op, void *lip)
fcntl(2) clone.
static int ufdSeek(void *cookie, _libio_pos_t pos, int whence)
void rpmioClean(void)
Free all memory allocated by rpmio usage.
static void cvtfmode(const char *m, char *stdio, size_t nstdio, char *other, size_t nother, const char **end, int *f, mode_t *mode)
Convert stdio fmode to open(2) mode, filtering out zlib/bzlib flags.
pgpDig pgpDigFree(pgpDig dig)
Destroy a container for parsed OpenPGP packates.
static void fdstat_enter(FD_t fd, int opx)
const char const char size_t len
off_t _libio_off_t
Hide libio API lossage.
static int fdGetFdno(FD_t fd)
char * getenv(const char *name)
static void * fdGetFp(FD_t fd)
static void fdSetFdno(FD_t fd, int fdno)
enum urltype_e urltype
Supported URL types.
static const char * _path
const char const char * cmd
static int ftpTimeoutSecs
const char * fdbg(FD_t fd)
struct urlinfo_s * urlinfo
rpmsquirrel rpmsquirrelFree(rpmsquirrel squirrel)
Destroy a squirrel interpreter.
size_t Fwrite(const void *buf, size_t size, size_t nmemb, FD_t fd)
fwrite(3) clone.
char * rpmCleanPath(char *path)
Canonicalize file path.
rpmruby _rpmrubyI
Current (global) interpreter instance.
int Fsetpos(FD_t fd, fpos_t *pos)
FD_t Fopen(const char *path, const char *_fmode)
fopen(3) clone.
rpmjs rpmjsFree(rpmjs js)
Destroy a js interpreter.
#define RPMURL_SERVER_HASRANGE
static int httpResp(urlinfo u, FD_t ctrl, char **str)
rpmioItem rpmioLinkPoolItem(rpmioItem item, const char *msg, const char *fn, unsigned ln)
Increment a pool item refcount.
int Access(const char *path, int amode)
access(2) clone.
rpmsx rpmsxFree(rpmsx sx)
Destroy a SELinux wrapper.
int rpmioMkpath(const char *path, mode_t mode, uid_t uid, gid_t gid)
Insure that directories in path exist, creating as needed.
urltype urlIsURL(const char *url)
Return type of URL.
static int ftpFileDone(urlinfo u, FD_t data)
void rpmlogClose(void)
Close desriptor used to write to system logger.
rpmsquirrel _rpmsquirrelI
int Fgetpos(FD_t fd, fpos_t *pos)
const char * urlStrerror(const char *url)
int Stat(const char *path, struct stat *st)
stat(2) clone.
FD_t fdLink(void *cookie, const char *msg)
static struct FDIO_s fpio_s
ssize_t davRead(void *cookie, char *buf, size_t count)
urltype urlType(void *_u)
int fdFgets(FD_t fd, char *buf, size_t len)
static int ftpLogin(urlinfo u)
int Fflush(FD_t fd)
fflush(3) clone.
static void fdPush(FD_t fd, FDIO_t io, void *fp, int fdno)
ssize_t(* fdio_write_function_t)(void *cookie, const char *buf, size_t nbytes)
int ufdClose(void *cookie)
rpmmgo rpmmgoFree(rpmmgo mgo)
Destroy a mongo wrapper.
fdio_fdopen_function_t _fdopen
static void rpmlog(int code, const char *fmt,...)
const char * ftpStrerror(int errorNumber)
rpmhkp rpmhkpFree(rpmhkp hkp)
Destroy a hkp handle.
static FDIO_t fdGetIo(FD_t fd)
int Fseek(FD_t fd, _libio_off_t offset, int whence)
fseek(3) clone.
FD_t fdNew(const char *msg)
FD_t ftpOpen(const char *url, int flags, mode_t mode, urlinfo *uret)
static void fdSetSyserrno(FD_t fd, int syserrno, const void *errcookie)
static void fdUpdateDigests(FD_t fd, const unsigned char *buf, ssize_t buflen)
Update digest(s) attached to fd.
static int getHostAddress(const char *host, struct in_addr *address)
struct _filter_s _rpmhkp_crl
static FD_t ufdOpen(const char *url, int flags, mode_t mode)
rpmpython rpmpythonFree(rpmpython python)
Destroy a python interpreter.
int Chown(const char *path, uid_t owner, gid_t group)
chown(2) clone.
static int ftpCommand(urlinfo u, char **str,...)
static int rpm_inet_aton(const char *cp, struct in_addr *inp)
int(* fdio_close_function_t)(void *cookie)
const char * Fstrerror(FD_t fd)
strerror(3) clone.
void * xcalloc(size_t nmemb, size_t size)
fdio_close_function_t close
rpmbf rpmbfFree(rpmbf bf)
Destroy a Bloom filter.
rpmgit rpmgitFree(rpmgit git)
Destroy a git wrapper.
rpmioItem rpmioGetPool(rpmioPool pool, size_t size)
Get unused item from pool, or alloc a new item.
void *(* rpmCallbackFunction)(const void *h, const rpmCallbackType what, const rpmuint64_t amount, const rpmuint64_t total, fnpyKey key, rpmCallbackData data)
FD_t fdFree(FD_t fd, const char *msg)
int Mkdir(const char *path, mode_t mode)
mkdir(2) clone.
const char const bson * data
static void fdPop(FD_t fd)
int fdReadable(FD_t fd, int secs)
static ssize_t ufdWrite(void *cookie, const char *buf, size_t count)
static void fdSetOpen(FD_t fd, const char *path, int flags, mode_t mode)
int rpmioAccess(const char *FN, const char *path, int mode)
Check FN access, expanding relative paths and twiddles.
rpmioPool _rpmrubyPool
The pool of Ruby interpreter instances.
static int tcpConnect(FD_t ctrl, const char *host, int port)
The FD_t File Handle data structure.
fdio_flush_function_t _flush
const char const char * user
static void fdFini(void *_fd)
void * rpmluaFree(rpmlua lua)
static int urlConnect(const char *url, urlinfo *uret)
const char const bson const bson * op
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
rpmaug rpmaugFree(rpmaug aug)
Destroy a augeas wrapper.
Embedded Ruby interpreter.
void * ufdGetUrlinfo(FD_t fd)
size_t Fread(void *buf, size_t size, size_t nmemb, FD_t fd)
fread(3) clone.
struct _filter_s _rpmhkp_awol
static int ftpAbort(urlinfo u, FD_t data)
static int fdFileno(void *cookie)
int Fclose(FD_t fd)
fclose(3) clone.
const char const bson int mongo_write_concern int flags
#define alloca_strdup(_s)
static const char * getFdErrstr(FD_t fd)
FD_t XfdNew(const char *msg, const char *fn, unsigned ln)
rpmruby rpmrubyFree(rpmruby ruby)
Destroys a Ruby interpreter instance.
static int ftpCheckResponse(urlinfo u, char **str)
ssize_t davWrite(void *cookie, const char *buf, size_t count)
struct @8 * FDSTAT_t
Cumulative statistics for a descriptor.
FD_t httpOpen(const char *url, int flags, mode_t mode, urlinfo *uret)
static struct FDIO_s ufdio_s
static int httpReq(FD_t ctrl, const char *httpCmd, const char *httpArg)
int ufdGetFile(FD_t sfd, FD_t tfd)
int Ferror(FD_t fd)
ferror(3) clone.
static void fdSetIo(FD_t fd, FDIO_t io)
int urlSplit(const char *url, urlinfo *uret)
Parse URL string into a control structure.
rpmsql rpmsqlFree(rpmsql sql)
Destroy a sql interpreter.
unsigned long long fd_cpioPos
int davClose(void *cookie)
static ssize_t ufdRead(void *cookie, char *buf, size_t count)
static int xisdigit(int c)
rpmioPool _rpmsquirrelPool
urltype urlPath(const char *url, const char **pathp)
Return path component of URL.
#define inet_aton(cp, inp)
void davDestroy(void)
Free global neon+openSSL state memory.
rpmioPool rpmioNewPool(const char *name, size_t size, int limit, int flags, char *(*dbg)(void *item), void(*init)(void *item), void(*fini)(void *item))
Create a memory pool.
char * stpcpy(char *dest, const char *src)
static int fdSeek(void *cookie, _libio_pos_t pos, int whence)
const char const char size_t size
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
static struct FDIO_s fdio_s
FD_t Fdopen(FD_t ofd, const char *fmode)
const char * contentDisposition
static int checkResponse(void *_u, FD_t ctrl, int *ecp, char **str)
void urlFreeCache(void)
Free cached URL control structures.
FD_t davOpen(const char *url, int flags, mode_t mode, urlinfo *uret)
Open a URL.
int davReq(FD_t ctrl, const char *httpCmd, const char *httpArg)
Send a http request.
rpmtcl rpmtclFree(rpmtcl tcl)
Destroy a tcl interpreter.
fdio_write_function_t write
int Fileno(FD_t fd)
fileno(3) clone.
static FD_t c2f(void *cookie)
int rpmDigestFinal(DIGEST_CTX ctx, void *datap, size_t *lenp, int asAscii)
Return digest and destroy context.
rpmxar rpmxarFree(rpmxar xar, const char *msg)
Destroy a xar archive instance.
ssize_t(* fdio_read_function_t)(void *cookie, char *buf, size_t nbytes)
fdio_read_function_t read
rpmficl rpmficlFree(rpmficl ficl)
Destroy a ficl interpreter.
static void fdSetFp(FD_t fd, void *fp)
int(* fdio_seek_function_t)(void *cookie, _libio_pos_t pos, int whence)
rpmperl rpmperlFree(rpmperl perl)
Destroy a perl interpreter.
static FD_t fdGetPool(rpmioPool pool)
ssize_t xarRead(void *cookie, char *buf, size_t count)
fdio_seek_function_t seek
int ftpReq(FD_t data, const char *ftpCmd, const char *ftpArg)
urlinfo urlFree(urlinfo u, const char *msg)
Dereference a URL control structure instance.
static void fdstat_exit(FD_t fd, int opx, ssize_t rc)
#define FDIOVEC(_fd, _vec)
rpmioPool rpmioFreePool(rpmioPool pool)
Reclaim memory pool items.
urlinfo urlLink(urlinfo u, const char *msg)
Reference a URL control structure instance.