From 527e824293ee934ca5da0ef5424efe5ab7757248 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 4 Jul 2001 07:36:09 +0000 Subject: strchr and strrchr are macros when compiling with optimisation in gcc, so we can't redefine them. damn. (This used to be commit c41fc06376d1a2b83690612304e85010b5e5f3cf) --- source3/smbd/close.c | 2 +- source3/smbd/dosmode.c | 2 +- source3/smbd/filename.c | 6 +++--- source3/smbd/groupname.c | 2 +- source3/smbd/lanman.c | 2 +- source3/smbd/mangle.c | 24 ++++++++++++------------ source3/smbd/nttrans.c | 4 ++-- source3/smbd/open.c | 4 ++-- source3/smbd/quotas.c | 2 +- source3/smbd/reply.c | 32 ++++++++++++++++---------------- source3/smbd/server.c | 4 ++-- source3/smbd/service.c | 2 +- source3/smbd/statcache.c | 2 +- source3/smbd/trans2.c | 6 +++--- source3/smbd/uid.c | 2 +- source3/smbd/vfs.c | 2 +- 16 files changed, 49 insertions(+), 49 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/close.c b/source3/smbd/close.c index dfbc2272e6..6b72a8563a 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -35,7 +35,7 @@ static void check_magic(files_struct *fsp,connection_struct *conn) { char *p; - if (!(p = strrchr(fsp->fsp_name,'/'))) + if (!(p = strrchr_m(fsp->fsp_name,'/'))) p = fsp->fsp_name; else p++; diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 89e5b1586c..639e365d1b 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -149,7 +149,7 @@ int dos_mode(connection_struct *conn,char *path,SMB_STRUCT_STAT *sbuf) /* hide files with a name starting with a . */ if (lp_hide_dot_files(SNUM(conn))) { - char *p = strrchr(path,'/'); + char *p = strrchr_m(path,'/'); if (p) p++; else diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 9b76d63dc6..70f34c52ad 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -176,7 +176,7 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component, */ if(saved_last_component) { - end = strrchr(name, '/'); + end = strrchr_m(name, '/'); if(end) pstrcpy(saved_last_component, end + 1); else @@ -243,7 +243,7 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component, #if 0 /* Keep Andrew's conservative code around, just in case. JRA. */ /* this is an extremely conservative test for mangled names. */ - if (strchr(start,magic_char)) + if (strchr_m(start,magic_char)) component_was_mangled = True; #endif @@ -261,7 +261,7 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component, /* * Pinpoint the end of this section of the filename. */ - end = strchr(start, '/'); + end = strchr_m(start, '/'); /* * Chop the name at this point. diff --git a/source3/smbd/groupname.c b/source3/smbd/groupname.c index d44e9a7a39..0640d4d7b2 100644 --- a/source3/smbd/groupname.c +++ b/source3/smbd/groupname.c @@ -125,7 +125,7 @@ void load_groupname_map(void) DEBUG(10,("load_groupname_map: Read line |%s|\n", s)); - if (!*s || strchr("#;",*s)) + if (!*s || strchr_m("#;",*s)) continue; if(!next_token(&s,unixname, "\t\n\r=", sizeof(unixname))) diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index 2b71770b2e..6e3145aa7d 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -866,7 +866,7 @@ static BOOL api_DosPrintQGetInfo(connection_struct *conn, str3 = p + 4; /* remove any trailing username */ - if ((p = strchr(QueueName,'%'))) *p = 0; + if ((p = strchr_m(QueueName,'%'))) *p = 0; DEBUG(3,("PrintQueue uLevel=%d name=%s\n",uLevel,QueueName)); diff --git a/source3/smbd/mangle.c b/source3/smbd/mangle.c index 8df71d4557..16286a8bb1 100644 --- a/source3/smbd/mangle.c +++ b/source3/smbd/mangle.c @@ -85,11 +85,11 @@ extern BOOL case_mangle; /* If true, all chars in 8.3 should be same case. */ * * isbasecahr() - Given a character, check the chartest array to see * if that character is in the basechars set. This is - * faster than using strchr(). + * faster than using strchr_m(). * * isillegal() - Given a character, check the chartest array to see * if that character is in the illegal characters set. - * This is faster than using strchr(). + * This is faster than using strchr_m(). * * mangled_cache - Cache header used for storing mangled -> original * reverse maps. @@ -181,7 +181,7 @@ static BOOL is_reserved_msdos( char *fname ) StrnCpy (upperFname, fname, 12); /* lpt1.txt and con.txt etc are also illegal */ - p = strchr(upperFname,'.'); + p = strchr_m(upperFname,'.'); if( p ) *p = '\0'; @@ -287,14 +287,14 @@ BOOL is_mangled( char *s ) if( !ct_initialized ) init_chartest(); - magic = strchr( s, magic_char ); + magic = strchr_m( s, magic_char ); while( magic && magic[1] && magic[2] ) /* 3 chars, 1st is magic. */ { if( ('.' == magic[3] || '/' == magic[3] || !(magic[3])) /* Ends with '.' or nul or '/' ? */ && isbasechar( toupper(magic[1]) ) /* is 2nd char basechar? */ && isbasechar( toupper(magic[2]) ) ) /* is 3rd char basechar? */ return( True ); /* If all above, then true, */ - magic = strchr( magic+1, magic_char ); /* else seek next magic. */ + magic = strchr_m( magic+1, magic_char ); /* else seek next magic. */ } return( False ); } /* is_mangled */ @@ -318,7 +318,7 @@ BOOL is_8_3( char *fname, BOOL check_case ) int l; char *p; char *dot_pos; - char *slash_pos = strrchr( fname, '/' ); + char *slash_pos = strrchr_m( fname, '/' ); /* If there is a directory path, skip it. */ if( slash_pos ) @@ -389,7 +389,7 @@ BOOL is_8_3( char *fname, BOOL check_case ) /* see smb.conf(5) for a description of the 'strip dot' parameter. */ if( lp_strip_dot() && len - l == 1 - && !strchr( dot_pos + 1, '.' ) ) + && !strchr_m( dot_pos + 1, '.' ) ) { *dot_pos = 0; return( True ); @@ -400,7 +400,7 @@ BOOL is_8_3( char *fname, BOOL check_case ) return( False ); /* extensions may not have a dot */ - if( strchr( dot_pos+1, '.' ) ) + if( strchr_m( dot_pos+1, '.' ) ) return( False ); /* must be in 8.3 format */ @@ -537,8 +537,8 @@ static void cache_mangled_name( char *mangled_name, char *raw_name ) /* See if the extensions are unmangled. If so, store the entry * without the extension, thus creating a "group" reverse map. */ - s1 = strrchr( mangled_name, '.' ); - if( s1 && (s2 = strrchr( raw_name, '.' )) ) + s1 = strrchr_m( mangled_name, '.' ); + if( s1 && (s2 = strrchr_m( raw_name, '.' )) ) { i = 1; while( s1[i] && (tolower( s1[1] ) == s2[i]) ) @@ -595,7 +595,7 @@ BOOL check_mangled_cache( char *s ) /* If we didn't find the name *with* the extension, try without. */ if( !FoundPtr ) { - ext_start = strrchr( s, '.' ); + ext_start = strrchr_m( s, '.' ); if( ext_start ) { if((saved_ext = strdup(ext_start)) == NULL) @@ -833,7 +833,7 @@ void mangle_name_83( char *s) extension[0] = 0; base[0] = 0; - p = strrchr(s,'.'); + p = strrchr_m(s,'.'); if( p && (strlen(p+1) < (size_t)4) ) { BOOL all_normal = ( strisnormal(p+1) ); /* XXXXXXXXX */ diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index ea37b14e5e..a156748cf8 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -684,7 +684,7 @@ int reply_ntcreate_and_X(connection_struct *conn, srvstr_pull(inbuf, fname, smb_buf(inbuf), sizeof(fname), -1, STR_TERMINATE); - if( strchr(fname, ':')) { + if( strchr_m(fname, ':')) { SSVAL(outbuf, smb_flg2, SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES); END_PROFILE(SMBntcreateX); return(ERROR(0, NT_STATUS_OBJECT_PATH_NOT_FOUND)); @@ -1190,7 +1190,7 @@ static int call_nt_transact_create(connection_struct *conn, srvstr_pull(inbuf, fname, params+53, sizeof(fname), -1, STR_TERMINATE); - if( strchr(fname, ':')) { + if( strchr_m(fname, ':')) { SSVAL(outbuf, smb_flg2, SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES); return(ERROR(0, NT_STATUS_OBJECT_PATH_NOT_FOUND)); } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 7c48e28138..858a26191f 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -42,7 +42,7 @@ static int fd_open(struct connection_struct *conn, char *fname, /* Fix for files ending in '.' */ if((fd == -1) && (errno == ENOENT) && - (strchr(fname,'.')==NULL)) { + (strchr_m(fname,'.')==NULL)) { pstrcat(fname,"."); fd = conn->vfs_ops.open(conn,fname,flags,mode); } @@ -245,7 +245,7 @@ return True if the filename is one of the special executable types ********************************************************************/ static BOOL is_executable(const char *fname) { - if ((fname = strrchr(fname,'.'))) { + if ((fname = strrchr_m(fname,'.'))) { if (strequal(fname,".com") || strequal(fname,".dll") || strequal(fname,".exe") || diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c index caf3997ba8..5d82756f24 100644 --- a/source3/smbd/quotas.c +++ b/source3/smbd/quotas.c @@ -330,7 +330,7 @@ static BOOL nfs_quotas(char *nfspath, uid_t euser_id, SMB_BIG_UINT *bsize, SMB_B host = strncat(cutstr,mnttype, sizeof(char) * len ); DEBUG(5,("nfs_quotas: looking for mount on \"%s\"\n", cutstr)); DEBUG(5,("nfs_quotas: of path \"%s\"\n", mnttype)); - testpath=strchr(mnttype, ':'); + testpath=strchr_m(mnttype, ':'); args.gqa_pathp = testpath+1; args.gqa_uid = uid; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index fe0f2862c6..a331073093 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -198,13 +198,13 @@ int reply_tcon(connection_struct *conn, p += srvstr_pull(inbuf, dev, p, sizeof(dev), -1, STR_TERMINATE) + 1; *user = 0; - p = strchr(service,'%'); + p = strchr_m(service,'%'); if (p != NULL) { *p = 0; fstrcpy(user,p+1); } - p = strrchr(service,'\\'); + p = strrchr_m(service,'\\'); if (p) { pstrcpy(service, p+1); } @@ -288,13 +288,13 @@ int reply_tcon_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt passlen = strlen(password); } - q = strchr(path+2,'\\'); + q = strchr_m(path+2,'\\'); if (!q) { END_PROFILE(SMBtconX); return(ERROR(ERRDOS,ERRnosuchshare)); } fstrcpy(service,q+1); - q = strchr(service,'%'); + q = strchr_m(service,'%'); if (q) { *q++ = 0; fstrcpy(user,q); @@ -1362,7 +1362,7 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size if (!check_name(directory,conn)) can_open = False; - p = strrchr(dir2,'/'); + p = strrchr_m(dir2,'/'); if (p == NULL) { pstrcpy(mask,dir2); @@ -1374,7 +1374,7 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size pstrcpy(mask,p+1); } - p = strrchr(directory,'/'); + p = strrchr_m(directory,'/'); if (!p) *directory = 0; else @@ -1976,7 +1976,7 @@ int unlink_internals(connection_struct *conn, char *inbuf,char *outbuf, rc = unix_convert(name,conn,0,&bad_path,&sbuf); - p = strrchr(name,'/'); + p = strrchr_m(name,'/'); if (!p) { pstrcpy(directory,"./"); pstrcpy(mask,name); @@ -3627,21 +3627,21 @@ static BOOL resolve_wildcards(char *name1,char *name2) fstring ext1,ext2; char *p,*p2; - name1 = strrchr(name1,'/'); - name2 = strrchr(name2,'/'); + name1 = strrchr_m(name1,'/'); + name2 = strrchr_m(name2,'/'); if (!name1 || !name2) return(False); fstrcpy(root1,name1); fstrcpy(root2,name2); - p = strrchr(root1,'.'); + p = strrchr_m(root1,'.'); if (p) { *p = 0; fstrcpy(ext1,p+1); } else { fstrcpy(ext1,""); } - p = strrchr(root2,'.'); + p = strrchr_m(root2,'.'); if (p) { *p = 0; fstrcpy(ext2,p+1); @@ -3731,7 +3731,7 @@ int rename_internals(connection_struct *conn, * as this is checked in resolve_wildcards(). */ - p = strrchr(name,'/'); + p = strrchr_m(name,'/'); if (!p) { pstrcpy(directory,"."); pstrcpy(mask,name); @@ -3767,7 +3767,7 @@ int rename_internals(connection_struct *conn, pstrcat(directory,mask); /* Ensure newname contains a '/' also */ - if(strrchr(newname,'/') == 0) { + if(strrchr_m(newname,'/') == 0) { pstring tmpstr; pstrcpy(tmpstr, "./"); @@ -3800,7 +3800,7 @@ int rename_internals(connection_struct *conn, * Note that we guarantee that newname contains a '/' * character above. */ - p = strrchr(newname,'/'); + p = strrchr_m(newname,'/'); pstrcpy(newname_modified_last_component,p+1); if(strcsequal(newname_modified_last_component, @@ -3966,7 +3966,7 @@ static BOOL copy_file(char *src,char *dest1,connection_struct *conn, int ofun, pstrcpy(dest,dest1); if (target_is_directory) { - char *p = strrchr(src,'/'); + char *p = strrchr_m(src,'/'); if (p) p++; else @@ -4091,7 +4091,7 @@ int reply_copy(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, return(ERROR(ERRSRV,ERRerror)); } - p = strrchr(name,'/'); + p = strrchr_m(name,'/'); if (!p) { pstrcpy(directory,"./"); pstrcpy(mask,name); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 8d115d954c..f753d615ed 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -389,7 +389,7 @@ static BOOL dump_core(void) char *p; pstring dname; pstrcpy(dname,debugf); - if ((p=strrchr(dname,'/'))) *p=0; + if ((p=strrchr_m(dname,'/'))) *p=0; pstrcat(dname,"/corefiles"); mkdir(dname,0700); sys_chown(dname,getuid(),getgid()); @@ -497,7 +497,7 @@ static void init_structs(void ) if (!*global_myname) { char *p; fstrcpy( global_myname, myhostname() ); - p = strchr( global_myname, '.' ); + p = strchr_m( global_myname, '.' ); if (p) *p = 0; } diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 836ef30f80..04139be917 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -102,7 +102,7 @@ int add_home_service(char *service, char *homedir) fstrcpy(new_service, service); - if ((usr_p = strchr(service,*lp_winbind_separator())) != NULL) + if ((usr_p = strchr_m(service,*lp_winbind_separator())) != NULL) fstrcpy(new_service, usr_p+1); lp_add_home(new_service,iHomeService,homedir); diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c index 65a4830016..2e31e1252e 100644 --- a/source3/smbd/statcache.c +++ b/source3/smbd/statcache.c @@ -174,7 +174,7 @@ BOOL stat_cache_lookup(connection_struct *conn, char *name, char *dirpath, /* * Didn't find it - remove last component for next try. */ - sp = strrchr(chk_name, '/'); + sp = strrchr_m(chk_name, '/'); if (sp) { *sp = '\0'; } else { diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index f768a72c6d..622b23c0b0 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -339,7 +339,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn, if (!conn->dirptr) return(False); - p = strrchr(path_mask,'/'); + p = strrchr_m(path_mask,'/'); if(p != NULL) { if(p[1] == '\0') @@ -732,7 +732,7 @@ static int call_trans2findfirst(connection_struct *conn, return(UNIXERROR(ERRDOS,ERRbadpath)); } - p = strrchr(directory,'/'); + p = strrchr_m(directory,'/'); if(p == NULL) { pstrcpy(mask,directory); pstrcpy(directory,"./"); @@ -1383,7 +1383,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn, DEBUG(3,("call_trans2qfilepathinfo %s level=%d call=%d total_data=%d\n", fname,info_level,tran_call,total_data)); - p = strrchr(fname,'/'); + p = strrchr_m(fname,'/'); if (!p) { base_name = fname; } else { diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c index da4c538319..0070781d24 100644 --- a/source3/smbd/uid.c +++ b/source3/smbd/uid.c @@ -288,7 +288,7 @@ BOOL lookup_name(const char *name, DOM_SID *psid, enum SID_NAME_USE *name_type) /* If we are looking up a domain user, make sure it is for the local machine only */ - if (strchr(name, sep[0]) || strchr(name, '\\')) { + if (strchr_m(name, sep[0]) || strchr_m(name, '\\')) { fstring domain, username; split_domain_name(name, domain, username); diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 747d393386..71ebf9b506 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -705,7 +705,7 @@ BOOL reduce_name(connection_struct *conn, char *s,char *dir,BOOL widelinks) all_string_sub(s,"//","/",0); pstrcpy(base_name,s); - p = strrchr(base_name,'/'); + p = strrchr_m(base_name,'/'); if (!p) return(True); -- cgit