svn commit: samba r16325 - in trunk/source/libads: .
jra at samba.org
jra at samba.org
Fri Jun 16 23:21:38 GMT 2006
Author: jra
Date: 2006-06-16 23:21:37 +0000 (Fri, 16 Jun 2006)
New Revision: 16325
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16325
Log:
Klocwork #499. Allways check results from alloc.
Jeremy.
Modified:
trunk/source/libads/ldap.c
Changeset:
Modified: trunk/source/libads/ldap.c
===================================================================
--- trunk/source/libads/ldap.c 2006-06-16 23:21:36 UTC (rev 16324)
+++ trunk/source/libads/ldap.c 2006-06-16 23:21:37 UTC (rev 16325)
@@ -1430,16 +1430,28 @@
if (!(host_spn = talloc_asprintf(ctx, "HOST/%s", my_fqdn))) {
talloc_destroy(ctx);
ads_msgfree(ads, res);
- return ADS_ERROR(LDAP_NO_SUCH_OBJECT);
+ return ADS_ERROR(LDAP_NO_MEMORY);
}
/* Add the extra principal */
psp1 = talloc_asprintf(ctx, "%s/%s", spn, machine_name);
+ if (!psp1) {
+ talloc_destroy(ctx);
+ ads_msgfree(ads, res);
+ return ADS_ERROR(LDAP_NO_MEMORY);
+ }
+
strupper_m(psp1);
strlower_m(&psp1[strlen(spn)]);
DEBUG(5,("ads_add_service_principal_name: INFO: Adding %s to host %s\n", psp1, machine_name));
servicePrincipalName[0] = psp1;
psp2 = talloc_asprintf(ctx, "%s/%s.%s", spn, machine_name, ads->config.realm);
+ if (!psp2) {
+ talloc_destroy(ctx);
+ ads_msgfree(ads, res);
+ return ADS_ERROR(LDAP_NO_MEMORY);
+ }
+
strupper_m(psp2);
strlower_m(&psp2[strlen(spn)]);
DEBUG(5,("ads_add_service_principal_name: INFO: Adding %s to host %s\n", psp2, machine_name));
@@ -1449,6 +1461,12 @@
* the KDC doesn't send "server principal unknown" errors to clients
* which use the DNS name in determining service principal names. */
psp3 = talloc_asprintf(ctx, "%s/%s", spn, my_fqdn);
+ if (!psp3) {
+ talloc_destroy(ctx);
+ ads_msgfree(ads, res);
+ return ADS_ERROR(LDAP_NO_MEMORY);
+ }
+
strupper_m(psp3);
strlower_m(&psp3[strlen(spn)]);
if (strcmp(psp2, psp3) != 0) {
More information about the samba-cvs
mailing list