summaryrefslogtreecommitdiff
path: root/source3/smbd/reply.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-07-05 16:36:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:49 -0500
commit8724dfe55155eef0fb612e547ecf0ebaee89adf4 (patch)
treeffe772acd58cf66c0554c322d72e262a95efca76 /source3/smbd/reply.c
parentfcda5b589633b96415890c569bf23e3e284e0916 (diff)
downloadsamba-8724dfe55155eef0fb612e547ecf0ebaee89adf4.tar.gz
samba-8724dfe55155eef0fb612e547ecf0ebaee89adf4.tar.bz2
samba-8724dfe55155eef0fb612e547ecf0ebaee89adf4.zip
r23727: Explicitly pass down FLAGS2 to srvstr_get_path.
Next step is to remove the bug that in the trans2 code we use the inbuf as the base pointer to decide whether we need ucs2 alignment where we need to use the beginning of the params buffer Jeremy, last one for today to reviw :-) (This used to be commit 18078b9faa3820fb34604063c9079c1ebe3ad47f)
Diffstat (limited to 'source3/smbd/reply.c')
-rw-r--r--source3/smbd/reply.c80
1 files changed, 55 insertions, 25 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index ac06f2fd6d..e0442c143a 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -209,8 +209,9 @@ NTSTATUS check_path_syntax_posix(char *path)
Pull a string and check the path allowing a wilcard - provide for error return.
****************************************************************************/
-size_t srvstr_get_path_wcard(char *inbuf, char *dest, const char *src, size_t dest_len, size_t src_len, int flags,
- NTSTATUS *err, BOOL *contains_wcard)
+size_t srvstr_get_path_wcard(char *inbuf, uint16 smb_flags2, char *dest,
+ const char *src, size_t dest_len, size_t src_len,
+ int flags, NTSTATUS *err, BOOL *contains_wcard)
{
size_t ret;
#ifdef DEVELOPER
@@ -218,10 +219,10 @@ size_t srvstr_get_path_wcard(char *inbuf, char *dest, const char *src, size_t de
#endif
if (src_len == 0) {
- ret = srvstr_pull_buf(inbuf, SVAL(inbuf, smb_flg2), dest, src,
+ ret = srvstr_pull_buf(inbuf, smb_flags2, dest, src,
dest_len, flags);
} else {
- ret = srvstr_pull(inbuf, SVAL(inbuf, smb_flg2), dest, src,
+ ret = srvstr_pull(inbuf, smb_flags2, dest, src,
dest_len, src_len, flags);
}
@@ -249,7 +250,9 @@ size_t srvstr_get_path_wcard(char *inbuf, char *dest, const char *src, size_t de
Pull a string and check the path - provide for error return.
****************************************************************************/
-size_t srvstr_get_path(char *inbuf, char *dest, const char *src, size_t dest_len, size_t src_len, int flags, NTSTATUS *err)
+size_t srvstr_get_path(char *inbuf, uint16 smb_flags2, char *dest,
+ const char *src, size_t dest_len, size_t src_len,
+ int flags, NTSTATUS *err)
{
size_t ret;
#ifdef DEVELOPER
@@ -257,14 +260,14 @@ size_t srvstr_get_path(char *inbuf, char *dest, const char *src, size_t dest_len
#endif
if (src_len == 0) {
- ret = srvstr_pull_buf(inbuf, SVAL(inbuf, smb_flg2), dest, src,
+ ret = srvstr_pull_buf(inbuf, smb_flags2, dest, src,
dest_len, flags);
} else {
- ret = srvstr_pull(inbuf, SVAL(inbuf, smb_flg2), dest, src,
+ ret = srvstr_pull(inbuf, smb_flags2, dest, src,
dest_len, src_len, flags);
}
- if (SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES) {
+ if (smb_flags2 & FLAGS2_DFS_PATHNAMES) {
/*
* For a DFS path the function parse_dfs_path()
* will do the path processing, just make a copy.
@@ -681,7 +684,8 @@ int reply_checkpath(connection_struct *conn, char *inbuf,char *outbuf, int dum_s
START_PROFILE(SMBcheckpath);
- srvstr_get_path(inbuf, name, smb_buf(inbuf) + 1, sizeof(name), 0, STR_TERMINATE, &status);
+ srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), name, smb_buf(inbuf) + 1,
+ sizeof(name), 0, STR_TERMINATE, &status);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBcheckpath);
status = map_checkpath_error(inbuf, status);
@@ -768,7 +772,8 @@ int reply_getatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
START_PROFILE(SMBgetatr);
p = smb_buf(inbuf) + 1;
- p += srvstr_get_path(inbuf, fname, p, sizeof(fname), 0, STR_TERMINATE, &status);
+ p += srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), fname, p,
+ sizeof(fname), 0, STR_TERMINATE, &status);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBgetatr);
return ERROR_NT(status);
@@ -854,7 +859,8 @@ int reply_setatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
START_PROFILE(SMBsetatr);
p = smb_buf(inbuf) + 1;
- p += srvstr_get_path(inbuf, fname, p, sizeof(fname), 0, STR_TERMINATE, &status);
+ p += srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), fname, p,
+ sizeof(fname), 0, STR_TERMINATE, &status);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBsetatr);
return ERROR_NT(status);
@@ -1016,7 +1022,9 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
maxentries = SVAL(inbuf,smb_vwv0);
dirtype = SVAL(inbuf,smb_vwv1);
p = smb_buf(inbuf) + 1;
- p += srvstr_get_path_wcard(inbuf, path, p, sizeof(path), 0, STR_TERMINATE, &nt_status, &mask_contains_wcard);
+ p += srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), path, p,
+ sizeof(path), 0, STR_TERMINATE, &nt_status,
+ &mask_contains_wcard);
if (!NT_STATUS_IS_OK(nt_status)) {
END_PROFILE(SMBsearch);
return ERROR_NT(nt_status);
@@ -1221,7 +1229,9 @@ int reply_fclose(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
outsize = set_message(inbuf,outbuf,1,0,True);
p = smb_buf(inbuf) + 1;
- p += srvstr_get_path_wcard(inbuf, path, p, sizeof(path), 0, STR_TERMINATE, &err, &path_contains_wcard);
+ p += srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), path, p,
+ sizeof(path), 0, STR_TERMINATE, &err,
+ &path_contains_wcard);
if (!NT_STATUS_IS_OK(err)) {
END_PROFILE(SMBfclose);
return ERROR_NT(err);
@@ -1280,7 +1290,8 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
deny_mode = SVAL(inbuf,smb_vwv0);
- srvstr_get_path(inbuf, fname, smb_buf(inbuf)+1, sizeof(fname), 0, STR_TERMINATE, &status);
+ srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), fname, smb_buf(inbuf)+1,
+ sizeof(fname), 0, STR_TERMINATE, &status);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBopen);
return ERROR_NT(status);
@@ -1414,7 +1425,8 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
}
/* XXXX we need to handle passed times, sattr and flags */
- srvstr_get_path(inbuf, fname, smb_buf(inbuf), sizeof(fname), 0, STR_TERMINATE, &status);
+ srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), fname, smb_buf(inbuf),
+ sizeof(fname), 0, STR_TERMINATE, &status);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBopenX);
return ERROR_NT(status);
@@ -1602,7 +1614,8 @@ int reply_mknew(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
ts[1] = convert_time_t_to_timespec(srv_make_unix_date3(inbuf + smb_vwv1)); /* mtime. */
- srvstr_get_path(inbuf, fname, smb_buf(inbuf) + 1, sizeof(fname), 0, STR_TERMINATE, &status);
+ srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), fname, smb_buf(inbuf) + 1,
+ sizeof(fname), 0, STR_TERMINATE, &status);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBcreate);
return ERROR_NT(status);
@@ -1703,7 +1716,8 @@ int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
init_smb_request(&req, (uint8 *)inbuf);
- srvstr_get_path(inbuf, fname, smb_buf(inbuf)+1, sizeof(fname), 0, STR_TERMINATE, &status);
+ srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), fname, smb_buf(inbuf)+1,
+ sizeof(fname), 0, STR_TERMINATE, &status);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBctemp);
return ERROR_NT(status);
@@ -2111,7 +2125,9 @@ int reply_unlink(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
dirtype = SVAL(inbuf,smb_vwv0);
- srvstr_get_path_wcard(inbuf, name, smb_buf(inbuf) + 1, sizeof(name), 0, STR_TERMINATE, &status, &path_contains_wcard);
+ srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), name,
+ smb_buf(inbuf) + 1, sizeof(name), 0,
+ STR_TERMINATE, &status, &path_contains_wcard);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBunlink);
return ERROR_NT(status);
@@ -3834,7 +3850,9 @@ int reply_mkdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
START_PROFILE(SMBmkdir);
- srvstr_get_path(inbuf, directory, smb_buf(inbuf) + 1, sizeof(directory), 0, STR_TERMINATE, &status);
+ srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), directory,
+ smb_buf(inbuf) + 1, sizeof(directory), 0,
+ STR_TERMINATE, &status);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBmkdir);
return ERROR_NT(status);
@@ -4075,7 +4093,9 @@ int reply_rmdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
NTSTATUS status;
START_PROFILE(SMBrmdir);
- srvstr_get_path(inbuf, directory, smb_buf(inbuf) + 1, sizeof(directory), 0, STR_TERMINATE, &status);
+ srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), directory,
+ smb_buf(inbuf) + 1, sizeof(directory), 0,
+ STR_TERMINATE, &status);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBrmdir);
return ERROR_NT(status);
@@ -4765,13 +4785,17 @@ int reply_mv(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
init_smb_request(&req, (uint8 *)inbuf);
p = smb_buf(inbuf) + 1;
- p += srvstr_get_path_wcard(inbuf, name, p, sizeof(name), 0, STR_TERMINATE, &status, &src_has_wcard);
+ p += srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), name, p,
+ sizeof(name), 0, STR_TERMINATE, &status,
+ &src_has_wcard);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBmv);
return ERROR_NT(status);
}
p++;
- p += srvstr_get_path_wcard(inbuf, newname, p, sizeof(newname), 0, STR_TERMINATE, &status, &dest_has_wcard);
+ p += srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), newname, p,
+ sizeof(newname), 0, STR_TERMINATE, &status,
+ &dest_has_wcard);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBmv);
return ERROR_NT(status);
@@ -4960,12 +4984,16 @@ int reply_copy(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
*directory = *mask = 0;
p = smb_buf(inbuf);
- p += srvstr_get_path_wcard(inbuf, name, p, sizeof(name), 0, STR_TERMINATE, &status, &source_has_wild);
+ p += srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), name, p,
+ sizeof(name), 0, STR_TERMINATE, &status,
+ &source_has_wild);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBcopy);
return ERROR_NT(status);
}
- p += srvstr_get_path_wcard(inbuf, newname, p, sizeof(newname), 0, STR_TERMINATE, &status, &dest_has_wild);
+ p += srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), newname, p,
+ sizeof(newname), 0, STR_TERMINATE, &status,
+ &dest_has_wild);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBcopy);
return ERROR_NT(status);
@@ -5181,7 +5209,9 @@ int reply_setdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
return ERROR_DOS(ERRDOS,ERRnoaccess);
}
- srvstr_get_path(inbuf, newdir, smb_buf(inbuf) + 1, sizeof(newdir), 0, STR_TERMINATE, &status);
+ srvstr_get_path(inbuf, SVAL(inbuf,smb_flg2), newdir,
+ smb_buf(inbuf) + 1, sizeof(newdir), 0, STR_TERMINATE,
+ &status);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(pathworks_setdir);
return ERROR_NT(status);