rpmio/rpmrpc.c File Reference

#include "system.h"
#include <rpmio_internal.h>
#include <rpmdav.h>
#include "ugid.h"
#include "debug.h"

Include dependency graph for rpmrpc.c:

Go to the source code of this file.

Defines

#define _RPMDAV_INTERNAL
#define g_strdup   xstrdup
#define g_free   free
#define MAXCOLS   30
#define alloca_strdup(_s)   strcpy(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.
int Chdir (const char *path)
 chdir(2) clone.
int Rmdir (const char *path)
 rmdir(2) clone.
int Chroot (const char *path)
 chroot(2) clone.
int Rename (const char *oldpath, const char *newpath)
 rename(2) clone.
int Link (const char *oldpath, const char *newpath)
 link(2) clone.
int Unlink (const char *path)
 unlink(2) clone.
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)
static DIR * ftpOpendir (const char *path)
int Stat (const char *path, struct stat *st)
 stat(2) clone.
int Lstat (const char *path, struct stat *st)
 lstat(2) clone.
int Chown (const char *path, uid_t owner, gid_t group)
 chown(2) clone.
int Lchown (const char *path, uid_t owner, gid_t group)
 lchown(2) clone.
int Chmod (const char *path, mode_t mode)
 chmod(2) clone.
int Mkfifo (const char *path, mode_t mode)
 mkfifo(3) clone.
int Mknod (const char *path, mode_t mode, dev_t dev)
 mknod(3) clone.
int Utime (const char *path, const struct utimbuf *buf)
 utime(2) clone.
int Utimes (const char *path, const struct timeval times[2])
int Symlink (const char *oldpath, const char *newpath)
 symlink(3) clone.
int Readlink (const char *path, char *buf, size_t bufsiz)
 readlink(2) clone.
int Access (const char *path, int amode)
 access(2) clone.
int Glob_pattern_p (const char *pattern, int quote)
 glob_pattern_p(3) clone.
int Glob_error (const char *epath, int eerrno)
 glob_error(3) clone.
int Glob (const char *pattern, int flags, int errfunc(const char *epath, int eerrno), glob_t *pglob)
 glob(3) clone.
void Globfree (glob_t *pglob)
 globfree(3) clone.
DIR * Opendir (const char *path)
 opendir(3) clone.
direct * Readdir (DIR *dir)
 readdir(3) clone.
int Closedir (DIR *dir)
 closedir(3) clone.
off_t Lseek (int fdno, off_t offset, int whence)
 lseek(2) clone.

Variables

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 = 0
static char * ftpBuf = NULL
static int ftp_st_ino = 0xdead0000


Detailed Description

Definition in file rpmrpc.c.


Define Documentation

#define _RPMDAV_INTERNAL

Definition at line 13 of file rpmrpc.c.

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

Definition at line 884 of file rpmrpc.c.

#define g_free   free

Definition at line 319 of file rpmrpc.c.

Referenced by vfs_parse_ls_lga().

#define g_strdup   xstrdup

Definition at line 318 of file rpmrpc.c.

Referenced by vfs_parse_ls_lga().

#define MAXCOLS   30

Definition at line 332 of file rpmrpc.c.

Referenced by vfs_split_text().


Enumeration Type Documentation

enum ftpSysCall_t

Enumerator:
DO_FTP_STAT 
DO_FTP_LSTAT 
DO_FTP_READLINK 
DO_FTP_ACCESS 
DO_FTP_GLOB 

Definition at line 866 of file rpmrpc.c.


Function Documentation

int Access ( const char *  path,
int  amode 
)

access(2) clone.

Todo:
Implement remotely.

Definition at line 1599 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_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by rpmdbRebuild(), and rpmioAccess().

int Chdir ( const char *  path  ) 

chdir(2) clone.

Definition at line 99 of file rpmrpc.c.

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

Referenced by getOutputFrom(), rpmpsmStage(), rpmtsRun(), and runScript().

int Chmod ( const char *  path,
mode_t  mode 
)

chmod(2) clone.

Todo:
Implement remotely.

Definition at line 1401 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_PATH, URL_IS_UNKNOWN, and urlPath().

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

chown(2) clone.

Todo:
Implement remotely.

Definition at line 1349 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_PATH, URL_IS_UNKNOWN, and urlPath().

int Chroot ( const char *  path  ) 

chroot(2) clone.

Todo:
Implement remotely.

Definition at line 159 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_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by rpmpsmStage(), rpmtsRun(), and runScript().

int Closedir ( DIR *  dir  ) 

closedir(3) clone.

Definition at line 1764 of file rpmrpc.c.

References _rpmio_debug.

Referenced by Fts_open(), and Glob().

static int ftpChdir ( const char *  path  )  [static]

Definition at line 40 of file rpmrpc.c.

References ftpCmd().

Referenced by Chdir(), and ftpNLST().

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

Definition at line 1117 of file rpmrpc.c.

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

Referenced by Lstat().

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

Definition at line 24 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]

Definition at line 887 of file rpmrpc.c.

References _url_iobuf_size, alloca_strdup, DO_FTP_ACCESS, DO_FTP_GLOB, DO_FTP_LSTAT, DO_FTP_READLINK, DO_FTP_STAT, fdFgets(), fdLink, ftpChdir(), ftpOpen(), ftpReq(), urlinfo_s::openError, ufdClose(), urlPath(), vfs_parse_ls_lga(), xcalloc(), and xrealloc().

Referenced by ftpLstat(), ftpOpendir(), ftpReadlink(), and ftpStat().

static DIR* ftpOpendir ( const char *  path  )  [static]

Definition at line 1145 of file rpmrpc.c.

References _ftp_debug, dirent, DO_FTP_GLOB, ftpNLST(), stpcpy(), stpncpy(), and xcalloc().

Referenced by Opendir().

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

Definition at line 1132 of file rpmrpc.c.

References _ftp_debug, DO_FTP_READLINK, and ftpNLST().

Referenced by Readlink().

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

Definition at line 54 of file rpmrpc.c.

References ftpCmd().

Referenced by Rename().

static int ftpRmdir ( const char *  path  )  [static]

Definition at line 47 of file rpmrpc.c.

References ftpCmd().

Referenced by Rmdir().

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

Definition at line 1101 of file rpmrpc.c.

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

Referenced by Stat().

static int ftpUnlink ( const char *  path  )  [static]

Definition at line 64 of file rpmrpc.c.

References ftpCmd().

Referenced by Unlink().

int Glob ( const char *  pattern,
int  flags,
int   errfunc(const char *epath, int eerrno),
glob_t *  pglob 
)

glob(3) clone.

Definition at line 1675 of file rpmrpc.c.

References _rpmio_debug, Closedir(), Lstat(), Opendir(), Readdir(), Stat(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by rpmGlob().

int Glob_error ( const char *  epath,
int  eerrno 
)

glob_error(3) clone.

Definition at line 1670 of file rpmrpc.c.

Referenced by rpmGlob().

int Glob_pattern_p ( const char *  pattern,
int  quote 
)

glob_pattern_p(3) clone.

Definition at line 1630 of file rpmrpc.c.

References URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, and urlPath().

Referenced by processBinaryFile(), and rpmGlob().

void Globfree ( glob_t *  pglob  ) 

globfree(3) clone.

Definition at line 1713 of file rpmrpc.c.

References _rpmio_debug.

Referenced by rpmGlob().

static int is_dos_date ( const char *  str  )  [static]

Definition at line 376 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 404 of file rpmrpc.c.

Referenced by vfs_parse_filedate(), and vfs_parse_ls_lga().

static int is_num ( int  idx  )  [static]

Definition at line 365 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 421 of file rpmrpc.c.

Referenced by vfs_parse_filedate().

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

Definition at line 387 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 440 of file rpmrpc.c.

Referenced by vfs_parse_filedate().

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

lchown(2) clone.

Todo:
Implement remotely.

Definition at line 1375 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_PATH, URL_IS_UNKNOWN, and urlPath().

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

link(2) clone.

Definition at line 242 of file rpmrpc.c.

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

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

lseek(2) clone.

Todo:
Implement SEEK_HOLE/SEEK_DATA.

Definition at line 1777 of file rpmrpc.c.

References _rpmio_debug.

int Lstat ( const char *  path,
struct stat *  st 
)

lstat(2) clone.

Definition at line 1319 of file rpmrpc.c.

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

Referenced by addFile(), checkOwners(), Fts_open(), Glob(), handleInstInstalledFiles(), prepFetch(), rpmQueryVerify(), and rpmVerifyFile().

int Mkdir ( const char *  path,
mode_t  mode 
)

mkdir(2) clone.

Definition at line 72 of file rpmrpc.c.

References ftpMkdir(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by packageBinaries(), rpmdbRebuild(), rpmioMkpath(), and rpmMkdirPath().

int Mkfifo ( const char *  path,
mode_t  mode 
)

mkfifo(3) clone.

Todo:
Implement remotely.

Definition at line 1427 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_PATH, URL_IS_UNKNOWN, and urlPath().

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

mknod(3) clone.

Todo:
Implement remotely.

Definition at line 1453 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_PATH, URL_IS_UNKNOWN, and urlPath().

DIR* Opendir ( const char *  path  ) 

opendir(3) clone.

Definition at line 1720 of file rpmrpc.c.

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

Referenced by Fts_open(), and Glob().

struct direct* Readdir ( DIR *  dir  ) 

readdir(3) clone.

Definition at line 1751 of file rpmrpc.c.

References _rpmio_debug.

Referenced by Fts_open(), and Glob().

int Readlink ( const char *  path,
char *  buf,
size_t  bufsiz 
)

readlink(2) clone.

Todo:
Implement remotely.

Definition at line 1565 of file rpmrpc.c.

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

Referenced by genCpioListAndHeader(), and rpmVerifyFile().

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

rename(2) clone.

Definition at line 189 of file rpmrpc.c.

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

int Rmdir ( const char *  path  ) 

rmdir(2) clone.

Definition at line 132 of file rpmrpc.c.

References ftpRmdir(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by rpmdbRebuild().

int Stat ( const char *  path,
struct stat *  st 
)

stat(2) clone.

Definition at line 1289 of file rpmrpc.c.

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

Referenced by buildForTarget(), db3open(), Fts_open(), Glob(), packageBinaries(), processSourceFiles(), rpmdsSysinfo(), rpmioFileExists(), rpmioMkpath(), and rpmMkdirPath().

static const char* statstr ( const struct stat *  st,
char *  buf 
) [static]

Definition at line 1080 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 1535 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_PATH, URL_IS_UNKNOWN, and urlPath().

int Unlink ( const char *  path  ) 

unlink(2) clone.

Definition at line 290 of file rpmrpc.c.

References ftpUnlink(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by buildForTarget(), db3open(), doRmSource(), doScript(), fsmStage(), rpmdbExportInfo(), rpmtsRollback(), urlGetFile(), and writeRPM().

int Utime ( const char *  path,
const struct utimbuf *  buf 
)

utime(2) clone.

Todo:
Implement remotely.

Definition at line 1481 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_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by rpmdbExportInfo().

int Utimes ( const char *  path,
const struct timeval  times[2] 
)

Definition at line 1508 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_PATH, URL_IS_UNKNOWN, and urlPath().

static int vfs_parse_filedate ( int  idx,
time_t *  t 
) [static]

Definition at line 551 of file rpmrpc.c.

References columns, current_mday, current_mon, current_year, is_dos_date(), is_month(), is_num(), is_time(), is_week(), and is_year().

static int vfs_parse_filemode ( const char *  p  )  [static]

Definition at line 491 of file rpmrpc.c.

Referenced by vfs_parse_ls_lga().

static int vfs_parse_filetype ( char  c  )  [static]

Definition at line 472 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]

Definition at line 662 of file rpmrpc.c.

References columns, g_free, g_strdup, gnameToGid(), is_dos_date(), is_month(), is_num(), is_week(), unameToUid(), vfs_parse_filemode(), vfs_parse_filetype(), and vfs_split_text().

Referenced by ftpNLST().

static int vfs_split_text ( char *  p  )  [static]

Definition at line 341 of file rpmrpc.c.

References column_ptr, columns, and MAXCOLS.

Referenced by vfs_parse_ls_lga().


Variable Documentation

int column_ptr[30] [static]

Definition at line 337 of file rpmrpc.c.

Referenced by vfs_split_text().

char* columns[30] [static]

Definition at line 335 of file rpmrpc.c.

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

int current_mday [static]

Definition at line 325 of file rpmrpc.c.

Referenced by vfs_parse_filedate().

int current_mon [static]

Definition at line 327 of file rpmrpc.c.

Referenced by vfs_parse_filedate().

int current_year [static]

Definition at line 329 of file rpmrpc.c.

Referenced by vfs_parse_filedate().

int ftp_st_ino = 0xdead0000 [static]

Definition at line 1098 of file rpmrpc.c.

char* ftpBuf = NULL [static]

Definition at line 882 of file rpmrpc.c.

size_t ftpBufAlloced = 0 [static]

Definition at line 877 of file rpmrpc.c.


Generated on Fri Sep 7 01:28:07 2007 for rpm by  doxygen 1.5.1