summaryrefslogtreecommitdiff
path: root/source3/smbd/trans2.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-03-17 22:56:13 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-03-17 22:56:13 +0000
commitad0d6509a761154c113e040a82ad78e72a3ccf30 (patch)
tree13f4b6188945bfd1ada57e76c612f45a21bce5e2 /source3/smbd/trans2.c
parentf06d1b240a0cc15bc50c907198c06fcd826d63b2 (diff)
downloadsamba-ad0d6509a761154c113e040a82ad78e72a3ccf30.tar.gz
samba-ad0d6509a761154c113e040a82ad78e72a3ccf30.tar.bz2
samba-ad0d6509a761154c113e040a82ad78e72a3ccf30.zip
Merge from HEAD:
- Make ReadDirName return a const char*. - Consequential changes from that - mark our fstring/pstring assumptions in function prototypes Andrew Bartlett (This used to be commit 10b53d7c6fd77f23433dd2ef12bb14b227147a48)
Diffstat (limited to 'source3/smbd/trans2.c')
-rw-r--r--source3/smbd/trans2.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index bea09e9e37..5d85cae907 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -460,7 +460,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
BOOL *out_of_space, BOOL *got_exact_match,
int *last_name_off)
{
- char *dname;
+ const char *dname;
BOOL found = False;
SMB_STRUCT_STAT sbuf;
pstring mask;
@@ -1173,7 +1173,8 @@ resume_key = %d resume name = %s continue=%d level = %d\n",
*/
int current_pos, start_pos;
- char *dname = NULL;
+ const char *dname = NULL;
+ pstring dname_pstring;
void *dirptr = conn->dirptr;
start_pos = TellDir(dirptr);
for(current_pos = start_pos; current_pos >= 0; current_pos--) {
@@ -1181,7 +1182,7 @@ resume_key = %d resume name = %s continue=%d level = %d\n",
SeekDir(dirptr, current_pos);
dname = ReadDirName(dirptr);
-
+ if (dname) {
/*
* Remember, mangle_map is called by
* get_lanman2_dir_entry(), so the resume name
@@ -1189,15 +1190,18 @@ resume_key = %d resume name = %s continue=%d level = %d\n",
* here.
*/
- if(dname != NULL)
- mangle_map( dname, False, True, SNUM(conn));
+ /* make sure we get a copy that mangle_map can modify */
+
+ pstrcpy(dname_pstring, dname);
+ mangle_map( dname_pstring, False, True, SNUM(conn));
- if(dname && strcsequal( resume_name, dname)) {
+ if(strcsequal( resume_name, dname_pstring)) {
SeekDir(dirptr, current_pos+1);
DEBUG(7,("call_trans2findnext: got match at pos %d\n", current_pos+1 ));
break;
}
}
+ }
/*
* Scan forward from start if not found going backwards.
@@ -1215,14 +1219,18 @@ resume_key = %d resume name = %s continue=%d level = %d\n",
* here.
*/
- if(dname != NULL)
- mangle_map( dname, False, True, SNUM(conn));
+ if(dname) {
+ /* make sure we get a copy that mangle_map can modify */
- if(dname && strcsequal( resume_name, dname)) {
+ pstrcpy(dname_pstring, dname);
+ mangle_map(dname_pstring, False, True, SNUM(conn));
+
+ if(strcsequal( resume_name, dname_pstring)) {
SeekDir(dirptr, current_pos+1);
DEBUG(7,("call_trans2findnext: got match at pos %d\n", current_pos+1 ));
break;
}
+ }
} /* end for */
} /* end if current_pos */
} /* end if requires_resume_key && !continue_bit */
@@ -1269,7 +1277,6 @@ resume_key = %d resume name = %s continue=%d level = %d\n",
dptr_close(&dptr_num); /* This frees up the saved mask */
}
-
/* Set up the return parameter block */
SSVAL(params,0,numentries);
SSVAL(params,2,finished);