autofssrv_cmd.c revision e563de9203be581acc30c7794f568ae40d22bee0
e02a063b3d675678c3b08075d84f30e665d1d53and Jakub Hrozek <jhrozek@redhat.com>
e02a063b3d675678c3b08075d84f30e665d1d53and Copyright (C) 2012 Red Hat
e02a063b3d675678c3b08075d84f30e665d1d53and Autofs responder: commands
e02a063b3d675678c3b08075d84f30e665d1d53and This program is free software; you can redistribute it and/or modify
e02a063b3d675678c3b08075d84f30e665d1d53and it under the terms of the GNU General Public License as published by
0662ed52e814f8f08ef0e09956413a792584eddffuankg the Free Software Foundation; either version 3 of the License, or
e02a063b3d675678c3b08075d84f30e665d1d53and (at your option) any later version.
e02a063b3d675678c3b08075d84f30e665d1d53and This program is distributed in the hope that it will be useful,
e02a063b3d675678c3b08075d84f30e665d1d53and but WITHOUT ANY WARRANTY; without even the implied warranty of
e02a063b3d675678c3b08075d84f30e665d1d53and MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e02a063b3d675678c3b08075d84f30e665d1d53and GNU General Public License for more details.
16b55a35cff91315d261d1baa776138af465c4e4fuankg You should have received a copy of the GNU General Public License
16b55a35cff91315d261d1baa776138af465c4e4fuankg along with this program. If not, see <http://www.gnu.org/licenses/>.
e02a063b3d675678c3b08075d84f30e665d1d53andstatic int autofs_cmd_send_error(struct autofs_cmd_ctx *cmdctx, int err)
e02a063b3d675678c3b08075d84f30e665d1d53and switch (ret) {
e02a063b3d675678c3b08075d84f30e665d1d53and /* all fine, just return here */
e02a063b3d675678c3b08075d84f30e665d1d53and /* async processing, just return here */
e02a063b3d675678c3b08075d84f30e665d1d53and /* very bad error */
e02a063b3d675678c3b08075d84f30e665d1d53and return setent_add_ref(memctx, map_ctx, &map_ctx->reqs, req);
e02a063b3d675678c3b08075d84f30e665d1d53andstatic void
e02a063b3d675678c3b08075d84f30e665d1d53andautofs_setent_notify(struct autofs_map_ctx *map_ctx, errno_t ret)
e02a063b3d675678c3b08075d84f30e665d1d53and unsigned long mcount;
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg unsigned long i;
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg for (i = 0; i < mcount; i++) {
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg DEBUG(SSSDBG_MINOR_FAILURE, "Could not delete key from hash\n");
e02a063b3d675678c3b08075d84f30e665d1d53and *map = talloc_get_type(value.ptr, struct autofs_map_ctx);
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg "Unexpected error reading from autofs map hash [%d][%s]\n",
e02a063b3d675678c3b08075d84f30e665d1d53and map = talloc_get_type(item->value.ptr, struct autofs_map_ctx);
e02a063b3d675678c3b08075d84f30e665d1d53and /* So that the destructor wouldn't attempt to remove the map from hash
e02a063b3d675678c3b08075d84f30e665d1d53and * table */
e02a063b3d675678c3b08075d84f30e665d1d53and DEBUG(SSSDBG_CRIT_FAILURE, "Missing autofs map name.\n");
e02a063b3d675678c3b08075d84f30e665d1d53and /* Add this entry to the hash table */
e02a063b3d675678c3b08075d84f30e665d1d53and talloc_set_destructor((TALLOC_CTX *) map, autofs_map_hash_remove);
e02a063b3d675678c3b08075d84f30e665d1d53and DEBUG(SSSDBG_TRACE_LIBS, "autofs map [%s] was already removed\n",
e02a063b3d675678c3b08075d84f30e665d1d53and /* Remove the autofs map result object from the lookup table */
e02a063b3d675678c3b08075d84f30e665d1d53and "Could not remove key from table! [%d][%s]\n",
e02a063b3d675678c3b08075d84f30e665d1d53and return -1;
e02a063b3d675678c3b08075d84f30e665d1d53andstatic struct tevent_req *
e02a063b3d675678c3b08075d84f30e665d1d53and const char *rawname,
0662ed52e814f8f08ef0e09956413a792584eddffuankgstatic errno_t setautomntent_recv(struct tevent_req *req);
e02a063b3d675678c3b08075d84f30e665d1d53andstatic void sss_autofs_cmd_setautomntent_done(struct tevent_req *req);
e02a063b3d675678c3b08075d84f30e665d1d53and/* FIXME - file a ticket to have per-responder private
e02a063b3d675678c3b08075d84f30e665d1d53and * data instead of growing the cli_ctx structure */
e02a063b3d675678c3b08075d84f30e665d1d53and const char *rawname;
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg DEBUG(SSSDBG_TRACE_INTERNAL, "sss_autofs_cmd_setautomntent\n");
if (!cmdctx) {
return ENOMEM;
goto done;
goto done;
if (!req) {
goto done;
done:
struct setautomntent_state {
char *mapname;
struct setautomntent_lookup_ctx {
bool returned_to_mainloop;
char *mapname;
static errno_t
void *pvt)
map);
if (!te) {
static errno_t
char *mapname,
static struct tevent_req *
const char *rawname,
char *domname;
if (!req) {
return NULL;
if (!dctx) {
goto fail;
goto fail;
if (domname) {
goto fail;
goto fail;
goto fail;
return req;
return req;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
if (!lookup_ctx) {
goto fail;
goto fail;
return req;
goto fail;
return req;
goto fail;
return req;
fail:
return req;
static errno_t
char *mapname,
return ENOENT;
static errno_t
static errno_t
while (dom) {
return EIO;
return ret;
return ret;
return ENOENT;
return EAGAIN;
return ret;
return EIO;
return EOK;
if (!map) {
return ENOMEM;
return ENOMEM;
return ENOMEM;
return ENOENT;
static errno_t
SYSDB_CACHE_EXPIRE, 0);
return EOK;
goto error;
if (!req) {
goto error;
if(!cb_ctx) {
goto error;
return EAGAIN;
return ret;
return EOK;
char *err_msg;
&err_msg);
if (err_maj) {
static errno_t
return EOK;
static errno_t
static errno_t
size_t c = 0;
if (!cmdctx) {
return ENOMEM;
if (!actx) {
return EIO;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
done:
goto done;
goto done;
goto done;
done:
static errno_t
return ret;
goto done;
goto done;
nentries = 0;
for (i=0; i < stop; i++) {
cursor++;
nentries++;
rp = 0;
done:
return EOK;
static errno_t
const char *key;
const char *value;
return EINVAL;
return ret;
return EOK;
static errno_t
const char *key);
size_t c = 0;
if (!cmdctx) {
return ENOMEM;
if (!actx) {
return EIO;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
done:
goto done;
goto done;
goto done;
done:
static errno_t
const char *key)
size_t i;
const char *value;
return ret;
goto done;
goto done;
goto done;
rp = 0;
done:
return EOK;
return ret;
return EOK;
return autofs_cli_protocol_version;
return autofs_cmds;