diff options
author | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-07-08 14:30:54 -0400 |
---|---|---|
committer | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-07-08 14:30:54 -0400 |
commit | 899ab1307290b15a33a1ad8d1513fe395c1f617c (patch) | |
tree | 9b47bf2ee17622420783ef761cd333ade3f57a7d /src/nis.c | |
parent | 2193b78622dce107208999df388f7a4e5ac5308d (diff) | |
download | slapi-nis-899ab1307290b15a33a1ad8d1513fe395c1f617c.tar.gz slapi-nis-899ab1307290b15a33a1ad8d1513fe395c1f617c.tar.xz slapi-nis-899ab1307290b15a33a1ad8d1513fe395c1f617c.zip |
- return no-domain or no-map when the master for a bogus map or domain is asked
Diffstat (limited to 'src/nis.c')
-rw-r--r-- | src/nis.c | 45 |
1 files changed, 35 insertions, 10 deletions
@@ -279,22 +279,47 @@ nis_master(struct plugin_state *state, struct ypresp_master *reply_master) { struct ypreq_nokey req_nokey; + bool_t supported; const char *master; memset(&req_nokey, 0, sizeof(req_nokey)); memset(reply_master, 0, sizeof(*reply_master)); if (xdr_ypreq_nokey(request_xdrs, &req_nokey)) { map_rdlock(); - reply_master->status = YP_TRUE; - if (map_master_name(state, &master) != 0) { - master = "localhost"; + if (map_supports_domain(state, req_nokey.domain, &supported) && + supported) { + if (map_supports_map(state, + req_nokey.domain, req_nokey.map, + &supported, NULL) && + supported) { + reply_master->status = YP_TRUE; + if (map_master_name(state, &master) != 0) { + master = "localhost"; + } + reply_master->master = (char *) master; + slapi_log_error(SLAPI_LOG_PLUGIN, + state->plugin_desc->spd_id, + "master(%s/%s) -> %s\n", + req_nokey.domain, + req_nokey.map, + reply_master->master); + } else { + reply_master->status = YP_NOMAP; + reply_master->master = NULL; + slapi_log_error(SLAPI_LOG_PLUGIN, + state->plugin_desc->spd_id, + "master(%s/%s) -> no-map\n", + req_nokey.domain, + req_nokey.map); + } + } else { + reply_master->status = YP_NODOM; + reply_master->master = NULL; + slapi_log_error(SLAPI_LOG_PLUGIN, + state->plugin_desc->spd_id, + "master(%s/%s) -> no-domain\n", + req_nokey.domain, + req_nokey.map); } - reply_master->master = (char *) master; - slapi_log_error(SLAPI_LOG_PLUGIN, - state->plugin_desc->spd_id, - "master(%s/%s) -> %s\n", - req_nokey.domain, - req_nokey.map, - reply_master->master); (*reply_fn)(state, cdata, reply, reply_xdrs); map_unlock(); } else { |