>From 156e0e54b7ccc3ba58f14132581d977d29cacacb Mon Sep 17 00:00:00 2001
From: Nick Guay <nguay@redhat.com>
Date: Tue, 17 Jul 2012 17:15:49 -0400
Subject: [PATCH] Fix uninitialized values

https://fedorahosted.org/sssd/ticket/1379
---
 src/db/sysdb_selinux.c                     |    4 ++--
 src/db/sysdb_sudo.c                        |    2 +-
 src/providers/ipa/ipa_session.c            |    8 ++++----
 src/providers/krb5/krb5_child_handler.c    |    2 +-
 src/providers/krb5/krb5_utils.c            |    2 +-
 src/providers/ldap/sdap_async_connection.c |    2 +-
 src/providers/ldap/sdap_async_sudo.c       |    2 +-
 src/responder/nss/nsssrv_services.c        |    2 +-
 src/responder/pam/pamsrv_cmd.c             |    2 +-
 src/responder/sudo/sudosrv_dp.c            |    2 +-
 src/sss_client/common.c                    |    2 +-
 11 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/db/sysdb_selinux.c b/src/db/sysdb_selinux.c
index e9f2da11ba476f7bd081935dcd4041104daff981..fe5827a18cfc8127c22917924ff8426a27042792 100644
--- a/src/db/sysdb_selinux.c
+++ b/src/db/sysdb_selinux.c
@@ -126,10 +126,10 @@ static errno_t sysdb_store_selinux_entity(struct sysdb_ctx *sysdb,
     struct ldb_message *msg;
     struct ldb_message *rm_msg;
     bool in_transaction = false;
-    const char *objectclass;
+    const char *objectclass = NULL;
     const char *name;
     char *clean_name;
-    struct ldb_dn *dn;
+    struct ldb_dn *dn = NULL;
     errno_t sret = EOK;
     errno_t ret;
     time_t now;
diff --git a/src/db/sysdb_sudo.c b/src/db/sysdb_sudo.c
index be7df651252ee448638254c7f6dc48d50526c2d3..be101d8b335ec472e7b71ae9beacc76878434d67 100644
--- a/src/db/sysdb_sudo.c
+++ b/src/db/sysdb_sudo.c
@@ -294,7 +294,7 @@ sysdb_get_sudo_user_info(TALLOC_CTX *mem_ctx, const char *username,
     struct ldb_message *msg;
     char **sysdb_groupnames = NULL;
     struct ldb_message_element *groups;
-    uid_t uid;
+    uid_t uid = 0;
     int i;
 
     tmp_ctx = talloc_new(NULL);
diff --git a/src/providers/ipa/ipa_session.c b/src/providers/ipa/ipa_session.c
index 238acdde776520dbb69046b8d45ecac4569e5cbc..dfd1a49bcf14cf9d793e1d75b63df97a8ba107fe 100644
--- a/src/providers/ipa/ipa_session.c
+++ b/src/providers/ipa/ipa_session.c
@@ -100,12 +100,12 @@ static void ipa_session_handler_done(struct tevent_req *req)
     struct be_req *breq = tevent_req_callback_data(req, struct be_req);
     struct sysdb_ctx *sysdb = breq->be_ctx->sysdb;
     errno_t ret, sret;
-    size_t map_count;
-    struct sysdb_attrs **maps;
+    size_t map_count = 0;
+    struct sysdb_attrs **maps = NULL;
     bool in_transaction = false;
-    char *default_user;
+    char *default_user = NULL;
     struct pam_data *pd = talloc_get_type(breq->req_data, struct pam_data);
-    char *map_order;
+    char *map_order = NULL;
 
     ret = ipa_get_selinux_recv(req, breq, &map_count, &maps,
                                &default_user, &map_order);
diff --git a/src/providers/krb5/krb5_child_handler.c b/src/providers/krb5/krb5_child_handler.c
index 0526ff019f2ced739cea6154e048aa0c45e16e6a..768d8c7dce1a8dd20b471f6abb51b16d2da4563b 100644
--- a/src/providers/krb5/krb5_child_handler.c
+++ b/src/providers/krb5/krb5_child_handler.c
@@ -92,7 +92,7 @@ static errno_t create_send_buffer(struct krb5child_req *kr,
     size_t rp;
     const char *keytab;
     uint32_t validate;
-    size_t username_len;
+    size_t username_len = 0;
 
     keytab = dp_opt_get_cstring(kr->krb5_ctx->opts, KRB5_KEYTAB);
     if (keytab == NULL) {
diff --git a/src/providers/krb5/krb5_utils.c b/src/providers/krb5/krb5_utils.c
index ceadcd582fefbd58b41ffae1e303fddd4403c141..f92a2cc6d4c1ef7167a2d4f05117e42fca579046 100644
--- a/src/providers/krb5/krb5_utils.c
+++ b/src/providers/krb5/krb5_utils.c
@@ -578,7 +578,7 @@ done:
 struct sss_krb5_cc_be *
 get_cc_be_ops(enum sss_krb5_cc_type type)
 {
-    struct sss_krb5_cc_be *be;
+    struct sss_krb5_cc_be *be = NULL;
 
     switch (type) {
         case SSS_KRB5_TYPE_FILE:
diff --git a/src/providers/ldap/sdap_async_connection.c b/src/providers/ldap/sdap_async_connection.c
index a0b5e2ba764e2c71451bba9b1a99d56cf07a0462..005494d202c149eb45a5c205971aa371a65b68ee 100644
--- a/src/providers/ldap/sdap_async_connection.c
+++ b/src/providers/ldap/sdap_async_connection.c
@@ -1312,7 +1312,7 @@ static void sdap_cli_resolve_done(struct tevent_req *subreq)
     struct sdap_cli_connect_state *state = tevent_req_data(req,
                                              struct sdap_cli_connect_state);
     int ret;
-    bool use_tls;
+    bool use_tls = true;
 
     switch (state->force_tls) {
     case CON_TLS_DFL:
diff --git a/src/providers/ldap/sdap_async_sudo.c b/src/providers/ldap/sdap_async_sudo.c
index 92200aa77f480bbd873b33191dcd16ddd2245f0b..db5e056d9c2b85e1febc6183d774c9c4030b17e6 100644
--- a/src/providers/ldap/sdap_async_sudo.c
+++ b/src/providers/ldap/sdap_async_sudo.c
@@ -460,7 +460,7 @@ static void sdap_sudo_load_sudoers_done(struct tevent_req *subreq)
     struct tevent_req *req = NULL; /* req from sdap_sudo_refresh_send() */
     struct sdap_sudo_refresh_state *state = NULL;
     struct sysdb_attrs **rules = NULL;
-    size_t rules_count;
+    size_t rules_count = 0;
     int ret;
     errno_t sret;
     bool in_transaction = false;
diff --git a/src/responder/nss/nsssrv_services.c b/src/responder/nss/nsssrv_services.c
index e0ee21c305ec696f0ca7836b63d2035104acaf1f..b0877bfc45fa4fb1200037b49231c8735c522349 100644
--- a/src/responder/nss/nsssrv_services.c
+++ b/src/responder/nss/nsssrv_services.c
@@ -1472,7 +1472,7 @@ static void
 setservent_step_done(struct tevent_req *req)
 {
     errno_t ret;
-    struct ldb_result *res;
+    struct ldb_result *res = NULL;
     struct setent_step_ctx *step_ctx =
             tevent_req_callback_data(req, struct setent_step_ctx);
     struct nss_dom_ctx *dctx = step_ctx->dctx;
diff --git a/src/responder/pam/pamsrv_cmd.c b/src/responder/pam/pamsrv_cmd.c
index 20de738fc58e3f3938715e85cf0c02639a0dd902..e66debe24397140462e334a4c70fd93801b09ca2 100644
--- a/src/responder/pam/pamsrv_cmd.c
+++ b/src/responder/pam/pamsrv_cmd.c
@@ -368,7 +368,7 @@ static errno_t get_selinux_string(struct pam_auth_req *preq)
     errno_t ret;
     int i, j;
     size_t order_count;
-    size_t len;
+    size_t len = 0;
 
     tmp_ctx = talloc_new(NULL);
     if (tmp_ctx == NULL) {
diff --git a/src/responder/sudo/sudosrv_dp.c b/src/responder/sudo/sudosrv_dp.c
index 2063b2911eb5e25102e7b778faf8a028779c680e..208606c262afdeaf16854d3352ebad54d46e999f 100644
--- a/src/responder/sudo/sudosrv_dp.c
+++ b/src/responder/sudo/sudosrv_dp.c
@@ -58,7 +58,7 @@ sss_dp_get_sudoers_send(TALLOC_CTX *mem_ctx,
     struct sss_dp_req_state *state;
     struct sss_dp_get_sudoers_info *info;
     errno_t ret;
-    char *key;
+    char *key = NULL;
 
     req = tevent_req_create(mem_ctx, &state, struct sss_dp_req_state);
     if (!req) {
diff --git a/src/sss_client/common.c b/src/sss_client/common.c
index da7d1f95c4f182bac1a3fdfbb9741b29c0835180..59eae3b1fe4101383de96f680458467a962c2248 100644
--- a/src/sss_client/common.c
+++ b/src/sss_client/common.c
@@ -379,7 +379,7 @@ static enum sss_status sss_cli_make_request_nochecks(
 
 static bool sss_cli_check_version(const char *socket_name)
 {
-    uint8_t *repbuf;
+    uint8_t *repbuf = NULL;
     size_t replen;
     enum sss_status nret;
     int errnop;
-- 
1.7.10.4

