diff options
-rw-r--r-- | source3/include/proto.h | 8 | ||||
-rw-r--r-- | source3/smbd/filename.c | 2 | ||||
-rw-r--r-- | source3/smbd/mangle.c | 78 |
3 files changed, 43 insertions, 45 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 01ae342f98f..969b8c6a86e 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -170,7 +170,7 @@ int dos_open(char *fname,int flags,int mode); DIR *dos_opendir(char *dname); int dos_stat(char *fname,SMB_STRUCT_STAT *sbuf); int sys_waitpid(pid_t pid,int *status,int options); -int dos_lstat(char *fname,struct stat *sbuf); +int dos_lstat(char *fname,SMB_STRUCT_STAT *sbuf); int dos_mkdir(char *dname,int mode); int dos_rmdir(char *dname); int dos_chdir(char *dname); @@ -305,7 +305,6 @@ int set_filelen(int fd, long len); int byte_checksum(char *buf,int len); char *dirname_dos(char *path,char *buf); void *Realloc(void *p,int size); -void Abort(void ); BOOL get_myname(char *my_name,struct in_addr *ip); BOOL ip_equal(struct in_addr ip1,struct in_addr ip2); int open_socket_in(int type, int port, int dlevel,uint32 socket_addr); @@ -2052,8 +2051,8 @@ BOOL is_mangled( char *s ); BOOL is_8_3( char *fname, BOOL check_case ); void reset_mangled_cache( void ); BOOL check_mangled_cache( char *s ); -void mangle_name_83( char *s, int s_len ); -BOOL name_map_mangle( char *OutName, BOOL need83, int snum ); +void mangle_name_83( char *s); +BOOL name_map_mangle(char *OutName, BOOL need83, int snum); /*The following definitions come from smbd/message.c */ @@ -2291,7 +2290,6 @@ char *quotequotes(char *s); void quote_spaces(char *buf); void cgi_setup(char *rootdir, int auth_required); char *cgi_baseurl(void); -char *cgi_rooturl(void); char *cgi_pathinfo(void); char *cgi_remote_host(void); char *cgi_remote_addr(void); diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 3bc69210b93..656bb8997c9 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -77,7 +77,7 @@ BOOL mangled_equal(char *name1, char *name2) return(False); pstrcpy(tmpname,name2); - mangle_name_83(tmpname,sizeof(tmpname)); + mangle_name_83(tmpname); return(strequal(name1,tmpname)); } diff --git a/source3/smbd/mangle.c b/source3/smbd/mangle.c index 0703a4a74ef..0a3d3f54eb7 100644 --- a/source3/smbd/mangle.c +++ b/source3/smbd/mangle.c @@ -799,12 +799,12 @@ static void do_fwd_mangled_map(char *s, char *MangledMap) } } /* do_fwd_mangled_map */ -/* ************************************************************************** ** +/***************************************************************************** * do the actual mangling to 8.3 format - * - * ************************************************************************** ** + * the buffer must be able to hold 13 characters (including the null) + ***************************************************************************** */ -void mangle_name_83( char *s, int s_len ) +void mangle_name_83( char *s) { int csum = str_checksum(s); char *p; @@ -907,7 +907,7 @@ void mangle_name_83( char *s, int s_len ) csum = csum % (36*36); - (void)slprintf( s, s_len - 1, "%s%c%c%c", + (void)slprintf(s, 12, "%s%c%c%c", base, magic_char, base36( csum/36 ), base36( csum ) ); if( *extension ) @@ -917,12 +917,13 @@ void mangle_name_83( char *s, int s_len ) } DEBUG( 5, ( "%s\n", s ) ); + } /* mangle_name_83 */ -/* ************************************************************************** ** +/***************************************************************************** * Convert a filename to DOS format. Return True if successful. * - * Input: OutName - Source *and* destination buffer. + * Input: OutName - Source *and* destination buffer. * * NOTE that OutName must point to a memory space that * is at least 13 bytes in size! @@ -939,47 +940,46 @@ void mangle_name_83( char *s, int s_len ) * Output: Returns False only if the name wanted mangling but the share does * not have name mangling turned on. * - * ************************************************************************** ** + * **************************************************************************** */ -BOOL name_map_mangle( char *OutName, BOOL need83, int snum ) - { - DEBUG(5, - ("name_map_mangle( %s, %s, %d )\n", OutName, need83?"TRUE":"FALSE", snum) ); +BOOL name_map_mangle(char *OutName, BOOL need83, int snum) +{ + char *map; + DEBUG(5,("name_map_mangle( %s, %s, %d )\n", + OutName, need83?"TRUE":"FALSE", snum)); #ifdef MANGLE_LONG_FILENAMES - if( !need83 && is_illegal_name(OutName) ) - need83 = True; + if( !need83 && is_illegal_name(OutName) ) + need83 = True; #endif - /* apply any name mappings */ - { - char *map = lp_mangled_map( snum ); + /* apply any name mappings */ + map = lp_mangled_map(snum); - if( map && *map ) - do_fwd_mangled_map( OutName, map ); - } + if (map && *map) { + do_fwd_mangled_map( OutName, map ); + } - /* check if it's already in 8.3 format */ - if( need83 && !is_8_3( OutName, True ) ) - { - char *tmp; /* kludge -- mangle_name_83() overwrites the source string */ - /* but cache_mangled_name() needs both. crh 09-Apr-1998 */ + /* check if it's already in 8.3 format */ + if (need83 && !is_8_3(OutName, True)) { + char *tmp; - if( !lp_manglednames( snum ) ) - return( False ); + if (!lp_manglednames(snum)) { + return(False); + } - /* mangle it into 8.3 */ - tmp = strdup( OutName ); - mangle_name_83( OutName, strlen(OutName) ); - if( tmp ) - { - cache_mangled_name( OutName, tmp ); - free( tmp ); - } - } + /* mangle it into 8.3 */ + tmp = strdup(OutName); + mangle_name_83(OutName); - DEBUG( 5, ("name_map_mangle() ==> [%s]\n", OutName) ); - return( True ); - } /* name_map_mangle */ + if(tmp) { + cache_mangled_name(OutName, tmp); + free(tmp); + } + } + + DEBUG(5,("name_map_mangle() ==> [%s]\n", OutName)); + return(True); +} /* name_map_mangle */ /* ========================================================================== */ |