summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/afs.c4
-rw-r--r--source3/lib/substitute.c15
-rw-r--r--source3/lib/username.c11
-rw-r--r--source3/lib/util.c10
-rw-r--r--source3/lib/util_str.c9
5 files changed, 37 insertions, 12 deletions
diff --git a/source3/lib/afs.c b/source3/lib/afs.c
index 849e9ce55d..4b6e6ecaf3 100644
--- a/source3/lib/afs.c
+++ b/source3/lib/afs.c
@@ -259,7 +259,9 @@ bool afs_login(connection_struct *conn)
/* The pts command always generates completely lower-case user
* names. */
- strlower_m(afs_username);
+ if (!strlower_m(afs_username)) {
+ return false;
+ }
cell = strchr(afs_username, '@');
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c
index 44582860a1..a254bcaa7d 100644
--- a/source3/lib/substitute.c
+++ b/source3/lib/substitute.c
@@ -66,7 +66,10 @@ bool set_local_machine_name(const char *local_name, bool perm)
/* alpha_strcpy includes the space for the terminating nul. */
alpha_strcpy(local_machine,tmp_local_machine,
SAFE_NETBIOS_CHARS,len+1);
- strlower_m(local_machine);
+ if (!strlower_m(local_machine)) {
+ TALLOC_FREE(tmp_local_machine);
+ return false;
+ }
TALLOC_FREE(tmp_local_machine);
already_perm = perm;
@@ -118,7 +121,10 @@ bool set_remote_machine_name(const char *remote_name, bool perm)
/* alpha_strcpy includes the space for the terminating nul. */
alpha_strcpy(remote_machine,tmp_remote_machine,
SAFE_NETBIOS_CHARS,len+1);
- strlower_m(remote_machine);
+ if (!strlower_m(remote_machine)) {
+ TALLOC_FREE(tmp_remote_machine);
+ return false;
+ }
TALLOC_FREE(tmp_remote_machine);
already_perm = perm;
@@ -153,7 +159,10 @@ void sub_set_smb_name(const char *name)
return;
}
trim_char(tmp, ' ', ' ');
- strlower_m(tmp);
+ if (!strlower_m(tmp)) {
+ TALLOC_FREE(tmp);
+ return;
+ }
len = strlen(tmp);
diff --git a/source3/lib/username.c b/source3/lib/username.c
index 7435a59ac7..665fbb4253 100644
--- a/source3/lib/username.c
+++ b/source3/lib/username.c
@@ -112,7 +112,11 @@ static struct passwd *Get_Pwnam_internals(TALLOC_CTX *mem_ctx,
/* Try in all lower case first as this is the most
common case on UNIX systems */
- strlower_m(user2);
+ if (!strlower_m(user2)) {
+ DEBUG(5,("strlower_m %s failed\n", user2));
+ goto done;
+ }
+
DEBUG(5,("Trying _Get_Pwnam(), username as lowercase is %s\n",user2));
ret = getpwnam_alloc_cached(mem_ctx, user2);
if(ret)
@@ -141,7 +145,10 @@ static struct passwd *Get_Pwnam_internals(TALLOC_CTX *mem_ctx,
}
/* Try all combinations up to usernamelevel */
- strlower_m(user2);
+ if (!strlower_m(user2)) {
+ DEBUG(5,("strlower_m %s failed\n", user2));
+ goto done;
+ }
DEBUG(5,("Checking combinations of %d uppercase letters in %s\n",
lp_usernamelevel(), user2));
ret = uname_string_combinations(user2, mem_ctx, getpwnam_alloc_cached,
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 9c380c5a02..b8513f6b9f 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1892,8 +1892,14 @@ bool unix_wild_match(const char *pattern, const char *string)
TALLOC_FREE(ctx);
return false;
}
- strlower_m(p2);
- strlower_m(s2);
+ if (!strlower_m(p2)) {
+ TALLOC_FREE(ctx);
+ return false;
+ }
+ if (!strlower_m(s2)) {
+ TALLOC_FREE(ctx);
+ return false;
+ }
/* Remove any *? and ** from the pattern as they are meaningless */
for(p = p2; *p; p++) {
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 8962b23da0..c302851335 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -60,8 +60,7 @@ bool strnorm(char *s, int case_default)
if (case_default == CASE_UPPER)
return strupper_m(s);
else
- strlower_m(s);
- return true; /* FIXME - return strlower_m value later. */
+ return strlower_m(s);
}
/**
@@ -491,7 +490,6 @@ bool strlower_m(char *s)
/* Catch mb conversion errors that may not terminate. */
if (errno) {
s[len-1] = '\0';
- ret = false;
}
errno = errno_save;
return ret;
@@ -1033,7 +1031,10 @@ char *talloc_asprintf_strlower_m(TALLOC_CTX *t, const char *fmt, ...)
if (ret == NULL) {
return NULL;
}
- strlower_m(ret);
+ if (!strlower_m(ret)) {
+ TALLOC_FREE(ret);
+ return NULL;
+ }
return ret;
}