summaryrefslogtreecommitdiff
path: root/source3/libads
diff options
context:
space:
mode:
authorMarc VanHeyningen <marc.vanheyningen@isilon.com>2008-03-14 14:26:28 -0800
committerVolker Lendecke <vl@samba.org>2008-03-17 20:52:25 +0100
commite06aa46b9fab1e107fea8f6453fb13deffa91e96 (patch)
treedb972999f1b17db3e6b100fec70b5f4643632172 /source3/libads
parent6274929b1e1ddf89f4c5e93414121eaf06b6ab14 (diff)
downloadsamba-e06aa46b9fab1e107fea8f6453fb13deffa91e96.tar.gz
samba-e06aa46b9fab1e107fea8f6453fb13deffa91e96.tar.bz2
samba-e06aa46b9fab1e107fea8f6453fb13deffa91e96.zip
Coverity fixes
(This used to be commit 3fc85d22590550f0539215d020e4411bf5b14363)
Diffstat (limited to 'source3/libads')
-rw-r--r--source3/libads/kerberos.c6
-rw-r--r--source3/libads/krb5_setpw.c17
-rw-r--r--source3/libads/ldap.c5
3 files changed, 22 insertions, 6 deletions
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
index ee25fb5551..66f203b12d 100644
--- a/source3/libads/kerberos.c
+++ b/source3/libads/kerberos.c
@@ -606,9 +606,11 @@ bool kerberos_secrets_store_salting_principal(const char *service,
krb5_principal princ = NULL;
char *princ_s = NULL;
char *unparsed_name = NULL;
+ krb5_error_code code;
- krb5_init_context(&context);
- if (!context) {
+ if (((code = krb5_init_context(&context)) != 0) || (context == NULL)) {
+ DEBUG(5, ("kerberos_secrets_store_salting_pricipal: kdb5_init_context failed: %s\n",
+ error_message(code)));
return False;
}
if (strchr_m(service, '@')) {
diff --git a/source3/libads/krb5_setpw.c b/source3/libads/krb5_setpw.c
index 852251a476..719f3bd3ec 100644
--- a/source3/libads/krb5_setpw.c
+++ b/source3/libads/krb5_setpw.c
@@ -438,10 +438,21 @@ static ADS_STATUS do_krb5_kpasswd_request(krb5_context context,
return ADS_ERROR_SYSTEM(rc);
}
addr_len = sizeof(remote_addr);
- getpeername(sock, (struct sockaddr *)&remote_addr, &addr_len);
+ if (getpeername(sock, (struct sockaddr *)&remote_addr, &addr_len) != 0) {
+ close(sock);
+ SAFE_FREE(ap_req.data);
+ krb5_auth_con_free(context, auth_context);
+ DEBUG(1,("getpeername() failed (%s)\n", error_message(errno)));
+ return ADS_ERROR_SYSTEM(errno);
+ }
addr_len = sizeof(local_addr);
- getsockname(sock, (struct sockaddr *)&local_addr, &addr_len);
-
+ if (getsockname(sock, (struct sockaddr *)&local_addr, &addr_len) != 0) {
+ close(sock);
+ SAFE_FREE(ap_req.data);
+ krb5_auth_con_free(context, auth_context);
+ DEBUG(1,("getsockname() failed (%s)\n", error_message(errno)));
+ return ADS_ERROR_SYSTEM(errno);
+ }
if (!setup_kaddr(&remote_kaddr, &remote_addr) ||
!setup_kaddr(&local_kaddr, &local_addr)) {
DEBUG(1,("do_krb5_kpasswd_request: "
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index d6b9ba622b..9ec06e5a1d 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -588,7 +588,10 @@ static char **ads_push_strvals(TALLOC_CTX *ctx, const char **in_vals)
if (!values) return NULL;
for (i=0; in_vals[i]; i++) {
- push_utf8_talloc(ctx, &values[i], in_vals[i]);
+ if (push_utf8_talloc(ctx, &values[i], in_vals[i]) == (size_t) -1) {
+ TALLOC_FREE(values);
+ return NULL;
+ }
}
return values;
}