summaryrefslogtreecommitdiff
path: root/source3/lib/username.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/username.c')
-rw-r--r--source3/lib/username.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/source3/lib/username.c b/source3/lib/username.c
index 925b44bb06..665fbb4253 100644
--- a/source3/lib/username.c
+++ b/source3/lib/username.c
@@ -42,7 +42,7 @@ static struct passwd *getpwnam_alloc_cached(TALLOC_CTX *mem_ctx, const char *nam
return tcopy_passwd(mem_ctx, pw);
}
- pw = sys_getpwnam(name);
+ pw = getpwnam(name);
if (pw == NULL) {
return NULL;
}
@@ -92,7 +92,7 @@ char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user)
}
/****************************************************************************
- * A wrapper for sys_getpwnam(). The following variations are tried:
+ * A wrapper for getpwnam(). The following variations are tried:
* - as transmitted
* - in all lower case if this differs from transmitted
* - in all upper case if this differs from transmitted
@@ -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)
@@ -128,7 +132,10 @@ static struct passwd *Get_Pwnam_internals(TALLOC_CTX *mem_ctx,
}
/* Try as uppercase, if username wasn't originally uppercase */
- strupper_m(user2);
+ if (!strupper_m(user2)) {
+ goto done;
+ }
+
if(strcmp(user, user2) != 0) {
DEBUG(5,("Trying _Get_Pwnam(), username as uppercase is %s\n",
user2));
@@ -138,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,