summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-08-08 17:01:00 -0700
committerJeremy Allison <jra@samba.org>2012-08-09 12:08:18 -0700
commitb70f23c2b581c5d455362ab37f4846de9a910055 (patch)
treecf95e8d35a03d1e39d5926d2e03d7046d42cae64 /source3/passdb
parentce21d0804012da27cec72abe896352d7f0e7e1e5 (diff)
downloadsamba-b70f23c2b581c5d455362ab37f4846de9a910055.tar.gz
samba-b70f23c2b581c5d455362ab37f4846de9a910055.tar.bz2
samba-b70f23c2b581c5d455362ab37f4846de9a910055.zip
Correctly check for errors in strlower_m() returns.
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/pdb_interface.c8
-rw-r--r--source3/passdb/pdb_ipa.c4
-rw-r--r--source3/passdb/pdb_ldap.c9
-rw-r--r--source3/passdb/pdb_tdb.c28
4 files changed, 37 insertions, 12 deletions
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 7a73fbfacf..cdbb378e94 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -472,7 +472,9 @@ static NTSTATUS pdb_default_create_user(struct pdb_methods *methods,
/* lowercase the username before creating the Unix account for
compatibility with previous Samba releases */
fstrcpy( name2, name );
- strlower_m( name2 );
+ if (!strlower_m( name2 )) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
add_script = talloc_all_string_sub(tmp_ctx,
add_script,
"%u",
@@ -598,7 +600,9 @@ static NTSTATUS pdb_default_delete_user(struct pdb_methods *methods,
external scripts */
fstrcpy( username, pdb_get_username(sam_acct) );
- strlower_m( username );
+ if (!strlower_m( username )) {
+ return status;
+ }
smb_delete_user( username );
diff --git a/source3/passdb/pdb_ipa.c b/source3/passdb/pdb_ipa.c
index bbd3339f2f..c0eb48d448 100644
--- a/source3/passdb/pdb_ipa.c
+++ b/source3/passdb/pdb_ipa.c
@@ -787,7 +787,9 @@ static struct pdb_domain_info *pdb_ipasam_get_domain_info(struct pdb_methods *pd
if (info->dns_domain == NULL) {
goto fail;
}
- strlower_m(info->dns_domain);
+ if (!strlower_m(info->dns_domain)) {
+ goto fail;
+ }
info->dns_forest = talloc_strdup(info, info->dns_domain);
/* we expect a domain SID to have 4 sub IDs */
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 56225a2965..9b4d8a6a4d 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -2015,9 +2015,14 @@ static NTSTATUS ldapsam_rename_sam_account(struct pdb_methods *my_methods,
posix name but preserve the case in passdb */
fstrcpy( oldname_lower, oldname );
- strlower_m( oldname_lower );
+ if (!strlower_m( oldname_lower )) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
fstrcpy( newname_lower, newname );
- strlower_m( newname_lower );
+ if (!strlower_m( newname_lower )) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
rename_script = realloc_string_sub2(rename_script,
"%unew",
newname_lower,
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 1295862303..bd6e123e31 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -572,7 +572,9 @@ static NTSTATUS tdbsam_getsampwnam (struct pdb_methods *my_methods,
/* Data is stored in all lower-case */
fstrcpy(name, sname);
- strlower_m(name);
+ if (!strlower_m(name)) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
/* set search key */
slprintf(keystr, sizeof(keystr)-1, "%s%s", USERPREFIX, name);
@@ -668,7 +670,9 @@ static bool tdb_delete_samacct_only( struct samu *sam_pass )
NTSTATUS status;
fstrcpy(name, pdb_get_username(sam_pass));
- strlower_m(name);
+ if (!strlower_m(name)) {
+ return false;
+ }
/* set the search key */
@@ -712,7 +716,9 @@ static NTSTATUS tdbsam_delete_sam_account(struct pdb_methods *my_methods,
}
fstrcpy(name, pdb_get_username(sam_pass));
- strlower_m(name);
+ if (!strlower_m(name)) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
/* set the search key */
@@ -785,7 +791,9 @@ static bool tdb_update_samacct_only( struct samu* newpwd, int flag )
data.dptr = buf;
fstrcpy(name, pdb_get_username(newpwd));
- strlower_m(name);
+ if (!strlower_m(name)) {
+ goto done;
+ }
DEBUG(5, ("Storing %saccount %s with RID %d\n",
flag == TDB_INSERT ? "(new) " : "", name,
@@ -823,7 +831,9 @@ static bool tdb_update_ridrec_only( struct samu* newpwd, int flag )
NTSTATUS status;
fstrcpy(name, pdb_get_username(newpwd));
- strlower_m(name);
+ if (!strlower_m(name)) {
+ return false;
+ }
/* setup RID data */
data = string_term_tdb_data(name);
@@ -1032,10 +1042,14 @@ static NTSTATUS tdbsam_rename_sam_account(struct pdb_methods *my_methods,
so that we lower case the posix name but preserve the case in passdb */
fstrcpy( oldname_lower, pdb_get_username(old_acct) );
- strlower_m( oldname_lower );
+ if (!strlower_m( oldname_lower )) {
+ goto cancel;
+ }
fstrcpy( newname_lower, newname );
- strlower_m( newname_lower );
+ if (!strlower_m( newname_lower )) {
+ goto cancel;
+ }
rename_script = talloc_string_sub2(new_acct,
rename_script,