diff options
Diffstat (limited to 'rpc/rpc-lib')
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.c | 5 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-transport.c | 2 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpcsvc-auth.c | 22 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpcsvc.c | 51 |
4 files changed, 46 insertions, 34 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index f2c2736e05e..9b0bfe33d5b 100644 --- a/rpc/rpc-lib/src/rpc-clnt.c +++ b/rpc/rpc-lib/src/rpc-clnt.c @@ -129,7 +129,6 @@ call_bail (void *data) struct tm frame_sent_tm; char frame_sent[32] = {0,}; struct timeval timeout = {0,}; - gf_timer_cbk_t timer_cbk = NULL; struct rpc_req req; struct iovec iov = {0,}; @@ -147,8 +146,6 @@ call_bail (void *data) /* Chaining to get call-always functionality from call-once timer */ if (conn->timer) { - timer_cbk = conn->timer->callbk; - timeout.tv_sec = 10; timeout.tv_usec = 0; @@ -673,8 +670,6 @@ rpc_clnt_handle_reply (struct rpc_clnt *clnt, rpc_transport_pollin_t *pollin) if (ret == 0) { rpc_clnt_reply_deinit (&req); } - - ret = 0; out: if (saved_frame) { diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c index 82ea9a74bfd..b77ea2aa553 100644 --- a/rpc/rpc-lib/src/rpc-transport.c +++ b/rpc/rpc-lib/src/rpc-transport.c @@ -79,7 +79,7 @@ valid_ipv4_address (char *address, int length) char *tmp = NULL, *ptr = NULL, *prev = NULL, *endptr = NULL; char ret = 1; - prev = tmp = gf_strdup (address); + tmp = gf_strdup (address); prev = strtok_r (tmp, ".", &ptr); while (prev != NULL) diff --git a/rpc/rpc-lib/src/rpcsvc-auth.c b/rpc/rpc-lib/src/rpcsvc-auth.c index 75305e68e2a..381cf282305 100644 --- a/rpc/rpc-lib/src/rpcsvc-auth.c +++ b/rpc/rpc-lib/src/rpcsvc-auth.c @@ -85,7 +85,7 @@ rpcsvc_auth_add_initers (rpcsvc_t *svc) ret = 0; err: - return 0; + return ret; } @@ -142,14 +142,26 @@ rpcsvc_auth_init_auths (rpcsvc_t *svc, dict_t *options) * it by default. This is a globally default rule, the user is still * allowed to disable the two for particular subvolumes. */ - if (!dict_get (options, "rpc-auth.auth-null")) + if (!dict_get (options, "rpc-auth.auth-null")) { ret = dict_set_str (options, "rpc-auth.auth-null", "on"); + if (ret) + gf_log ("rpc-auth", GF_LOG_DEBUG, + "dict_set failed for 'auth-nill'"); + } - if (!dict_get (options, "rpc-auth.auth-unix")) + if (!dict_get (options, "rpc-auth.auth-unix")) { ret = dict_set_str (options, "rpc-auth.auth-unix", "on"); + if (ret) + gf_log ("rpc-auth", GF_LOG_DEBUG, + "dict_set failed for 'auth-unix'"); + } - if (!dict_get (options, "rpc-auth.auth-glusterfs")) + if (!dict_get (options, "rpc-auth.auth-glusterfs")) { ret = dict_set_str (options, "rpc-auth.auth-glusterfs", "on"); + if (ret) + gf_log ("rpc-auth", GF_LOG_DEBUG, + "dict_set failed for 'auth-unix'"); + } list_for_each_entry_safe (auth, tmp, &svc->authschemes, authlist) { ret = rpcsvc_auth_init_auth (svc, options, auth); @@ -191,7 +203,6 @@ out: rpcsvc_auth_t * __rpcsvc_auth_get_handler (rpcsvc_request_t *req) { - int ret = -1; struct rpcsvc_auth_list *auth = NULL; struct rpcsvc_auth_list *tmp = NULL; rpcsvc_t *svc = NULL; @@ -207,7 +218,6 @@ __rpcsvc_auth_get_handler (rpcsvc_request_t *req) if (list_empty (&svc->authschemes)) { gf_log (GF_RPCSVC, GF_LOG_WARNING, "No authentication!"); - ret = 0; goto err; } diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c index bb4e37ef8b0..9bb7e0e4c9e 100644 --- a/rpc/rpc-lib/src/rpcsvc.c +++ b/rpc/rpc-lib/src/rpcsvc.c @@ -371,8 +371,13 @@ rpcsvc_conn_check_volume_specific (dict_t *options, char *volname, if ((dict_get (options, "rpc-auth.addr.namelookup"))) { ret = dict_get_str (options, "rpc-auth.addr.namelookup" , &namestr); - if (ret == 0) + if (ret == 0) { ret = gf_string2boolean (namestr, &namelookup); + if (ret) + gf_log ("rpcsvc", GF_LOG_DEBUG, + "wrong option %s given for " + "'namelookup'", namestr); + } } /* We need two separate checks because the rules with addresses in them @@ -408,8 +413,13 @@ rpcsvc_conn_check_volume_general (dict_t *options, rpcsvc_conn_t *conn) if ((dict_get (options, "rpc-auth.addr.namelookup"))) { ret = dict_get_str (options, "rpc-auth.addr.namelookup" , &namestr); - if (ret == 0) + if (!ret) { ret = gf_string2boolean (namestr, &namelookup); + if (ret) + gf_log ("rpcsvc", GF_LOG_DEBUG, + "wrong option %s given for " + "'namelookup'", namestr); + } } /* We need two separate checks because the rules with addresses in them @@ -466,9 +476,15 @@ rpcsvc_volume_allowed (dict_t *options, char *volname) GF_FREE (srchstr); srchstr = globalrule; ret = dict_get_str (options, srchstr, &addrstr); - } else + if (ret) + gf_log ("rpcsvc", GF_LOG_DEBUG, + "failed to get the string %s", srchstr); + } else { ret = dict_get_str (options, srchstr, &addrstr); - + if (ret) + gf_log ("rpcsvc", GF_LOG_DEBUG, + "failed to get the string %s", srchstr); + } out: return addrstr; } @@ -657,7 +673,6 @@ rpcsvc_conn_init (rpcsvc_t *svc, rpc_transport_t *trans) conn = rpcsvc_conn_alloc (svc, trans); if (!conn) { - ret = -1; gf_log (GF_RPCSVC, GF_LOG_DEBUG, "cannot init a connection"); goto out; } @@ -1143,6 +1158,9 @@ rpcsvc_request_create (rpcsvc_conn_t *conn, rpc_transport_pollin_t *msg) err: if (ret == -1) { ret = rpcsvc_error_reply (req); + if (ret) + gf_log ("rpcsvc", GF_LOG_DEBUG, + "failed to queue error reply"); req = NULL; } @@ -1195,6 +1213,9 @@ err_reply: if ((ret == RPCSVC_ACTOR_ERROR) || (req->rpc_err != SUCCESS)) ret = rpcsvc_error_reply (req); + if (ret) + gf_log ("rpcsvc", GF_LOG_DEBUG, "failed to queue error reply"); + /* No need to propagate error beyond this function since the reply * has now been queued. */ ret = 0; @@ -1208,7 +1229,6 @@ rpcsvc_notify (rpc_transport_t *trans, void *mydata, rpc_transport_event_t event, void *data, ...) { rpcsvc_conn_t *conn = NULL; - rpcsvc_t *svc = NULL; int ret = -1; rpc_transport_pollin_t *msg = NULL; rpc_transport_t *new_trans = NULL; @@ -1218,8 +1238,6 @@ rpcsvc_notify (rpc_transport_t *trans, void *mydata, goto out; } - svc = conn->svc; - switch (event) { case RPC_TRANSPORT_ACCEPT: new_trans = data; @@ -1765,7 +1783,6 @@ rpcsvc_listener_t * rpcsvc_listener_alloc (rpcsvc_t *svc, rpcsvc_conn_t *conn) { rpcsvc_listener_t *listener = NULL; - int ret = -1; listener = GF_CALLOC (1, sizeof (*listener), gf_common_mt_rpcsvc_listener_t); @@ -1774,17 +1791,6 @@ rpcsvc_listener_alloc (rpcsvc_t *svc, rpcsvc_conn_t *conn) goto out; } - /* TODO: unresolved symbol */ - ret = rpc_transport_get_myaddr (conn->trans, NULL, 0, - &listener->sa, - sizeof (listener->sa)); - ret = 0; - if (ret == -1) { - GF_FREE (listener); - listener = NULL; - goto out; - } - listener->conn = conn; INIT_LIST_HEAD (&listener->list); @@ -2005,7 +2011,8 @@ fail: ret = xdr_serialize_dump_rsp (iov, &rsp); if (ret < 0) { - req->rpc_err = GARBAGE_ARGS; + if (req) + req->rpc_err = GARBAGE_ARGS; op_errno = EINVAL; goto fail; } @@ -2015,7 +2022,7 @@ fail: free_prog_details (&rsp); - return 0; + return ret; } int |