From f1727032bcf4b8e0bb147a84d07e531c17429877 Mon Sep 17 00:00:00 2001
From: Jan Zeleny <jzeleny@redhat.com>
Date: Wed, 1 Sep 2010 16:30:32 +0200
Subject: [PATCH 1/4] Dead assignments cleanup in providers code

Dead assignments were deleted. Also prototype of function
sdap_access_decide_offline() has been changed, since its return
code was never used.
Ticket: #586
---
 src/providers/child_common.c       |    2 --
 src/providers/data_provider_opts.c |    1 -
 src/providers/krb5/krb5_child.c    |    1 -
 src/providers/ldap/ldap_id_enum.c  |    2 --
 src/providers/ldap/sdap_access.c   |   18 +++++++-----------
 src/providers/proxy/proxy_id.c     |    2 --
 6 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/src/providers/child_common.c b/src/providers/child_common.c
index a242338..5b2251f 100644
--- a/src/providers/child_common.c
+++ b/src/providers/child_common.c
@@ -492,14 +492,12 @@ void child_cleanup(int readfd, int writefd)
     if (readfd != -1) {
         ret = close(readfd);
         if (ret != EOK) {
-            ret = errno;
             DEBUG(1, ("close failed [%d][%s].\n", errno, strerror(errno)));
         }
     }
     if (writefd != -1) {
         ret = close(writefd);
         if (ret != EOK) {
-            ret = errno;
             DEBUG(1, ("close failed [%d][%s].\n", errno, strerror(errno)));
         }
     }
diff --git a/src/providers/data_provider_opts.c b/src/providers/data_provider_opts.c
index 98283e4..14f48ac 100644
--- a/src/providers/data_provider_opts.c
+++ b/src/providers/data_provider_opts.c
@@ -42,7 +42,6 @@ int dp_get_options(TALLOC_CTX *memctx,
         opts[i].opt_name = def_opts[i].opt_name;
         opts[i].type = def_opts[i].type;
         opts[i].def_val = def_opts[i].def_val;
-        ret = EOK;
 
         switch (def_opts[i].type) {
         case DP_OPT_STRING:
diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c
index cfb3f42..6892c66 100644
--- a/src/providers/krb5/krb5_child.c
+++ b/src/providers/krb5/krb5_child.c
@@ -270,7 +270,6 @@ static krb5_error_code create_ccache_file(struct krb5_req *kr, krb5_creds *creds
 done:
     if (fd != -1) {
         close(fd);
-        fd = -1;
     }
     if (kerr != 0 && tmp_cc != NULL) {
         krb5_cc_destroy(kr->ctx, tmp_cc);
diff --git a/src/providers/ldap/ldap_id_enum.c b/src/providers/ldap/ldap_id_enum.c
index 87b9563..0917e71 100644
--- a/src/providers/ldap/ldap_id_enum.c
+++ b/src/providers/ldap/ldap_id_enum.c
@@ -531,8 +531,6 @@ static struct tevent_req *enum_groups_send(TALLOC_CTX *memctx,
     state->ctx = ctx;
     state->op = op;
 
-    attr_name = ctx->opts->group_map[SDAP_AT_GROUP_NAME].name;
-
     if (ctx->max_group_timestamp && !purge) {
 
         state->filter = talloc_asprintf(state,
diff --git a/src/providers/ldap/sdap_access.c b/src/providers/ldap/sdap_access.c
index 7d7832a..90b5371 100644
--- a/src/providers/ldap/sdap_access.c
+++ b/src/providers/ldap/sdap_access.c
@@ -99,7 +99,7 @@ struct sdap_access_req_ctx {
     char *basedn;
 };
 
-static int sdap_access_decide_offline(struct tevent_req *req);
+static void sdap_access_decide_offline(struct tevent_req *req);
 static int sdap_access_retry(struct tevent_req *req);
 static void sdap_access_connect_done(struct tevent_req *subreq);
 static void sdap_access_get_access_done(struct tevent_req *req);
@@ -182,7 +182,7 @@ static struct tevent_req *sdap_access_send(TALLOC_CTX *mem_ctx,
     /* Ok, we have one result, check if we are online or offline */
     if (be_is_offline(state->be_ctx)) {
         /* Ok, we're offline. Return from the cache */
-        ret = sdap_access_decide_offline(req);
+        sdap_access_decide_offline(req);
         goto finished;
     }
 
@@ -241,7 +241,7 @@ finished:
     return req;
 }
 
-static int sdap_access_decide_offline(struct tevent_req *req)
+static void sdap_access_decide_offline(struct tevent_req *req)
 {
     struct sdap_access_req_ctx *state =
             tevent_req_data(req, struct sdap_access_req_ctx);
@@ -253,8 +253,6 @@ static int sdap_access_decide_offline(struct tevent_req *req)
         DEBUG(6, ("Access denied by cached credentials\n"));
         state->pam_status = PAM_PERM_DENIED;
     }
-
-    return EOK;
 }
 
 static int sdap_access_retry(struct tevent_req *req)
@@ -287,11 +285,9 @@ static void sdap_access_connect_done(struct tevent_req *subreq)
 
     if (ret != EOK) {
         if (dp_error == DP_ERR_OFFLINE) {
-            ret = sdap_access_decide_offline(req);
-            if (ret == EOK) {
-                tevent_req_done(req);
-                return;
-            }
+            sdap_access_decide_offline(req);
+            tevent_req_done(req);
+            return;
         }
 
         tevent_req_error(req, ret);
@@ -344,7 +340,7 @@ static void sdap_access_get_access_done(struct tevent_req *subreq)
             }
             state->pam_status = PAM_SYSTEM_ERR;
         } else if (dp_error == DP_ERR_OFFLINE) {
-            ret = sdap_access_decide_offline(req);
+            sdap_access_decide_offline(req);
         } else {
             DEBUG(1, ("sdap_get_generic_send() returned error [%d][%s]\n",
                       ret, strerror(ret)));
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
index 8536b93..d2fba72 100644
--- a/src/providers/proxy/proxy_id.c
+++ b/src/providers/proxy/proxy_id.c
@@ -1037,7 +1037,6 @@ void proxy_get_account_info(struct be_req *breq)
 {
     struct be_acct_req *ar;
     struct proxy_id_ctx *ctx;
-    struct tevent_context *ev;
     struct sysdb_ctx *sysdb;
     struct sss_domain_info *domain;
     uid_t uid;
@@ -1047,7 +1046,6 @@ void proxy_get_account_info(struct be_req *breq)
     ar = talloc_get_type(breq->req_data, struct be_acct_req);
     ctx = talloc_get_type(breq->be_ctx->bet_info[BET_ID].pvt_bet_data,
                           struct proxy_id_ctx);
-    ev = breq->be_ctx->ev;
     sysdb = breq->be_ctx->sysdb;
     domain = breq->be_ctx->domain;
 
-- 
1.7.2.1

