1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

lib/replace: We cannot use strchr_m in lib/replace

In any case, it is always safe to search for . even in a multibyte string.

Andrew Bartlett
This commit is contained in:
Andrew Bartlett 2012-06-01 14:07:42 +10:00
parent 954da1b81e
commit 664af060ac

View File

@ -55,7 +55,7 @@ ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t si
ssize_t retval;
int attrnamespace = (strncmp(name, "system", 6) == 0) ?
EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1;
/*
* The BSD implementation has a nasty habit of silently truncating
* the returned value to the size of the buffer, so we have to check
@ -111,7 +111,7 @@ ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size)
ssize_t retval;
int attrnamespace = (strncmp(name, "system", 6) == 0) ?
EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1;
if((retval=extattr_get_fd(filedes, attrnamespace, attrname, NULL, 0)) >= 0) {
if(retval > size) {
@ -385,7 +385,7 @@ int rep_removexattr (const char *path, const char *name)
char *s;
int attrnamespace = (strncmp(name, "system", 6) == 0) ?
EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1;
return extattr_delete_file(path, attrnamespace, attrname);
#elif defined(HAVE_ATTR_REMOVE)
@ -424,7 +424,7 @@ int rep_fremovexattr (int filedes, const char *name)
char *s;
int attrnamespace = (strncmp(name, "system", 6) == 0) ?
EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1;
return extattr_delete_fd(filedes, attrnamespace, attrname);
#elif defined(HAVE_ATTR_REMOVEF)
@ -464,7 +464,7 @@ int rep_setxattr (const char *path, const char *name, const void *value, size_t
int retval = 0;
int attrnamespace = (strncmp(name, "system", 6) == 0) ?
EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1;
if (flags) {
/* Check attribute existence */
retval = extattr_get_file(path, attrnamespace, attrname, NULL, 0);
@ -529,7 +529,7 @@ int rep_fsetxattr (int filedes, const char *name, const void *value, size_t size
int retval = 0;
int attrnamespace = (strncmp(name, "system", 6) == 0) ?
EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER;
const char *attrname = ((s=strchr_m(name, '.')) == NULL) ? name : s + 1;
const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1;
if (flags) {
/* Check attribute existence */
retval = extattr_get_fd(filedes, attrnamespace, attrname, NULL, 0);