summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-07-04 07:36:09 +0000
committerAndrew Tridgell <tridge@samba.org>2001-07-04 07:36:09 +0000
commitc41fc06376d1a2b83690612304e85010b5e5f3cf (patch)
tree59f4f1203405c352984a30e0d4eb4d0955248e1e
parentdebb471267960e56005a741817ebd227ecfc512a (diff)
downloadsamba-c41fc06376d1a2b83690612304e85010b5e5f3cf.tar.gz
samba-c41fc06376d1a2b83690612304e85010b5e5f3cf.tar.xz
samba-c41fc06376d1a2b83690612304e85010b5e5f3cf.zip
strchr and strrchr are macros when compiling with optimisation in gcc, so we can't redefine them. damn.
-rw-r--r--source/client/client.c22
-rw-r--r--source/client/clitar.c12
-rw-r--r--source/client/smbmount.c16
-rw-r--r--source/client/smbspool.c8
-rw-r--r--source/include/safe_string.h4
-rw-r--r--source/lib/access.c10
-rw-r--r--source/lib/cmd_interp.c12
-rw-r--r--source/lib/debug.c2
-rw-r--r--source/lib/interface.c2
-rw-r--r--source/lib/substitute.c8
-rw-r--r--source/lib/system.c4
-rw-r--r--source/lib/username.c8
-rw-r--r--source/lib/util.c20
-rw-r--r--source/lib/util_file.c2
-rw-r--r--source/lib/util_sid.c4
-rw-r--r--source/lib/util_sock.c2
-rw-r--r--source/lib/util_str.c22
-rw-r--r--source/libsmb/cliconnect.c2
-rw-r--r--source/libsmb/libsmbclient.c10
-rw-r--r--source/libsmb/namequery.c4
-rw-r--r--source/libsmb/nmblib.c2
-rw-r--r--source/msdfs/msdfs.c8
-rw-r--r--source/nmbd/nmbd.c6
-rw-r--r--source/nmbd/nmbd_sendannounce.c2
-rw-r--r--source/nmbd/nmbd_winsserver.c8
-rw-r--r--source/nsswitch/wb_client.c6
-rw-r--r--source/nsswitch/wbinfo.c2
-rw-r--r--source/nsswitch/winbind_nss.c4
-rw-r--r--source/nsswitch/winbindd.c2
-rw-r--r--source/nsswitch/winbindd_pam.c4
-rw-r--r--source/nsswitch/winbindd_util.c4
-rw-r--r--source/param/loadparm.c6
-rw-r--r--source/passdb/machine_sid.c2
-rw-r--r--source/passdb/passdb.c4
-rw-r--r--source/passdb/pdb_smbpasswd.c8
-rw-r--r--source/printing/lpq_parse.c30
-rw-r--r--source/printing/nt_printing.c26
-rw-r--r--source/printing/pcap.c14
-rw-r--r--source/printing/print_generic.c2
-rw-r--r--source/printing/print_svid.c8
-rw-r--r--source/rpc_client/cli_spoolss.c2
-rw-r--r--source/rpc_server/srv_dfs_nt.c2
-rw-r--r--source/rpc_server/srv_samr_nt.c10
-rw-r--r--source/rpc_server/srv_spoolss_nt.c8
-rw-r--r--source/rpc_server/srv_util.c2
-rw-r--r--source/rpcclient/rpcclient.c6
-rw-r--r--source/smbd/close.c2
-rw-r--r--source/smbd/dosmode.c2
-rw-r--r--source/smbd/filename.c6
-rw-r--r--source/smbd/groupname.c2
-rw-r--r--source/smbd/lanman.c2
-rw-r--r--source/smbd/mangle.c24
-rw-r--r--source/smbd/nttrans.c4
-rw-r--r--source/smbd/open.c4
-rw-r--r--source/smbd/quotas.c2
-rw-r--r--source/smbd/reply.c32
-rw-r--r--source/smbd/server.c4
-rw-r--r--source/smbd/service.c2
-rw-r--r--source/smbd/statcache.c2
-rw-r--r--source/smbd/trans2.c6
-rw-r--r--source/smbd/uid.c2
-rw-r--r--source/smbd/vfs.c2
-rw-r--r--source/smbwrapper/smbsh.c2
-rw-r--r--source/smbwrapper/smbw.c4
-rw-r--r--source/torture/locktest.c4
-rw-r--r--source/torture/locktest2.c4
-rw-r--r--source/torture/masktest.c10
-rw-r--r--source/torture/rpctorture.c4
-rw-r--r--source/torture/torture.c4
-rw-r--r--source/utils/make_printerdef.c14
-rw-r--r--source/utils/nmblookup.c2
-rw-r--r--source/utils/pdbedit.c4
-rw-r--r--source/utils/rpccheck.c2
-rw-r--r--source/utils/smbcacls.c10
-rw-r--r--source/utils/smbpasswd.c6
-rw-r--r--source/utils/smbw_sample.c2
-rw-r--r--source/utils/testparm.c8
-rw-r--r--source/web/cgi.c24
78 files changed, 276 insertions, 278 deletions
diff --git a/source/client/client.c b/source/client/client.c
index ccbeb72e812..479c4f764f9 100644
--- a/source/client/client.c
+++ b/source/client/client.c
@@ -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);
diff --git a/source/client/clitar.c b/source/client/clitar.c
index 8f935da4e05..d28e652b35e 100644
--- a/source/client/clitar.c
+++ b/source/client/clitar.c
@@ -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();
}
diff --git a/source/client/smbmount.c b/source/client/smbmount.c
index 076be0ccb86..d0c18e6134b 100644
--- a/source/client/smbmount.c
+++ b/source/client/smbmount.c
@@ -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);
}
diff --git a/source/client/smbspool.c b/source/client/smbspool.c
index 1c85de11dd7..0c21399e967 100644
--- a/source/client/smbspool.c
+++ b/source/client/smbspool.c
@@ -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...
diff --git a/source/include/safe_string.h b/source/include/safe_string.h
index 3e379c48dfb..e609381a898 100644
--- a/source/include/safe_string.h
+++ b/source/include/safe_string.h
@@ -47,10 +47,8 @@
#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)
diff --git a/source/lib/access.c b/source/lib/access.c
index c32b0b7c6c0..99f3cc49b51 100644
--- a/source/lib/access.c
+++ b/source/lib/access.c
@@ -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));
diff --git a/source/lib/cmd_interp.c b/source/lib/cmd_interp.c
index ef6f94bd496..292f0e9e9ec 100644
--- a/source/lib/cmd_interp.c
+++ b/source/lib/cmd_interp.c
@@ -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));
}
}
diff --git a/source/lib/debug.c b/source/lib/debug.c
index 06092c6a356..27d5e55dc0f 100644
--- a/source/lib/debug.c
+++ b/source/lib/debug.c
@@ -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
diff --git a/source/lib/interface.c b/source/lib/interface.c
index e16afa45af0..269e0fa85be 100644
--- a/source/lib/interface.c
+++ b/source/lib/interface.c
@@ -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++) {
diff --git a/source/lib/substitute.c b/source/lib/substitute.c
index 25be4b030f7..7f597d37f20 100644
--- a/source/lib/substitute.c
+++ b/source/lib/substitute.c
@@ -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)) {
diff --git a/source/lib/system.c b/source/lib/system.c
index 8d4a872f14b..0799a855e81 100644
--- a/source/lib/system.c
+++ b/source/lib/system.c
@@ -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.
diff --git a/source/lib/username.c b/source/lib/username.c
index 3c99fc33d56..403a855f1a7 100644
--- a/source/lib/username.c
+++ b/source/lib/username.c
@@ -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);
diff --git a/source/lib/util.c b/source/lib/util.c
index a8ef69e5593..d220b2c5315 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -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 {
diff --git a/source/lib/util_file.c b/source/lib/util_file.c
index 7dc25a8dae2..01a8b1c3334 100644
--- a/source/lib/util_file.c
+++ b/source/lib/util_file.c
@@ -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"));
diff --git a/source/lib/util_sid.c b/source/lib/util_sid.c
index 70341507cb7..c89c7c70d97 100644
--- a/source/lib/util_sid.c
+++ b/source/lib/util_sid.c
@@ -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;
diff --git a/source/lib/util_sock.c b/source/lib/util_sock.c
index 01cff85f653..a55ef1a92e8 100644
--- a/source/lib/util_sock.c
+++ b/source/lib/util_sock.c
@@ -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;
diff --git a/source/lib/util_str.c b/source/lib/util_str.c
index 8ff3e23443a..736229c75f8 100644
--- a/source/lib/util_str.c
+++ b/source/lib/util_str.c
@@ -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)
diff --git a/source/libsmb/cliconnect.c b/source/libsmb/cliconnect.c
index 7ec06276827..9511a56e31c 100644
--- a/source/libsmb/cliconnect.c
+++ b/source/libsmb/cliconnect.c
@@ -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;
diff --git a/source/libsmb/libsmbclient.c b/source/libsmb/libsmbclient.c
index 10444a8ab9b..b9441746651 100644
--- a/source/libsmb/libsmbclient.c
+++ b/source/libsmb/libsmbclient.c
@@ -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;
}
diff --git a/source/libsmb/namequery.c b/source/libsmb/namequery.c
index 18bf6f4804e..c5c4d92c092 100644
--- a/source/libsmb/namequery.c
+++ b/source/libsmb/namequery.c
@@ -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;
diff --git a/source/libsmb/nmblib.c b/source/libsmb/nmblib.c
index d3b0e68aef8..9d7167f3054 100644
--- a/source/libsmb/nmblib.c
+++ b/source/libsmb/nmblib.c
@@ -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];
diff --git a/source/msdfs/msdfs.c b/source/msdfs/msdfs.c
index 92f6f1910da..2890b05b521 100644
--- a/source/msdfs/msdfs.c
+++ b/source/msdfs/msdfs.c
@@ -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 = '\\';
diff --git a/source/nmbd/nmbd.c b/source/nmbd/nmbd.c
index ca9d04d7681..8b771bc4524 100644
--- a/source/nmbd/nmbd.c
+++ b/source/nmbd/nmbd.c
@@ -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 );
diff --git a/source/nmbd/nmbd_sendannounce.c b/source/nmbd/nmbd_sendannounce.c
index eb5839253b0..32a6d339ded 100644
--- a/source/nmbd/nmbd_sendannounce.c
+++ b/source/nmbd/nmbd_sendannounce.c
@@ -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)
diff --git a/source/nmbd/nmbd_winsserver.c b/source/nmbd/nmbd_winsserver.c
index 296102fd99c..0ba1aef0574 100644
--- a/source/nmbd/nmbd_winsserver.c
+++ b/source/nmbd/nmbd_winsserver.c
@@ -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 ));
diff --git a/source/nsswitch/wb_client.c b/source/nsswitch/wb_client.c
index 2a29773b9ec..05c68d240c8 100644
--- a/source/nsswitch/wb_client.c
+++ b/source/nsswitch/wb_client.c
@@ -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);
}
diff --git a/source/nsswitch/wbinfo.c b/source/nsswitch/wbinfo.c
index 9d3568417f4..5ffd58b183c 100644
--- a/source/nsswitch/wbinfo.c
+++ b/source/nsswitch/wbinfo.c
@@ -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;
}
diff --git a/source/nsswitch/winbind_nss.c b/source/nsswitch/winbind_nss.c
index a2816bfdd3f..cbbc30b75c1 100644
--- a/source/nsswitch/winbind_nss.c
+++ b/source/nsswitch/winbind_nss.c
@@ -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 {
diff --git a/source/nsswitch/winbindd.c b/source/nsswitch/winbindd.c
index 4177d0219a5..9371078a79d 100644
--- a/source/nsswitch/winbindd.c
+++ b/source/nsswitch/winbindd.c
@@ -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;
}
diff --git a/source/nsswitch/winbindd_pam.c b/source/nsswitch/winbindd_pam.c
index 0cbc3166c8c..e69268fe2ab 100644
--- a/source/nsswitch/winbindd_pam.c
+++ b/source/nsswitch/winbindd_pam.c
@@ -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);
diff --git a/source/nsswitch/winbindd_util.c b/source/nsswitch/winbindd_util.c
index 4c7071d0633..39a2f78d5c4 100644
--- a/source/nsswitch/winbindd_util.c
+++ b/source/nsswitch/winbindd_util.c
@@ -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);
diff --git a/source/param/loadparm.c b/source/param/loadparm.c
index 4b89387abf0..da25d526a18 100644
--- a/source/param/loadparm.c
+++ b/source/param/loadparm.c
@@ -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++;
diff --git a/source/passdb/machine_sid.c b/source/passdb/machine_sid.c
index f714106b431..34b0c742087 100644
--- a/source/passdb/machine_sid.c
+++ b/source/passdb/machine_sid.c
@@ -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';
}
diff --git a/source/passdb/passdb.c b/source/passdb/passdb.c
index 580cae0240a..3bb49091e63 100644
--- a/source/passdb/passdb.c
+++ b/source/passdb/passdb.c
@@ -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)
{
diff --git a/source/passdb/pdb_smbpasswd.c b/source/passdb/pdb_smbpasswd.c
index 3679bd13194..dbb0d050c9d 100644
--- a/source/passdb/pdb_smbpasswd.c
+++ b/source/passdb/pdb_smbpasswd.c
@@ -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++;
diff --git a/source/printing/lpq_parse.c b/source/printing/lpq_parse.c
index a143709570b..90d84995958 100644
--- a/source/printing/lpq_parse.c
+++ b/source/printing/lpq_parse.c
@@ -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;
}
diff --git a/source/printing/nt_printing.c b/source/printing/nt_printing.c
index d099c29cc19..d742773d275 100644
--- a/source/printing/nt_printing.c
+++ b/source/printing/nt_printing.c
@@ -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;
}
diff --git a/source/printing/pcap.c b/source/printing/pcap.c
index 1f909d3533a..313e17fb1c5 100644
--- a/source/printing/pcap.c
+++ b/source/printing/pcap.c
@@ -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);
diff --git a/source/printing/print_generic.c b/source/printing/print_generic.c
index 3e5753583e7..bc9751a6539 100644
--- a/source/printing/print_generic.c
+++ b/source/printing/print_generic.c
@@ -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;
diff --git a/source/printing/print_svid.c b/source/printing/print_svid.c
index 301f3886719..22ddbe70b95 100644
--- a/source/printing/print_svid.c
+++ b/source/printing/print_svid.c
@@ -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 */
diff --git a/source/rpc_client/cli_spoolss.c b/source/rpc_client/cli_spoolss.c
index 2dd492364b7..c5b36fe2a57 100644
--- a/source/rpc_client/cli_spoolss.c
+++ b/source/rpc_client/cli_spoolss.c
@@ -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';
diff --git a/source/rpc_server/srv_dfs_nt.c b/source/rpc_server/srv_dfs_nt.c
index 54c3fbf324c..a84f2ceb48e 100644
--- a/source/rpc_server/srv_dfs_nt.c
+++ b/source/rpc_server/srv_dfs_nt.c
@@ -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));
diff --git a/source/rpc_server/srv_samr_nt.c b/source/rpc_server/srv_samr_nt.c
index d783de3b4bc..a73dcb30d2c 100644
--- a/source/rpc_server/srv_samr_nt.c
+++ b/source/rpc_server/srv_samr_nt.c
@@ -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;
}
diff --git a/source/rpc_server/srv_spoolss_nt.c b/source/rpc_server/srv_spoolss_nt.c
index 7002241a001..79c788e67bb 100644
--- a/source/rpc_server/srv_spoolss_nt.c
+++ b/source/rpc_server/srv_spoolss_nt.c
@@ -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;
diff --git a/source/rpc_server/srv_util.c b/source/rpc_server/srv_util.c
index deaa6008b9a..f9e02b9bca0 100644
--- a/source/rpc_server/srv_util.c
+++ b/source/rpc_server/srv_util.c
@@ -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;
diff --git a/source/rpcclient/rpcclient.c b/source/rpcclient/rpcclient.c
index 0d1b84f8492..6e4d60d208e 100644
--- a/source/rpcclient/rpcclient.c
+++ b/source/rpcclient/rpcclient.c
@@ -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;
}
diff --git a/source/smbd/close.c b/source/smbd/close.c
index dfbc2272e6c..6b72a8563a4 100644
--- a/source/smbd/close.c
+++ b/source/smbd/close.c
@@ -35,7 +35,7 @@ static void check_magic(files_struct *fsp,connection_struct *conn)
{
char *p;
- if (!(p = strrchr(fsp->fsp_name,'/')))
+ if (!(p = strrchr_m(fsp->fsp_name,'/')))
p = fsp->fsp_name;
else
p++;
diff --git a/source/smbd/dosmode.c b/source/smbd/dosmode.c
index 89e5b1586c7..639e365d1bc 100644
--- a/source/smbd/dosmode.c
+++ b/source/smbd/dosmode.c
@@ -149,7 +149,7 @@ int dos_mode(connection_struct *conn,char *path,SMB_STRUCT_STAT *sbuf)
/* hide files with a name starting with a . */
if (lp_hide_dot_files(SNUM(conn)))
{
- char *p = strrchr(path,'/');
+ char *p = strrchr_m(path,'/');
if (p)
p++;
else
diff --git a/source/smbd/filename.c b/source/smbd/filename.c
index 9b76d63dc6d..70f34c52ada 100644
--- a/source/smbd/filename.c
+++ b/source/smbd/filename.c
@@ -176,7 +176,7 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
*/
if(saved_last_component) {
- end = strrchr(name, '/');
+ end = strrchr_m(name, '/');
if(end)
pstrcpy(saved_last_component, end + 1);
else
@@ -243,7 +243,7 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
#if 0
/* Keep Andrew's conservative code around, just in case. JRA. */
/* this is an extremely conservative test for mangled names. */
- if (strchr(start,magic_char))
+ if (strchr_m(start,magic_char))
component_was_mangled = True;
#endif
@@ -261,7 +261,7 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
/*
* Pinpoint the end of this section of the filename.
*/
- end = strchr(start, '/');
+ end = strchr_m(start, '/');
/*
* Chop the name at this point.
diff --git a/source/smbd/groupname.c b/source/smbd/groupname.c
index d44e9a7a39c..0640d4d7b2a 100644
--- a/source/smbd/groupname.c
+++ b/source/smbd/groupname.c
@@ -125,7 +125,7 @@ void load_groupname_map(void)
DEBUG(10,("load_groupname_map: Read line |%s|\n", s));
- if (!*s || strchr("#;",*s))
+ if (!*s || strchr_m("#;",*s))
continue;
if(!next_token(&s,unixname, "\t\n\r=", sizeof(unixname)))
diff --git a/source/smbd/lanman.c b/source/smbd/lanman.c
index 2b71770b2e3..6e3145aa7d9 100644
--- a/source/smbd/lanman.c
+++ b/source/smbd/lanman.c
@@ -866,7 +866,7 @@ static BOOL api_DosPrintQGetInfo(connection_struct *conn,
str3 = p + 4;
/* remove any trailing username */
- if ((p = strchr(QueueName,'%'))) *p = 0;
+ if ((p = strchr_m(QueueName,'%'))) *p = 0;
DEBUG(3,("PrintQueue uLevel=%d name=%s\n",uLevel,QueueName));
diff --git a/source/smbd/mangle.c b/source/smbd/mangle.c
index 8df71d45571..16286a8bb1e 100644
--- a/source/smbd/mangle.c
+++ b/source/smbd/mangle.c
@@ -85,11 +85,11 @@ extern BOOL case_mangle; /* If true, all chars in 8.3 should be same case. */
*
* isbasecahr() - Given a character, check the chartest array to see
* if that character is in the basechars set. This is
- * faster than using strchr().
+ * faster than using strchr_m().
*
* isillegal() - Given a character, check the chartest array to see
* if that character is in the illegal characters set.
- * This is faster than using strchr().
+ * This is faster than using strchr_m().
*
* mangled_cache - Cache header used for storing mangled -> original
* reverse maps.
@@ -181,7 +181,7 @@ static BOOL is_reserved_msdos( char *fname )
StrnCpy (upperFname, fname, 12);
/* lpt1.txt and con.txt etc are also illegal */
- p = strchr(upperFname,'.');
+ p = strchr_m(upperFname,'.');
if( p )
*p = '\0';
@@ -287,14 +287,14 @@ BOOL is_mangled( char *s )
if( !ct_initialized )
init_chartest();
- magic = strchr( s, magic_char );
+ magic = strchr_m( s, magic_char );
while( magic && magic[1] && magic[2] ) /* 3 chars, 1st is magic. */
{
if( ('.' == magic[3] || '/' == magic[3] || !(magic[3])) /* Ends with '.' or nul or '/' ? */
&& isbasechar( toupper(magic[1]) ) /* is 2nd char basechar? */
&& isbasechar( toupper(magic[2]) ) ) /* is 3rd char basechar? */
return( True ); /* If all above, then true, */
- magic = strchr( magic+1, magic_char ); /* else seek next magic. */
+ magic = strchr_m( magic+1, magic_char ); /* else seek next magic. */
}
return( False );
} /* is_mangled */
@@ -318,7 +318,7 @@ BOOL is_8_3( char *fname, BOOL check_case )
int l;
char *p;
char *dot_pos;
- char *slash_pos = strrchr( fname, '/' );
+ char *slash_pos = strrchr_m( fname, '/' );
/* If there is a directory path, skip it. */
if( slash_pos )
@@ -389,7 +389,7 @@ BOOL is_8_3( char *fname, BOOL check_case )
/* see smb.conf(5) for a description of the 'strip dot' parameter. */
if( lp_strip_dot()
&& len - l == 1
- && !strchr( dot_pos + 1, '.' ) )
+ && !strchr_m( dot_pos + 1, '.' ) )
{
*dot_pos = 0;
return( True );
@@ -400,7 +400,7 @@ BOOL is_8_3( char *fname, BOOL check_case )
return( False );
/* extensions may not have a dot */
- if( strchr( dot_pos+1, '.' ) )
+ if( strchr_m( dot_pos+1, '.' ) )
return( False );
/* must be in 8.3 format */
@@ -537,8 +537,8 @@ static void cache_mangled_name( char *mangled_name, char *raw_name )
/* See if the extensions are unmangled. If so, store the entry
* without the extension, thus creating a "group" reverse map.
*/
- s1 = strrchr( mangled_name, '.' );
- if( s1 && (s2 = strrchr( raw_name, '.' )) )
+ s1 = strrchr_m( mangled_name, '.' );
+ if( s1 && (s2 = strrchr_m( raw_name, '.' )) )
{
i = 1;
while( s1[i] && (tolower( s1[1] ) == s2[i]) )
@@ -595,7 +595,7 @@ BOOL check_mangled_cache( char *s )
/* If we didn't find the name *with* the extension, try without. */
if( !FoundPtr )
{
- ext_start = strrchr( s, '.' );
+ ext_start = strrchr_m( s, '.' );
if( ext_start )
{
if((saved_ext = strdup(ext_start)) == NULL)
@@ -833,7 +833,7 @@ void mangle_name_83( char *s)
extension[0] = 0;
base[0] = 0;
- p = strrchr(s,'.');
+ p = strrchr_m(s,'.');
if( p && (strlen(p+1) < (size_t)4) )
{
BOOL all_normal = ( strisnormal(p+1) ); /* XXXXXXXXX */
diff --git a/source/smbd/nttrans.c b/source/smbd/nttrans.c
index ea37b14e5e5..a156748cf85 100644
--- a/source/smbd/nttrans.c
+++ b/source/smbd/nttrans.c
@@ -684,7 +684,7 @@ int reply_ntcreate_and_X(connection_struct *conn,
srvstr_pull(inbuf, fname, smb_buf(inbuf), sizeof(fname), -1, STR_TERMINATE);
- if( strchr(fname, ':')) {
+ if( strchr_m(fname, ':')) {
SSVAL(outbuf, smb_flg2, SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES);
END_PROFILE(SMBntcreateX);
return(ERROR(0, NT_STATUS_OBJECT_PATH_NOT_FOUND));
@@ -1190,7 +1190,7 @@ static int call_nt_transact_create(connection_struct *conn,
srvstr_pull(inbuf, fname, params+53, sizeof(fname), -1, STR_TERMINATE);
- if( strchr(fname, ':')) {
+ if( strchr_m(fname, ':')) {
SSVAL(outbuf, smb_flg2, SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES);
return(ERROR(0, NT_STATUS_OBJECT_PATH_NOT_FOUND));
}
diff --git a/source/smbd/open.c b/source/smbd/open.c
index 7c48e28138b..858a26191f9 100644
--- a/source/smbd/open.c
+++ b/source/smbd/open.c
@@ -42,7 +42,7 @@ static int fd_open(struct connection_struct *conn, char *fname,
/* Fix for files ending in '.' */
if((fd == -1) && (errno == ENOENT) &&
- (strchr(fname,'.')==NULL)) {
+ (strchr_m(fname,'.')==NULL)) {
pstrcat(fname,".");
fd = conn->vfs_ops.open(conn,fname,flags,mode);
}
@@ -245,7 +245,7 @@ return True if the filename is one of the special executable types
********************************************************************/
static BOOL is_executable(const char *fname)
{
- if ((fname = strrchr(fname,'.'))) {
+ if ((fname = strrchr_m(fname,'.'))) {
if (strequal(fname,".com") ||
strequal(fname,".dll") ||
strequal(fname,".exe") ||
diff --git a/source/smbd/quotas.c b/source/smbd/quotas.c
index caf3997ba80..5d82756f24c 100644
--- a/source/smbd/quotas.c
+++ b/source/smbd/quotas.c
@@ -330,7 +330,7 @@ static BOOL nfs_quotas(char *nfspath, uid_t euser_id, SMB_BIG_UINT *bsize, SMB_B
host = strncat(cutstr,mnttype, sizeof(char) * len );
DEBUG(5,("nfs_quotas: looking for mount on \"%s\"\n", cutstr));
DEBUG(5,("nfs_quotas: of path \"%s\"\n", mnttype));
- testpath=strchr(mnttype, ':');
+ testpath=strchr_m(mnttype, ':');
args.gqa_pathp = testpath+1;
args.gqa_uid = uid;
diff --git a/source/smbd/reply.c b/source/smbd/reply.c
index fe0f2862c68..a3310730933 100644
--- a/source/smbd/reply.c
+++ b/source/smbd/reply.c
@@ -198,13 +198,13 @@ int reply_tcon(connection_struct *conn,
p += srvstr_pull(inbuf, dev, p, sizeof(dev), -1, STR_TERMINATE) + 1;
*user = 0;
- p = strchr(service,'%');
+ p = strchr_m(service,'%');
if (p != NULL) {
*p = 0;
fstrcpy(user,p+1);
}
- p = strrchr(service,'\\');
+ p = strrchr_m(service,'\\');
if (p) {
pstrcpy(service, p+1);
}
@@ -288,13 +288,13 @@ int reply_tcon_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
passlen = strlen(password);
}
- q = strchr(path+2,'\\');
+ q = strchr_m(path+2,'\\');
if (!q) {
END_PROFILE(SMBtconX);
return(ERROR(ERRDOS,ERRnosuchshare));
}
fstrcpy(service,q+1);
- q = strchr(service,'%');
+ q = strchr_m(service,'%');
if (q) {
*q++ = 0;
fstrcpy(user,q);
@@ -1362,7 +1362,7 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
if (!check_name(directory,conn))
can_open = False;
- p = strrchr(dir2,'/');
+ p = strrchr_m(dir2,'/');
if (p == NULL)
{
pstrcpy(mask,dir2);
@@ -1374,7 +1374,7 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
pstrcpy(mask,p+1);
}
- p = strrchr(directory,'/');
+ p = strrchr_m(directory,'/');
if (!p)
*directory = 0;
else
@@ -1976,7 +1976,7 @@ int unlink_internals(connection_struct *conn, char *inbuf,char *outbuf,
rc = unix_convert(name,conn,0,&bad_path,&sbuf);
- p = strrchr(name,'/');
+ p = strrchr_m(name,'/');
if (!p) {
pstrcpy(directory,"./");
pstrcpy(mask,name);
@@ -3627,21 +3627,21 @@ static BOOL resolve_wildcards(char *name1,char *name2)
fstring ext1,ext2;
char *p,*p2;
- name1 = strrchr(name1,'/');
- name2 = strrchr(name2,'/');
+ name1 = strrchr_m(name1,'/');
+ name2 = strrchr_m(name2,'/');
if (!name1 || !name2) return(False);
fstrcpy(root1,name1);
fstrcpy(root2,name2);
- p = strrchr(root1,'.');
+ p = strrchr_m(root1,'.');
if (p) {
*p = 0;
fstrcpy(ext1,p+1);
} else {
fstrcpy(ext1,"");
}
- p = strrchr(root2,'.');
+ p = strrchr_m(root2,'.');
if (p) {
*p = 0;
fstrcpy(ext2,p+1);
@@ -3731,7 +3731,7 @@ int rename_internals(connection_struct *conn,
* as this is checked in resolve_wildcards().
*/
- p = strrchr(name,'/');
+ p = strrchr_m(name,'/');
if (!p) {
pstrcpy(directory,".");
pstrcpy(mask,name);
@@ -3767,7 +3767,7 @@ int rename_internals(connection_struct *conn,
pstrcat(directory,mask);
/* Ensure newname contains a '/' also */
- if(strrchr(newname,'/') == 0) {
+ if(strrchr_m(newname,'/') == 0) {
pstring tmpstr;
pstrcpy(tmpstr, "./");
@@ -3800,7 +3800,7 @@ int rename_internals(connection_struct *conn,
* Note that we guarantee that newname contains a '/'
* character above.
*/
- p = strrchr(newname,'/');
+ p = strrchr_m(newname,'/');
pstrcpy(newname_modified_last_component,p+1);
if(strcsequal(newname_modified_last_component,
@@ -3966,7 +3966,7 @@ static BOOL copy_file(char *src,char *dest1,connection_struct *conn, int ofun,
pstrcpy(dest,dest1);
if (target_is_directory) {
- char *p = strrchr(src,'/');
+ char *p = strrchr_m(src,'/');
if (p)
p++;
else
@@ -4091,7 +4091,7 @@ int reply_copy(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
return(ERROR(ERRSRV,ERRerror));
}
- p = strrchr(name,'/');
+ p = strrchr_m(name,'/');
if (!p) {
pstrcpy(directory,"./");
pstrcpy(mask,name);
diff --git a/source/smbd/server.c b/source/smbd/server.c
index 8d115d954cb..f753d615edb 100644
--- a/source/smbd/server.c
+++ b/source/smbd/server.c
@@ -389,7 +389,7 @@ static BOOL dump_core(void)
char *p;
pstring dname;
pstrcpy(dname,debugf);
- if ((p=strrchr(dname,'/'))) *p=0;
+ if ((p=strrchr_m(dname,'/'))) *p=0;
pstrcat(dname,"/corefiles");
mkdir(dname,0700);
sys_chown(dname,getuid(),getgid());
@@ -497,7 +497,7 @@ static void init_structs(void )
if (!*global_myname) {
char *p;
fstrcpy( global_myname, myhostname() );
- p = strchr( global_myname, '.' );
+ p = strchr_m( global_myname, '.' );
if (p)
*p = 0;
}
diff --git a/source/smbd/service.c b/source/smbd/service.c
index 836ef30f80c..04139be917b 100644
--- a/source/smbd/service.c
+++ b/source/smbd/service.c
@@ -102,7 +102,7 @@ int add_home_service(char *service, char *homedir)
fstrcpy(new_service, service);
- if ((usr_p = strchr(service,*lp_winbind_separator())) != NULL)
+ if ((usr_p = strchr_m(service,*lp_winbind_separator())) != NULL)
fstrcpy(new_service, usr_p+1);
lp_add_home(new_service,iHomeService,homedir);
diff --git a/source/smbd/statcache.c b/source/smbd/statcache.c
index 65a48300164..2e31e1252e0 100644
--- a/source/smbd/statcache.c
+++ b/source/smbd/statcache.c
@@ -174,7 +174,7 @@ BOOL stat_cache_lookup(connection_struct *conn, char *name, char *dirpath,
/*
* Didn't find it - remove last component for next try.
*/
- sp = strrchr(chk_name, '/');
+ sp = strrchr_m(chk_name, '/');
if (sp) {
*sp = '\0';
} else {
diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c
index f768a72c6d3..622b23c0b02 100644
--- a/source/smbd/trans2.c
+++ b/source/smbd/trans2.c
@@ -339,7 +339,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
if (!conn->dirptr)
return(False);
- p = strrchr(path_mask,'/');
+ p = strrchr_m(path_mask,'/');
if(p != NULL)
{
if(p[1] == '\0')
@@ -732,7 +732,7 @@ static int call_trans2findfirst(connection_struct *conn,
return(UNIXERROR(ERRDOS,ERRbadpath));
}
- p = strrchr(directory,'/');
+ p = strrchr_m(directory,'/');
if(p == NULL) {
pstrcpy(mask,directory);
pstrcpy(directory,"./");
@@ -1383,7 +1383,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
DEBUG(3,("call_trans2qfilepathinfo %s level=%d call=%d total_data=%d\n",
fname,info_level,tran_call,total_data));
- p = strrchr(fname,'/');
+ p = strrchr_m(fname,'/');
if (!p) {
base_name = fname;
} else {
diff --git a/source/smbd/uid.c b/source/smbd/uid.c
index da4c5383197..0070781d244 100644
--- a/source/smbd/uid.c
+++ b/source/smbd/uid.c
@@ -288,7 +288,7 @@ BOOL lookup_name(const char *name, DOM_SID *psid, enum SID_NAME_USE *name_type)
/* If we are looking up a domain user, make sure it is
for the local machine only */
- if (strchr(name, sep[0]) || strchr(name, '\\')) {
+ if (strchr_m(name, sep[0]) || strchr_m(name, '\\')) {
fstring domain, username;
split_domain_name(name, domain, username);
diff --git a/source/smbd/vfs.c b/source/smbd/vfs.c
index 747d393386a..71ebf9b506b 100644
--- a/source/smbd/vfs.c
+++ b/source/smbd/vfs.c
@@ -705,7 +705,7 @@ BOOL reduce_name(connection_struct *conn, char *s,char *dir,BOOL widelinks)
all_string_sub(s,"//","/",0);
pstrcpy(base_name,s);
- p = strrchr(base_name,'/');
+ p = strrchr_m(base_name,'/');
if (!p)
return(True);
diff --git a/source/smbwrapper/smbsh.c b/source/smbwrapper/smbsh.c
index c5007e187d4..37e29a94f9e 100644
--- a/source/smbwrapper/smbsh.c
+++ b/source/smbwrapper/smbsh.c
@@ -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);
diff --git a/source/smbwrapper/smbw.c b/source/smbwrapper/smbw.c
index fd7f2a0253c..dd78480f17d 100644
--- a/source/smbwrapper/smbw.c
+++ b/source/smbwrapper/smbw.c
@@ -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 */
diff --git a/source/torture/locktest.c b/source/torture/locktest.c
index 2eaa6057c65..f7f7c580aad 100644
--- a/source/torture/locktest.c
+++ b/source/torture/locktest.c
@@ -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);
diff --git a/source/torture/locktest2.c b/source/torture/locktest2.c
index 171386dec3a..37baa62b73f 100644
--- a/source/torture/locktest2.c
+++ b/source/torture/locktest2.c
@@ -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);
diff --git a/source/torture/masktest.c b/source/torture/masktest.c
index a10a4e954c9..0acdb0d95cc 100644
--- a/source/torture/masktest.c
+++ b/source/torture/masktest.c
@@ -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);
diff --git a/source/torture/rpctorture.c b/source/torture/rpctorture.c
index b42c315b1db..1708e9a860a 100644
--- a/source/torture/rpctorture.c
+++ b/source/torture/rpctorture.c
@@ -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;
}
diff --git a/source/torture/torture.c b/source/torture/torture.c
index a7c50fbfe0f..fcf48e0560a 100644
--- a/source/torture/torture.c
+++ b/source/torture/torture.c
@@ -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);
diff --git a/source/utils/make_printerdef.c b/source/utils/make_printerdef.c
index f403ee79bb6..5107b124a7b 100644
--- a/source/utils/make_printerdef.c
+++ b/source/utils/make_printerdef.c
@@ -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");
diff --git a/source/utils/nmblookup.c b/source/utils/nmblookup.c
index adb75e6104f..3e2f0610e6c 100644
--- a/source/utils/nmblookup.c
+++ b/source/utils/nmblookup.c
@@ -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);
diff --git a/source/utils/pdbedit.c b/source/utils/pdbedit.c
index 2b1dfe9f925..ec90e7ff1db 100644
--- a/source/utils/pdbedit.c
+++ b/source/utils/pdbedit.c
@@ -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;
diff --git a/source/utils/rpccheck.c b/source/utils/rpccheck.c
index f504463027c..1b00d528ac7 100644
--- a/source/utils/rpccheck.c
+++ b/source/utils/rpccheck.c
@@ -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");
diff --git a/source/utils/smbcacls.c b/source/utils/smbcacls.c
index 9edc35f8005..20333f772b4 100644
--- a/source/utils/smbcacls.c
+++ b/source/utils/smbcacls.c
@@ -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);
diff --git a/source/utils/smbpasswd.c b/source/utils/smbpasswd.c
index ebc588eb646..a10e7579109 100644
--- a/source/utils/smbpasswd.c
+++ b/source/utils/smbpasswd.c
@@ -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);
diff --git a/source/utils/smbw_sample.c b/source/utils/smbw_sample.c
index 7d6eb7f353d..6a8fbf116b1 100644
--- a/source/utils/smbw_sample.c
+++ b/source/utils/smbw_sample.c
@@ -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);
diff --git a/source/utils/testparm.c b/source/utils/testparm.c
index c9080e19940..9b19a6c0fdc 100644
--- a/source/utils/testparm.c
+++ b/source/utils/testparm.c
@@ -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) );
diff --git a/source/web/cgi.c b/source/web/cgi.c
index 07f84b2a61d..af9d2ea8f6d 100644
--- a/source/web/cgi.c
+++ b/source/web/cgi.c
@@ -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;
}