summaryrefslogtreecommitdiff
path: root/source3/libads
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/libads
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/libads')
-rw-r--r--source3/libads/ads_struct.c6
-rw-r--r--source3/libads/kerberos.c2
-rw-r--r--source3/libads/ldap.c15
-rw-r--r--source3/libads/sasl.c14
4 files changed, 30 insertions, 7 deletions
diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c
index 285057ba53..45d00a39a3 100644
--- a/source3/libads/ads_struct.c
+++ b/source3/libads/ads_struct.c
@@ -108,7 +108,11 @@ char *ads_build_domain(const char *dn)
return NULL;
}
- strlower_m( dnsdomain );
+ if (!strlower_m( dnsdomain )) {
+ SAFE_FREE(dnsdomain);
+ return NULL;
+ }
+
all_string_sub( dnsdomain, "dc=", "", 0);
all_string_sub( dnsdomain, ",", ".", 0 );
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
index 80f99de482..1093d12c2c 100644
--- a/source3/libads/kerberos.c
+++ b/source3/libads/kerberos.c
@@ -356,7 +356,7 @@ char* kerberos_standard_des_salt( void )
fstring salt;
fstr_sprintf( salt, "host/%s.%s@", lp_netbios_name(), lp_realm() );
- strlower_m( salt );
+ (void)strlower_m( salt );
fstrcat( salt, lp_realm() );
return SMB_STRDUP( salt );
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index fa88244598..946c1a36a7 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -1954,7 +1954,10 @@ ADS_STATUS ads_add_service_principal_name(ADS_STRUCT *ads, const char *machine_n
goto out;
}
- strlower_m(&psp1[strlen(spn)]);
+ if (!strlower_m(&psp1[strlen(spn)])) {
+ ret = ADS_ERROR(LDAP_NO_MEMORY);
+ goto out;
+ }
servicePrincipalName[0] = psp1;
DEBUG(5,("ads_add_service_principal_name: INFO: Adding %s to host %s\n",
@@ -1972,7 +1975,10 @@ ADS_STATUS ads_add_service_principal_name(ADS_STRUCT *ads, const char *machine_n
goto out;
}
- strlower_m(&psp2[strlen(spn)]);
+ if (!strlower_m(&psp2[strlen(spn)])) {
+ ret = ADS_ERROR(LDAP_NO_MEMORY);
+ goto out;
+ }
servicePrincipalName[1] = psp2;
DEBUG(5,("ads_add_service_principal_name: INFO: Adding %s to host %s\n",
@@ -3468,7 +3474,10 @@ ADS_STATUS ads_leave_realm(ADS_STRUCT *ads, const char *hostname)
/* hostname must be lowercase */
host = SMB_STRDUP(hostname);
- strlower_m(host);
+ if (!strlower_m(host)) {
+ SAFE_FREE(host);
+ return ADS_ERROR_SYSTEM(EINVAL);
+ }
status = ads_find_machine_acct(ads, &res, host);
if (!ADS_ERR_OK(status)) {
diff --git a/source3/libads/sasl.c b/source3/libads/sasl.c
index a04ac9dd69..438db05df8 100644
--- a/source3/libads/sasl.c
+++ b/source3/libads/sasl.c
@@ -652,7 +652,12 @@ static ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads,
return ADS_ERROR(LDAP_NO_MEMORY);
}
- strlower_m(server);
+ if (!strlower_m(server)) {
+ SAFE_FREE(server);
+ SAFE_FREE(server_realm);
+ return ADS_ERROR(LDAP_NO_MEMORY);
+ }
+
if (!strupper_m(server_realm)) {
SAFE_FREE(server);
SAFE_FREE(server_realm);
@@ -683,7 +688,12 @@ static ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads,
return ADS_ERROR(LDAP_NO_MEMORY);
}
- strlower_m(server);
+ if (!strlower_m(server)) {
+ SAFE_FREE(server);
+ SAFE_FREE(server_realm);
+ return ADS_ERROR(LDAP_NO_MEMORY);
+ }
+
if (!strupper_m(server_realm)) {
SAFE_FREE(server);
SAFE_FREE(server_realm);