Net-LibNFS

 view release on metacpan or  search on metacpan

LibNFS.xs  view on Meta::CPAN


        perl_cb_s* cb_sp = _create_callback_struct(aTHX_ funcname, cb, _parse_fallible_empty_return, NULL);

        int err = nfs_truncate_async(perl_nfs->nfs, path, len, _do_perl_callback, cb_sp);

        if (err) {
            _croak_nfs_errno(aTHX_ perl_nfs->nfs, funcname, err, NULL);
        }

SV*
chown (SV* self_sv, SV* path_sv, SV* uid_sv, SV* gid_sv)
    ALIAS:
        lchown = 1
    CODE:
        nlnfs_s* perl_nfs = exs_structref_ptr(self_sv);

        const char* path = exs_SvPVbyte_nolen(path_sv);

        int uid = SvIV(uid_sv);   // TODO
        int gid = SvIV(gid_sv);   // TODO

        int err;

        if (ix) {
            err = nfs_lchown(perl_nfs->nfs, path, uid, gid);
        }
        else {
            err = nfs_chown(perl_nfs->nfs, path, uid, gid);
        }

        if (err) {
            _croak_nfs_errno(aTHX_ perl_nfs->nfs, ix ? "lchown" : "chown", err, NULL);
        }

        RETVAL = SvREFCNT_inc(self_sv);
    OUTPUT:
        RETVAL

void
_async_chown (SV* self_sv, SV* path_sv, SV* uid_sv, SV* gid_sv, SV* cb)
    ALIAS:
        _async_lchown = 1
    CODE:
        nlnfs_s* perl_nfs = exs_structref_ptr(self_sv);

        const char* path = exs_SvPVbyte_nolen(path_sv);

        int uid = SvIV(uid_sv);   // TODO
        int gid = SvIV(gid_sv);   // TODO

        const char* funcname = ix ? "lchown" : "chown";

        perl_cb_s* cb_sp = _create_callback_struct(aTHX_ funcname, cb, _parse_fallible_empty_return, NULL);

        int err;

        if (ix) {
            err = nfs_lchown_async(perl_nfs->nfs, path, uid, gid, _do_perl_callback, cb_sp);
        }
        else {
            err = nfs_chown_async(perl_nfs->nfs, path, uid, gid, _do_perl_callback, cb_sp);
        }

        if (err) {
            _croak_nfs_errno(aTHX_ perl_nfs->nfs, funcname, err, NULL);
        }

SV*
symlink (SV* self_sv, SV* old_sv, SV* new_sv)
    ALIAS:
        rename = 1

LibNFS.xs  view on Meta::CPAN


        perl_cb_s* cb_sp = _create_callback_struct(aTHX_ "chmod", cb, _parse_fallible_empty_return, NULL);

        int err = nfs_fchmod_async(perl_nfs->nfs, nfs_fh->nfsfh, mode, _do_perl_callback, cb_sp);

        if (err) {
            _croak_nfs_errno(aTHX_ perl_nfs->nfs, "chmod", err, NULL);
        }

SV*
chown (SV* self_sv, SV* uid_sv, SV* gid_sv)
    CODE:
        int uid = SvIV(uid_sv);   // TODO
        int gid = SvIV(gid_sv);   // TODO

        nlnfs_fh_s* nfs_fh = exs_structref_ptr(self_sv);

        SV* nfs_sv = nfs_fh->perl_nfs;

        nlnfs_s* perl_nfs = exs_structref_ptr(nfs_sv);

        int err = nfs_fchown(perl_nfs->nfs, nfs_fh->nfsfh, uid, gid);

        if (err) {
            _croak_nfs_errno(aTHX_ perl_nfs->nfs, "fchown", err, NULL);
        }

        RETVAL = SvREFCNT_inc(self_sv);
    OUTPUT:
        RETVAL

void
_async_chown (SV* self_sv, SV* uid_sv, SV* gid_sv, SV* cb)
    CODE:
        int uid = SvIV(uid_sv);   // TODO
        int gid = SvIV(gid_sv);   // TODO

        nlnfs_fh_s* nfs_fh = exs_structref_ptr(self_sv);

        SV* nfs_sv = nfs_fh->perl_nfs;

        nlnfs_s* perl_nfs = exs_structref_ptr(nfs_sv);

        perl_cb_s* cb_sp = _create_callback_struct(aTHX_ "chown", cb, _parse_fallible_empty_return, NULL);

        int err = nfs_fchown_async(perl_nfs->nfs, nfs_fh->nfsfh, uid, gid, _do_perl_callback, cb_sp);

        if (err) {
            _croak_nfs_errno(aTHX_ perl_nfs->nfs, "chown", err, NULL);
        }

# ----------------------------------------------------------------------

MODULE = Net::LibNFS        PACKAGE = Net::LibNFS::Stat

PROTOTYPES: DISABLE

UV
dev (SV* self_sv)

MANIFEST  view on Meta::CPAN

libnfs/rquota/rquota.c
libnfs/rquota/rquota.x
libnfs/tests/CMakeLists.txt
libnfs/tests/Makefile.am
libnfs/tests/README
libnfs/tests/functions.sh
libnfs/tests/ld_timeout.c
libnfs/tests/prog_access.c
libnfs/tests/prog_access2.c
libnfs/tests/prog_chmod.c
libnfs/tests/prog_chown.c
libnfs/tests/prog_create.c
libnfs/tests/prog_fchmod.c
libnfs/tests/prog_fchown.c
libnfs/tests/prog_fstat.c
libnfs/tests/prog_ftruncate.c
libnfs/tests/prog_lchmod.c
libnfs/tests/prog_lchown.c
libnfs/tests/prog_link.c
libnfs/tests/prog_lseek.c
libnfs/tests/prog_lstat.c
libnfs/tests/prog_mkdir.c
libnfs/tests/prog_mknod.c
libnfs/tests/prog_mount.c
libnfs/tests/prog_open_read.c
libnfs/tests/prog_open_write.c
libnfs/tests/prog_opendir.c
libnfs/tests/prog_rename.c

MANIFEST  view on Meta::CPAN

libnfs/tests/test_0322_lstat_valgrind_leak_check.sh
libnfs/tests/test_0330_ftruncate.sh
libnfs/tests/test_0332_ftruncate_valgrind_leak_check.sh
libnfs/tests/test_0340_truncate.sh
libnfs/tests/test_0341_truncate_paths.sh
libnfs/tests/test_0350_lseek.sh
libnfs/tests/test_0360_statvfs.sh
libnfs/tests/test_0370_chmod.sh
libnfs/tests/test_0380_lchmod.sh
libnfs/tests/test_0390_fchmod.sh
libnfs/tests/test_0400_chown.sh
libnfs/tests/test_0410_lchown.sh
libnfs/tests/test_0420_fchown.sh
libnfs/tests/test_0430_access.sh
libnfs/tests/test_0440_access2.sh
libnfs/tests/test_0450_utimes.sh
libnfs/tests/test_0460_opendir.sh
libnfs/tests/test_1000_mount_paths.sh
libnfs/tests/test_1010_chdir_paths.sh
libnfs/tests/test_8000_timeout.sh.disabled
libnfs/tests/test_9900_valgrind_leak_check_full.sh
libnfs/tests/test_9910_valgrind_timeout.sh
libnfs/tests/test_9990_build_rpm.sh

README.md  view on Meta::CPAN

Sets a path’s mode.

Returns _OBJ_.

## $obj = _OBJ_->lchmod( $PATH, $MODE )

Like `chmod()` above but won’t follow symbolic links.

Returns _OBJ_.

## $obj = _OBJ_->chown( $PATH, $UID, $GID )

Sets a path’s ownership.

Returns _OBJ_.

## $obj = _OBJ_->utime( $PATH, $ATIME, $MTIME )

Updates $PATH’s atime & mtime. A time can be specified as either:

- A nonnegative number (not necessarily an integer).

README.md  view on Meta::CPAN

seconds and microseconds.

Returns _OBJ_.

## $obj = _OBJ_->lutime( $PATH, $ATIME, $MTIME )

Like `utime()` above but can operate on symlinks.

Returns _OBJ_.

## $obj = _OBJ_->lchown( $PATH, $MODE )

Like `chown()` above but won’t follow symbolic links.

Returns _OBJ_.

## $obj = _OBJ_->link( $OLDPATH, $NEWPATH )

Creates a hard link.

Returns _OBJ_.

## $obj = _OBJ_->symlink( $OLDPATH, $NEWPATH )

easyxs/ppport.h  view on Meta::CPAN

KEY_binmode|5.003007||Viu
KEY_bless|5.003007||Viu
KEY_break|5.027008||Viu
KEY_caller|5.003007||Viu
KEY_catch|5.033007||Viu
KEY_chdir|5.003007||Viu
KEY_CHECK|5.006000||Viu
KEY_chmod|5.003007||Viu
KEY_chomp|5.003007||Viu
KEY_chop|5.003007||Viu
KEY_chown|5.003007||Viu
KEY_chr|5.003007||Viu
KEY_chroot|5.003007||Viu
KEY_close|5.003007||Viu
KEY_closedir|5.003007||Viu
KEY_cmp|5.003007||Viu
KEY_connect|5.003007||Viu
KEY_continue|5.003007||Viu
KEY_cos|5.003007||Viu
KEY_crypt|5.003007||Viu
KEY___DATA|5.003007||Viu

easyxs/ppport.h  view on Meta::CPAN

Perl_isnan|5.006001|5.006001|n
PERL_IS_SUBWORD_ADDR|5.027007||Viu
PERL_IS_UTF8_CHAR_DFA|5.035004||Viu
PERL_JNP_TO_DECIMAL|5.033001||Viu
Perl_langinfo|5.027004|5.027004|n
PERL_LANGINFO_H|5.027004||Viu
PERL_LAST_5_18_0_INTERP_MEMBER|5.017009||Viu
Perl_ldexp|5.021003|5.021003|n
PerlLIO_access|5.005000||Viu
PerlLIO_chmod|5.005000||Viu
PerlLIO_chown|5.005000||Viu
PerlLIO_chsize|5.005000||Viu
PerlLIO_close|5.005000||Viu
PerlLIO_dup2|5.005000||Viu
PerlLIO_dup2_cloexec|5.027008||Viu
PerlLIO_dup|5.005000||Viu
PerlLIO_dup_cloexec|5.027008||Viu
PerlLIO_flock|5.005000||Viu
PerlLIO_fstat|5.005000||Viu
PerlLIO_ioctl|5.005000||Viu
PerlLIO_isatty|5.005000||Viu

lib/Net/LibNFS.pm  view on Meta::CPAN

Sets a path’s mode.

Returns I<OBJ>.

=head2 $obj = I<OBJ>->lchmod( $PATH, $MODE )

Like C<chmod()> above but won’t follow symbolic links.

Returns I<OBJ>.

=head2 $obj = I<OBJ>->chown( $PATH, $UID, $GID )

Sets a path’s ownership.

Returns I<OBJ>.

=head2 $obj = I<OBJ>->utime( $PATH, $ATIME, $MTIME )

Updates $PATH’s atime & mtime. A time can be specified as either:

=over

lib/Net/LibNFS.pm  view on Meta::CPAN

=back

Returns I<OBJ>.

=head2 $obj = I<OBJ>->lutime( $PATH, $ATIME, $MTIME )

Like C<utime()> above but can operate on symlinks.

Returns I<OBJ>.

=head2 $obj = I<OBJ>->lchown( $PATH, $MODE )

Like C<chown()> above but won’t follow symbolic links.

Returns I<OBJ>.

=head2 $obj = I<OBJ>->link( $OLDPATH, $NEWPATH )

Creates a hard link.

Returns I<OBJ>.

=head2 $obj = I<OBJ>->symlink( $OLDPATH, $NEWPATH )

lib/Net/LibNFS/Async.pm  view on Meta::CPAN

Promise resolves empty.

=cut

sub lchmod {
    my ($self, $path, $mode) = @_;

    return $self->_async_act( _async_lchmod => $path, $mode );
}

=head2 promise() = I<OBJ>->chown( $PATH, $UID, $GID )

Promise resolves empty.

=cut

sub chown {
    my ($self, $path, $uid, $gid) = @_;

    return $self->_async_act( _async_chown => $path, $uid, $gid );
}

=head2 promise() = I<OBJ>->lchown( $PATH, $UID, $GID )

Promise resolves empty.

=cut

sub lchown {
    my ($self, $path, $uid, $gid) = @_;

    return $self->_async_act( _async_lchown => $path, $uid, $gid );
}

=head2 promise() = I<OBJ>->utime( $PATH, $ATIME, $MTIME )

Promise resolves empty.

=cut

sub utime {
    my ($self, $path, $atime, $mtime) = @_;

lib/Net/LibNFS/Async/Filehandle.pm  view on Meta::CPAN

=item * I<OBJ>->chmod( $MODE )

=cut

sub chmod {
    my ($self, $mode) = @_;

    return $self->_io_act( _async_chmod => $mode );
}

=item * I<OBJ>->chown( $UID, $GID )

=cut

sub chown {
    my ($self, $uid, $gid) = @_;

    return $self->_io_act( '_async_chown', $uid, $gid );
}

=item * I<OBJ>->stat()

=cut

sub stat {
    my ($self) = @_;

    return $self->_io_act( '_async_stat' );

lib/Net/LibNFS/Filehandle.pm  view on Meta::CPAN

Like L<fsync(2)>. Returns I<OBJ>.

=head2 $obj = I<OBJ>->truncate( $LENGTH )

Like L<ftruncate(2)>. Returns I<OBJ>.

=head2 $obj = I<OBJ>->chmod( $MODE )

Like L<fchmod(2)>. Returns I<OBJ>.

=head2 $obj = I<OBJ>->chown( $UID, $GID )

Like L<fchown(2)>. Returns I<OBJ>.

=cut

1;

libnfs/CHANGELOG  view on Meta::CPAN

BSD compile fix
OpenBSD support
fix double free in nfs3_pread_mcb()

Changes since 5.0.0
Fix non-pthread build
	
Changes since 4.0.0
	
Multithread support for Linux and Windows
Fix NFS4 behavior of chmod/chown/utimes
Add marshalling / unmarshalling of various NFSv4.1 structures (but not 4.1 support)
PS3 support
PS2 EE support
Support escaped characters in the URL
Fix MINGW build

Changes since 3.0.0

Fix the versioning in makerpms.sh
Fix some compile issues in the test programs.

libnfs/README  view on Meta::CPAN

gcc -fPIC -shared -o ld_nfs.so examples/ld_nfs.c -ldl -lnfs

Then try things like
LD_NFS_DEBUG=9 LD_PRELOAD=./ld_nfs.so cat nfs://127.0.0.1//data/tmp/foo123

LD_NFS_DEBUG=9 LD_PRELOAD=./ld_nfs.so cp nfs://127.0.0.1//data/tmp/foo123 nfs://127.0.0.1//data/tmp/foo123.copy

LD_NFS_UID and LD_NFS_GID can be used to fake the uid and the gid in the nfs context.
This can be useful on "insecure" enabled NFS share to make the server trust you as a root.
You can try to run as a normal user things like :
LD_NFS_DEBUG=9 LD_NFS_UID=0 LD_NFS_GID=0 LD_PRELOAD=./ld_nfs.so chown root:root nfs://127.0.0.1//data/tmp/foo123

This is just a toy preload module. Don't open bugs if it does not work. Send
patches to make it better instead.


RELEASE TARBALLS
================
Release tarballs are available at
https://sites.google.com/site/libnfstarballs/li

libnfs/examples/ld_nfs.c  view on Meta::CPAN


int fchmodat(int fd, const char *path, mode_t mode, int flags)
{
	if (!strncmp(path, "nfs:", 4)) {
		return chmod(path, mode);
	}

	return real_fchmodat(fd, path, mode, flags);
}

int (*real_fchown)(int fd, __uid_t uid, __gid_t gid);

int fchown(int fd, __uid_t uid, __gid_t gid)
{
	if (nfs_fd_list[fd].is_nfs == 1) {
		int ret;

		LD_NFS_DPRINTF(9, "fchown(%d, %o, %o)", fd, (int)uid, (int)gid);
		if ((ret = nfs_fchown(nfs_fd_list[fd].nfs,
				nfs_fd_list[fd].fh,
				uid, gid)) < 0) {
			errno = -ret;
			return -1;
		}
		return 0;
	}

	return real_fchown(fd, uid, gid);
}

int (*real_chown)(const char *path, __uid_t uid, __gid_t gid);

int chown(const char *path, __uid_t uid, __gid_t gid)
{
	if (!strncmp(path, "nfs:", 4)) {
		int fd, ret;

		LD_NFS_DPRINTF(9, "chown(%s, %o, %o)", path, (int)uid, (int)gid);
		fd = open(path, 0, 0);
		if (fd == -1) {
			return fd;
		}

		ret = fchown(fd, uid, gid);
		close(fd);
		return ret;
	}

	return real_chown(path, uid, gid);
}

int (*real_fchownat)(int fd, const char *path, __uid_t uid, __gid_t gid, int flags);

int fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flags)
{
	if (!strncmp(path, "nfs:", 4)) {
		return chown(path, uid, gid);
	}

	return real_fchownat(fd, path, uid, gid, flags);
}

static void __attribute__((constructor)) _init(void)
{
	int i;

	if (getenv("LD_NFS_DEBUG") != NULL) {
		debug = atoi(getenv("LD_NFS_DEBUG"));
	}

libnfs/examples/ld_nfs.c  view on Meta::CPAN

		LD_NFS_DPRINTF(0, "Failed to dlsym(fchmod)");
		exit(10);
	}

	real_fchmodat = dlsym(RTLD_NEXT, "fchmodat");
	if (real_fchmodat == NULL) {
		LD_NFS_DPRINTF(0, "Failed to dlsym(fchmodat)");
		exit(10);
	}

	real_chown = dlsym(RTLD_NEXT, "chown");
	if (real_chown == NULL) {
		LD_NFS_DPRINTF(0, "Failed to dlsym(chown)");
		exit(10);
	}

	real_fchown = dlsym(RTLD_NEXT, "fchown");
	if (real_fchown == NULL) {
		LD_NFS_DPRINTF(0, "Failed to dlsym(fchown)");
		exit(10);
	}

	real_fchownat = dlsym(RTLD_NEXT, "fchownat");
	if (real_fchownat == NULL) {
		LD_NFS_DPRINTF(0, "Failed to dlsym(fchownat)");
		exit(10);
	}
}

libnfs/examples/nfs-io.c  view on Meta::CPAN

		gettimeofday(&times[0], NULL);
		gettimeofday(&times[1], NULL);
		ret = nfs_utimes(nfs, url->file, times);
	} else if (!strncmp(argv[1], "chmod", 5)) {
		if (argc < 4) {
			fprintf(stderr, "Invalid arguments for chmod");
			goto finished;
		}
		int mode = strtol(argv[2], NULL, 8);
		ret = nfs_chmod(nfs, url->file, mode);
	} else if (!strncmp(argv[1], "chown", 5)) {
		if (argc < 5) {
			fprintf(stderr, "Invalid arguments for chown");
			goto finished;
		}
		int uid = strtol(argv[2], NULL, 10);
		int gid = strtol(argv[3], NULL, 10);
		ret = nfs_chown(nfs, url->file, uid, gid);
	} else if (!strncmp(argv[1], "stat", 4)) {
		struct nfs_stat_64 st;
		ret = nfs_stat64(nfs, url->file, &st);
		if (!ret) {
			switch (st.nfs_mode & S_IFMT) {
	#ifndef WIN32
			case S_IFLNK:
				printf("l");
				break;
	#endif

libnfs/include/libnfs-private.h  view on Meta::CPAN


int nfs3_access_async(struct nfs_context *nfs, const char *path, int mode,
                      nfs_cb cb, void *private_data);
int nfs3_access2_async(struct nfs_context *nfs, const char *path, nfs_cb cb,
                       void *private_data);
int nfs3_chdir_async(struct nfs_context *nfs, const char *path,
                     nfs_cb cb, void *private_data);
int nfs3_chmod_async_internal(struct nfs_context *nfs, const char *path,
                              int no_follow, int mode, nfs_cb cb,
                              void *private_data);
int nfs3_chown_async_internal(struct nfs_context *nfs, const char *path,
                              int no_follow, int uid, int gid,
                              nfs_cb cb, void *private_data);
int nfs3_close_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb,
                     void *private_data);
int nfs3_create_async(struct nfs_context *nfs, const char *path, int flags,
                      int mode, nfs_cb cb, void *private_data);
int nfs3_fchmod_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode,
                      nfs_cb cb, void *private_data);
int nfs3_fchown_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid,
                      int gid, nfs_cb cb, void *private_data);
int nfs3_fstat_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb,
                     void *private_data);
int nfs3_fstat64_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb,
                       void *private_data);
int nfs3_fsync_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb,
                     void *private_data);
int nfs3_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh,
                         uint64_t length, nfs_cb cb, void *private_data);
int nfs3_link_async(struct nfs_context *nfs, const char *oldpath,

libnfs/include/libnfs-private.h  view on Meta::CPAN

   
int nfs4_access_async(struct nfs_context *nfs, const char *path, int mode,
                      nfs_cb cb, void *private_data);
int nfs4_access2_async(struct nfs_context *nfs, const char *path, nfs_cb cb,
                       void *private_data);
int nfs4_chdir_async(struct nfs_context *nfs, const char *path,
                     nfs_cb cb, void *private_data);
int nfs4_chmod_async_internal(struct nfs_context *nfs, const char *path,
                              int no_follow, int mode, nfs_cb cb,
                              void *private_data);
int nfs4_chown_async_internal(struct nfs_context *nfs, const char *path,
                              int no_follow, int uid, int gid,
                              nfs_cb cb, void *private_data);
int nfs4_close_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb,
                     void *private_data);
int nfs4_create_async(struct nfs_context *nfs, const char *path, int flags,
                      int mode, nfs_cb cb, void *private_data);
int nfs4_fchmod_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode,
                      nfs_cb cb, void *private_data);
int nfs4_fchown_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid,
                      int gid, nfs_cb cb, void *private_data);
int nfs4_fcntl_async(struct nfs_context *nfs, struct nfsfh *nfsfh,
                     enum nfs4_fcntl_op cmd, void *arg,
                     nfs_cb cb, void *private_data);
int nfs4_fstat64_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb,
                       void *private_data);
int nfs4_fsync_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb,
                     void *private_data);
int nfs4_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh,
                         uint64_t length, nfs_cb cb, void *private_data);

libnfs/include/nfsc/libnfs.h  view on Meta::CPAN

 * -errno : The command failed.
 */
EXTERN int nfs_fchmod(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode);



/*
 * CHOWN()
 */
/*
 * Async chown(<name>)
 * Function returns
 *  0 : The command was queued successfully. The callback will be invoked once
 *      the command completes.
 * <0 : An error occured when trying to queue the command.
 *      The callback will not be invoked.
 *
 * When the callback is invoked, status indicates the result:
 *      0 : Success.
 *          data is NULL
 * -errno : An error occured.
 *          data is the error string.
 */
EXTERN int nfs_chown_async(struct nfs_context *nfs, const char *path, int uid,
                           int gid, nfs_cb cb, void *private_data);
/*
 * Sync chown(<name>)
 * Function returns
 *      0 : The operation was successful.
 * -errno : The command failed.
 */
EXTERN int nfs_chown(struct nfs_context *nfs, const char *path, int uid,
                     int gid);
/*
 * Async chown(<name>)
 *
 * Like chown except if the destination is a symbolic link, it acts on the
 * symbolic link itself.
 *
 * Function returns
 *  0 : The command was queued successfully. The callback will be invoked once
 *      the command completes.
 * <0 : An error occured when trying to queue the command.
 *      The callback will not be invoked.
 *
 * When the callback is invoked, status indicates the result:
 *      0 : Success.
 *          data is NULL
 * -errno : An error occured.
 *          data is the error string.
 */
EXTERN int nfs_lchown_async(struct nfs_context *nfs, const char *path, int uid,
                            int gid, nfs_cb cb, void *private_data);
/*
 * Sync chown(<name>)
 *
 * Like chown except if the destination is a symbolic link, it acts on the
 * symbolic link itself.
 *
 * Function returns
 *      0 : The operation was successful.
 * -errno : The command failed.
 */
EXTERN int nfs_lchown(struct nfs_context *nfs, const char *path, int uid,
                      int gid);



/*
 * FCHOWN()
 */
/*
 * Async fchown(<handle>)
 * Function returns
 *  0 : The command was queued successfully. The callback will be invoked once
 *      the command completes.
 * <0 : An error occured when trying to queue the command.
 *      The callback will not be invoked.
 *
 * When the callback is invoked, status indicates the result:
 *      0 : Success.
 *          data is NULL
 * -errno : An error occured.
 *          data is the error string.
 */
EXTERN int nfs_fchown_async(struct nfs_context *nfs, struct nfsfh *nfsfh,
                            int uid, int gid, nfs_cb cb, void *private_data);
/*
 * Sync fchown(<handle>)
 * Function returns
 *      0 : The operation was successful.
 * -errno : The command failed.
 */
EXTERN int nfs_fchown(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid,
                      int gid);




/*
 * UTIMES()
 */
/*
 * Async utimes(<path>)

libnfs/lib/libnfs-sync.c  view on Meta::CPAN

	wait_for_nfs_reply(nfs, &cb_data);
        nfs_destroy_cb_sem(&cb_data);

	return cb_data.status;
}




/*
 * chown()
 */
static void
chown_cb(int status, struct nfs_context *nfs, void *data, void *private_data)
{
	struct sync_cb_data *cb_data = private_data;

	if (status < 0) {
		nfs_set_error(nfs, "chown call failed with \"%s\"",
                              (char *)data);
                goto finished;
	}

 finished:
        cb_data_is_finished(cb_data, status);
}

int
nfs_chown(struct nfs_context *nfs, const char *path, int uid, int gid)
{
	struct sync_cb_data cb_data;

        if (nfs_init_cb_data(&nfs, &cb_data)) {
                return -1;
        }

	if (nfs_chown_async(nfs, path, uid, gid, chown_cb, &cb_data) != 0) {
		nfs_set_error(nfs, "nfs_chown_async failed. %s",
                              nfs_get_error(nfs));
                nfs_destroy_cb_sem(&cb_data);
		return -1;
	}

	wait_for_nfs_reply(nfs, &cb_data);
        nfs_destroy_cb_sem(&cb_data);

	return cb_data.status;
}

/*
 * lchown()
 */
int
nfs_lchown(struct nfs_context *nfs, const char *path, int uid, int gid)
{
	struct sync_cb_data cb_data;

        if (nfs_init_cb_data(&nfs, &cb_data)) {
                return -1;
        }

	if (nfs_lchown_async(nfs, path, uid, gid, chown_cb, &cb_data) != 0) {
		nfs_set_error(nfs, "nfs_lchown_async failed. %s",
                              nfs_get_error(nfs));
                nfs_destroy_cb_sem(&cb_data);
		return -1;
	}

	wait_for_nfs_reply(nfs, &cb_data);
        nfs_destroy_cb_sem(&cb_data);

	return cb_data.status;
}

/*
 * fchown()
 */
static void
fchown_cb(int status, struct nfs_context *nfs, void *data, void *private_data)
{
	struct sync_cb_data *cb_data = private_data;

	if (status < 0) {
		nfs_set_error(nfs, "fchown call failed with \"%s\"",
                              (char *)data);
                goto finished;
	}

 finished:
        cb_data_is_finished(cb_data, status);
}

int
nfs_fchown(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int gid)
{
	struct sync_cb_data cb_data;

        if (nfs_init_cb_data(&nfs, &cb_data)) {
                return -1;
        }

	if (nfs_fchown_async(nfs, nfsfh, uid, gid, fchown_cb, &cb_data) != 0) {
		nfs_set_error(nfs, "nfs_fchown_async failed. %s",
                              nfs_get_error(nfs));
                nfs_destroy_cb_sem(&cb_data);
		return -1;
	}

	wait_for_nfs_reply(nfs, &cb_data);
        nfs_destroy_cb_sem(&cb_data);

	return cb_data.status;
}

libnfs/lib/libnfs-win32.def  view on Meta::CPAN

mount_free_export_list
mount_getexports
mount_getexports_async
nfs_find_local_servers
free_nfs_srvr_list
nfs_access
nfs_access_async
nfs_chdir
nfs_chmod
nfs_chmod_async
nfs_chown
nfs_chown_async
nfs_close
nfs_close_async
nfs_closedir
nfs_creat
nfs_creat_async
nfs_create
nfs_create_async
nfs_destroy_context
nfs_fchmod
nfs_fchmod_async
nfs_fchown
nfs_fchown_async
nfs_fcntl
nfs_fcntl_async
nfs_fstat
nfs_fstat_async
nfs_fstat64
nfs_fstat64_async
nfs_fsync
nfs_fsync_async
nfs_ftruncate
nfs_ftruncate_async

libnfs/lib/libnfs.c  view on Meta::CPAN

        case NFS_V4:
                return nfs4_fchmod_async(nfs, nfsfh, mode, cb, private_data);
        default:
                nfs_set_error(nfs, "%s does not support NFSv%d",
                              __FUNCTION__, nfs->nfsi->version);
                return -1;
        }
}

int
nfs_chown_async(struct nfs_context *nfs, const char *path, int uid, int gid,
                nfs_cb cb, void *private_data)
{
	switch (nfs->nfsi->version) {
        case NFS_V3:
                return nfs3_chown_async_internal(nfs, path, 0, uid, gid,
                                                 cb, private_data);
        case NFS_V4:
                return nfs4_chown_async_internal(nfs, path, 0, uid, gid,
                                                 cb, private_data);
        default:
                nfs_set_error(nfs, "%s does not support NFSv%d",
                              __FUNCTION__, nfs->nfsi->version);
                return -1;
        }
}

int
nfs_lchown_async(struct nfs_context *nfs, const char *path, int uid, int gid,
                 nfs_cb cb, void *private_data)
{
	switch (nfs->nfsi->version) {
        case NFS_V3:
                return nfs3_chown_async_internal(nfs, path, 1, uid, gid,
                                                 cb, private_data);
        case NFS_V4:
                return nfs4_chown_async_internal(nfs, path, 1, uid, gid,
                                                 cb, private_data);
        default:
                nfs_set_error(nfs, "%s does not support NFSv%d",
                              __FUNCTION__, nfs->nfsi->version);
                return -1;
        }
}

int
nfs_fchown_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid,
                 int gid, nfs_cb cb, void *private_data)
{
	switch (nfs->nfsi->version) {
        case NFS_V3:
                return nfs3_fchown_async(nfs, nfsfh, uid, gid,
                                         cb, private_data);
        case NFS_V4:
                return nfs4_fchown_async(nfs, nfsfh, uid, gid,
                                         cb, private_data);
        default:
                nfs_set_error(nfs, "%s does not support NFSv%d",
                              __FUNCTION__, nfs->nfsi->version);
                return -1;
        }
}

int
nfs_utimes_async(struct nfs_context *nfs, const char *path,

libnfs/lib/nfs_v3.c  view on Meta::CPAN

                                  nfs3_utimes_continue_internal,
                                  new_times, free, 0) != 0) {
		return -1;
	}

	return 0;
}

        
static void
nfs3_chown_cb(struct rpc_context *rpc, int status, void *command_data,
              void *private_data)
{
	struct nfs_cb_data *data = private_data;
	struct nfs_context *nfs = data->nfs;
	SETATTR3res *res;

	assert(rpc->magic == RPC_CONTEXT_MAGIC);

	if (check_nfs3_error(nfs, status, data, command_data)) {
		free_nfs_cb_data(data);

libnfs/lib/nfs_v3.c  view on Meta::CPAN

		data->cb(nfsstat3_to_errno(res->status), nfs,
                         nfs_get_error(nfs), data->private_data);
		free_nfs_cb_data(data);
		return;
	}

	data->cb(0, nfs, NULL, data->private_data);
	free_nfs_cb_data(data);
}

struct nfs_chown_data {
       uid_t uid;
       gid_t gid;
};

static int
nfs3_chown_continue_internal(struct nfs_context *nfs,
                             struct nfs_attr *attr _U_,
                             struct nfs_cb_data *data)
{
	SETATTR3args args;
	struct nfs_chown_data *chown_data = data->continue_data;

	memset(&args, 0, sizeof(SETATTR3args));
	args.object.data.data_len = data->fh.len;
	args.object.data.data_val = data->fh.val;
	if (chown_data->uid != (uid_t)-1) {
		args.new_attributes.uid.set_it = 1;
		args.new_attributes.uid.set_uid3_u.uid = chown_data->uid;
	}
	if (chown_data->gid != (gid_t)-1) {
		args.new_attributes.gid.set_it = 1;
		args.new_attributes.gid.set_gid3_u.gid = chown_data->gid;
	}

	if (rpc_nfs3_setattr_async(nfs->rpc, nfs3_chown_cb, &args, data) != 0) {
		nfs_set_error(nfs, "RPC error: Failed to send SETATTR "
                              "call for %s", data->path);
		data->cb(-ENOMEM, nfs, nfs_get_error(nfs),
                         data->private_data);
		free_nfs_cb_data(data);
		return -1;
	}
	return 0;
}

int
nfs3_chown_async_internal(struct nfs_context *nfs, const char *path,
                          int no_follow, int uid, int gid,
                          nfs_cb cb, void *private_data)
{
	struct nfs_chown_data *chown_data;

	chown_data = malloc(sizeof(struct nfs_chown_data));
	if (chown_data == NULL) {
		nfs_set_error(nfs, "Failed to allocate memory for "
                              "chown data structure");
		return -1;
	}

	chown_data->uid = uid;
	chown_data->gid = gid;

	if (nfs3_lookuppath_async(nfs, path, no_follow, cb, private_data,
                                  nfs3_chown_continue_internal,
                                  chown_data, free, 0) != 0) {
		return -1;
	}

	return 0;
}

int
nfs3_fchown_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid,
                  int gid, nfs_cb cb, void *private_data)
{
	struct nfs_cb_data *data;
	struct nfs_chown_data *chown_data;

	chown_data = malloc(sizeof(struct nfs_chown_data));
	if (chown_data == NULL) {
		nfs_set_error(nfs, "Failed to allocate memory for "
                              "fchown data structure");
		return -1;
	}

	chown_data->uid = uid;
	chown_data->gid = gid;

	data = malloc(sizeof(struct nfs_cb_data));
	if (data == NULL) {
		nfs_set_error(nfs, "out of memory. failed to allocate "
                              "memory for fchown data");
		free(chown_data);
		return -1;
	}
	memset(data, 0, sizeof(struct nfs_cb_data));
	data->nfs           = nfs;
	data->cb            = cb;
	data->private_data  = private_data;
	data->continue_data = chown_data;
	data->free_continue_data = free;
	data->fh.len = nfsfh->fh.len;
	data->fh.val = malloc(data->fh.len);
	if (data->fh.val == NULL) {
		nfs_set_error(nfs, "Out of memory: Failed to allocate fh");
		free_nfs_cb_data(data);
		return -1;
	}
	memcpy(data->fh.val, nfsfh->fh.val, data->fh.len);

	if (nfs3_chown_continue_internal(nfs, NULL, data) != 0) {
		return -1;
	}

	return 0;
}

static void
nfs3_chmod_cb(struct rpc_context *rpc, int status, void *command_data,
              void *private_data)
{

libnfs/lib/nfs_v4.c  view on Meta::CPAN

        saargs->obj_attributes.attrmask.bitmap4_len = 2;
        saargs->obj_attributes.attrmask.bitmap4_val = mask;

        saargs->obj_attributes.attr_vals.attrlist4_len = 4;
        saargs->obj_attributes.attr_vals.attrlist4_val = sabuf;

        return 1;
}

static int
nfs4_op_chown(struct nfs_context *nfs, nfs_argop4 *op, struct nfsfh *fh,
              void *sabuf, int len)
{
        SETATTR4args *saargs;
        static uint32_t mask[2] = {0,
                                   1 << (FATTR4_OWNER - 32) |
                                   1 << (FATTR4_OWNER_GROUP - 32)};

        op[0].argop = OP_SETATTR;
        saargs = &op[0].nfs_argop4_u.opsetattr;
        if (fh) {

libnfs/lib/nfs_v4.c  view on Meta::CPAN

                data->filler.blob0.val = NULL;
                free_nfs4_cb_data(data);
                return -1;
        }

        return 0;
}

#define CHOWN_BLOB_SIZE 64
static int
nfs4_create_chown_buffer(struct nfs_context *nfs, struct nfs4_cb_data *data,
                         int uid, int gid)
{
        char *str;
        int i, l;
        uint32_t len;

        data->filler.blob3.val = malloc(CHOWN_BLOB_SIZE);
        if (data->filler.blob3.val == NULL) {
                nfs_set_error(nfs, "Out of memory");
                return -1;

libnfs/lib/nfs_v4.c  view on Meta::CPAN

        memcpy(&str[i], &len, sizeof(uint32_t));
        i += 4 + l;
        i = (i + 3) & ~0x03;

        data->filler.blob3.len = i;

        return 0;
}

static void
nfs4_chown_cb(struct rpc_context *rpc, int status, void *command_data,
                   void *private_data)
{
        struct nfs4_cb_data *data = private_data;
        struct nfs_context *nfs = data->nfs;
        COMPOUND4res *res = command_data;

        if (check_nfs4_error(nfs, status, data, res, "OPEN")) {
                return;
        }

        data->cb(0, nfs, NULL, data->private_data);
        free_nfs4_cb_data(data);
}

static int
nfs4_populate_chown(struct nfs4_cb_data *data, nfs_argop4 *op)
{
        return nfs4_op_chown(data->nfs, op, NULL, data->filler.blob3.val,
                           data->filler.blob3.len);
}

int
nfs4_chown_async_internal(struct nfs_context *nfs, const char *path,
                          int no_follow, int uid, int gid,
                          nfs_cb cb, void *private_data)
{
        struct nfs4_cb_data *data;

        data = init_cb_data_split_path(nfs, path);
        if (data == NULL) {
                return -1;
        }

        data->cb           = cb;
        data->private_data = private_data;
        data->filler.func = nfs4_populate_chown;
        data->filler.max_op = 1;

        if (no_follow) {
                data->flags |= LOOKUP_FLAG_NO_FOLLOW;
        }

        if (nfs4_create_chown_buffer(nfs, data, uid, gid) < 0) {
                free_nfs4_cb_data(data);
                return -1;
        }

        if (nfs4_lookup_path_async(nfs, data, nfs4_chown_cb) < 0) {
                return -1;
        }

        return 0;
}

int
nfs4_fchown_async(struct nfs_context *nfs, struct nfsfh *fh, int uid, int gid,
                  nfs_cb cb, void *private_data)
{
        COMPOUND4args args;
        nfs_argop4 op[2];
        struct nfs4_cb_data *data;
        int i;

        data = malloc(sizeof(*data));
        if (data == NULL) {
                nfs_set_error(nfs, "Out of memory.");
                return -1;
        }
        memset(data, 0, sizeof(*data));

        data->nfs          = nfs;
        data->cb           = cb;
        data->private_data = private_data;

        if (nfs4_create_chown_buffer(nfs, data, uid, gid) < 0) {
                free_nfs4_cb_data(data);
                return -1;
        }
        
        memset(op, 0, sizeof(op));

        i = nfs4_op_putfh(nfs, &op[0], fh);
        i += nfs4_op_chown(nfs, &op[i], fh, data->filler.blob3.val,
                           data->filler.blob3.len);

        memset(&args, 0, sizeof(args));
        args.argarray.argarray_len = i;
        args.argarray.argarray_val = op;

        if (rpc_nfs4_compound_async(nfs->rpc, nfs4_fsync_cb, &args,
                                    data) != 0) {
                data->filler.blob0.val = NULL;
                free_nfs4_cb_data(data);

libnfs/nfs/libnfs-raw-nfs.c  view on Meta::CPAN

		 if (!zdr_post_op_attr (zdrs, &objp->obj_attributes))
			 return FALSE;
		buf = ZDR_INLINE (zdrs, 6 * BYTES_PER_ZDR_UNIT);
		if (buf == NULL) {
			 if (!zdr_u_int (zdrs, &objp->linkmax))
				 return FALSE;
			 if (!zdr_u_int (zdrs, &objp->name_max))
				 return FALSE;
			 if (!zdr_bool (zdrs, &objp->no_trunc))
				 return FALSE;
			 if (!zdr_bool (zdrs, &objp->chown_restricted))
				 return FALSE;
			 if (!zdr_bool (zdrs, &objp->case_insensitive))
				 return FALSE;
			 if (!zdr_bool (zdrs, &objp->case_preserving))
				 return FALSE;
		} else {
			IZDR_PUT_U_LONG(buf, objp->linkmax);
			IZDR_PUT_U_LONG(buf, objp->name_max);
			IZDR_PUT_BOOL(buf, objp->no_trunc);
			IZDR_PUT_BOOL(buf, objp->chown_restricted);
			IZDR_PUT_BOOL(buf, objp->case_insensitive);
			IZDR_PUT_BOOL(buf, objp->case_preserving);
		}
		return TRUE;
	} else if (zdrs->x_op == ZDR_DECODE) {
		 if (!zdr_post_op_attr (zdrs, &objp->obj_attributes))
			 return FALSE;
		buf = ZDR_INLINE (zdrs, 6 * BYTES_PER_ZDR_UNIT);
		if (buf == NULL) {
			 if (!zdr_u_int (zdrs, &objp->linkmax))
				 return FALSE;
			 if (!zdr_u_int (zdrs, &objp->name_max))
				 return FALSE;
			 if (!zdr_bool (zdrs, &objp->no_trunc))
				 return FALSE;
			 if (!zdr_bool (zdrs, &objp->chown_restricted))
				 return FALSE;
			 if (!zdr_bool (zdrs, &objp->case_insensitive))
				 return FALSE;
			 if (!zdr_bool (zdrs, &objp->case_preserving))
				 return FALSE;
		} else {
			objp->linkmax = IZDR_GET_U_LONG(buf);
			objp->name_max = IZDR_GET_U_LONG(buf);
			objp->no_trunc = IZDR_GET_BOOL(buf);
			objp->chown_restricted = IZDR_GET_BOOL(buf);
			objp->case_insensitive = IZDR_GET_BOOL(buf);
			objp->case_preserving = IZDR_GET_BOOL(buf);
		}
	 return TRUE;
	}

	 if (!zdr_post_op_attr (zdrs, &objp->obj_attributes))
		 return FALSE;
	 if (!zdr_u_int (zdrs, &objp->linkmax))
		 return FALSE;
	 if (!zdr_u_int (zdrs, &objp->name_max))
		 return FALSE;
	 if (!zdr_bool (zdrs, &objp->no_trunc))
		 return FALSE;
	 if (!zdr_bool (zdrs, &objp->chown_restricted))
		 return FALSE;
	 if (!zdr_bool (zdrs, &objp->case_insensitive))
		 return FALSE;
	 if (!zdr_bool (zdrs, &objp->case_preserving))
		 return FALSE;
	return TRUE;
}

uint32_t
zdr_PATHCONF3resfail (ZDR *zdrs, PATHCONF3resfail *objp)

libnfs/nfs/libnfs-raw-nfs.h  view on Meta::CPAN

struct PATHCONF3args {
	nfs_fh3 object;
};
typedef struct PATHCONF3args PATHCONF3args;

struct PATHCONF3resok {
	post_op_attr obj_attributes;
	u_int linkmax;
	u_int name_max;
	uint32_t no_trunc;
	uint32_t chown_restricted;
	uint32_t case_insensitive;
	uint32_t case_preserving;
};
typedef struct PATHCONF3resok PATHCONF3resok;

struct PATHCONF3resfail {
	post_op_attr obj_attributes;
};
typedef struct PATHCONF3resfail PATHCONF3resfail;

libnfs/nfs/nfs.x  view on Meta::CPAN


struct PATHCONF3args {
	nfs_fh3   object;
};

struct PATHCONF3resok {
	post_op_attr obj_attributes;
	unsigned int linkmax;
	unsigned int name_max;
	bool         no_trunc;
	bool         chown_restricted;
	bool         case_insensitive;
	bool         case_preserving;
};

struct PATHCONF3resfail {
	post_op_attr obj_attributes;
};

union PATHCONF3res switch (nfsstat3 status) {
	case NFS3_OK:

libnfs/nfs4/libnfs-raw-nfs4.c  view on Meta::CPAN

zdr_fattr4_case_preserving (ZDR *zdrs, fattr4_case_preserving *objp)
{
	

	 if (!zdr_bool (zdrs, objp))
		 return FALSE;
	return TRUE;
}

uint32_t
zdr_fattr4_chown_restricted (ZDR *zdrs, fattr4_chown_restricted *objp)
{
	

	 if (!zdr_bool (zdrs, objp))
		 return FALSE;
	return TRUE;
}

uint32_t
zdr_fattr4_fileid (ZDR *zdrs, fattr4_fileid *objp)

libnfs/nfs4/libnfs-raw-nfs4.h  view on Meta::CPAN

typedef uint32_t fattr4_aclsupport;

typedef uint32_t fattr4_archive;

typedef uint32_t fattr4_cansettime;

typedef uint32_t fattr4_case_insensitive;

typedef uint32_t fattr4_case_preserving;

typedef uint32_t fattr4_chown_restricted;

typedef uint64_t fattr4_fileid;

typedef uint64_t fattr4_files_avail;

typedef nfs_fh4 fattr4_filehandle;

typedef uint64_t fattr4_files_free;

typedef uint64_t fattr4_files_total;

libnfs/nfs4/libnfs-raw-nfs4.h  view on Meta::CPAN

extern  uint32_t zdr_fattr4_fsid (ZDR *, fattr4_fsid*);
extern  uint32_t zdr_fattr4_unique_handles (ZDR *, fattr4_unique_handles*);
extern  uint32_t zdr_fattr4_lease_time (ZDR *, fattr4_lease_time*);
extern  uint32_t zdr_fattr4_rdattr_error (ZDR *, fattr4_rdattr_error*);
extern  uint32_t zdr_fattr4_acl (ZDR *, fattr4_acl*);
extern  uint32_t zdr_fattr4_aclsupport (ZDR *, fattr4_aclsupport*);
extern  uint32_t zdr_fattr4_archive (ZDR *, fattr4_archive*);
extern  uint32_t zdr_fattr4_cansettime (ZDR *, fattr4_cansettime*);
extern  uint32_t zdr_fattr4_case_insensitive (ZDR *, fattr4_case_insensitive*);
extern  uint32_t zdr_fattr4_case_preserving (ZDR *, fattr4_case_preserving*);
extern  uint32_t zdr_fattr4_chown_restricted (ZDR *, fattr4_chown_restricted*);
extern  uint32_t zdr_fattr4_fileid (ZDR *, fattr4_fileid*);
extern  uint32_t zdr_fattr4_files_avail (ZDR *, fattr4_files_avail*);
extern  uint32_t zdr_fattr4_filehandle (ZDR *, fattr4_filehandle*);
extern  uint32_t zdr_fattr4_files_free (ZDR *, fattr4_files_free*);
extern  uint32_t zdr_fattr4_files_total (ZDR *, fattr4_files_total*);
extern  uint32_t zdr_fattr4_fs_locations (ZDR *, fattr4_fs_locations*);
extern  uint32_t zdr_fattr4_hidden (ZDR *, fattr4_hidden*);
extern  uint32_t zdr_fattr4_homogeneous (ZDR *, fattr4_homogeneous*);
extern  uint32_t zdr_fattr4_maxfilesize (ZDR *, fattr4_maxfilesize*);
extern  uint32_t zdr_fattr4_maxlink (ZDR *, fattr4_maxlink*);

libnfs/nfs4/libnfs-raw-nfs4.h  view on Meta::CPAN

extern uint32_t zdr_fattr4_fsid ();
extern uint32_t zdr_fattr4_unique_handles ();
extern uint32_t zdr_fattr4_lease_time ();
extern uint32_t zdr_fattr4_rdattr_error ();
extern uint32_t zdr_fattr4_acl ();
extern uint32_t zdr_fattr4_aclsupport ();
extern uint32_t zdr_fattr4_archive ();
extern uint32_t zdr_fattr4_cansettime ();
extern uint32_t zdr_fattr4_case_insensitive ();
extern uint32_t zdr_fattr4_case_preserving ();
extern uint32_t zdr_fattr4_chown_restricted ();
extern uint32_t zdr_fattr4_fileid ();
extern uint32_t zdr_fattr4_files_avail ();
extern uint32_t zdr_fattr4_filehandle ();
extern uint32_t zdr_fattr4_files_free ();
extern uint32_t zdr_fattr4_files_total ();
extern uint32_t zdr_fattr4_fs_locations ();
extern uint32_t zdr_fattr4_hidden ();
extern uint32_t zdr_fattr4_homogeneous ();
extern uint32_t zdr_fattr4_maxfilesize ();
extern uint32_t zdr_fattr4_maxlink ();

libnfs/nfs4/nfs4.x  view on Meta::CPAN

typedef fsid4           fattr4_fsid;
typedef bool            fattr4_unique_handles;
typedef uint32_t        fattr4_lease_time;
typedef nfsstat4        fattr4_rdattr_error;
typedef nfsace4         fattr4_acl<>;
typedef uint32_t        fattr4_aclsupport;
typedef bool            fattr4_archive;
typedef bool            fattr4_cansettime;
typedef bool            fattr4_case_insensitive;
typedef bool            fattr4_case_preserving;
typedef bool            fattr4_chown_restricted;
typedef uint64_t        fattr4_fileid;
typedef uint64_t        fattr4_files_avail;
typedef nfs_fh4         fattr4_filehandle;
typedef uint64_t        fattr4_files_free;
typedef uint64_t        fattr4_files_total;
typedef fs_locations4   fattr4_fs_locations;
typedef bool            fattr4_hidden;
typedef bool            fattr4_homogeneous;
typedef uint64_t        fattr4_maxfilesize;
typedef uint32_t        fattr4_maxlink;

libnfs/packaging/RPM/libnfs.spec.in  view on Meta::CPAN

* Wed Aug 10 2022 : Version 5.0.2
- Various small multithreading fixes
- Add opaque pointer to service_proc to make it easier to build server apps.
- BSD compile fix
- OpenBSD support
- fix double free in nfs3_pread_mcb() 
* Tue Feb 1 2022 : Version 5.0.1
- Fix non-pthread build
* Fri Jan 28 2022 : Version 5.0.0
- Multithread support for Linux and Windows
- Fix NFS4 behavior of chmod/chown/utimes
- Add marshalling / unmarshalling of various NFSv4.1 structures (but not 4.1 support)
- PS3 support
- PS2 EE support
- Support escaped characters in the URL
- Fix MINGW build
* Wed Feb 13 2019 : Version 4.0.0
- Fix the versioning in makerpms.sh
- Fix some compile issues in the test programs.
- NFSv3: skip commit on close if the file has not been written to.
- Add nfs_umount() to NFSv3

libnfs/packaging/RPM/libnfs.spec.in  view on Meta::CPAN

 - Android fix for nfs-ls
 - Make S_IFLNK available on windows.
 - Fix a use after free.
 - Fix a bug where truncate() treated offset as 32bit.
* Tue Nov 25 2014 : Version 1.9.6
 - Add O_TRUNC support for nfs_create
 - Handle OOM during create
 - Return more stats fields as part of readdir since we get these for "free"
   when we use READDIRPLUS
 - Follow symlinks during path resolution
 - Add lchown, lstat and lutimes
 - Replace all [u_]quad types with [u]int types in our RPC layer
 - Solaris build fixes
* Sat Jul 19 2014 : Version 1.9.5
 - Remove old ONC-RPC symbols
* Wed Mar 19 2014 : Version 1.9.3
 - Add O_TRUNC support to nfs_open()
 - Add a simple but incomplete LD_PRELOAD tool
 - Fixes for some memory leaks and C++ compile support
 - Make ANDROID default uid/gid to 65534
 - Allow the READDIRPLUS emulation to still work if some objects

libnfs/tests/CMakeLists.txt  view on Meta::CPAN

find_library(DL_LIBRARY dl)

set(TEST_PROGS prog_access
               prog_access2
               prog_chmod
               prog_chown
               prog_create
               prog_fchmod
               prog_fchown
               prog_fstat
               prog_ftruncate
               prog_lchmod
               prog_lchown
               prog_link
               prog_lseek
               prog_lstat
               prog_mkdir
               prog_mknod
               prog_mount
               prog_open_read
               prog_open_write
               prog_opendir
               prog_rename

libnfs/tests/Makefile.am  view on Meta::CPAN

AM_CPPFLAGS = -I${srcdir}/../include -I${srcdir}/../include/nfsc \
	"-D_U_=__attribute__((unused))" \
	"-D_R_(A,B)=__attribute__((format(printf,A,B)))"
AM_CFLAGS = $(WARN_CFLAGS)
LDADD = ../lib/libnfs.la

noinst_PROGRAMS = prog_access prog_access2 prog_chmod prog_chown prog_create \
	prog_fchmod prog_fchown prog_fstat prog_ftruncate prog_lchmod \
	prog_lchown prog_link prog_lseek prog_lstat prog_mkdir \
	prog_mknod prog_mount prog_opendir prog_open_read prog_open_write \
	prog_rename prog_rmdir prog_stat prog_statvfs prog_symlink \
	prog_timeout prog_truncate prog_unlink prog_utimes

EXTRA_PROGRAMS = ld_timeout
CLEANFILES = ld_timeout.o ld_timeout.so

ld_timeout_SOURCES = ld_timeout.c
ld_timeout_CFLAGS = $(AM_CFLAGS) -fPIC

libnfs/tests/prog_chown.c  view on Meta::CPAN

#include <stdint.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

#include "libnfs.h"

void usage(void)
{
	fprintf(stderr, "Usage: prog_chown <url> <cwd> <path> <uid> <gid>"
                "\n");
	exit(1);
}

int main(int argc, char *argv[])
{
	struct nfs_context *nfs = NULL;
	struct nfs_url *url = NULL;
	int ret = 0;
        int uid, gid;

libnfs/tests/prog_chown.c  view on Meta::CPAN

		goto finished;
	}

	if (nfs_chdir(nfs, argv[2]) != 0) {
 		fprintf(stderr, "Failed to chdir to \"%s\" : %s\n",
			argv[2], nfs_get_error(nfs));
		ret = 1;
		goto finished;
	}

	if (nfs_chown(nfs, argv[3], uid, gid)) {
 		fprintf(stderr, "Failed to chown(): %s\n",
			nfs_get_error(nfs));
		ret = 1;
		goto finished;
	}
        
finished:
	nfs_destroy_url(url);
	nfs_destroy_context(nfs);

	return ret;

libnfs/tests/prog_fchown.c  view on Meta::CPAN

#include <stdint.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

#include "libnfs.h"

void usage(void)
{
	fprintf(stderr, "Usage: prog_fchown <url> <cwd> <path> <uid> <gid>"
                "\n");
	exit(1);
}

int main(int argc, char *argv[])
{
	struct nfs_context *nfs = NULL;
	struct nfs_url *url = NULL;
	int ret = 0;
        int uid, gid;

libnfs/tests/prog_fchown.c  view on Meta::CPAN

		ret = 1;
		goto finished;
	}

	if (nfs_open(nfs, argv[3], O_RDWR, &fh)) {
 		fprintf(stderr, "Failed to open file : %s\n",
			nfs_get_error(nfs));
		exit(1);
	}

	if (nfs_fchown(nfs, fh, uid, gid)) {
 		fprintf(stderr, "Failed to fchown(): %s\n",
			nfs_get_error(nfs));
		ret = 1;
		goto finished;
	}

	if (nfs_close(nfs, fh)) {
 		fprintf(stderr, "Failed to close(): %s\n",
			nfs_get_error(nfs));
		ret = 1;
		goto finished;



( run in 1.649 second using v1.01-cache-2.11-cpan-71847e10f99 )