diff options
author | Jeremy Allison <jra@samba.org> | 2012-08-08 15:49:34 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2012-08-09 12:07:32 -0700 |
commit | c13887defc4c05b6b87f8f40ae0cf981a497f443 (patch) | |
tree | 45750aebc286cdbf0e9457c844517096e74d9163 /source3 | |
parent | 526e875cec15761099438e17df3f56bc2bd5b761 (diff) | |
download | samba-c13887defc4c05b6b87f8f40ae0cf981a497f443.tar.gz samba-c13887defc4c05b6b87f8f40ae0cf981a497f443.tar.bz2 samba-c13887defc4c05b6b87f8f40ae0cf981a497f443.zip |
Check error returns on strnorm().
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 2 | ||||
-rw-r--r-- | source3/lib/util_str.c | 5 | ||||
-rw-r--r-- | source3/modules/vfs_prealloc.c | 4 | ||||
-rw-r--r-- | source3/smbd/filename.c | 15 |
4 files changed, 19 insertions, 7 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index bdb20bf8ff..bfb9b37fd5 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -662,7 +662,7 @@ ssize_t tstream_read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize); bool strnequal(const char *s1,const char *s2,size_t n); bool strcsequal(const char *s1,const char *s2); -void strnorm(char *s, int case_default); +bool strnorm(char *s, int case_default); char *push_skip_string(char *buf); char *skip_string(const char *base, size_t len, char *buf); size_t str_charnum(const char *s); diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index b740de6659..446838a0b9 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -55,12 +55,13 @@ bool strnequal(const char *s1,const char *s2,size_t n) Convert a string to "normal" form. **/ -void strnorm(char *s, int case_default) +bool strnorm(char *s, int case_default) { if (case_default == CASE_UPPER) - (void)strupper_m(s); /* FIXME - return a bool here. */ + return strupper_m(s); else strlower_m(s); + return true; /* FIXME - return strlower_m value later. */ } /** diff --git a/source3/modules/vfs_prealloc.c b/source3/modules/vfs_prealloc.c index f67cefbe2f..4ba27a6c85 100644 --- a/source3/modules/vfs_prealloc.c +++ b/source3/modules/vfs_prealloc.c @@ -139,7 +139,9 @@ static int prealloc_open(vfs_handle_struct* handle, if (dot && *++dot) { if (strlen(dot) < sizeof(fext)) { strncpy(fext, dot, sizeof(fext)); - strnorm(fext, CASE_LOWER); + if (!strnorm(fext, CASE_LOWER)) { + goto normal_open; + } } } diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index a4f9cd1bf6..0be566f897 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -323,7 +323,11 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, if (conn->case_sensitive && !conn->case_preserve && !conn->short_case_preserve) { - strnorm(smb_fname->base_name, lp_defaultcase(SNUM(conn))); + if (!strnorm(smb_fname->base_name, lp_defaultcase(SNUM(conn)))) { + DEBUG(0, ("strnorm %s failed\n", smb_fname->base_name)); + status = NT_STATUS_INVALID_PARAMETER; + goto err; + } } /* @@ -740,8 +744,13 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, (mangle_is_8_3(start, False, conn->params) && !conn->short_case_preserve)) { - strnorm(start, - lp_defaultcase(SNUM(conn))); + if (!strnorm(start, + lp_defaultcase(SNUM(conn)))) { + DEBUG(0, ("strnorm %s failed\n", + start)); + status = NT_STATUS_INVALID_PARAMETER; + goto err; + } } /* |