mirror of
https://github.com/samba-team/samba.git
synced 2025-08-30 17:49:30 +03:00
- Make ReadDirName return a const char*.
- Consequential changes from that - mark our fstring/pstring assumptions in function prototypes Andrew Bartlett
This commit is contained in:
@ -1291,7 +1291,7 @@ static int file_find(struct file_list **list, const char *directory,
|
|||||||
int ret;
|
int ret;
|
||||||
char *path;
|
char *path;
|
||||||
BOOL isdir;
|
BOOL isdir;
|
||||||
char *dname;
|
const char *dname;
|
||||||
|
|
||||||
dir = opendir(directory);
|
dir = opendir(directory);
|
||||||
if (!dir) return -1;
|
if (!dir) return -1;
|
||||||
|
@ -1435,7 +1435,7 @@ void smb_panic(const char *why)
|
|||||||
A readdir wrapper which just returns the file name.
|
A readdir wrapper which just returns the file name.
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
char *readdirname(DIR *p)
|
const char *readdirname(DIR *p)
|
||||||
{
|
{
|
||||||
SMB_STRUCT_DIRENT *ptr;
|
SMB_STRUCT_DIRENT *ptr;
|
||||||
char *dname;
|
char *dname;
|
||||||
|
@ -64,7 +64,7 @@ static int findpty(char **slave)
|
|||||||
int master;
|
int master;
|
||||||
static fstring line;
|
static fstring line;
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
char *dpname;
|
const char *dpname;
|
||||||
|
|
||||||
#if defined(HAVE_GRANTPT)
|
#if defined(HAVE_GRANTPT)
|
||||||
/* Try to open /dev/ptmx. If that fails, fall through to old method. */
|
/* Try to open /dev/ptmx. If that fails, fall through to old method. */
|
||||||
|
@ -107,7 +107,7 @@ BOOL mangle_check_cache(char *s)
|
|||||||
map a long filename to a 8.3 name.
|
map a long filename to a 8.3 name.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void mangle_map(char *OutName, BOOL need83, BOOL cache83, int snum)
|
void mangle_map(pstring OutName, BOOL need83, BOOL cache83, int snum)
|
||||||
{
|
{
|
||||||
/* name mangling can be disabled for speed, in which case
|
/* name mangling can be disabled for speed, in which case
|
||||||
we just truncate the string */
|
we just truncate the string */
|
||||||
|
@ -484,7 +484,7 @@ static BOOL is_legal_name(const char *name)
|
|||||||
|
|
||||||
the name parameter must be able to hold 13 bytes
|
the name parameter must be able to hold 13 bytes
|
||||||
*/
|
*/
|
||||||
static void name_map(char *name, BOOL need83, BOOL cache83)
|
static void name_map(fstring name, BOOL need83, BOOL cache83)
|
||||||
{
|
{
|
||||||
char *dot_p;
|
char *dot_p;
|
||||||
char lead_chars[7];
|
char lead_chars[7];
|
||||||
|
@ -201,7 +201,7 @@ static void mangled_map(char *s, const char *MangledMap)
|
|||||||
front end routine to the mangled map code
|
front end routine to the mangled map code
|
||||||
personally I think that the whole idea of "mangled map" is completely bogus
|
personally I think that the whole idea of "mangled map" is completely bogus
|
||||||
*/
|
*/
|
||||||
void mangle_map_filename(char *fname, int snum)
|
void mangle_map_filename(fstring fname, int snum)
|
||||||
{
|
{
|
||||||
char *map;
|
char *map;
|
||||||
|
|
||||||
|
@ -460,7 +460,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
|
|||||||
BOOL *out_of_space, BOOL *got_exact_match,
|
BOOL *out_of_space, BOOL *got_exact_match,
|
||||||
int *last_name_off)
|
int *last_name_off)
|
||||||
{
|
{
|
||||||
char *dname;
|
const char *dname;
|
||||||
BOOL found = False;
|
BOOL found = False;
|
||||||
SMB_STRUCT_STAT sbuf;
|
SMB_STRUCT_STAT sbuf;
|
||||||
pstring mask;
|
pstring mask;
|
||||||
@ -1173,7 +1173,8 @@ resume_key = %d resume name = %s continue=%d level = %d\n",
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int current_pos, start_pos;
|
int current_pos, start_pos;
|
||||||
char *dname = NULL;
|
const char *dname = NULL;
|
||||||
|
pstring dname_pstring;
|
||||||
void *dirptr = conn->dirptr;
|
void *dirptr = conn->dirptr;
|
||||||
start_pos = TellDir(dirptr);
|
start_pos = TellDir(dirptr);
|
||||||
for(current_pos = start_pos; current_pos >= 0; current_pos--) {
|
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);
|
SeekDir(dirptr, current_pos);
|
||||||
dname = ReadDirName(dirptr);
|
dname = ReadDirName(dirptr);
|
||||||
|
if (dname) {
|
||||||
/*
|
/*
|
||||||
* Remember, mangle_map is called by
|
* Remember, mangle_map is called by
|
||||||
* get_lanman2_dir_entry(), so the resume name
|
* get_lanman2_dir_entry(), so the resume name
|
||||||
@ -1189,15 +1190,18 @@ resume_key = %d resume name = %s continue=%d level = %d\n",
|
|||||||
* here.
|
* here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(dname != NULL)
|
/* make sure we get a copy that mangle_map can modify */
|
||||||
mangle_map( dname, False, True, SNUM(conn));
|
|
||||||
|
|
||||||
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);
|
SeekDir(dirptr, current_pos+1);
|
||||||
DEBUG(7,("call_trans2findnext: got match at pos %d\n", current_pos+1 ));
|
DEBUG(7,("call_trans2findnext: got match at pos %d\n", current_pos+1 ));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan forward from start if not found going backwards.
|
* 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.
|
* here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(dname != NULL)
|
if(dname) {
|
||||||
mangle_map( dname, False, True, SNUM(conn));
|
/* 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);
|
SeekDir(dirptr, current_pos+1);
|
||||||
DEBUG(7,("call_trans2findnext: got match at pos %d\n", current_pos+1 ));
|
DEBUG(7,("call_trans2findnext: got match at pos %d\n", current_pos+1 ));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} /* end for */
|
} /* end for */
|
||||||
} /* end if current_pos */
|
} /* end if current_pos */
|
||||||
} /* end if requires_resume_key && !continue_bit */
|
} /* 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 */
|
dptr_close(&dptr_num); /* This frees up the saved mask */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Set up the return parameter block */
|
/* Set up the return parameter block */
|
||||||
SSVAL(params,0,numentries);
|
SSVAL(params,0,numentries);
|
||||||
SSVAL(params,2,finished);
|
SSVAL(params,2,finished);
|
||||||
|
Reference in New Issue
Block a user