ea: initialize named attr paths

zero-initialize the paths for named attrs, and initialize the file.name instead of using a temporary dst_name

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2012-04-06 13:56:57 -04:00 committed by unknown
parent 7bd70cf488
commit fd591f92d7
2 changed files with 10 additions and 12 deletions

View file

@ -217,11 +217,10 @@ static int handle_getexattr(nfs41_upcall *upcall)
PFILE_FULL_EA_INFORMATION eainfo, entry_pos; PFILE_FULL_EA_INFORMATION eainfo, entry_pos;
unsigned char *entry_buf, buf[NFS4_EASIZE] = { 0 }; unsigned char *entry_buf, buf[NFS4_EASIZE] = { 0 };
nfs41_open_state *state = upcall->state_ref; nfs41_open_state *state = upcall->state_ref;
nfs41_path_fh parent, file; nfs41_path_fh parent = { 0 }, file = { 0 };
open_claim4 claim; open_claim4 claim;
stateid4 open_stateid; stateid4 open_stateid;
stateid_arg stateid; stateid_arg stateid;
nfs41_component dst_name;
open_delegation4 delegation = { 0 }; open_delegation4 delegation = { 0 };
bool_t eof; bool_t eof;
uint32_t bytes_read = 0; uint32_t bytes_read = 0;
@ -244,14 +243,14 @@ static int handle_getexattr(nfs41_upcall *upcall)
entry_pos = eainfo = (PFILE_FULL_EA_INFORMATION)entry_buf; entry_pos = eainfo = (PFILE_FULL_EA_INFORMATION)entry_buf;
while (gea != prev) { while (gea != prev) {
dst_name.name = gea->EaName; file.name.name = gea->EaName;
dst_name.len = gea->EaNameLength; file.name.len = gea->EaNameLength;
claim.claim = CLAIM_NULL; claim.claim = CLAIM_NULL;
claim.u.null.filename = &dst_name; claim.u.null.filename = &file.name;
status = nfs41_open(state->session, &parent, &file, &state->owner, status = nfs41_open(state->session, &parent, &file, &state->owner,
&claim, OPEN4_SHARE_ACCESS_READ, OPEN4_SHARE_DENY_BOTH, &claim, OPEN4_SHARE_ACCESS_READ, OPEN4_SHARE_DENY_BOTH,
OPEN4_NOCREATE, UNCHECKED4, 0, TRUE, &open_stateid, OPEN4_NOCREATE, UNCHECKED4, 0, TRUE, &open_stateid,
&delegation, NULL); &delegation, NULL);
if (status) { if (status) {
dprintf(1, "nfs41_open() failed with error %s.\n", dprintf(1, "nfs41_open() failed with error %s.\n",
nfs_error_string(status)); nfs_error_string(status));

View file

@ -538,10 +538,9 @@ static int handle_setexattr(nfs41_upcall *upcall)
nfs41_file_info createattrs, info = { 0 }; nfs41_file_info createattrs, info = { 0 };
PFILE_FULL_EA_INFORMATION eainfo = PFILE_FULL_EA_INFORMATION eainfo =
(PFILE_FULL_EA_INFORMATION)args->buf, prev = NULL; (PFILE_FULL_EA_INFORMATION)args->buf, prev = NULL;
nfs41_path_fh parent, file; nfs41_path_fh parent = { 0 }, file = { 0 };
open_claim4 claim; open_claim4 claim;
stateid4 open_stateid; stateid4 open_stateid;
nfs41_component dst_name;
nfs41_write_verf verf; nfs41_write_verf verf;
uint32_t bytes_written; uint32_t bytes_written;
UCHAR *buf; UCHAR *buf;
@ -591,12 +590,12 @@ static int handle_setexattr(nfs41_upcall *upcall)
status = ERROR_INVALID_DATA; status = ERROR_INVALID_DATA;
goto out; goto out;
} }
dst_name.name = eainfo->EaName; file.name.name = eainfo->EaName;
dst_name.len = eainfo->EaNameLength; file.name.len = eainfo->EaNameLength;
claim.claim = CLAIM_NULL; claim.claim = CLAIM_NULL;
claim.u.null.filename = &dst_name; claim.u.null.filename = &file.name;
status = nfs41_open(state->session, &parent, &file, &state->owner, &claim, status = nfs41_open(state->session, &parent, &file, &state->owner, &claim,
OPEN4_SHARE_ACCESS_WRITE, OPEN4_SHARE_DENY_BOTH, OPEN4_CREATE, OPEN4_SHARE_ACCESS_WRITE, OPEN4_SHARE_DENY_BOTH, OPEN4_CREATE,
UNCHECKED4, &createattrs, TRUE, &open_stateid, &delegation, NULL); UNCHECKED4, &createattrs, TRUE, &open_stateid, &delegation, NULL);
if (status) { if (status) {
dprintf(1, "handle_setexattr: nfs41_rpc_open() failed with error %s.\n", dprintf(1, "handle_setexattr: nfs41_rpc_open() failed with error %s.\n",