summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authortodd stecher <todd.stecher@gmail.com>2009-02-09 13:25:59 -0800
committerSteven Danneman <steven.danneman@isilon.com>2009-02-10 14:43:14 -0800
commit9d4d2f70cbf83919a11c194c8234de269c5d91ee (patch)
treea8379f0ebb9a6d23f78109e1beb57541b279cbd2 /source3/utils
parentfdd282afa3e80712790c5bbac84bf4f88644692a (diff)
downloadsamba-9d4d2f70cbf83919a11c194c8234de269c5d91ee.tar.gz
samba-9d4d2f70cbf83919a11c194c8234de269c5d91ee.tar.bz2
samba-9d4d2f70cbf83919a11c194c8234de269c5d91ee.zip
S3: Fixes for coverity issues.
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_ads.c10
-rw-r--r--source3/utils/net_cache.c3
-rw-r--r--source3/utils/ntlm_auth.c5
3 files changed, 14 insertions, 4 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 86fb9f6782..58bbb70ce6 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -123,6 +123,7 @@ static int net_ads_cldap_netlogon(struct net_context *c, ADS_STRUCT *ads)
static int net_ads_lookup(struct net_context *c, int argc, const char **argv)
{
ADS_STRUCT *ads;
+ int ret;
if (c->display_usage) {
d_printf("Usage:\n"
@@ -133,6 +134,7 @@ static int net_ads_lookup(struct net_context *c, int argc, const char **argv)
if (!ADS_ERR_OK(ads_startup_nobind(c, false, &ads))) {
d_fprintf(stderr, "Didn't find the cldap server!\n");
+ ads_destroy(&ads);
return -1;
}
@@ -141,7 +143,9 @@ static int net_ads_lookup(struct net_context *c, int argc, const char **argv)
ads->ldap.port = 389;
}
- return net_ads_cldap_netlogon(c, ads);
+ ret = net_ads_cldap_netlogon(c, ads);
+ ads_destroy(&ads);
+ return ret;
}
@@ -166,6 +170,7 @@ static int net_ads_info(struct net_context *c, int argc, const char **argv)
if (!ads || !ads->config.realm) {
d_fprintf(stderr, "Didn't find the ldap server!\n");
+ ads_destroy(&ads);
return -1;
}
@@ -189,6 +194,7 @@ static int net_ads_info(struct net_context *c, int argc, const char **argv)
d_printf("KDC server: %s\n", ads->auth.kdc_server );
d_printf("Server time offset: %d\n", ads->auth.time_offset );
+ ads_destroy(&ads);
return 0;
}
@@ -383,6 +389,7 @@ static int net_ads_workgroup(struct net_context *c, int argc, const char **argv)
print_sockaddr(addr, sizeof(addr), &ads->ldap.ss);
if ( !ads_cldap_netlogon_5(talloc_tos(), addr, ads->server.realm, &reply ) ) {
d_fprintf(stderr, "CLDAP query failed!\n");
+ ads_destroy(&ads);
return -1;
}
@@ -1847,6 +1854,7 @@ static int net_ads_password(struct net_context *c, int argc, const char **argv)
if (!ads->config.realm) {
d_fprintf(stderr, "Didn't find the kerberos server!\n");
+ ads_destroy(&ads);
return -1;
}
diff --git a/source3/utils/net_cache.c b/source3/utils/net_cache.c
index cabb6d5280..5e7db38515 100644
--- a/source3/utils/net_cache.c
+++ b/source3/utils/net_cache.c
@@ -216,7 +216,7 @@ static int net_cache_del(struct net_context *c, int argc, const char **argv)
static int net_cache_get(struct net_context *c, int argc, const char **argv)
{
const char* keystr = argv[0];
- char* valuestr;
+ char* valuestr = NULL;
time_t timeout;
if (argc < 1 || c->display_usage) {
@@ -226,6 +226,7 @@ static int net_cache_get(struct net_context *c, int argc, const char **argv)
if (gencache_get(keystr, &valuestr, &timeout)) {
print_cache_entry(keystr, valuestr, timeout, NULL);
+ SAFE_FREE(valuestr);
return 0;
}
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index 8aa8e5e0f9..b94efc99cf 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -526,7 +526,7 @@ static NTSTATUS winbind_pw_check(struct ntlmssp_state *ntlmssp_state, DATA_BLOB
char *error_string;
uint8 lm_key[8];
uint8 user_sess_key[16];
- char *unix_name;
+ char *unix_name = NULL;
nt_status = contact_winbind_auth_crap(ntlmssp_state->user, ntlmssp_state->domain,
ntlmssp_state->workstation,
@@ -549,7 +549,6 @@ static NTSTATUS winbind_pw_check(struct ntlmssp_state *ntlmssp_state, DATA_BLOB
}
ntlmssp_state->auth_context = talloc_strdup(ntlmssp_state,
unix_name);
- SAFE_FREE(unix_name);
} else {
DEBUG(NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCESS_DENIED) ? 0 : 3,
("Login for user [%s]\\[%s]@[%s] failed due to [%s]\n",
@@ -558,6 +557,8 @@ static NTSTATUS winbind_pw_check(struct ntlmssp_state *ntlmssp_state, DATA_BLOB
error_string ? error_string : "unknown error (NULL)"));
ntlmssp_state->auth_context = NULL;
}
+
+ SAFE_FREE(unix_name);
return nt_status;
}