diff options
author | Jeremy Allison <jra@samba.org> | 2004-03-24 03:48:08 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2004-03-24 03:48:08 +0000 |
commit | 90f64838f49283aaf2a14adc99113ac3d5ddd795 (patch) | |
tree | 7583d3d23463511a6b5257ac2fce3794123a8cff | |
parent | e7633698510ac0b72c6b0fd1d19c099cf45b320c (diff) | |
download | samba-90f64838f49283aaf2a14adc99113ac3d5ddd795.tar.gz samba-90f64838f49283aaf2a14adc99113ac3d5ddd795.tar.bz2 samba-90f64838f49283aaf2a14adc99113ac3d5ddd795.zip |
Added cli_set_ea(), cli_get_ea next...
Jeremy.
(This used to be commit b0c109c40335a2f59406e1d2845d676d211faf14)
-rw-r--r-- | source3/libsmb/clifile.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index a3fa811e29..6641d6b056 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -1161,3 +1161,67 @@ NTSTATUS cli_raw_ioctl(struct cli_state *cli, int fnum, uint32 code, DATA_BLOB * return NT_STATUS_OK; } + +/********************************************************* + Set an extended attribute on a pathname. +*********************************************************/ + +BOOL cli_set_ea(struct cli_state *cli, const char *path, const char *ea_name, const char *ea_val, size_t ea_len) +{ + unsigned int data_len = 0; + unsigned int param_len = 0; + uint16 setup = TRANSACT2_SETPATHINFO; + char param[sizeof(pstring)+6]; + char *data = NULL; + char *rparam=NULL, *rdata=NULL; + char *p; + size_t srclen = 2*(strlen(path)+1); + size_t ea_namelen = strlen(ea_name); + + memset(param, 0, sizeof(param)); + SSVAL(param,0,SMB_INFO_SET_EA); + p = ¶m[6]; + + p += clistr_push(cli, p, path, MIN(srclen, sizeof(param)-6), STR_TERMINATE); + param_len = PTR_DIFF(p, param); + + data_len = 4 + ea_namelen + 1 + ea_len; + data = malloc(data_len); + if (!data) { + return False; + } + p = data; + SCVAL(p, 0, 0); /* EA flags. */ + SCVAL(p, 1, ea_namelen); + SSVAL(p, 2, ea_len); + memcpy(p+4, ea_name, ea_namelen+1); /* Copy in the name. */ + memcpy(p+4+ea_namelen+1, ea_val, ea_len); + data_len = 4 + ea_namelen + 1 + ea_len; + + if (!cli_send_trans(cli, SMBtrans2, + NULL, /* name */ + -1, 0, /* fid, flags */ + &setup, 1, 0, /* setup, length, max */ + param, param_len, 2, /* param, length, max */ + (char *)&data, data_len, cli->max_xmit /* data, length, max */ + )) { + return False; + } + + if (!cli_receive_trans(cli, SMBtrans2, + &rparam, ¶m_len, + &rdata, &data_len)) { + return False; + } + + SAFE_FREE(data); + SAFE_FREE(rdata); + SAFE_FREE(rparam); + + return True; +} + +BOOL cli_get_ea(struct cli_state *cli, const char *path, const char *ea_name, char **value, size_t *val_len) +{ + return False; +} |