rpm  5.4.15
Macros | Enumerations | Functions | Variables
rpmrpc.c File Reference
#include "system.h"
#include <rpmio_internal.h>
#include <rpmmacro.h>
#include <rpmdir.h>
#include <rpmdav.h>
#include <rpmhash.h>
#include <ugid.h>
#include "debug.h"
Include dependency graph for rpmrpc.c:

Go to the source code of this file.

Macros

#define _RPMDIR_INTERNAL
 
#define _RPMDAV_INTERNAL
 
#define g_strdup   xstrdup
 
#define g_free   free
 
#define MAXCOLS   30
 
#define alloca_strdup(_s)   strcpy((char *)alloca(strlen(_s)+1), (_s))
 

Enumerations

enum  ftpSysCall_t {
  DO_FTP_STAT = 1, DO_FTP_LSTAT = 2, DO_FTP_READLINK = 3, DO_FTP_ACCESS = 4,
  DO_FTP_GLOB = 5
}
 

Functions

static int ftpMkdir (const char *path, mode_t mode)
 
static int ftpChdir (const char *path)
 
static int ftpRmdir (const char *path)
 
static int ftpRename (const char *oldpath, const char *newpath)
 
static int ftpUnlink (const char *path)
 
int Mkdir (const char *path, mode_t mode)
 mkdir(2) clone. More...
 
int Chdir (const char *path)
 chdir(2) clone. More...
 
int Rmdir (const char *path)
 rmdir(2) clone. More...
 
int Chroot (const char *path)
 chroot(2) clone. More...
 
int Open (const char *path, int flags, mode_t mode)
 open(2) clone. More...
 
int Rename (const char *oldpath, const char *newpath)
 rename(2) clone. More...
 
int Link (const char *oldpath, const char *newpath)
 link(2) clone. More...
 
int Unlink (const char *path)
 unlink(2) clone. More...
 
static int vfs_split_text (char *p)
 
static int is_num (int idx)
 
static int is_dos_date (const char *str)
 
static int is_week (const char *str, struct tm *tim)
 
static int is_month (const char *str, struct tm *tim)
 
static int is_time (const char *str, struct tm *tim)
 
static int is_year (const char *str, struct tm *tim)
 
static int vfs_parse_filetype (char c)
 
static int vfs_parse_filemode (const char *p)
 
static int vfs_parse_filedate (int idx, time_t *t)
 
static int vfs_parse_ls_lga (char *p, struct stat *st, const char **filename, const char **linkname)
 
static int ftpNLST (const char *url, ftpSysCall_t ftpSysCall, struct stat *st, char *rlbuf, size_t rlbufsiz)
 
static const char * statstr (const struct stat *st, char *buf)
 
static int ftpStat (const char *path, struct stat *st)
 
static int ftpLstat (const char *path, struct stat *st)
 
static int ftpReadlink (const char *path, char *buf, size_t bufsiz)
 
DIR * ftpOpendir (const char *path)
 Create an argv directory from an ftp:// URI. More...
 
static char * ftpRealpath (const char *path, char *resolved_path)
 
int Stat (const char *path, struct stat *st)
 stat(2) clone. More...
 
int Lstat (const char *path, struct stat *st)
 lstat(2) clone. More...
 
int Fstat (FD_t fd, struct stat *st)
 fstat(2) clone. More...
 
int Fadvise (FD_t fd, off_t offset, off_t len, int advice)
 posix_fadvise(2) clone. More...
 
int Fallocate (FD_t fd, off_t offset, off_t len)
 posix_fallocate(3)/fallocate(2) clone. More...
 
int Chown (const char *path, uid_t owner, gid_t group)
 chown(2) clone. More...
 
int Fchown (FD_t fd, uid_t owner, gid_t group)
 fchown(2) clone. More...
 
int Lchown (const char *path, uid_t owner, gid_t group)
 lchown(2) clone. More...
 
int Chmod (const char *path, mode_t mode)
 chmod(2) clone. More...
 
int Lchmod (const char *path, mode_t mode)
 lchmod(2) clone. More...
 
int Fchmod (FD_t fd, mode_t mode)
 fchmod(2) clone. More...
 
int Chflags (const char *path, unsigned int flags)
 chflags(2) clone. More...
 
int Lchflags (const char *path, unsigned int flags)
 lchflags(2) clone. More...
 
int Fchflags (FD_t fd, unsigned int flags)
 fchflags(2) clone. More...
 
int Mkfifo (const char *path, mode_t mode)
 mkfifo(3) clone. More...
 
int Mknod (const char *path, mode_t mode, dev_t dev)
 mknod(3) clone. More...
 
int Utime (const char *path, const struct utimbuf *buf)
 
int Utimes (const char *path, const struct timeval times[2])
 
int Lutimes (const char *path, const struct timeval times[2])
 
int Symlink (const char *oldpath, const char *newpath)
 symlink(3) clone. More...
 
int Readlink (const char *path, char *buf, size_t bufsiz)
 readlink(2) clone. More...
 
int Access (const char *path, int amode)
 access(2) clone. More...
 
int Glob_pattern_p (const char *pattern, int quote)
 glob_pattern_p(3) clone. More...
 
int Glob_error (const char *epath, int eerrno)
 glob_error(3) clone. More...
 
int Glob (const char *pattern, int flags, int errfunc(const char *epath, int eerrno), void *_pglob)
 glob(3) clone. More...
 
void Globfree (void *_pglob)
 globfree(3) clone. More...
 
char * Realpath (const char *path, char *resolved_path)
 realpath(3) clone. More...
 
off_t Lseek (int fdno, off_t offset, int whence)
 lseek(2) clone. More...
 

Variables

const char * _chroot_prefix = NULL
 
static int current_mday
 
static int current_mon
 
static int current_year
 
static char * columns [30]
 
static int column_ptr [30]
 
static size_t ftpBufAlloced
 
static char * ftpBuf
 

Macro Definition Documentation

#define _RPMDAV_INTERNAL

Definition at line 12 of file rpmrpc.c.

#define _RPMDIR_INTERNAL

Definition at line 10 of file rpmrpc.c.

#define alloca_strdup (   _s)    strcpy((char *)alloca(strlen(_s)+1), (_s))

Definition at line 987 of file rpmrpc.c.

Referenced by ftpNLST().

#define g_free   free

Definition at line 435 of file rpmrpc.c.

Referenced by vfs_parse_ls_lga().

#define g_strdup   xstrdup

Definition at line 434 of file rpmrpc.c.

Referenced by vfs_parse_ls_lga().

#define MAXCOLS   30

Definition at line 448 of file rpmrpc.c.

Referenced by vfs_split_text().

Enumeration Type Documentation

Enumerator
DO_FTP_STAT 
DO_FTP_LSTAT 
DO_FTP_READLINK 
DO_FTP_ACCESS 
DO_FTP_GLOB 

Definition at line 970 of file rpmrpc.c.

Function Documentation

int Access ( const char *  path,
int  amode 
)

access(2) clone.

Todo:
Implement remotely.

Definition at line 2196 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by createDir(), main(), rpmioAccess(), rpmrepoTestSetupDirs(), and rpmsqlNew().

int Chdir ( const char *  path)
int Chflags ( const char *  path,
unsigned int  flags 
)

chflags(2) clone.

Todo:
Implement remotely.

Definition at line 1861 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

int Chmod ( const char *  path,
mode_t  mode 
)

chmod(2) clone.

Todo:
Implement remotely.

Definition at line 1765 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by compare(), iosmStage(), and mtreeMiss().

int Chown ( const char *  path,
uid_t  owner,
gid_t  group 
)

chown(2) clone.

Todo:
Implement remotely.

Definition at line 1674 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by compare(), createDir(), iosmStage(), mtreeMiss(), and rpmioMkpath().

int Chroot ( const char *  path)
int Fadvise ( FD_t  fd,
off_t  offset,
off_t  len,
int  advice 
)

posix_fadvise(2) clone.

Definition at line 1495 of file rpmrpc.c.

References _, _rpmio_debug, fdGetOPath(), Fileno(), rpmlog(), RPMLOG_DEBUG, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by iosmStage(), rpmgiOpen(), and rpmShowProgress().

int Fallocate ( FD_t  fd,
off_t  offset,
off_t  len 
)

posix_fallocate(3)/fallocate(2) clone.

Definition at line 1548 of file rpmrpc.c.

References _, _rpmio_debug, fdGetOPath(), Fileno(), rpmlog(), RPMLOG_DEBUG, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

int Fchflags ( FD_t  fd,
unsigned int  flags 
)

fchflags(2) clone.

Todo:
Implement remotely.

Definition at line 1927 of file rpmrpc.c.

References _rpmio_debug, errno, fdGetOPath(), Fileno(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

int Fchmod ( FD_t  fd,
mode_t  mode 
)

fchmod(2) clone.

Todo:
Implement remotely.

Definition at line 1830 of file rpmrpc.c.

References _rpmio_debug, errno, fdGetOPath(), Fileno(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by io_copy_attrs().

int Fchown ( FD_t  fd,
uid_t  owner,
gid_t  group 
)

fchown(2) clone.

Todo:
Implement remotely.

Definition at line 1704 of file rpmrpc.c.

References _rpmio_debug, errno, fdGetOPath(), Fileno(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by io_copy_attrs().

int Fstat ( FD_t  fd,
struct stat *  st 
)
static int ftpChdir ( const char *  path)
static

Definition at line 41 of file rpmrpc.c.

References ftpCmd().

Referenced by Chdir(), and ftpNLST().

static int ftpLstat ( const char *  path,
struct stat *  st 
)
static

Definition at line 1225 of file rpmrpc.c.

References _ftp_debug, DO_FTP_LSTAT, ftpNLST(), hashFunctionString(), and statstr().

Referenced by Lstat().

static int ftpMkdir ( const char *  path,
mode_t  mode 
)
static

Definition at line 25 of file rpmrpc.c.

References ftpCmd().

Referenced by Mkdir().

static int ftpNLST ( const char *  url,
ftpSysCall_t  ftpSysCall,
struct stat *  st,
char *  rlbuf,
size_t  rlbufsiz 
)
static
DIR* ftpOpendir ( const char *  path)

Create an argv directory from an ftp:// URI.

Parameters
pathftp:// directory path
Returns
argv DIR

Definition at line 1254 of file rpmrpc.c.

References _ftp_debug, avOpendir(), DO_FTP_GLOB, errno, ftpBuf, ftpNLST(), rpmavxNew(), S_IFSOCK, and xcalloc().

Referenced by Opendir().

static int ftpReadlink ( const char *  path,
char *  buf,
size_t  bufsiz 
)
static

Definition at line 1243 of file rpmrpc.c.

References _ftp_debug, DO_FTP_READLINK, and ftpNLST().

Referenced by Readlink().

static char* ftpRealpath ( const char *  path,
char *  resolved_path 
)
static

Definition at line 1353 of file rpmrpc.c.

References xstrdup().

Referenced by Realpath().

static int ftpRename ( const char *  oldpath,
const char *  newpath 
)
static

Definition at line 55 of file rpmrpc.c.

References ftpCmd().

Referenced by Rename().

static int ftpRmdir ( const char *  path)
static

Definition at line 48 of file rpmrpc.c.

References ftpCmd().

Referenced by Rmdir().

static int ftpStat ( const char *  path,
struct stat *  st 
)
static

Definition at line 1206 of file rpmrpc.c.

References _ftp_debug, DO_FTP_STAT, ftpNLST(), hashFunctionString(), and statstr().

Referenced by Stat().

static int ftpUnlink ( const char *  path)
static

Definition at line 65 of file rpmrpc.c.

References ftpCmd().

Referenced by Unlink().

int Glob ( const char *  pattern,
int  flags,
int   errfuncconst char *epath, int eerrno,
void *  _pglob 
)
int Glob_error ( const char *  epath,
int  eerrno 
)

glob_error(3) clone.

Definition at line 2271 of file rpmrpc.c.

Referenced by rpmGlob().

int Glob_pattern_p ( const char *  pattern,
int  quote 
)
void Globfree ( void *  _pglob)

globfree(3) clone.

Definition at line 2322 of file rpmrpc.c.

References _rpmio_debug, and globfree().

Referenced by rpmGlob().

static int is_dos_date ( const char *  str)
static

Definition at line 487 of file rpmrpc.c.

Referenced by vfs_parse_filedate(), and vfs_parse_ls_lga().

static int is_month ( const char *  str,
struct tm *  tim 
)
static

Definition at line 514 of file rpmrpc.c.

Referenced by vfs_parse_filedate(), and vfs_parse_ls_lga().

static int is_num ( int  idx)
static

Definition at line 478 of file rpmrpc.c.

References columns.

Referenced by vfs_parse_filedate(), and vfs_parse_ls_lga().

static int is_time ( const char *  str,
struct tm *  tim 
)
static

Definition at line 531 of file rpmrpc.c.

Referenced by vfs_parse_filedate().

static int is_week ( const char *  str,
struct tm *  tim 
)
static

Definition at line 497 of file rpmrpc.c.

Referenced by vfs_parse_filedate(), and vfs_parse_ls_lga().

static int is_year ( const char *  str,
struct tm *  tim 
)
static

Definition at line 550 of file rpmrpc.c.

Referenced by vfs_parse_filedate().

int Lchflags ( const char *  path,
unsigned int  flags 
)

lchflags(2) clone.

Todo:
Implement remotely.

Definition at line 1893 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

int Lchmod ( const char *  path,
mode_t  mode 
)

lchmod(2) clone.

Todo:
Implement remotely.

Definition at line 1795 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

int Lchown ( const char *  path,
uid_t  owner,
gid_t  group 
)

lchown(2) clone.

Todo:
Implement remotely.

Definition at line 1735 of file rpmrpc.c.

References _rpmio_debug, errno, lchown, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by iosmStage().

int Link ( const char *  oldpath,
const char *  newpath 
)

link(2) clone.

Definition at line 345 of file rpmrpc.c.

References _rpmio_debug, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, urlPath(), and xstrncasecmp().

Referenced by iosmStage().

off_t Lseek ( int  fdno,
off_t  offset,
int  whence 
)

lseek(2) clone.

Todo:
Implement SEEK_HOLE/SEEK_DATA.

Definition at line 2417 of file rpmrpc.c.

References _rpmio_debug.

int Lstat ( const char *  path,
struct stat *  st 
)
int Lutimes ( const char *  path,
const struct timeval  times[2] 
)
int Mkdir ( const char *  path,
mode_t  mode 
)
int Mkfifo ( const char *  path,
mode_t  mode 
)

mkfifo(3) clone.

Todo:
Implement remotely.

Definition at line 1959 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by iosmStage().

int Mknod ( const char *  path,
mode_t  mode,
dev_t  dev 
)

mknod(3) clone.

Todo:
Implement remotely.

Definition at line 1989 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by iosmStage().

int Open ( const char *  path,
int  flags,
mode_t  mode 
)

open(2) clone.

Todo:
Implement remotely.

Definition at line 219 of file rpmrpc.c.

References _chroot_prefix, _free(), _rpmio_debug, errno, rpmExpand(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by db_init(), and rpmgitCmdInit().

int Readlink ( const char *  path,
char *  buf,
size_t  bufsiz 
)
char* Realpath ( const char *  path,
char *  resolved_path 
)
int Rename ( const char *  oldpath,
const char *  newpath 
)
int Rmdir ( const char *  path)
int Stat ( const char *  path,
struct stat *  st 
)
static const char* statstr ( const struct stat *  st,
char *  buf 
)
static

Definition at line 1180 of file rpmrpc.c.

Referenced by ftpLstat(), and ftpStat().

int Symlink ( const char *  oldpath,
const char *  newpath 
)

symlink(3) clone.

Todo:
Implement remotely.

Definition at line 2120 of file rpmrpc.c.

References _rpmio_debug, errno, out, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by iosmStage(), and mtreeMiss().

int Unlink ( const char *  path)
int Utime ( const char *  path,
const struct utimbuf *  buf 
)
int Utimes ( const char *  path,
const struct timeval  times[2] 
)
static int vfs_parse_filedate ( int  idx,
time_t *  t 
)
static
static int vfs_parse_filemode ( const char *  p)
static

Definition at line 601 of file rpmrpc.c.

Referenced by vfs_parse_ls_lga().

static int vfs_parse_filetype ( char  c)
static

Definition at line 582 of file rpmrpc.c.

References S_IFSOCK.

Referenced by vfs_parse_ls_lga().

static int vfs_parse_ls_lga ( char *  p,
struct stat *  st,
const char **  filename,
const char **  linkname 
)
static
static int vfs_split_text ( char *  p)
static

Definition at line 456 of file rpmrpc.c.

References column_ptr, columns, and MAXCOLS.

Referenced by vfs_parse_ls_lga().

Variable Documentation

const char* _chroot_prefix = NULL

Definition at line 174 of file rpmrpc.c.

Referenced by Chroot(), and Open().

int column_ptr[30]
static

Definition at line 453 of file rpmrpc.c.

Referenced by vfs_parse_ls_lga(), and vfs_split_text().

char* columns[30]
static

Definition at line 451 of file rpmrpc.c.

Referenced by is_num(), odbcNCols(), vfs_parse_filedate(), vfs_parse_ls_lga(), and vfs_split_text().

int current_mday
static

Definition at line 441 of file rpmrpc.c.

Referenced by vfs_parse_filedate().

int current_mon
static

Definition at line 443 of file rpmrpc.c.

Referenced by vfs_parse_filedate().

int current_year
static

Definition at line 445 of file rpmrpc.c.

Referenced by vfs_parse_filedate().

char* ftpBuf
static

Definition at line 985 of file rpmrpc.c.

Referenced by ftpNLST(), and ftpOpendir().

size_t ftpBufAlloced
static

Definition at line 980 of file rpmrpc.c.

Referenced by ftpNLST().