X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=lib%2Flibnfs.c;h=c7c9f48285a9f64ade49f9fdd0997d7c16f810ad;hb=2811861b9634ebc30b3c56afe681f1d3eb0e5060;hp=118f1d4f3e612caf3094d7a9e0b493d417171eef;hpb=16104b27bd8deedc07a23aec33b4ef3cde82808f;p=deb_libnfs.git diff --git a/lib/libnfs.c b/lib/libnfs.c index 118f1d4..c7c9f48 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -37,6 +37,8 @@ #include #include #include +#include +#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-raw-mount.h" @@ -111,7 +113,7 @@ struct nfs_mcb_data { static int nfs_lookup_path_async_internal(struct nfs_context *nfs, struct nfs_cb_data *data, struct nfs_fh3 *fh); -void nfs_set_auth(struct nfs_context *nfs, AUTH *auth) +void nfs_set_auth(struct nfs_context *nfs, struct AUTH *auth) { rpc_set_auth(nfs->rpc, auth); } @@ -2946,8 +2948,17 @@ static void nfs_symlink_cb(struct rpc_context *rpc _U_, int status, void *comman static int nfs_symlink_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) { struct nfs_symlink_data *symlink_data = data->continue_data; + SYMLINK3args sa; - if (rpc_nfs_symlink_async(nfs->rpc, nfs_symlink_cb, &data->fh, symlink_data->newpathobject, symlink_data->oldpath, data) != 0) { + memset(&sa, 0, sizeof(SYMLINK3args)); + sa.where.dir.data.data_len = data->fh.data.data_len; + sa.where.dir.data.data_val = data->fh.data.data_val; + sa.where.name = symlink_data->newpathobject; + sa.symlink.symlink_attributes.mode.set_it = 1; + sa.symlink.symlink_attributes.mode.set_mode3_u.mode = S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH; + sa.symlink.symlink_data = symlink_data->oldpath; + + if (rpc_nfs_symlink_async(nfs->rpc, nfs_symlink_cb, &sa, data) != 0) { rpc_set_error(nfs->rpc, "RPC error: Failed to send SYMLINK call for %s", data->path); data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data); free_nfs_cb_data(data); @@ -3332,7 +3343,7 @@ uint64_t nfs_get_readmax(struct nfs_context *nfs) */ uint64_t nfs_get_writemax(struct nfs_context *nfs) { - /* Some XDR libraries can not marshall PDUs bigger than this */ + /* Some ZDR libraries can not marshall PDUs bigger than this */ if (nfs->writemax < 32768) { return nfs->writemax; } @@ -3538,3 +3549,7 @@ const char *nfs_get_export(struct nfs_context *nfs) { const struct nfs_fh3 *nfs_get_rootfh(struct nfs_context *nfs) { return &nfs->rootfh; } + +struct nfs_fh3 *nfs_get_fh(struct nfsfh *nfsfh) { + return &nfsfh->fh; +}