summaryrefslogtreecommitdiff
path: root/usr/src/lib/libidmap/common/utils.c
diff options
context:
space:
mode:
authorbaban <none@none>2007-07-12 11:41:36 -0700
committerbaban <none@none>2007-07-12 11:41:36 -0700
commit651c0131ccc65381cbda174bee44a4fd7a518d6b (patch)
treee5612dfc36d4b61454a9c258599a558b22ac92e0 /usr/src/lib/libidmap/common/utils.c
parent85025c032d701094e5f35de4f42ce66082924fc1 (diff)
downloadillumos-joyent-651c0131ccc65381cbda174bee44a4fd7a518d6b.tar.gz
6570027 memory leak in idmapd for idmap show -c winname:... code path
6573151 libidmap API should be more specific about RPC failures 6573159 idmap_config.c should use idmapdlog() to log messages instead of its own routines 6573415 Segmentation Fault in "idmap show unixname:unknownuser winname" 6573634 idmapd fails to start the reaper thread to close idle AD connections 6573752 idmapd still has syslog messages that should not be localized 6574136 libidmap should clear its handles after use for possible reuse 6575859 idmap add -u/g winname:...@* ... should be treated as an error -- @* rules must be directional 6576387 libidmap should provide macro for mapping direction
Diffstat (limited to 'usr/src/lib/libidmap/common/utils.c')
-rw-r--r--usr/src/lib/libidmap/common/utils.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/usr/src/lib/libidmap/common/utils.c b/usr/src/lib/libidmap/common/utils.c
index c9d9c69001..80b9141c47 100644
--- a/usr/src/lib/libidmap/common/utils.c
+++ b/usr/src/lib/libidmap/common/utils.c
@@ -42,7 +42,7 @@
static struct timeval TIMEOUT = { 25, 0 };
idmap_retcode
-_udt_extend_batch(idmap_udt_handle_t *udthandle, int opnum) {
+_udt_extend_batch(idmap_udt_handle_t *udthandle) {
idmap_update_op *tmplist;
size_t nsize;
@@ -61,7 +61,7 @@ _udt_extend_batch(idmap_udt_handle_t *udthandle, int opnum) {
udthandle->batch.idmap_update_batch_len += _UDT_SIZE_INCR;
}
udthandle->batch.idmap_update_batch_val[udthandle->next].opnum =
- opnum;
+ OP_NONE;
return (IDMAP_SUCCESS);
}
@@ -125,8 +125,34 @@ _iter_get_next_list(int type, idmap_iter_t *iter,
TIMEOUT);
if (clntstat != RPC_SUCCESS) {
free(*list);
- return (IDMAP_ERR_RPC);
+ return (_idmap_rpc2stat(clnt));
}
iter->retlist = *list;
return (IDMAP_SUCCESS);
}
+
+idmap_stat
+_idmap_rpc2stat(CLIENT *clnt) {
+ /*
+ * We only deal with door_call(3C) errors here. We look at
+ * r_err.re_errno instead of r_err.re_status because we need
+ * to differentiate between RPC failures caused by bad door fd
+ * and others.
+ */
+ struct rpc_err r_err;
+ if (clnt) {
+ clnt_geterr(clnt, &r_err);
+ errno = r_err.re_errno;
+ switch (r_err.re_errno) {
+ case ENOMEM:
+ return (IDMAP_ERR_MEMORY);
+ case EBADF:
+ return (IDMAP_ERR_RPC_HANDLE);
+ default:
+ return (IDMAP_ERR_RPC);
+ }
+ }
+
+ /* null handle */
+ return (IDMAP_ERR_RPC_HANDLE);
+}