[SSSD] [PATCH] initialize sockaddr_in structure
Sumit Bose
sbose at redhat.com
Tue Sep 8 09:12:24 UTC 2009
Hi,
valgrind told me that the sockaddr_in structure might be used
uninitialized. This patch fixes this and adds some debugging messages I
found useful to follow the usage of the plugin.
bye,
Sumit
-------------- next part --------------
>From be17f8cefb0b2485fde334d60eddd3dababa1fb1 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Tue, 8 Sep 2009 10:56:33 +0200
Subject: [PATCH] initialize sockaddr_in structure
---
server/krb5_plugin/sssd_krb5_locator_plugin.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/server/krb5_plugin/sssd_krb5_locator_plugin.c b/server/krb5_plugin/sssd_krb5_locator_plugin.c
index 699cad4..62f5f72 100644
--- a/server/krb5_plugin/sssd_krb5_locator_plugin.c
+++ b/server/krb5_plugin/sssd_krb5_locator_plugin.c
@@ -21,6 +21,10 @@ krb5_error_code sssd_krb5_locator_init(krb5_context context,
struct sssd_ctx *ctx;
char *dummy;
+#ifdef KRB5_PLUGIN_DEBUG
+ fprintf(stderr,"sssd_krb5_locator_init called\n");
+#endif
+
ctx = calloc(1,sizeof(struct sssd_ctx));
if (ctx == NULL) return ENOMEM;
@@ -51,6 +55,10 @@ void sssd_krb5_locator_close(void *private_data)
{
struct sssd_ctx *ctx;
+#ifdef KRB5_PLUGIN_DEBUG
+ fprintf(stderr,"sssd_krb5_locator_close called\n");
+#endif
+
if (private_data == NULL) return;
ctx = (struct sssd_ctx *) private_data;
@@ -73,6 +81,8 @@ krb5_error_code sssd_krb5_locator_lookup(void *private_data,
struct sockaddr_in addr;
struct sssd_ctx *ctx;
+ memset(&addr, 0, sizeof(struct sockaddr_in));
+
if (private_data == NULL) return KRB5_PLUGIN_NO_HANDLE;
ctx = (struct sssd_ctx *) private_data;
--
1.6.2.5
More information about the sssd-devel
mailing list