Author: vlendec Date: 2006-06-19 19:41:56 +0000 (Mon, 19 Jun 2006) New Revision: 16361
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16361 Log: Fix Klocwork ID 1731 1770 1771 1775 1796 Volker Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_ads.c branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c branches/SAMBA_3_0/source/nsswitch/winbindd_misc.c trunk/source/nsswitch/winbindd_ads.c trunk/source/nsswitch/winbindd_cache.c trunk/source/nsswitch/winbindd_cm.c trunk/source/nsswitch/winbindd_misc.c Changeset: Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_ads.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_ads.c 2006-06-19 19:07:39 UTC (rev 16360) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_ads.c 2006-06-19 19:41:56 UTC (rev 16361) @@ -904,7 +904,11 @@ members = NULL; num_members = 0; - attrs = TALLOC_ARRAY(mem_ctx, const char *, 3); + if ((attrs = TALLOC_ARRAY(mem_ctx, const char *, 3)) == NULL) { + status = NT_STATUS_NO_MEMORY; + goto done; + } + attrs[1] = talloc_strdup(mem_ctx, "usnChanged"); attrs[2] = NULL; Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2006-06-19 19:07:39 UTC (rev 16360) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2006-06-19 19:41:56 UTC (rev 16361) @@ -276,7 +276,7 @@ { char *sid_string; sid_string = centry_string(centry, mem_ctx); - if (!string_to_sid(sid, sid_string)) { + if ((sid_string == NULL) || (!string_to_sid(sid, sid_string))) { return False; } return True; @@ -2136,6 +2136,7 @@ if (!wcache->tdb) { DEBUG(0,("Failed to open winbindd_cache.tdb!\n")); + return; } tdb_traverse(wcache->tdb, traverse_fn_cleanup, NULL); Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c 2006-06-19 19:07:39 UTC (rev 16360) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c 2006-06-19 19:41:56 UTC (rev 16361) @@ -723,6 +723,9 @@ if ((num_dcnames == 0) || (num_dcnames != num_addrs)) return False; + if ((addrs == NULL) || (dcnames == NULL)) + return False; + if ( !open_any_socket_out(addrs, num_addrs, 10000, &fd_index, fd) ) { for (i=0; i<num_dcs; i++) { Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_misc.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_misc.c 2006-06-19 19:07:39 UTC (rev 16360) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_misc.c 2006-06-19 19:41:56 UTC (rev 16361) @@ -158,7 +158,10 @@ /* This is a bit excessive, but the extra data sooner or later will be talloc'ed */ - extra_data_len = strlen(extra_data); + extra_data_len = 0; + if (extra_data != NULL) { + extra_data_len = strlen(extra_data); + } if (extra_data_len > 0) { state->response.extra_data.data = SMB_STRDUP(extra_data); Modified: trunk/source/nsswitch/winbindd_ads.c =================================================================== --- trunk/source/nsswitch/winbindd_ads.c 2006-06-19 19:07:39 UTC (rev 16360) +++ trunk/source/nsswitch/winbindd_ads.c 2006-06-19 19:41:56 UTC (rev 16361) @@ -904,7 +904,11 @@ members = NULL; num_members = 0; - attrs = TALLOC_ARRAY(mem_ctx, const char *, 3); + if ((attrs = TALLOC_ARRAY(mem_ctx, const char *, 3)) == NULL) { + status = NT_STATUS_NO_MEMORY; + goto done; + } + attrs[1] = talloc_strdup(mem_ctx, "usnChanged"); attrs[2] = NULL; Modified: trunk/source/nsswitch/winbindd_cache.c =================================================================== --- trunk/source/nsswitch/winbindd_cache.c 2006-06-19 19:07:39 UTC (rev 16360) +++ trunk/source/nsswitch/winbindd_cache.c 2006-06-19 19:41:56 UTC (rev 16361) @@ -276,7 +276,7 @@ { char *sid_string; sid_string = centry_string(centry, mem_ctx); - if (!string_to_sid(sid, sid_string)) { + if ((sid_string == NULL) || (!string_to_sid(sid, sid_string))) { return False; } return True; @@ -2258,6 +2258,7 @@ if (!wcache->tdb) { DEBUG(0,("Failed to open winbindd_cache.tdb!\n")); + return; } tdb_traverse(wcache->tdb, traverse_fn_cleanup, NULL); Modified: trunk/source/nsswitch/winbindd_cm.c =================================================================== --- trunk/source/nsswitch/winbindd_cm.c 2006-06-19 19:07:39 UTC (rev 16360) +++ trunk/source/nsswitch/winbindd_cm.c 2006-06-19 19:41:56 UTC (rev 16361) @@ -723,6 +723,9 @@ if ((num_dcnames == 0) || (num_dcnames != num_addrs)) return False; + if ((addrs == NULL) || (dcnames == NULL)) + return False; + if ( !open_any_socket_out(addrs, num_addrs, 10000, &fd_index, fd) ) { for (i=0; i<num_dcs; i++) { Modified: trunk/source/nsswitch/winbindd_misc.c =================================================================== --- trunk/source/nsswitch/winbindd_misc.c 2006-06-19 19:07:39 UTC (rev 16360) +++ trunk/source/nsswitch/winbindd_misc.c 2006-06-19 19:41:56 UTC (rev 16361) @@ -158,7 +158,10 @@ /* This is a bit excessive, but the extra data sooner or later will be talloc'ed */ - extra_data_len = strlen(extra_data); + extra_data_len = 0; + if (extra_data != NULL) { + extra_data_len = strlen(extra_data); + } if (extra_data_len > 0) { state->response.extra_data.data = SMB_STRDUP(extra_data);