summaryrefslogtreecommitdiff
path: root/source3/libads
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-08-08 15:35:28 -0700
committerJeremy Allison <jra@samba.org>2012-08-09 12:06:54 -0700
commit526e875cec15761099438e17df3f56bc2bd5b761 (patch)
tree8ad776c58b3a25b8739b03cdaf330c295bc570b7 /source3/libads
parente1ec86a49ce1d7c3ebe99fc175ffad70a03c4a0b (diff)
downloadsamba-526e875cec15761099438e17df3f56bc2bd5b761.tar.gz
samba-526e875cec15761099438e17df3f56bc2bd5b761.tar.bz2
samba-526e875cec15761099438e17df3f56bc2bd5b761.zip
Check error returns from strupper_m() (in all reasonable places).
Diffstat (limited to 'source3/libads')
-rw-r--r--source3/libads/kerberos.c4
-rw-r--r--source3/libads/kerberos_keytab.c5
-rw-r--r--source3/libads/ldap.c18
-rw-r--r--source3/libads/sasl.c13
4 files changed, 33 insertions, 7 deletions
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
index 7e95380011..80f99de482 100644
--- a/source3/libads/kerberos.c
+++ b/source3/libads/kerberos.c
@@ -861,7 +861,9 @@ bool create_local_private_krb5_conf_for_domain(const char *realm,
fname, realm, domain ));
realm_upper = talloc_strdup(fname, realm);
- strupper_m(realm_upper);
+ if (!strupper_m(realm_upper)) {
+ goto done;
+ }
kdc_ip_string = get_kdc_ip_string(dname, realm, sitename, pss, kdc_name);
if (!kdc_ip_string) {
diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c
index 0e23a6add3..eb2603b672 100644
--- a/source3/libads/kerberos_keytab.c
+++ b/source3/libads/kerberos_keytab.c
@@ -564,7 +564,10 @@ int ads_keytab_create_default(ADS_STRUCT *ads)
/* upper case the sAMAccountName to make it easier for apps to
know what case to use in the keytab file */
- strupper_m(sam_account_name);
+ if (!strupper_m(sam_account_name)) {
+ ret = -1;
+ goto done;
+ }
ret = ads_keytab_add_entry(ads, sam_account_name);
if (ret != 0) {
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 640a020a8b..fa88244598 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -298,7 +298,11 @@ static bool ads_try_connect(ADS_STRUCT *ads, const char *server, bool gc)
ads->config.flags = cldap_reply.server_type;
ads->config.ldap_server_name = SMB_STRDUP(cldap_reply.pdc_dns_name);
ads->config.realm = SMB_STRDUP(cldap_reply.dns_domain);
- strupper_m(ads->config.realm);
+ if (!strupper_m(ads->config.realm)) {
+ ret = false;
+ goto out;
+ }
+
ads->config.bind_path = ads_build_dn(ads->config.realm);
if (*cldap_reply.server_site) {
ads->config.server_site_name =
@@ -1945,7 +1949,11 @@ ADS_STATUS ads_add_service_principal_name(ADS_STRUCT *ads, const char *machine_n
ads_msgfree(ads, res);
return ADS_ERROR(LDAP_NO_MEMORY);
}
- strupper_m(psp1);
+ if (!strupper_m(psp1)) {
+ ret = ADS_ERROR(LDAP_NO_MEMORY);
+ goto out;
+ }
+
strlower_m(&psp1[strlen(spn)]);
servicePrincipalName[0] = psp1;
@@ -1959,7 +1967,11 @@ ADS_STATUS ads_add_service_principal_name(ADS_STRUCT *ads, const char *machine_n
ret = ADS_ERROR(LDAP_NO_MEMORY);
goto out;
}
- strupper_m(psp2);
+ if (!strupper_m(psp2)) {
+ ret = ADS_ERROR(LDAP_NO_MEMORY);
+ goto out;
+ }
+
strlower_m(&psp2[strlen(spn)]);
servicePrincipalName[1] = psp2;
diff --git a/source3/libads/sasl.c b/source3/libads/sasl.c
index ee3a693f71..a04ac9dd69 100644
--- a/source3/libads/sasl.c
+++ b/source3/libads/sasl.c
@@ -653,7 +653,12 @@ static ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads,
}
strlower_m(server);
- strupper_m(server_realm);
+ if (!strupper_m(server_realm)) {
+ SAFE_FREE(server);
+ SAFE_FREE(server_realm);
+ return ADS_ERROR(LDAP_NO_MEMORY);
+ }
+
if (asprintf(&princ, "ldap/%s@%s", server, server_realm) == -1) {
SAFE_FREE(server);
SAFE_FREE(server_realm);
@@ -679,7 +684,11 @@ static ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads,
}
strlower_m(server);
- strupper_m(server_realm);
+ if (!strupper_m(server_realm)) {
+ SAFE_FREE(server);
+ SAFE_FREE(server_realm);
+ return ADS_ERROR(LDAP_NO_MEMORY);
+ }
if (asprintf(&princ, "ldap/%s@%s", server, server_realm) == -1) {
SAFE_FREE(server);
SAFE_FREE(server_realm);