strchr and strrchr are macros when compiling with optimisation in gcc, so we can...
authorAndrew Tridgell <tridge@samba.org>
Wed, 4 Jul 2001 07:36:09 +0000 (07:36 +0000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 4 Jul 2001 07:36:09 +0000 (07:36 +0000)
(This used to be commit c41fc06376d1a2b83690612304e85010b5e5f3cf)

78 files changed:
source3/client/client.c
source3/client/clitar.c
source3/client/smbmount.c
source3/client/smbspool.c
source3/include/safe_string.h
source3/lib/access.c
source3/lib/cmd_interp.c
source3/lib/debug.c
source3/lib/interface.c
source3/lib/substitute.c
source3/lib/system.c
source3/lib/username.c
source3/lib/util.c
source3/lib/util_file.c
source3/lib/util_sid.c
source3/lib/util_sock.c
source3/lib/util_str.c
source3/libsmb/cliconnect.c
source3/libsmb/libsmbclient.c
source3/libsmb/namequery.c
source3/libsmb/nmblib.c
source3/msdfs/msdfs.c
source3/nmbd/nmbd.c
source3/nmbd/nmbd_sendannounce.c
source3/nmbd/nmbd_winsserver.c
source3/nsswitch/wb_client.c
source3/nsswitch/wbinfo.c
source3/nsswitch/winbind_nss.c
source3/nsswitch/winbindd.c
source3/nsswitch/winbindd_pam.c
source3/nsswitch/winbindd_util.c
source3/param/loadparm.c
source3/passdb/machine_sid.c
source3/passdb/passdb.c
source3/passdb/pdb_smbpasswd.c
source3/printing/lpq_parse.c
source3/printing/nt_printing.c
source3/printing/pcap.c
source3/printing/print_generic.c
source3/printing/print_svid.c
source3/rpc_client/cli_spoolss.c
source3/rpc_server/srv_dfs_nt.c
source3/rpc_server/srv_samr_nt.c
source3/rpc_server/srv_spoolss_nt.c
source3/rpc_server/srv_util.c
source3/rpcclient/rpcclient.c
source3/smbd/close.c
source3/smbd/dosmode.c
source3/smbd/filename.c
source3/smbd/groupname.c
source3/smbd/lanman.c
source3/smbd/mangle.c
source3/smbd/nttrans.c
source3/smbd/open.c
source3/smbd/quotas.c
source3/smbd/reply.c
source3/smbd/server.c
source3/smbd/service.c
source3/smbd/statcache.c
source3/smbd/trans2.c
source3/smbd/uid.c
source3/smbd/vfs.c
source3/smbwrapper/smbsh.c
source3/smbwrapper/smbw.c
source3/torture/locktest.c
source3/torture/locktest2.c
source3/torture/masktest.c
source3/torture/rpctorture.c
source3/torture/torture.c
source3/utils/make_printerdef.c
source3/utils/nmblookup.c
source3/utils/pdbedit.c
source3/utils/rpccheck.c
source3/utils/smbcacls.c
source3/utils/smbpasswd.c
source3/utils/smbw_sample.c
source3/utils/testparm.c
source3/web/cgi.c

index ccbeb72e812f851f6e1d113fac968f8dfaab7de4..479c4f764f99b0862bb54f7e710e6cd13c3a2fd8 100644 (file)
@@ -479,7 +479,7 @@ static void do_list_helper(file_info *f, const char *mask, void *state)
                        char *p;
 
                        pstrcpy(mask2, mask);
-                       p = strrchr(mask2,'\\');
+                       p = strrchr_m(mask2,'\\');
                        if (!p) return;
                        p[1] = 0;
                        pstrcat(mask2, f->name);
@@ -1354,7 +1354,7 @@ static void cmd_print(void)
        }
 
        pstrcpy(rname,lname);
-       p = strrchr(rname,'/');
+       p = strrchr_m(rname,'/');
        if (p) {
                slprintf(rname, sizeof(rname)-1, "%s-%d", p+1, (int)sys_getpid());
        }
@@ -1813,7 +1813,7 @@ static void process_command_string(char *cmd)
                fstring tok;
                int i;
                
-               if ((p = strchr(cmd, ';')) == 0) {
+               if ((p = strchr_m(cmd, ';')) == 0) {
                        strncpy(line, cmd, 999);
                        line[1000] = '\0';
                        cmd += strlen(cmd);
@@ -1971,7 +1971,7 @@ struct cli_state *do_connect(const char *server, const char *share)
        sharename = servicename;
        if (*sharename == '\\') {
                server = sharename+2;
-               sharename = strchr(server,'\\');
+               sharename = strchr_m(server,'\\');
                if (!sharename) return NULL;
                *sharename = 0;
                sharename++;
@@ -2003,7 +2003,7 @@ struct cli_state *do_connect(const char *server, const char *share)
                         called.name, cli_errstr(c)));
                cli_shutdown(c);
                free(c);
-               if ((p=strchr(called.name, '.'))) {
+               if ((p=strchr_m(called.name, '.'))) {
                        *p = 0;
                        goto again;
                }
@@ -2350,11 +2350,11 @@ static int do_message_op(void)
                /* modification to support userid%passwd syntax in the USER var
                   25.Aug.97, jdblair@uab.edu */
 
-               if ((p=strchr(username,'%'))) {
+               if ((p=strchr_m(username,'%'))) {
                        *p = 0;
                        pstrcpy(password,p+1);
                        got_pass = True;
-                       memset(strchr(getenv("USER"),'%')+1,'X',strlen(password));
+                       memset(strchr_m(getenv("USER"),'%')+1,'X',strlen(password));
                }
                strupper(username);
        }
@@ -2471,11 +2471,11 @@ static int do_message_op(void)
                        {
                                char *lp;
                                pstrcpy(username,optarg);
-                               if ((lp=strchr(username,'%'))) {
+                               if ((lp=strchr_m(username,'%'))) {
                                        *lp = 0;
                                        pstrcpy(password,lp+1);
                                        got_pass = True;
-                                       memset(strchr(optarg,'%')+1,'X',strlen(password));
+                                       memset(strchr_m(optarg,'%')+1,'X',strlen(password));
                                }
                        }
                        break;
@@ -2512,7 +2512,7 @@ static int do_message_op(void)
                                        /* break up the line into parameter & value.
                                           will need to eat a little whitespace possibly */
                                        param = buf;
-                                       if (!(ptr = strchr (buf, '=')))
+                                       if (!(ptr = strchr_m (buf, '=')))
                                                continue;
                                        val = ptr+1;
                                        *ptr = '\0';
@@ -2589,7 +2589,7 @@ static int do_message_op(void)
                return do_tar_op(base_directory);
        }
 
-       if ((p=strchr(query_host,'#'))) {
+       if ((p=strchr_m(query_host,'#'))) {
                *p = 0;
                p++;
                sscanf(p, "%x", &name_type);
index 8f935da4e05c7f96df2d1311bc69bc2b70eff61a..d28e652b35e974230deadc963853e44ee4f8d627 100644 (file)
@@ -533,7 +533,7 @@ static BOOL ensurepath(char *fname)
   safe_strcpy(ffname, fname, strlen(fname));
 
   /* do a `basename' on ffname, so don't try and make file name directory */
-  if ((basehack=strrchr(ffname, '\\')) == NULL)
+  if ((basehack=strrchr_m(ffname, '\\')) == NULL)
     return True;
   else
     *basehack='\0';
@@ -1451,7 +1451,7 @@ int process_tar(void)
          *(cliplist[i]+strlen(cliplist[i])-1)='\0';
        }
        
-       if (strrchr(cliplist[i], '\\')) {
+       if (strrchr_m(cliplist[i], '\\')) {
          pstring saved_dir;
          
          safe_strcpy(saved_dir, cur_dir, sizeof(pstring));
@@ -1463,7 +1463,7 @@ int process_tar(void)
            safe_strcat(tarmac, cliplist[i], sizeof(pstring));
          }
          safe_strcpy(cur_dir, tarmac, sizeof(pstring));
-         *(strrchr(cur_dir, '\\')+1)='\0';
+         *(strrchr_m(cur_dir, '\\')+1)='\0';
 
          DEBUG(5, ("process_tar, do_list with tarmac: %s\n", tarmac));
          do_list(tarmac,attribute,do_tar, False, True);
@@ -1514,13 +1514,13 @@ static int clipfind(char **aret, int ret, char *tok)
   if (aret==NULL) return 0;
 
   /* ignore leading slashes or dots in token */
-  while(strchr("/\\.", *tok)) tok++;
+  while(strchr_m("/\\.", *tok)) tok++;
 
   while(ret--) {
     char *pkey=*aret++;
 
     /* ignore leading slashes or dots in list */
-    while(strchr("/\\.", *pkey)) pkey++;
+    while(strchr_m("/\\.", *pkey)) pkey++;
 
     if (!strslashcmp(pkey, tok)) return 1;
   }
@@ -1604,7 +1604,7 @@ static int read_inclusion_file(char *filename)
        } else {
          unfixtarname(tmpstr, p, strlen(p) + 1, True);
          cliplist[i] = tmpstr;
-         if ((p = strchr(p, '\000')) == NULL) {
+         if ((p = strchr_m(p, '\000')) == NULL) {
            DEBUG(0,("INTERNAL ERROR: inclusion_buffer is of unexpected contents.\n"));
            abort();
          }
index 076be0ccb8609a2e0e417f98551b04744f843104..d0c18e6134bbcc7377fdb6a5d035c521751a2541 100644 (file)
@@ -130,7 +130,7 @@ static struct cli_state *do_connection(char *service)
        }
 
        pstrcpy(server, service+2);
-       share = strchr(server,'\\');
+       share = strchr_m(server,'\\');
        if (!share) {
                usage();
                exit(1);
@@ -164,7 +164,7 @@ static struct cli_state *do_connection(char *service)
                         getpid(), called.name, cli_errstr(c)));
                cli_shutdown(c);
                free(c);
-               if ((p=strchr(called.name, '.'))) {
+               if ((p=strchr_m(called.name, '.'))) {
                        *p = 0;
                        goto again;
                }
@@ -715,7 +715,7 @@ static void parse_mount_smb(int argc, char **argv)
         */
         for (opts = strtok(optarg, ","); opts; opts = strtok(NULL, ",")) {
                DEBUG(3, ("opts: %s\n", opts));
-                if ((opteq = strchr(opts, '='))) {
+                if ((opteq = strchr_m(opts, '='))) {
                         val = atoi(opteq + 1);
                         *opteq = '\0';
 
@@ -723,13 +723,13 @@ static void parse_mount_smb(int argc, char **argv)
                            !strcmp(opts, "logon")) {
                                char *lp;
                                pstrcpy(username,opteq+1);
-                               if ((lp=strchr(username,'%'))) {
+                               if ((lp=strchr_m(username,'%'))) {
                                        *lp = 0;
                                        pstrcpy(password,lp+1);
                                        got_pass = True;
-                                       memset(strchr(opteq+1,'%')+1,'X',strlen(password));
+                                       memset(strchr_m(opteq+1,'%')+1,'X',strlen(password));
                                }
-                               if ((lp=strchr(username,'/'))) {
+                               if ((lp=strchr_m(username,'/'))) {
                                        *lp = 0;
                                        pstrcpy(workgroup,lp+1);
                                }
@@ -824,11 +824,11 @@ static void parse_mount_smb(int argc, char **argv)
        if (getenv("USER")) {
                pstrcpy(username,getenv("USER"));
 
-               if ((p=strchr(username,'%'))) {
+               if ((p=strchr_m(username,'%'))) {
                        *p = 0;
                        pstrcpy(password,p+1);
                        got_pass = True;
-                       memset(strchr(getenv("USER"),'%')+1,'X',strlen(password));
+                       memset(strchr_m(getenv("USER"),'%')+1,'X',strlen(password));
                }
                strupper(username);
        }
index 1c85de11dd70bdd89aa8b888fee358bd327213ea..0c21399e967ff23ca96646ab4528ace464ea9bf4 100644 (file)
@@ -134,7 +134,7 @@ static int          smb_print(struct cli_state *, char *, FILE *);
   * Extract the destination from the URI...
   */
 
-  if ((sep = strrchr(uri, '@')) != NULL)
+  if ((sep = strrchr_m(uri, '@')) != NULL)
   {
     username = uri + 6;
     *sep++ = '\0';
@@ -145,7 +145,7 @@ static int          smb_print(struct cli_state *, char *, FILE *);
     * Extract password as needed...
     */
 
-    if ((password = strchr(username, ':')) != NULL)
+    if ((password = strchr_m(username, ':')) != NULL)
       *password++ = '\0';
     else
       password = "";
@@ -157,7 +157,7 @@ static int          smb_print(struct cli_state *, char *, FILE *);
     server   = uri + 6;
   }
 
-  if ((sep = strchr(server, '/')) == NULL)
+  if ((sep = strchr_m(server, '/')) == NULL)
   {
     fputs("ERROR: Bad URI - need printer name!\n", stderr);
     return (1);
@@ -166,7 +166,7 @@ static int          smb_print(struct cli_state *, char *, FILE *);
   *sep++ = '\0';
   printer = sep;
 
-  if ((sep = strchr(printer, '/')) != NULL)
+  if ((sep = strchr_m(printer, '/')) != NULL)
   {
    /*
     * Convert to smb://[username:password@]workgroup/server/printer...
index 3e379c48dfb498f97d9593867cc5426bebd903fe..e609381a898ca4ecb2b02a84de37b82874a3fc48 100644 (file)
 #define wfstrcpy(d,s) safe_strcpy_w((d),(s),sizeof(wfstring))
 #define wfstrcat(d,s) safe_strcat_w((d),(s),sizeof(wfstring))
 
-/* replace some standard C library string functions with multi-byte
+/* replace some string functions with multi-byte
    versions */
-#define strchr(s, c) strchr_m(s, c)
-#define strrchr(s, c) strrchr_m(s, c)
 #define strlower(s) strlower_m(s)
 #define strupper(s) strupper_m(s)
 
index c32b0b7c6c0c273b8edfe074e4dae935ddad6ff2..99f3cc49b519681230b477d7b0ac8537abea41fb 100644 (file)
@@ -97,19 +97,19 @@ static int string_match(char *tok,char *s, char *invalid_char)
        } else if (strcasecmp(tok, "FAIL") == 0) {      /* fail: match any */
                return (FAIL);
        } else if (strcasecmp(tok, "LOCAL") == 0) {     /* local: no dots */
-               if (strchr(s, '.') == 0 && strcasecmp(s, "unknown") != 0)
+               if (strchr_m(s, '.') == 0 && strcasecmp(s, "unknown") != 0)
                        return (True);
        } else if (!strcasecmp(tok, s)) {   /* match host name or address */
                return (True);
        } else if (tok[(tok_len = strlen(tok)) - 1] == '.') {   /* network */
                if (strncmp(tok, s, tok_len) == 0)
                        return (True);
-       } else if ((cut = strchr(tok, '/')) != 0) {     /* netnumber/netmask */
+       } else if ((cut = strchr_m(tok, '/')) != 0) {   /* netnumber/netmask */
                if (isdigit((int)s[0]) && masked_match(tok, cut, s))
                        return (True);
-       } else if (strchr(tok, '*') != 0) {
+       } else if (strchr_m(tok, '*') != 0) {
                *invalid_char = '*';
-       } else if (strchr(tok, '?') != 0) {
+       } else if (strchr_m(tok, '?') != 0) {
                *invalid_char = '?';
        }
        return (False);
@@ -252,7 +252,7 @@ static BOOL only_ipaddrs_in_list(char** list)
                         * was a network/netmask pair.  Only network/netmask pairs
                         * have a '/' in them
                         */
-                       if ((p=strchr(*list, '/')) == NULL)
+                       if ((p=strchr_m(*list, '/')) == NULL)
                        {
                                only_ip = False;
                                DEBUG(3,("only_ipaddrs_in_list: list has non-ip address (%s)\n", *list));
index ef6f94bd4962316451ef51c654132c8e89d90be4..292f0e9e9ec431d62c1b9ff335e206883ad72efb 100644 (file)
@@ -365,7 +365,7 @@ static uint32 process(struct client_info *info, char *cmd_str)
                {
                        char *p;
 
-                       if ((p = strchr(cmd, ';')) == 0)
+                       if ((p = strchr_m(cmd, ';')) == 0)
                        {
                                strncpy(line, cmd, 999);
                                line[1000] = '\0';
@@ -702,11 +702,11 @@ static uint32 cmd_use(struct client_info *info, int argc, char *argv[])
                        {
                                char *lp;
                                pstrcpy(usr.ntc.user_name, optarg);
-                               if ((lp = strchr(usr.ntc.user_name, '%')))
+                               if ((lp = strchr_m(usr.ntc.user_name, '%')))
                                {
                                        *lp = 0;
                                        pstrcpy(password, lp + 1);
-                                       memset(strchr(optarg, '%') + 1, 'X',
+                                       memset(strchr_m(optarg, '%') + 1, 'X',
                                               strlen(password));
                                        got_pwd = True;
                                }
@@ -1012,7 +1012,7 @@ static uint32 cmd_set(CLIENT_INFO *info, int argc, char *argv[])
                                char *lp;
                                cmd_set_options |= CMD_USER;
                                pstrcpy(usr.ntc.user_name, optarg);
-                               if ((lp = strchr(usr.ntc.user_name, '%')))
+                               if ((lp = strchr_m(usr.ntc.user_name, '%')))
                                {
                                        *lp = 0;
                                        pstrcpy(password, lp + 1);
@@ -1241,11 +1241,11 @@ static void read_user_env(struct ntuser_creds *u)
                /* modification to support userid%passwd syntax in the USER var
                   25.Aug.97, jdblair@uab.edu */
 
-               if ((p = strchr(u->user_name, '%')))
+               if ((p = strchr_m(u->user_name, '%')))
                {
                        *p = 0;
                        pstrcpy(password, p + 1);
-                       memset(strchr(getenv("USER"), '%') + 1, 'X',
+                       memset(strchr_m(getenv("USER"), '%') + 1, 'X',
                               strlen(password));
                }
        }
index 06092c6a35663c7a5dc3c9f21c3e5e488fed7519..27d5e55dc0f10be82b070bb199fdcb18e4c30fae 100644 (file)
@@ -312,7 +312,7 @@ void setup_logging(char *pname, BOOL interactive)
        }
 #ifdef WITH_SYSLOG
        else {
-               char *p = strrchr( pname,'/' );
+               char *p = strrchr_m( pname,'/' );
                if (p)
                        pname = p + 1;
 #ifdef LOG_DAEMON
index e16afa45af06520350f36d951133f96ffa458689..269e0fa85be56d66584c37d12fadfa5f1cbcbf77 100644 (file)
@@ -120,7 +120,7 @@ static void interpret_interface(char *token)
        if (added) return;
 
        /* maybe it is a DNS name */
-       p = strchr(token,'/');
+       p = strchr_m(token,'/');
        if (!p) {
                ip = *interpret_addr2(token);
                for (i=0;i<total_probed;i++) {
index 25be4b030f714d0790e0712d56628e396be054f8..7f597d37f2050e4c51f6ecc4a180b7c7ea2166ae 100644 (file)
@@ -56,7 +56,7 @@ static size_t expand_env_var(char *p, int len)
         * Look for the terminating ')'.
         */
 
-       if ((q = strchr(p,')')) == NULL) {
+       if ((q = strchr_m(p,')')) == NULL) {
                DEBUG(0,("expand_env_var: Unterminated environment variable [%s]\n", p));
                return 2;
        }
@@ -107,7 +107,7 @@ static char *automount_path(char *user_name)
                char *automount_value = automount_lookup(user_name);
 
                if(strlen(automount_value) > 0) {
-                       home_path_start = strchr(automount_value,':');
+                       home_path_start = strchr_m(automount_value,':');
                        if (home_path_start != NULL) {
                                DEBUG(5, ("NIS lookup succeeded.  Home path is: %s\n",
                                                home_path_start?(home_path_start+1):""));
@@ -171,7 +171,7 @@ void standard_sub_basic(char *str)
        char *p, *s;
        fstring pidstr;
 
-       for (s=str; (p=strchr(s, '%'));s=p) {
+       for (s=str; (p=strchr_m(s, '%'));s=p) {
                fstring tmp_str;
 
                int l = sizeof(pstring) - (int)(p-str);
@@ -220,7 +220,7 @@ void standard_sub_advanced(int snum, char *user, char *connectpath, gid_t gid, c
        char *p, *s, *home;
        struct passwd *pass;
 
-       for (s=str; (p=strchr(s, '%'));s=p) {
+       for (s=str; (p=strchr_m(s, '%'));s=p) {
                int l = sizeof(pstring) - (int)(p-str);
                
                switch (*(p+1)) {
index 8d4a872f14b3c7956e669d16fb4ebe3770383dc9..0799a855e81be5fbd2bc1460f6810c310892bfa6 100644 (file)
@@ -340,7 +340,7 @@ struct hostent *sys_gethostbyname(const char *name)
 
   /* Does this name have any dots in it? If so, make no change */
 
-  if (strchr(name, '.'))
+  if (strchr_m(name, '.'))
     return(gethostbyname(name));
 
   /* Get my hostname, which should have domain name 
@@ -350,7 +350,7 @@ struct hostent *sys_gethostbyname(const char *name)
 
   gethostname(hostname, sizeof(hostname) - 1);
   hostname[sizeof(hostname) - 1] = 0;
-  if ((domain = strchr(hostname, '.')) == NULL)
+  if ((domain = strchr_m(hostname, '.')) == NULL)
     return(gethostbyname(name));
 
   /* Attach domain name to query and do modified query.
index 3c99fc33d5607f34c6bcee36df039a631bc9ce29..403a855f1a762e74bfbac472d3bd6dea753a4e8c 100644 (file)
@@ -92,7 +92,7 @@ BOOL map_username(char *user)
 
   while((s=fgets_slash(buf,sizeof(buf),f))!=NULL) {
     char *unixname = s;
-    char *dosname = strchr(unixname,'=');
+    char *dosname = strchr_m(unixname,'=');
     BOOL return_if_mapped = False;
 
     if (!dosname)
@@ -109,7 +109,7 @@ BOOL map_username(char *user)
         unixname++;
     }
     
-    if (!*unixname || strchr("#;",*unixname))
+    if (!*unixname || strchr_m("#;",*unixname))
       continue;
 
     {
@@ -120,7 +120,7 @@ BOOL map_username(char *user)
       }
     }
 
-    if (strchr(dosname,'*') || user_in_list(user,dosname)) {
+    if (strchr_m(dosname,'*') || user_in_list(user,dosname)) {
       DEBUG(3,("Mapped user %s to %s\n",user,unixname));
       mapped_user = True;
       fstrcpy(last_from,user);
@@ -529,7 +529,7 @@ struct passwd *smb_getpwnam(char *user, BOOL allow_change)
           lookup just the username portion locally */
        sep = lp_winbind_separator();
        if (!sep || !*sep) sep = "\\";
-       p = strchr(user,*sep);
+       p = strchr_m(user,*sep);
        if (p && 
            strncasecmp(global_myname, user, strlen(global_myname))==0) {
                return Get_Pwnam(p+1, allow_change);
index a8ef69e5593d4bd65c484875c5f8041039f3edcb..d220b2c5315f67ab92e97e89916aa76520a95d41 100644 (file)
@@ -140,7 +140,7 @@ char *Atoic(char *p, int *n, char *c)
                p++;
        }
 
-       if (strchr(c, *p) == NULL)
+       if (strchr_m(c, *p) == NULL)
        {
                DEBUG(5, ("Atoic: no separator characters (%s) not found\n", c));
                return NULL;
@@ -366,7 +366,7 @@ void dos_clean_name(char *s)
       *p = 0;
       pstrcpy(s1,p+3);
 
-      if ((p=strrchr(s,'\\')) != NULL)
+      if ((p=strrchr_m(s,'\\')) != NULL)
        *p = 0;
       else
        *s = 0;
@@ -404,7 +404,7 @@ void unix_clean_name(char *s)
       *p = 0;
       pstrcpy(s1,p+3);
 
-      if ((p=strrchr(s,'/')) != NULL)
+      if ((p=strrchr_m(s,'/')) != NULL)
        *p = 0;
       else
        *s = 0;
@@ -428,7 +428,7 @@ void make_dir_struct(char *buf,char *mask,char *fname,SMB_OFF_T size,int mode,ti
     size = 0;
 
   memset(buf+1,' ',11);
-  if ((p = strchr(mask2,'.')) != NULL)
+  if ((p = strchr_m(mask2,'.')) != NULL)
     {
       *p = 0;
       memcpy(buf+1,mask2,MIN(strlen(mask2),8));
@@ -720,7 +720,7 @@ BOOL get_myname(char *my_name)
 
        if (my_name) {
                /* split off any parts after an initial . */
-               char *p = strchr(hostname,'.');
+               char *p = strchr_m(hostname,'.');
                if (p) *p = 0;
                
                fstrcpy(my_name,hostname);
@@ -766,7 +766,7 @@ BOOL is_ipaddress(const char *str)
       pure_address = False;
 
   /* Check that a pure number is not misinterpreted as an IP */
-  pure_address = pure_address && (strchr(str, '.') != NULL);
+  pure_address = pure_address && (strchr_m(str, '.') != NULL);
 
   return pure_address;
 }
@@ -1144,7 +1144,7 @@ BOOL is_in_path(char *name, name_compare_entry *namelist)
   }
 
   /* Get the last component of the unix name. */
-  p = strrchr(name, '/');
+  p = strrchr_m(name, '/');
   strncpy(last_component, p ? ++p : name, sizeof(last_component)-1);
   last_component[sizeof(last_component)-1] = '\0'; 
 
@@ -1211,7 +1211,7 @@ void set_namearray(name_compare_entry **ppname_array, char *namelist)
           continue;
         }
       /* find the next / */
-      name_end = strchr(nameptr, '/');
+      name_end = strchr_m(nameptr, '/');
 
       /* oops - the last check for a / didn't find one. */
       if (name_end == NULL)
@@ -1244,7 +1244,7 @@ void set_namearray(name_compare_entry **ppname_array, char *namelist)
           continue;
       }
       /* find the next / */
-      if ((name_end = strchr(nameptr, '/')) != NULL) 
+      if ((name_end = strchr_m(nameptr, '/')) != NULL) 
       {
           *name_end = 0;
          }
@@ -1741,7 +1741,7 @@ char *parent_dirname(const char *path)
                return(NULL);
 
        pstrcpy(dirpath, path);
-       p = strrchr(dirpath, '/');  /* Find final '/', if any */
+       p = strrchr_m(dirpath, '/');  /* Find final '/', if any */
        if (!p) {
                pstrcpy(dirpath, ".");    /* No final "/", so dir is "." */
        } else {
index 7dc25a8dae26268f6ffbbf0e8413951684cd1871..01a8b1c3334e999f3b17aa7bebdab852d7ab9ddf 100644 (file)
@@ -255,7 +255,7 @@ int getfileline(void *vp, char *linebuf, int linebuf_size)
                        continue;
                }
 
-               p = (unsigned char *) strchr(linebuf, ':');
+               p = (unsigned char *) strchr_m(linebuf, ':');
                if (p == NULL)
                {
                        DEBUG(0, ("getfileline: malformed line entry (no :)\n"));
index 70341507cb7f86e76a58f0d84f5181e6281dfb22..c89c7c70d97c52f2dac567bbc5b9f539e6eafe63 100644 (file)
@@ -318,8 +318,8 @@ void split_domain_name(const char *fullname, char *domain, char *name)
                fullname++;
 
        pstrcpy(full_name, fullname);
-       p = strchr(full_name+1, '\\');
-       if (!p) p = strchr(full_name+1, sep[0]);
+       p = strchr_m(full_name+1, '\\');
+       if (!p) p = strchr_m(full_name+1, sep[0]);
 
        if (p != NULL) {
                *p = 0;
index 01cff85f653440e7489332bace465fd73a3a572a..a55ef1a92e80ad09d6c9442b5146adde38d15411 100644 (file)
@@ -127,7 +127,7 @@ void set_socket_options(int fd, char *options)
                char *p;
                BOOL got_value = False;
 
-               if ((p = strchr(tok,'='))) {
+               if ((p = strchr_m(tok,'='))) {
                        *p = 0;
                        value = atoi(p+1);
                        got_value = True;
index 8ff3e23443afbe1576d31e99b9e14c55b604e92c..736229c75f8f111d2ecede4f97ab376adbd8aed0 100644 (file)
@@ -43,13 +43,13 @@ BOOL next_token(char **ptr,char *buff,char *sep, size_t bufsize)
        if (!sep) sep = " \t\n\r";
 
        /* find the first non sep char */
-       while (*s && strchr(sep,*s)) s++;
+       while (*s && strchr_m(sep,*s)) s++;
        
        /* nothing left? */
        if (! *s) return(False);
        
        /* copy over the token */
-       for (quoted = False; len < bufsize && *s && (quoted || !strchr(sep,*s)); s++) {
+       for (quoted = False; len < bufsize && *s && (quoted || !strchr_m(sep,*s)); s++) {
                if (*s == '\"') {
                        quoted = !quoted;
                } else {
@@ -103,15 +103,15 @@ char **toktocliplist(int *ctok, char *sep)
 
        if (!sep) sep = " \t\n\r";
 
-       while(*s && strchr(sep,*s)) s++;
+       while(*s && strchr_m(sep,*s)) s++;
 
        /* nothing left? */
        if (!*s) return(NULL);
 
        do {
                ictok++;
-               while(*s && (!strchr(sep,*s))) s++;
-               while(*s && strchr(sep,*s)) *s++=0;
+               while(*s && (!strchr_m(sep,*s))) s++;
+               while(*s && strchr_m(sep,*s)) *s++=0;
        } while(*s);
        
        *ctok=ictok;
@@ -461,7 +461,7 @@ char *alpha_strcpy(char *dest, const char *src, const char *other_safe_chars, si
 
        for(i = 0; i < len; i++) {
                int val = (src[i] & 0xff);
-               if(isupper(val) || islower(val) || isdigit(val) || strchr(other_safe_chars, val))
+               if(isupper(val) || islower(val) || isdigit(val) || strchr_m(other_safe_chars, val))
                        dest[i] = src[i];
                else
                        dest[i] = '_';
@@ -499,7 +499,7 @@ char *strncpyn(char *dest, const char *src,size_t n, char c)
        char *p;
        size_t str_len;
 
-       p = strchr(src, c);
+       p = strchr_m(src, c);
        if (p == NULL)
        {
                DEBUG(5, ("strncpyn: separator character (%c) not found\n", c));
@@ -539,14 +539,14 @@ size_t strhex_to_str(char *p, size_t len, const char *strhex)
                        continue;
                }
 
-               if (!(p1 = strchr(hexchars, toupper(strhex[i]))))
+               if (!(p1 = strchr_m(hexchars, toupper(strhex[i]))))
                {
                        break;
                }
 
                i++; /* next hex digit */
 
-               if (!(p2 = strchr(hexchars, toupper(strhex[i]))))
+               if (!(p2 = strchr_m(hexchars, toupper(strhex[i]))))
                {
                        break;
                }
@@ -751,7 +751,7 @@ void all_string_sub(char *s,const char *pattern,const char *insert, size_t len)
 ****************************************************************************/
 void split_at_last_component(char *path, char *front, char sep, char *back)
 {
-       char *p = strrchr(path, sep);
+       char *p = strrchr_m(path, sep);
 
        if (p != NULL)
        {
@@ -806,7 +806,7 @@ char *string_truncate(char *s, int length)
 
 
 /****************************************************************************
-strchr and strrchr are very hard to do on general multi-byte strings. 
+strchr and strrchr_m are very hard to do on general multi-byte strings. 
 we convert via ucs2 for now
 ****************************************************************************/
 char *strchr_m(const char *s, char c)
index 7ec0627682753cd118a1690420953902fa3feb74..9511a56e31cc845a29d75bd5d814a60418df57d4 100644 (file)
@@ -60,7 +60,7 @@ BOOL cli_session_setup(struct cli_state *cli,
 
        /* allow for workgroups as part of the username */
        fstrcpy(user2, user);
-       if ((p=strchr(user2,'\\')) || (p=strchr(user2,'/'))) {
+       if ((p=strchr_m(user2,'\\')) || (p=strchr_m(user2,'/'))) {
                *p = 0;
                user = p+1;
                workgroup = user2;
index 10444a8ab9bd4db1dbe0fca602e650d20de419ab..b9441746651caa9a6768c35260040e5220bd5d4e 100644 (file)
@@ -133,7 +133,7 @@ smbc_parse_path(const char *fname, char *server, char *share, char *path,
    * exists ...
    */
 
-  if (strchr(p, '@')) { 
+  if (strchr_m(p, '@')) { 
     pstring username, passwd, domain;
     char *u = userinfo;
 
@@ -141,13 +141,13 @@ smbc_parse_path(const char *fname, char *server, char *share, char *path,
 
     username[0] = passwd[0] = domain[0] = 0;
 
-    if (strchr(u, ';')) {
+    if (strchr_m(u, ';')) {
       
       next_token(&u, domain, ";", sizeof(fstring));
 
     }
 
-    if (strchr(u, ':')) {
+    if (strchr_m(u, ':')) {
 
       next_token(&u, username, ":", sizeof(fstring));
 
@@ -276,11 +276,11 @@ struct smbc_server *smbc_server(char *server, char *share,
 
   DEBUG(4,("smbc_server: server_n=[%s] server=[%s]\n", server_n, server));
   
-  if ((p=strchr(server_n,'#')) && 
+  if ((p=strchr_m(server_n,'#')) && 
       (strcmp(p+1,"1D")==0 || strcmp(p+1,"01")==0)) {
     
     fstrcpy(group, server_n);
-    p = strchr(group,'#');
+    p = strchr_m(group,'#');
     *p = 0;
                
   }
index 18bf6f4804e3f3ca06a0d46fd171468fb1bd7d06..c5c4d92c092d70d0a9803908778dec5168605591 100644 (file)
@@ -503,7 +503,7 @@ BOOL getlmhostsent( FILE *fp, pstring name, int *name_type, struct in_addr *ipad
 
     DEBUG(4, ("getlmhostsent: lmhost entry: %s %s %s\n", ip, name, flags));
 
-    if (strchr(flags,'G') || strchr(flags,'S'))
+    if (strchr_m(flags,'G') || strchr_m(flags,'S'))
     {
       DEBUG(0,("getlmhostsent: group flag in lmhosts ignored (obsolete)\n"));
       continue;
@@ -513,7 +513,7 @@ BOOL getlmhostsent( FILE *fp, pstring name, int *name_type, struct in_addr *ipad
 
     /* Extra feature. If the name ends in '#XX', where XX is a hex number,
        then only add that name type. */
-    if((ptr = strchr(name, '#')) != NULL)
+    if((ptr = strchr_m(name, '#')) != NULL)
     {
       char *endptr;
 
index d3b0e68aef88f6ba5c01aa2dcdb77b04ed5fd849..9d7167f30541eaa6ee28823f1e0b7c6c81038c37 100644 (file)
@@ -300,7 +300,7 @@ static int put_nmb_name(char *buf,int offset,struct nmb_name *name)
     pstrcpy(&buf[offset+1],name->scope);  
   
     p = &buf[offset+1];
-    while ((p = strchr(p,'.'))) {
+    while ((p = strchr_m(p,'.'))) {
       buf[offset] = PTR_DIFF(p,&buf[offset+1]);
       offset += (buf[offset] + 1);
       p = &buf[offset+1];
index 92f6f1910daec3c875a477838c4d9875fc360b2d..2890b05b521ad93a86e6783151d80da2769840f2 100644 (file)
@@ -58,7 +58,7 @@ static BOOL parse_dfs_path(char* pathname, struct dfs_path* pdp)
 
        /* now tokenize */
        /* parse out hostname */
-       p = strchr(temp,'\\');
+       p = strchr_m(temp,'\\');
        if(p == NULL)
                return False;
        *p = '\0';
@@ -67,7 +67,7 @@ static BOOL parse_dfs_path(char* pathname, struct dfs_path* pdp)
 
        /* parse out servicename */
        temp = p+1;
-       p = strchr(temp,'\\');
+       p = strchr_m(temp,'\\');
        if(p == NULL) {
                pstrcpy(pdp->servicename,temp);
                return True;
@@ -78,7 +78,7 @@ static BOOL parse_dfs_path(char* pathname, struct dfs_path* pdp)
 
        /* parse out volumename */
        temp = p+1;
-       p = strchr(temp,'\\');
+       p = strchr_m(temp,'\\');
        if(p == NULL) {
                pstrcpy(pdp->volumename,temp);
                return True;
@@ -202,7 +202,7 @@ static BOOL parse_symlink(char* buf,struct referral** preflist, int* refcount)
   
        for(i=0;i<count;i++) {
                /* replace / in the alternate path by a \ */
-               char* p = strchr(alt_path[i],'/');
+               char* p = strchr_m(alt_path[i],'/');
                if(p)
                        *p = '\\'; 
 
index ca9d04d7681c21425559e42201a9b9bf578679a1..8b771bc4524bf490346bcbb31d37ef68b2c3715b 100644 (file)
@@ -111,7 +111,7 @@ static BOOL dump_core(void)
   char *p;
   pstring dname;
   pstrcpy( dname, debugf );
-  if ((p=strrchr(dname,'/')))
+  if ((p=strrchr_m(dname,'/')))
     *p=0;
   pstrcat( dname, "/corefiles" );
   mkdir( dname, 0700 );
@@ -558,7 +558,7 @@ static BOOL init_structs(void)
   if (! *global_myname)
   {
     fstrcpy( global_myname, myhostname() );
-    p = strchr( global_myname, '.' );
+    p = strchr_m( global_myname, '.' );
     if (p)
       *p = 0;
   }
@@ -622,7 +622,7 @@ static BOOL init_structs(void)
   
   fstrcpy( local_machine, global_myname );
   trim_string( local_machine, " ", " " );
-  p = strchr( local_machine, ' ' );
+  p = strchr_m( local_machine, ' ' );
   if (p)
     *p = 0;
   strlower( local_machine );
index eb5839253b042de522f116ebe5f03b1b42997a12..32a6d339dedcdb0fbf9f37a079996195460d2dc9 100644 (file)
@@ -510,7 +510,7 @@ void announce_remote(time_t t)
     char *wgroup;
     int i;
 
-    wgroup = strchr(s2,'/');
+    wgroup = strchr_m(s2,'/');
     if (wgroup)
       *wgroup++ = 0;
     if (!wgroup || !*wgroup)
index 296102fd99c0892d15ad3aa3b85672ff9de308c5..0ba1aef0574d2c647ee39c530fd376fdb789f3a0 100644 (file)
@@ -43,7 +43,7 @@ static void wins_hook(char *operation, struct name_record *namerec, int ttl)
        if (!cmd || !*cmd) return;
 
        for (p=namerec->name.name; *p; p++) {
-               if (!(isalnum((int)*p) || strchr("._-",*p))) {
+               if (!(isalnum((int)*p) || strchr_m("._-",*p))) {
                        DEBUG(3,("not calling wins hook for invalid name %s\n", nmb_namestr(&namerec->name)));
                        return;
                }
@@ -255,7 +255,7 @@ BOOL initialise_wins(void)
       got_token = next_token(&ptr,ip_str,NULL,sizeof(ip_str));
       was_ip = False;
 
-      if(got_token && strchr(ip_str, '.'))
+      if(got_token && strchr_m(ip_str, '.'))
       {
         num_ips++;
         was_ip = True;
@@ -310,7 +310,7 @@ BOOL initialise_wins(void)
     /* Netbios name. # divides the name from the type (hex): netbios#xx */
     pstrcpy(name,name_str);
       
-    if((p = strchr(name,'#')) != NULL)
+    if((p = strchr_m(name,'#')) != NULL)
     {
       *p = 0;
       sscanf(p+1,"%x",&type);
@@ -1630,7 +1630,7 @@ void wins_write_database(BOOL background)
 
       tm = LocalTime(&namerec->data.death_time);
       ts = asctime(tm);
-      nl = strrchr( ts, '\n' );
+      nl = strrchr_m( ts, '\n' );
       if( NULL != nl )
         *nl = '\0';
       DEBUGADD(4,("TTL = %s  ", ts ));
index 2a29773b9ec497871974d7949f34bfbdfe2b06f4..05c68d240c80dc13cc4f209322ca6903149e1c6c 100644 (file)
@@ -36,8 +36,8 @@ static void parse_domain_user(char *domuser, fstring domain, fstring user)
         char *p;
         char *sep = lp_winbind_separator();
         if (!sep) sep = "\\";
-        p = strchr(domuser,*sep);
-        if (!p) p = strchr(domuser,'\\');
+        p = strchr_m(domuser,*sep);
+        if (!p) p = strchr_m(domuser,'\\');
         if (!p) {
                 fstrcpy(domain,"");
                 fstrcpy(user, domuser);
@@ -286,7 +286,7 @@ int winbind_initgroups(char *user, gid_t gid)
 
        sep = lp_winbind_separator();
 
-       if (!strchr(user, *sep)) {
+       if (!strchr_m(user, *sep)) {
                return initgroups(user, gid);
        }
 
index 9d3568417f44e7c1c3e89ef6971083e0ff33d0ba..5ffd58b183c70bb8572be8d83cf081ed137f9c6e 100644 (file)
@@ -349,7 +349,7 @@ int main(int argc, char **argv)
                char *p;
 
                fstrcpy(global_myname, myhostname());
-               p = strchr(global_myname, '.');
+               p = strchr_m(global_myname, '.');
                if (p) {
                        *p = 0;
                }
index a2816bfdd3f59f04d5bd6fd0ae3667ab8f29b911..cbbc30b75c10c3985c82beea4b3882ea235970c8 100644 (file)
@@ -87,13 +87,13 @@ BOOL next_token(char **ptr,char *buff,char *sep, size_t bufsize)
        if (!sep) sep = " \t\n\r";
 
        /* find the first non sep char */
-       while (*s && strchr(sep,*s)) s++;
+       while (*s && strchr_m(sep,*s)) s++;
        
        /* nothing left? */
        if (! *s) return(False);
        
        /* copy over the token */
-       for (quoted = False; len < bufsize && *s && (quoted || !strchr(sep,*s)); s++) {
+       for (quoted = False; len < bufsize && *s && (quoted || !strchr_m(sep,*s)); s++) {
                if (*s == '\"') {
                        quoted = !quoted;
                } else {
index 4177d0219a5b6a44e1d8fb812dfdb6124d0e141b..9371078a79dd8baf242664932ee8f0f112ba2d30 100644 (file)
@@ -693,7 +693,7 @@ int main(int argc, char **argv)
                char *p;
 
                fstrcpy(global_myname, myhostname());
-               p = strchr(global_myname, '.');
+               p = strchr_m(global_myname, '.');
                if (p) {
                        *p = 0;
                }
index 0cbc3166c8c4d6c126885faefd21d1b38e241d8f..e69268fe2ab79a34ca14b18b5b84bcae69b5a8fb 100644 (file)
@@ -31,8 +31,8 @@ static void parse_domain_user(char *domuser, fstring domain, fstring user)
         char *p;
         char *sep = lp_winbind_separator();
         if (!sep) sep = "\\";
-        p = strchr(domuser,*sep);
-        if (!p) p = strchr(domuser,'\\');
+        p = strchr_m(domuser,*sep);
+        if (!p) p = strchr_m(domuser,'\\');
         if (!p) {
                 fstrcpy(domain,"");
                 fstrcpy(user, domuser);
index 4c7071d06338b70e4921d5d0007a9315be59d04a..39a2f78d5c452b656a56523218573fc44e8e8d99 100644 (file)
@@ -909,8 +909,8 @@ void parse_domain_user(char *domuser, fstring domain, fstring user)
        char *p;
        char *sep = lp_winbind_separator();
        if (!sep) sep = "\\";
-       p = strchr(domuser,*sep);
-       if (!p) p = strchr(domuser,'\\');
+       p = strchr_m(domuser,*sep);
+       if (!p) p = strchr_m(domuser,'\\');
        if (!p) {
                fstrcpy(domain,"");
                fstrcpy(user, domuser);
index 4b89387abf02ec98de7d712fe96cc5410ca99bed..da25d526a18adce3e62e4583193f6cb64f7f4bfd 100644 (file)
@@ -2211,7 +2211,7 @@ static BOOL source_env(char **lines)
                strncpy(varval, line, len);
                varval[len] = '\0';
 
-               p = strchr(line, (int)'=');
+               p = strchr_m(line, (int)'=');
                if (p == NULL)
                {
                        DEBUG(4, ("source_env: missing '=': %s\n", line));
@@ -3486,7 +3486,7 @@ int lp_major_announce_version(void)
        if ((vers = lp_announce_version()) == NULL)
                return major_version;
 
-       if ((p = strchr(vers, '.')) == 0)
+       if ((p = strchr_m(vers, '.')) == 0)
                return major_version;
 
        *p = '\0';
@@ -3508,7 +3508,7 @@ int lp_minor_announce_version(void)
        if ((vers = lp_announce_version()) == NULL)
                return minor_version;
 
-       if ((p = strchr(vers, '.')) == 0)
+       if ((p = strchr_m(vers, '.')) == 0)
                return minor_version;
 
        p++;
index f714106b43138935704045fdc8a0f036cb9ef23f..34b0c742087267ff998dc9a5151d7eb09c3f8470 100644 (file)
@@ -70,7 +70,7 @@ BOOL pdb_generate_sam_sid(void)
        generate_wellknown_sids();
 
        pstrcpy(sid_file, lp_smb_passwd_file());
-       p = strrchr(sid_file, '/');
+       p = strrchr_m(sid_file, '/');
        if(p != NULL) {
                *++p = '\0';
        }
index 580cae0240a84ddd3a39ef9f643a7c4535519e91..3bb49091e634daf24d258c5e1e032e282ff0e980 100644 (file)
@@ -318,8 +318,8 @@ BOOL pdb_gethexpwd(char *p, unsigned char *pwd)
                hinybble = toupper(p[i]);
                lonybble = toupper(p[i + 1]);
 
-               p1 = strchr(hexchars, hinybble);
-               p2 = strchr(hexchars, lonybble);
+               p1 = strchr_m(hexchars, hinybble);
+               p2 = strchr_m(hexchars, lonybble);
 
                if (!p1 || !p2)
                {
index 3679bd1319449e4a17a38a128707c0473fec2f50..dbb0d050c9de36201d3bcb73de18a93897cc6211 100644 (file)
@@ -343,7 +343,7 @@ static struct smb_passwd *getsmbfilepwent(void *vp)
       DEBUG(6, ("getsmbfilepwent: skipping comment or blank line\n"));
       continue;
     }
-    p = (unsigned char *) strchr(linebuf, ':');
+    p = (unsigned char *) strchr_m(linebuf, ':');
     if (p == NULL) {
       DEBUG(0, ("getsmbfilepwent: malformed password entry (no :)\n"));
       continue;
@@ -443,7 +443,7 @@ static struct smb_passwd *getsmbfilepwent(void *vp)
 
     if (*p == '[')
        {
-      unsigned char *end_p = (unsigned char *)strchr((char *)p, ']');
+      unsigned char *end_p = (unsigned char *)strchr_m((char *)p, ']');
       pw_buf.acct_ctrl = pdb_decode_acct_ctrl((char*)p);
 
       /* Must have some account type set. */
@@ -768,7 +768,7 @@ static BOOL mod_smbfilepwd_entry(struct smb_passwd* pwd, BOOL override)
       continue;
     }
 
-    p = (unsigned char *) strchr(linebuf, ':');
+    p = (unsigned char *) strchr_m(linebuf, ':');
 
     if (p == NULL) {
       DEBUG(0, ("mod_smbfilepwd_entry: malformed password entry (no :)\n"));
@@ -1346,7 +1346,7 @@ BOOL pdb_getsampwnam(SAM_ACCOUNT *sam_acct, char *username)
        /* break the username from the domain if we have 
           been given a string in the form 'DOMAIN\user' */
        fstrcpy (name, username);
-       if ((user=strchr(name, '\\')) != NULL) {
+       if ((user=strchr_m(name, '\\')) != NULL) {
                domain = name;
                *user = '\0';
                user++;
index a143709570bd60ee0a2b2d0810927a83b9580537..90d84995958a77c74119f61e8a219b195ef6c7c1 100644 (file)
@@ -277,7 +277,7 @@ static BOOL parse_lpq_lprng(char *line,print_queue_struct *buf,BOOL first)
    * for the current user on the taskbar.  Plop in a null.
    */
 
-  if ((cptr = strchr(buf->user,'@')) != NULL) {
+  if ((cptr = strchr_m(buf->user,'@')) != NULL) {
     *cptr = '\0';
   }
 
@@ -342,13 +342,13 @@ static BOOL parse_lpq_aix(char *line,print_queue_struct *buf,BOOL first)
           if (!isdigit((int)*tok[1]) || !isdigit((int)*tok[4])) return(False);
           buf->size = atoi(tok[4]) * 1024;
           /* if the fname contains a space then use STDIN */
-          if (strchr(tok[2],' '))
+          if (strchr_m(tok[2],' '))
             fstrcpy(tok[2],"STDIN");
 
           /* only take the last part of the filename */
           {
             fstring tmp;
-            char *p = strrchr(tok[2],'/');
+            char *p = strrchr_m(tok[2],'/');
             if (p)
               {
                 fstrcpy(tmp,p+1);
@@ -376,13 +376,13 @@ static BOOL parse_lpq_aix(char *line,print_queue_struct *buf,BOOL first)
       if (!isdigit((int)*tok[3]) || !isdigit((int)*tok[8])) return(False);
       buf->size = atoi(tok[8]) * 1024;
       /* if the fname contains a space then use STDIN */
-      if (strchr(tok[4],' '))
+      if (strchr_m(tok[4],' '))
         fstrcpy(tok[4],"STDIN");
 
       /* only take the last part of the filename */
       {
         fstring tmp;
-        char *p = strrchr(tok[4],'/');
+        char *p = strrchr_m(tok[4],'/');
         if (p)
           {
             fstrcpy(tmp,p+1);
@@ -453,7 +453,7 @@ static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first)
     if (!isdigit((int)*tok[1])) return(False);
     
     /* if the fname contains a space then use STDIN */
-    if (strchr(tok[0],' '))
+    if (strchr_m(tok[0],' '))
       fstrcpy(tok[0],"STDIN");
     
     buf->size = atoi(tok[1]);
@@ -564,7 +564,7 @@ static BOOL parse_lpq_sysv(char *line,print_queue_struct *buf,BOOL first)
     return(False);
 
   /* if the user contains a ! then trim the first part of it */  
-  if ((p=strchr(tok[2],'!'))) {
+  if ((p=strchr_m(tok[2],'!'))) {
       fstring tmp;
       fstrcpy(tmp,p+1);
       fstrcpy(tok[2],tmp);
@@ -627,7 +627,7 @@ static BOOL parse_lpq_qnx(char *line,print_queue_struct *buf,BOOL first)
   /* only take the last part of the filename */
   {
     fstring tmp;
-    char *p = strrchr(tok[6],'/');
+    char *p = strrchr_m(tok[6],'/');
     if (p)
       {
        fstrcpy(tmp,p+1);
@@ -685,13 +685,13 @@ static BOOL parse_lpq_plp(char *line,print_queue_struct *buf,BOOL first)
     return(False);
 
   /* if the fname contains a space then use STDIN */
-  if (strchr(tok[6],' '))
+  if (strchr_m(tok[6],' '))
     fstrcpy(tok[6],"STDIN");
 
   /* only take the last part of the filename */
   {
     fstring tmp;
-    char *p = strrchr(tok[6],'/');
+    char *p = strrchr_m(tok[6],'/');
     if (p)
       {
         fstrcpy(tmp,p+1);
@@ -703,9 +703,9 @@ static BOOL parse_lpq_plp(char *line,print_queue_struct *buf,BOOL first)
   buf->job = atoi(tok[4]);
 
   buf->size = atoi(tok[7]);
-  if (strchr(tok[7],'K'))
+  if (strchr_m(tok[7],'K'))
     buf->size *= 1024;
-  if (strchr(tok[7],'M'))
+  if (strchr_m(tok[7],'M'))
     buf->size *= 1024*1024;
 
   buf->status = strequal(tok[0],"active")?LPQ_PRINTING:LPQ_QUEUED;
@@ -841,8 +841,8 @@ static BOOL parse_lpq_nt(char *line,print_queue_struct *buf,BOOL first)
     return(False);
 
   /* Just want the first word in the owner field - the username */
-  if (strchr(parse_line.owner, ' '))
-    *(strchr(parse_line.owner, ' ')) = '\0';
+  if (strchr_m(parse_line.owner, ' '))
+    *(strchr_m(parse_line.owner, ' ')) = '\0';
   else
     parse_line.space1 = '\0';
 
@@ -1053,7 +1053,7 @@ BOOL parse_lpq_entry(int snum,char *line,
 
   /* We don't want the newline in the status message. */
   {
-    char *p = strchr(line,'\n');
+    char *p = strchr_m(line,'\n');
     if (p) *p = 0;
   }
 
index d099c29cc194b35a393f3839bc5a4e87050fe0f5..d742773d27523ffa9e157b3ed5bb6ad84a877e57 100644 (file)
@@ -673,29 +673,29 @@ static uint32 clean_up_driver_struct_level_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 *dri
         * or worse c:\windows\system\driver.dll !
         */
        /* using an intermediate string to not have overlaping memcpy()'s */
-       if ((p = strrchr(driver->driverpath,'\\')) != NULL) {
+       if ((p = strrchr_m(driver->driverpath,'\\')) != NULL) {
                fstrcpy(new_name, p+1);
                fstrcpy(driver->driverpath, new_name);
        }
 
-       if ((p = strrchr(driver->datafile,'\\')) != NULL) {
+       if ((p = strrchr_m(driver->datafile,'\\')) != NULL) {
                fstrcpy(new_name, p+1);
                fstrcpy(driver->datafile, new_name);
        }
 
-       if ((p = strrchr(driver->configfile,'\\')) != NULL) {
+       if ((p = strrchr_m(driver->configfile,'\\')) != NULL) {
                fstrcpy(new_name, p+1);
                fstrcpy(driver->configfile, new_name);
        }
 
-       if ((p = strrchr(driver->helpfile,'\\')) != NULL) {
+       if ((p = strrchr_m(driver->helpfile,'\\')) != NULL) {
                fstrcpy(new_name, p+1);
                fstrcpy(driver->helpfile, new_name);
        }
 
        if (driver->dependentfiles) {
                for (i=0; *driver->dependentfiles[i]; i++) {
-                       if ((p = strrchr(driver->dependentfiles[i],'\\')) != NULL) {
+                       if ((p = strrchr_m(driver->dependentfiles[i],'\\')) != NULL) {
                                fstrcpy(new_name, p+1);
                                fstrcpy(driver->dependentfiles[i], new_name);
                        }
@@ -738,29 +738,29 @@ static uint32 clean_up_driver_struct_level_6(NT_PRINTER_DRIVER_INFO_LEVEL_6 *dri
         * or worse c:\windows\system\driver.dll !
         */
        /* using an intermediate string to not have overlaping memcpy()'s */
-       if ((p = strrchr(driver->driverpath,'\\')) != NULL) {
+       if ((p = strrchr_m(driver->driverpath,'\\')) != NULL) {
                fstrcpy(new_name, p+1);
                fstrcpy(driver->driverpath, new_name);
        }
 
-       if ((p = strrchr(driver->datafile,'\\')) != NULL) {
+       if ((p = strrchr_m(driver->datafile,'\\')) != NULL) {
                fstrcpy(new_name, p+1);
                fstrcpy(driver->datafile, new_name);
        }
 
-       if ((p = strrchr(driver->configfile,'\\')) != NULL) {
+       if ((p = strrchr_m(driver->configfile,'\\')) != NULL) {
                fstrcpy(new_name, p+1);
                fstrcpy(driver->configfile, new_name);
        }
 
-       if ((p = strrchr(driver->helpfile,'\\')) != NULL) {
+       if ((p = strrchr_m(driver->helpfile,'\\')) != NULL) {
                fstrcpy(new_name, p+1);
                fstrcpy(driver->helpfile, new_name);
        }
 
        if (driver->dependentfiles) {
                for (i=0; *driver->dependentfiles[i]; i++) {
-                       if ((p = strrchr(driver->dependentfiles[i],'\\')) != NULL) {
+                       if ((p = strrchr_m(driver->dependentfiles[i],'\\')) != NULL) {
                                fstrcpy(new_name, p+1);
                                fstrcpy(driver->dependentfiles[i], new_name);
                        }
@@ -2292,7 +2292,7 @@ static void map_to_os2_driver(fstring drivername)
 
        for( i = 0; i < numlines; i++) {
                char *nt_name = lines[i];
-               char *os2_name = strchr(nt_name,'=');
+               char *os2_name = strchr_m(nt_name,'=');
 
                if (!os2_name)
                        continue;
@@ -2302,7 +2302,7 @@ static void map_to_os2_driver(fstring drivername)
                while (isspace(*nt_name))
                        nt_name++;
 
-               if (!*nt_name || strchr("#;",*nt_name))
+               if (!*nt_name || strchr_m("#;",*nt_name))
                        continue;
 
                {
@@ -3189,7 +3189,7 @@ BOOL nt_printing_getsec(TALLOC_CTX *ctx, char *printername, SEC_DESC_BUF **secde
        fstring key;
        char *temp;
 
-       if ((temp = strchr(printername + 2, '\\'))) {
+       if ((temp = strchr_m(printername + 2, '\\'))) {
                printername = temp + 1;
        }
 
index 1f909d3533a4c95f0802de80ffd0c91fb70c820b..313e17fb1c55a06a32e16412c405353f6d79a30c 100644 (file)
@@ -122,7 +122,7 @@ static void ScanQconfig_fn(char *psz,void (*fn)(char *, char *))
                {
                        case 0: /* locate an entry */
                         if (*line == '\t' || *line == ' ') continue;
-                        if ((p=strchr(line,':')))
+                        if ((p=strchr_m(line,':')))
                         {
                                *p = '\0';
                                p = strtok(line,":");
@@ -297,14 +297,14 @@ BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname)
        continue;
 
       /* now we have a real printer line - cut it off at the first : */      
-      p = strchr(line,':');
+      p = strchr_m(line,':');
       if (p) *p = 0;
       
       /* now just check if the name is in the list */
       /* NOTE: I avoid strtok as the fn calling this one may be using it */
       for (p=line; p; p=q)
        {
-         if ((q = strchr(p,'|'))) *q++ = 0;
+         if ((q = strchr_m(p,'|'))) *q++ = 0;
 
          if (strequal(p,pszPrintername))
            {
@@ -378,7 +378,7 @@ void pcap_printer_fn(void (*fn)(char *, char *))
        continue;
 
       /* now we have a real printer line - cut it off at the first : */      
-      p = strchr(line,':');
+      p = strchr_m(line,':');
       if (p) *p = 0;
       
       /* now find the most likely printer name and comment 
@@ -388,9 +388,9 @@ void pcap_printer_fn(void (*fn)(char *, char *))
       for (p=line; p; p=q)
        {
          BOOL has_punctuation;
-         if ((q = strchr(p,'|'))) *q++ = 0;
+         if ((q = strchr_m(p,'|'))) *q++ = 0;
 
-         has_punctuation = (strchr(p,' ') || strchr(p,'\t') || strchr(p,'(') || strchr(p,')'));
+         has_punctuation = (strchr_m(p,' ') || strchr_m(p,'\t') || strchr_m(p,'(') || strchr_m(p,')'));
 
          if (strlen(p)>strlen(comment) && has_punctuation)
            {
@@ -405,7 +405,7 @@ void pcap_printer_fn(void (*fn)(char *, char *))
              continue;
            }
 
-         if (!strchr(comment,' ') && 
+         if (!strchr_m(comment,' ') && 
              strlen(p) > strlen(comment))
            {
              StrnCpy(comment,p,sizeof(comment)-1);
index 3e5753583e7aa8ea0d1f281e54079af648f68ef5..bc9751a6539404e122675fd6e42aab51cc70ee06 100644 (file)
@@ -157,7 +157,7 @@ static int generic_job_submit(int snum, struct printjob *pjob)
                return 0;
 
        pstrcpy(print_directory, pjob->filename);
-       p = strrchr(print_directory,'/');
+       p = strrchr_m(print_directory,'/');
        if (!p)
                return 0;
        *p++ = 0;
index 301f38867195bfd4936ed66f76783f0a9f3c2e2d..22ddbe70b95437a409e51d66f1d6e84b7643e8bc 100644 (file)
@@ -59,8 +59,8 @@ static void populate_printers(void)
                char *buf = lines[i];
 
                /* eat "system/device for " */
-               if (((tmp = strchr(buf, ' ')) == NULL) ||
-                   ((tmp = strchr(++tmp, ' ')) == NULL))
+               if (((tmp = strchr_m(buf, ' ')) == NULL) ||
+                   ((tmp = strchr_m(++tmp, ' ')) == NULL))
                        continue;
 
                /*
@@ -68,13 +68,13 @@ static void populate_printers(void)
                 */
 
                if(!strncmp("for ",++tmp,4)) {
-                       tmp=strchr(tmp, ' ');
+                       tmp=strchr_m(tmp, ' ');
                        tmp++;
                }
                name = tmp;
 
                /* truncate the ": ..." */
-               if ((tmp = strchr(name, ':')) != NULL)
+               if ((tmp = strchr_m(name, ':')) != NULL)
                        *tmp = '\0';
                
                /* add it to the cache */
index 2dd492364b727ec843ae14ee02c4ae9a8ca7cc15..c5b36fe2a57a2224b0b0c4ef220e13622153d8f4 100644 (file)
@@ -448,7 +448,7 @@ BOOL spoolss_open_printer_ex(  const char *printername,
         memset(srv_name, 0, sizeof(srv_name));
         fstrcpy(srv_name, printername);
 
-        s = strchr(&srv_name[2], '\\');
+        s = strchr_m(&srv_name[2], '\\');
        if (s != NULL)
                *s = '\0';
 
index 54c3fbf324c17dd4e289a252bac0f0aab70fb3bb..a84f2ceb48e07daebddbf6ea04ce2f277af9b8d5 100644 (file)
@@ -253,7 +253,7 @@ static BOOL init_reply_dfs_info_3(TALLOC_CTX *ctx, struct junction_map* j, DFS_I
          
          pstrcpy(path, ref->alternate_path);
          trim_string(path,"\\","");
-         p = strrchr(path,'\\');
+         p = strrchr_m(path,'\\');
          if(p==NULL)
            {
              DEBUG(4,("init_reply_dfs_info_3: invalid path: no \\ found in %s\n",path));
index d783de3b4bc3db656c6ebb60204d35ea62e7d0b4..a73dcb30d2c63f64ee9ae8f9afe450ba20721bad 100644 (file)
@@ -256,7 +256,7 @@ static char *unmap_unixname(char *unix_user_name, int name_idx)
 
        for (i=0; lines[i]; i++) {
                char *unixname = lines[i];
-               char *dosname = strchr(unixname,'=');
+               char *dosname = strchr_m(unixname,'=');
 
                if (!dosname)
                        continue;
@@ -271,7 +271,7 @@ static char *unmap_unixname(char *unix_user_name, int name_idx)
                                unixname++;
                }
     
-               if (!*unixname || strchr("#;",*unixname))
+               if (!*unixname || strchr_m("#;",*unixname))
                        continue;
 
                if (strncmp(unixname, unix_user_name, strlen(unix_user_name)))
@@ -280,7 +280,7 @@ static char *unmap_unixname(char *unix_user_name, int name_idx)
                /* We have matched the UNIX user name */
 
                while(next_token(&dosname, tok, LIST_SEP, sizeof(tok))) {
-                       if (!strchr("@&+", *tok)) {
+                       if (!strchr_m("@&+", *tok)) {
                                name_idx--;
                                if (name_idx < 0 ) {
                                        break;
@@ -406,7 +406,7 @@ static BOOL get_passwd_entries(SAM_USER_INFO_21 *pw_buf,
 
                        /* Don't enumerate winbind users as they are not local */
 
-                       if (strchr(pwd->pw_name, *sep) != NULL) {
+                       if (strchr_m(pwd->pw_name, *sep) != NULL) {
                                continue;
                        }
 
@@ -834,7 +834,7 @@ static BOOL get_group_alias_entries(TALLOC_CTX *ctx, DOMAIN_GRP **d_grp, DOM_SID
                        sid_split_rid(&smap.sid, &trid);
 
                        /* Don't return winbind groups as they are not local! */
-                       if (strchr(smap.nt_name, *sep) != NULL) {
+                       if (strchr_m(smap.nt_name, *sep) != NULL) {
                                DEBUG(10,("get_group_alias_entries: not returing %s, not local.\n", smap.nt_name ));
                                continue;
                        }
index 7002241a001eba7bd99ea132412f657db29b2325..79c788e67bb8543c178e79bd88b84b2ac50a5367 100644 (file)
@@ -377,7 +377,7 @@ static BOOL set_printer_hnd_printertype(Printer_entry *Printer, char *handlename
        }
 
        /* it's a print server */
-       if (*handlename=='\\' && *(handlename+1)=='\\' && !strchr(handlename+2, '\\')) {
+       if (*handlename=='\\' && *(handlename+1)=='\\' && !strchr_m(handlename+2, '\\')) {
                DEBUGADD(4,("Printer is a print server\n"));
                Printer->printer_type = PRINTER_HANDLE_IS_PRINTSERVER;          
        }
@@ -414,7 +414,7 @@ static BOOL set_printer_hnd_name(Printer_entry *Printer, char *handlename)
                return False;
        
        if (*handlename=='\\') {
-               aprinter=strchr(handlename+2, '\\');
+               aprinter=strchr_m(handlename+2, '\\');
                aprinter++;
        }
        else {
@@ -442,7 +442,7 @@ static BOOL set_printer_hnd_name(Printer_entry *Printer, char *handlename)
                if (get_a_printer(&printer, 2, lp_servicename(snum))!=0)
                        continue;
 
-               printername=strchr(printer->info_2->printername+2, '\\');
+               printername=strchr_m(printer->info_2->printername+2, '\\');
                printername++;
 
                DEBUG(10,("set_printer_hnd_name: name [%s], aprinter [%s]\n",
@@ -1461,7 +1461,7 @@ static void spoolss_notify_printer_name(int snum,
        uint32 len;
                
        /* the notify name should not contain the \\server\ part */
-       char *p = strrchr(printer->info_2->printername, '\\');
+       char *p = strrchr_m(printer->info_2->printername, '\\');
 
        if (!p) {
                p = printer->info_2->printername;
index deaa6008b9ab6b4b31768afa5ca02feaa973f6c1..f9e02b9bca07968c565cba53c9252d3984817260 100644 (file)
@@ -114,7 +114,7 @@ int make_dom_gids(TALLOC_CTX *ctx, char *gids_str, DOM_GID **ppgids)
     uint32 rid = 0;
     int i;
 
-    attr = strchr(s2,'/');
+    attr = strchr_m(s2,'/');
     if (attr)
       *attr++ = 0;
 
index 0d1b84f8492d5a3ed9ffa906554fc6f514c475cf..6e4d60d208ec9a2082fd6c5b07be000e58b663ff 100644 (file)
@@ -163,7 +163,7 @@ static char* next_command (char** cmdstr)
        if (!cmdstr || !(*cmdstr))
                return NULL;
        
-       p = strchr(*cmdstr, ';');
+       p = strchr_m(*cmdstr, ';');
        if (p)
                *p = '\0';
        pstrcpy(command, *cmdstr);
@@ -588,11 +588,11 @@ static void usage(char *pname)
                case 'U': {
                        char *lp;
                        pstrcpy(username,optarg);
-                       if ((lp=strchr(username,'%'))) {
+                       if ((lp=strchr_m(username,'%'))) {
                                *lp = 0;
                                pstrcpy(password,lp+1);
                                got_pass = True;
-                               memset(strchr(optarg,'%')+1,'X',strlen(password));
+                               memset(strchr_m(optarg,'%')+1,'X',strlen(password));
                        }
                        break;
                }
index dfbc2272e6cae580255d648991674fd8423ac1d4..6b72a8563a40675f898f8755e197d50a6bf65aa1 100644 (file)
@@ -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++;
index 89e5b1586c75cb2e540127c22c18a4f3cbecd3b6..639e365d1bcd8516c7b7e40e0d545b5810310567 100644 (file)
@@ -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
index 9b76d63dc6da0d06e65adfbbe957a9f29922aeec..70f34c52ada509fd42cfc5b69b5a7bb2d3fe0765 100644 (file)
@@ -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.
index d44e9a7a39c8f18964f0751678b0be284494bd9a..0640d4d7b2a9f73387e998819acbc75fc3ef2f2c 100644 (file)
@@ -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)))
index 2b71770b2e3e7f20b9a341a6665061dd95283405..6e3145aa7d9d4c941166251c7911519e42c8e7ce 100644 (file)
@@ -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));
  
index 8df71d45571f509ae1171da3e69c38281e0bb99d..16286a8bb1e1fb60dcf6c71a5d6b84796d38faa8 100644 (file)
@@ -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 */
index ea37b14e5e59504fc2fff0c2bd22fd48febc18af..a156748cf85103386a35e26465b28a9a7e7ffd16 100644 (file)
@@ -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));
       }
index 7c48e28138b63f04ee5f54701417501d330b4fab..858a26191f97cfa949113595fd124dfa78cd42eb 100644 (file)
@@ -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") ||
index caf3997ba800cadb279f84deb0d05c06f0dedcca..5d82756f24c5ff560d01e71b45a8beebca1effd5 100644 (file)
@@ -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;
 
index fe0f2862c68a8f86e86414b5db293226b5d624b2..a3310730933006e154e1f25dca10a34bbb62df6c 100644 (file)
@@ -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);
index 8d115d954cb24a162fea248c261a1f25d50ddd7c..f753d615edba0807b134fd9d637c9a5c743e21c2 100644 (file)
@@ -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;
        }
index 836ef30f80c695c0827ce0b2dd6b0e384cd3d1bc..04139be917b3c08ddcee6768fe1bbc99ef49dcfd 100644 (file)
@@ -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);
index 65a4830016436ff548231fc263b9d42cc609ac4d..2e31e1252e05f6df6d3d6abaa5f212ee3d6884fb 100644 (file)
@@ -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 {
index f768a72c6d3ca0bfc02438321a7e33d793d2e1d9..622b23c0b028619b6843338e59a062c8729428fa 100644 (file)
@@ -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 {
index da4c5383197368f2e7b5b949198095d60bf0d274..0070781d244e558a277eaf06493e492e31361e26 100644 (file)
@@ -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);
index 747d393386a48349ebce74cb568935670a9c181d..71ebf9b506b99c1b3ff84196e3de756f78d4d878 100644 (file)
@@ -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);
index c5007e187d44fef9092f08a791f457a3a5d1c3c9..37e29a94f9e769f0410cae999c0c4d105f692d4a 100644 (file)
@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
                        smbw_setshared("DEBUG", optarg);
                        break;
                case 'U':
-                       p = strchr(optarg,'%');
+                       p = strchr_m(optarg,'%');
                        if (p) {
                                *p=0;
                                smbw_setshared("PASSWORD",p+1);
index fd7f2a0253cd16affd1a915f4515154741f50f5c..dd78480f17d8b5b95954ef07b27415ba3aac8ae6 100644 (file)
@@ -481,13 +481,13 @@ struct smbw_server *smbw_server(char *server, char *share)
 
        DEBUG(4,("server_n=[%s] server=[%s]\n", server_n, server));
 
-       if ((p=strchr(server_n,'#')) && 
+       if ((p=strchr_m(server_n,'#')) && 
            (strcmp(p+1,"1D")==0 || strcmp(p+1,"01")==0)) {
                struct in_addr sip;
                pstring s;
 
                fstrcpy(group, server_n);
-               p = strchr(group,'#');
+               p = strchr_m(group,'#');
                *p = 0;
                
                /* cache the workgroup master lookup */
index 2eaa6057c65705bd7f82115656964ab5151e004a..f7f7c580aad54e8096661dfb92fa0775f4173ef6 100644 (file)
@@ -120,7 +120,7 @@ struct cli_state *connect_one(char *share)
        static int count;
 
        fstrcpy(server,share+2);
-       share = strchr(server,'\\');
+       share = strchr_m(server,'\\');
        if (!share) return NULL;
        *share = 0;
        share++;
@@ -524,7 +524,7 @@ static void usage(void)
                switch (opt) {
                case 'U':
                        pstrcpy(username,optarg);
-                       p = strchr(username,'%');
+                       p = strchr_m(username,'%');
                        if (p) {
                                *p = 0;
                                pstrcpy(password, p+1);
index 171386dec3ada39bda952be5d2ff0ec25fafb462..37baa62b73f2a1be8df004d7c493a3a68ac5f98f 100644 (file)
@@ -162,7 +162,7 @@ struct cli_state *connect_one(char *share)
        static int count;
 
        fstrcpy(server,share+2);
-       share = strchr(server,'\\');
+       share = strchr_m(server,'\\');
        if (!share) return NULL;
        *share = 0;
        share++;
@@ -577,7 +577,7 @@ static void usage(void)
                switch (opt) {
                case 'U':
                        pstrcpy(username,optarg);
-                       p = strchr(username,'%');
+                       p = strchr_m(username,'%');
                        if (p) {
                                *p = 0;
                                pstrcpy(password, p+1);
index a10a4e954c9777a045a4776a45a0379fe0ea5c33..0acdb0d95cc1161c104408d13c5aeb89879f1c61 100644 (file)
@@ -76,7 +76,7 @@ int ms_fnmatch_lanman_core(char *pattern, char *string)
                case '<':
                        for (; *n; n++) {
                                if (ms_fnmatch_lanman_core(p, n) == 0) goto match;
-                               if (*n == '.' && !strchr(n+1,'.')) {
+                               if (*n == '.' && !strchr_m(n+1,'.')) {
                                        n++;
                                        break;
                                }
@@ -146,7 +146,7 @@ static char *reg_test(char *pattern, char *long_name, char *short_name)
        static fstring ret;
        fstrcpy(ret, "---");
 
-       pattern = 1+strrchr(pattern,'\\');
+       pattern = 1+strrchr_m(pattern,'\\');
 
        if (reg_match_one(pattern, ".")) ret[0] = '+';
        if (reg_match_one(pattern, "..")) ret[1] = '+';
@@ -169,7 +169,7 @@ struct cli_state *connect_one(char *share)
        extern struct in_addr ipzero;
 
        server = share+2;
-       share = strchr(server,'\\');
+       share = strchr_m(server,'\\');
        if (!share) return NULL;
        *share = 0;
        share++;
@@ -289,7 +289,7 @@ static void get_real_name(struct cli_state *cli,
        }
 
 #if 0
-       if (!strchr(short_name,'.')) {
+       if (!strchr_m(short_name,'.')) {
                fstrcat(short_name,".");
        }
 #endif
@@ -468,7 +468,7 @@ static void usage(void)
                        break;
                case 'U':
                        pstrcpy(username,optarg);
-                       p = strchr(username,'%');
+                       p = strchr_m(username,'%');
                        if (p) {
                                *p = 0;
                                pstrcpy(password, p+1);
index b42c315b1db493acedd81be85fee7d3b0bafa5ae..1708e9a860ab7226c8d24ce74d137df2d6e622a5 100644 (file)
@@ -394,12 +394,12 @@ enum client_action
                        {
                                char *lp;
                                pstrcpy(smb_cli->user_name,optarg);
-                               if ((lp=strchr(smb_cli->user_name,'%')))
+                               if ((lp=strchr_m(smb_cli->user_name,'%')))
                                {
                                        *lp = 0;
                                        pstrcpy(password,lp+1);
                                        got_pass = True;
-                                       memset(strchr(optarg,'%')+1,'X',strlen(password));
+                                       memset(strchr_m(optarg,'%')+1,'X',strlen(password));
                                }
                                break;
                        }
index a7c50fbfe0f59f903219c2f2fd59f7f954c07831..fcf48e0560adf0f105523567e6b4e2cef3c1d285 100644 (file)
@@ -3233,7 +3233,7 @@ static void usage(void)
        }
 
        fstrcpy(host, &argv[1][2]);
-       p = strchr(&host[2],'/');
+       p = strchr_m(&host[2],'/');
        if (!p) {
                usage();
        }
@@ -3280,7 +3280,7 @@ static void usage(void)
                        break;
                case 'U':
                        pstrcpy(username,optarg);
-                       p = strchr(username,'%');
+                       p = strchr_m(username,'%');
                        if (p) {
                                *p = 0;
                                pstrcpy(password, p+1);
index f403ee79bb615b0c0e943b0751b72ecf6c71a90c..5107b124a7b766d2a52354de009942912e1ca61d 100644 (file)
@@ -47,8 +47,8 @@ static char *myfgets(char *s, int n, FILE *stream)
   int i;
 
   fgets(s,n,stream);
-  while ((LString1 = strchr(s,'%')) != NULL) {
-    if (!(LString2 = strchr(LString1+1,'%'))) break;
+  while ((LString1 = strchr_m(s,'%')) != NULL) {
+    if (!(LString2 = strchr_m(LString1+1,'%'))) break;
     *LString2 = '\0';
     pstrcpy(String,LString1+1);
     i = 0;
@@ -56,7 +56,7 @@ static char *myfgets(char *s, int n, FILE *stream)
       if (strncmp(sbuffer[i],String,strlen(String))==0)
       {
        pstrcpy(String,sbuffer[i]);
-       if ((temp = strchr(String,'=')) != NULL) ++temp;
+       if ((temp = strchr_m(String,'=')) != NULL) ++temp;
        pstrcpy(String,temp);
        break;
       }
@@ -360,7 +360,7 @@ static void scan_copyfiles(FILE *fichier, char *chaine)
  * This may still be wrong but at least I get the same list
  * of files as seen on a printer test page.
  */
-        part = strchr(buffer[i],'=');
+        part = strchr_m(buffer[i],'=');
         if (part) {
           /*
            * Case (1) eg. pscript.hlp =  pscript.hl_ - chop after the first name.
@@ -379,13 +379,13 @@ static void scan_copyfiles(FILE *fichier, char *chaine)
               break;
           }
         } else {
-          part = strchr(buffer[i],',');
+          part = strchr_m(buffer[i],',');
           if (part) {
             /*
              * Cases (2-4)
              */
 
-            if ((mpart = strrchr(part+1,','))!=NULL) {
+            if ((mpart = strrchr_m(part+1,','))!=NULL) {
               /*
                * Second ',' - case 3 or 4.
                * Check if the last part is just a number,
@@ -507,7 +507,7 @@ static void scan_short_desc(FILE *fichier, char *short_desc)
        temp = strtok(languagemonitor,",");
        if (*temp == '"') ++temp;
        pstrcpy(languagemonitor,temp);
-       if ((temp = strchr(languagemonitor,'"'))!=NULL) *temp = '\0';
+       if ((temp = strchr_m(languagemonitor,'"'))!=NULL) *temp = '\0';
   }
 
   if (i) fprintf(stderr,"End of section found\n");
index adb75e6104f14d87627008c453bd44992add64cd..3e2f0610e6cb84ae96564deea60226c49f539b89 100644 (file)
@@ -303,7 +303,7 @@ int main(int argc,char *argv[])
        }
       }
 
-      p = strchr(lookup,'#');
+      p = strchr_m(lookup,'#');
       if (p) {
         *p = '\0';
         sscanf(++p,"%x",&lookup_type);
index 2b1dfe9f925c0431854743c3464f0e9ef4980e98..ec90e7ff1dbb12bd4b3e25141d6c1a392955cff1 100644 (file)
@@ -391,7 +391,7 @@ static int import_users (char *filename)
                sam_pwent.acct_ctrl = ACB_NORMAL;
                
                /* Get user name */
-               p = (unsigned char *) strchr(linebuf, ':');
+               p = (unsigned char *) strchr_m(linebuf, ':');
                if (p == NULL)
                {
                        fprintf (stderr, "Error: malformed password entry at line %d !!\n", line);
@@ -478,7 +478,7 @@ static int import_users (char *filename)
                /* Get ACCT_CTRL field if any */
                if (*p == '[')
                {
-                       unsigned char *end_p = (unsigned char *)strchr((char *)p, ']');
+                       unsigned char *end_p = (unsigned char *)strchr_m((char *)p, ']');
                        
                        sam_pwent.acct_ctrl = pdb_decode_acct_ctrl((char*)p);
                        if(sam_pwent.acct_ctrl == 0) sam_pwent.acct_ctrl = ACB_NORMAL;
index f504463027cccd2341f964e09151b2c21e867775..1b00d528ac7b1829a15f9fe7433cc1b34006d8c0 100644 (file)
@@ -46,7 +46,7 @@ main()
        prs_init(&ps, 1600, 4, ctx, MARSHALL);
 
        while (scanf("%s", s)!=-1) {
-               if (strlen(s)==2 && strchr(filter, *s)!=NULL && strchr(filter, *(s+1))!=NULL) {
+               if (strlen(s)==2 && strchr_m(filter, *s)!=NULL && strchr_m(filter, *(s+1))!=NULL) {
                        d=strtol(s, NULL, 16);
                        if(!prs_append_data(&ps, &d, 1))
                                printf("error while reading data\n");
index 9edc35f80057fe4885660354b6c2feb26e61f066..20333f772b481c7f7a0490304c0b668dfc233713 100644 (file)
@@ -234,7 +234,7 @@ static BOOL parse_ace(SEC_ACE *ace, char *str)
        struct perm_value *v;
 
        ZERO_STRUCTP(ace);
-       p = strchr(str,':');
+       p = strchr_m(str,':');
        if (!p) return False;
        *p = '\0';
        p++;
@@ -697,7 +697,7 @@ struct cli_state *connect_one(char *share)
        extern pstring global_myname;
 
        fstrcpy(server,share+2);
-       share = strchr(server,'\\');
+       share = strchr_m(server,'\\');
        if (!share) return NULL;
        *share = 0;
        share++;
@@ -843,11 +843,11 @@ You can string acls together with spaces, commas or newlines\n\
        if (getenv("USER")) {
                pstrcpy(username,getenv("USER"));
 
-               if ((p=strchr(username,'%'))) {
+               if ((p=strchr_m(username,'%'))) {
                        *p = 0;
                        pstrcpy(password,p+1);
                        got_pass = True;
-                       memset(strchr(getenv("USER"), '%') + 1, 'X',
+                       memset(strchr_m(getenv("USER"), '%') + 1, 'X',
                               strlen(password));
                }
        }
@@ -856,7 +856,7 @@ You can string acls together with spaces, commas or newlines\n\
                switch (opt) {
                case 'U':
                        pstrcpy(username,optarg);
-                       p = strchr(username,'%');
+                       p = strchr_m(username,'%');
                        if (p) {
                                *p = 0;
                                pstrcpy(password, p+1);
index ebc588eb6469d1b86db4aecd16757ef6c14201c1..a10e757910970d379dceab757203f19dfd57137d 100644 (file)
@@ -603,11 +603,11 @@ static int process_root(int argc, char *argv[])
 
                        fstrcpy(user_name, optarg);
 
-                       if ((lp = strchr(user_name, '%'))) {
+                       if ((lp = strchr_m(user_name, '%'))) {
                                *lp = 0;
                                fstrcpy(user_password, lp + 1);
                                got_pass = True;
-                               memset(strchr(optarg, '%') + 1, 'X',
+                               memset(strchr_m(optarg, '%') + 1, 'X',
                                       strlen(user_password));
                        }
 
@@ -920,7 +920,7 @@ int main(int argc, char **argv)
        if (!*global_myname) {   
                char *p;
                fstrcpy(global_myname, myhostname());
-               p = strchr(global_myname, '.' );
+               p = strchr_m(global_myname, '.' );
                if (p) *p = 0;
        }           
        strupper(global_myname);
index 7d6eb7f353d986555971b5245bb0b6d6132cf90a..6a8fbf116b1cce4af3424ce3c26b33538df28a44 100644 (file)
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
                        smbw_setshared("DEBUG", optarg);
                        break;
                case 'U':
-                       p = strchr(optarg,'%');
+                       p = strchr_m(optarg,'%');
                        if (p) {
                                *p=0;
                                smbw_setshared("PASSWORD",p+1);
index c9080e1994086f297d45240c252feb922a781d37..9b19a6c0fdc8eb364fbbed7c24f865f45c55b39e 100644 (file)
@@ -240,8 +240,8 @@ int main(int argc, char *argv[])
       int i;
       if(deny_list) {
         for (i=0; deny_list[i]; i++) {
-          char *hasstar = strchr(deny_list[i], '*');
-          char *hasquery = strchr(deny_list[i], '?');
+          char *hasstar = strchr_m(deny_list[i], '*');
+          char *hasquery = strchr_m(deny_list[i], '?');
           if(hasstar || hasquery) {
             printf("Invalid character %c in hosts deny list (%s) for service %s.\n",
                  hasstar ? *hasstar : *hasquery, deny_list[i], lp_servicename(s) );
@@ -251,8 +251,8 @@ int main(int argc, char *argv[])
 
       if(allow_list) {
         for (i=0; allow_list[i]; i++) {
-          char *hasstar = strchr(allow_list[i], '*');
-          char *hasquery = strchr(allow_list[i], '?');
+          char *hasstar = strchr_m(allow_list[i], '*');
+          char *hasquery = strchr_m(allow_list[i], '?');
           if(hasstar || hasquery) {
             printf("Invalid character %c in hosts allow list (%s) for service %s.\n",
                  hasstar ? *hasstar : *hasquery, allow_list[i], lp_servicename(s) );
index 07f84b2a61d967d94cc47c4323daa3d421d6c9ef..af9d2ea8f6df2cb1d85dc52bbe74c9553c789575 100644 (file)
@@ -50,12 +50,12 @@ static void unescape(char *buf)
 {
        char *p=buf;
 
-       while ((p=strchr(p,'+')))
+       while ((p=strchr_m(p,'+')))
                *p = ' ';
 
        p = buf;
 
-       while (p && *p && (p=strchr(p,'%'))) {
+       while (p && *p && (p=strchr_m(p,'%'))) {
                int c1 = p[1];
                int c2 = p[2];
 
@@ -104,7 +104,7 @@ static char *grab_line(FILE *f, int *cl)
                
                if (c == '\r') continue;
 
-               if (strchr("\n&", c)) break;
+               if (strchr_m("\n&", c)) break;
 
                ret[i++] = c;
 
@@ -160,7 +160,7 @@ void cgi_load_variables(FILE *f1)
             ((s=getenv("REQUEST_METHOD")) && 
              strcasecmp(s,"POST")==0))) {
                while (len && (line=grab_line(f, &len))) {
-                       p = strchr(line,'=');
+                       p = strchr_m(line,'=');
                        if (!p) continue;
                        
                        *p = 0;
@@ -200,7 +200,7 @@ void cgi_load_variables(FILE *f1)
 
        if ((s=query_string) || (s=getenv("QUERY_STRING"))) {
                for (tok=strtok(s,"&;");tok;tok=strtok(NULL,"&;")) {
-                       p = strchr(tok,'=');
+                       p = strchr_m(tok,'=');
                        if (!p) continue;
                        
                        *p = 0;
@@ -335,7 +335,7 @@ static void base64_decode(char *s)
 
        n=i=0;
 
-       while (*s && (p=strchr(b64,*s))) {
+       while (*s && (p=strchr_m(b64,*s))) {
                idx = (int)(p - b64);
                byte_offset = (i*6)/8;
                bit_offset = (i*6)%8;
@@ -377,7 +377,7 @@ static BOOL cgi_handle_authorization(char *line)
        line += 6;
        while (line[0] == ' ') line++;
        base64_decode(line);
-       if (!(p=strchr(line,':'))) {
+       if (!(p=strchr_m(line,':'))) {
                /*
                 * Always give the same error so a cracker
                 * cannot tell why we fail.
@@ -475,7 +475,7 @@ static void cgi_download(char *file)
 
        /* sanitise the filename */
        for (i=0;file[i];i++) {
-               if (!isalnum((int)file[i]) && !strchr("/.-_", file[i])) {
+               if (!isalnum((int)file[i]) && !strchr_m("/.-_", file[i])) {
                        cgi_setup_error("404 File Not Found","",
                                        "Illegal character in filename");
                }
@@ -491,7 +491,7 @@ static void cgi_download(char *file)
                                "The requested file was not found");
        }
        printf("HTTP/1.0 200 OK\r\n");
-       if ((p=strrchr(file,'.'))) {
+       if ((p=strrchr_m(file,'.'))) {
                if (strcmp(p,".gif")==0) {
                        printf("Content-Type: image/gif\r\n");
                } else if (strcmp(p,".jpg")==0) {
@@ -579,15 +579,15 @@ void cgi_setup(char *rootdir, int auth_required)
        }
 
        /* trim the URL */
-       if ((p = strchr(url,' ')) || (p=strchr(url,'\t'))) {
+       if ((p = strchr_m(url,' ')) || (p=strchr_m(url,'\t'))) {
                *p = 0;
        }
-       while (*url && strchr("\r\n",url[strlen(url)-1])) {
+       while (*url && strchr_m("\r\n",url[strlen(url)-1])) {
                url[strlen(url)-1] = 0;
        }
 
        /* anything following a ? in the URL is part of the query string */
-       if ((p=strchr(url,'?'))) {
+       if ((p=strchr_m(url,'?'))) {
                query_string = p+1;
                *p = 0;
        }