[SCM] Samba Shared Repository - branch v3-3-test updated -
release-3-2-0pre2-4734-gb37c96a
Jeremy Allison
jra at samba.org
Tue Dec 23 19:56:42 GMT 2008
The branch, v3-3-test has been updated
via b37c96a4fcf35ba2208078a53bf9484dcd31bd31 (commit)
from badf7dc63fe96930700e7ea04d6d6f66a7a8c1f3 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test
- Log -----------------------------------------------------------------
commit b37c96a4fcf35ba2208078a53bf9484dcd31bd31
Author: Jeremy Allison <jeremy at jeremy-desktop.(none)>
Date: Tue Dec 23 11:57:03 2008 -0800
More asprintf warning fixes.
Jeremy.
-----------------------------------------------------------------------
Summary of changes:
source/libads/ads_struct.c | 11 ++++++++---
source/libads/kerberos_keytab.c | 20 ++++++++++++++++----
source/libads/ldap_user.c | 5 ++++-
3 files changed, 28 insertions(+), 8 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/libads/ads_struct.c b/source/libads/ads_struct.c
index 8cc2f12..aef35ad 100644
--- a/source/libads/ads_struct.c
+++ b/source/libads/ads_struct.c
@@ -57,12 +57,17 @@ char *ads_build_path(const char *realm, const char *sep, const char *field, int
strlcat(ret, p, len);
while ((p=strtok_r(NULL, sep, &saveptr)) != NULL) {
- char *s;
+ int retval;
+ char *s = NULL;
if (reverse)
- asprintf(&s, "%s%s,%s", field, p, ret);
+ retval = asprintf(&s, "%s%s,%s", field, p, ret);
else
- asprintf(&s, "%s,%s%s", ret, field, p);
+ retval = asprintf(&s, "%s,%s%s", ret, field, p);
free(ret);
+ if (retval == -1) {
+ free(r);
+ return NULL;
+ }
ret = SMB_STRDUP(s);
free(s);
}
diff --git a/source/libads/kerberos_keytab.c b/source/libads/kerberos_keytab.c
index c4e6709..7c028cb 100644
--- a/source/libads/kerberos_keytab.c
+++ b/source/libads/kerberos_keytab.c
@@ -299,17 +299,29 @@ int ads_keytab_add_entry(ADS_STRUCT *ads, const char *srvPrinc)
if (strchr_m(srvPrinc, '@')) {
/* It's a fully-named principal. */
- asprintf(&princ_s, "%s", srvPrinc);
+ if (asprintf(&princ_s, "%s", srvPrinc) == -1) {
+ ret = -1;
+ goto out;
+ }
} else if (srvPrinc[strlen(srvPrinc)-1] == '$') {
/* It's the machine account, as used by smbclient clients. */
- asprintf(&princ_s, "%s@%s", srvPrinc, lp_realm());
+ if (asprintf(&princ_s, "%s@%s", srvPrinc, lp_realm()) == -1) {
+ ret = -1;
+ goto out;
+ }
} else {
/* It's a normal service principal. Add the SPN now so that we
* can obtain credentials for it and double-check the salt value
* used to generate the service's keys. */
- asprintf(&princ_s, "%s/%s@%s", srvPrinc, my_fqdn, lp_realm());
- asprintf(&short_princ_s, "%s/%s@%s", srvPrinc, machine_name, lp_realm());
+ if (asprintf(&princ_s, "%s/%s@%s", srvPrinc, my_fqdn, lp_realm()) == -1) {
+ ret = -1;
+ goto out;
+ }
+ if (asprintf(&short_princ_s, "%s/%s@%s", srvPrinc, machine_name, lp_realm()) == -1) {
+ ret = -1;
+ goto out;
+ }
/* According to http://support.microsoft.com/kb/326985/en-us,
certain principal names are automatically mapped to the host/...
diff --git a/source/libads/ldap_user.c b/source/libads/ldap_user.c
index bef2c91..eecd904 100644
--- a/source/libads/ldap_user.c
+++ b/source/libads/ldap_user.c
@@ -35,7 +35,10 @@
return ADS_ERROR(LDAP_NO_MEMORY);
}
- asprintf(&ldap_exp, "(samAccountName=%s)", escaped_user);
+ if (asprintf(&ldap_exp, "(samAccountName=%s)", escaped_user) == -1) {
+ SAFE_FREE(escaped_user);
+ return ADS_ERROR(LDAP_NO_MEMORY);
+ }
status = ads_search(ads, res, ldap_exp, attrs);
SAFE_FREE(ldap_exp);
SAFE_FREE(escaped_user);
--
Samba Shared Repository
More information about the samba-cvs
mailing list