nsssrv_cmd.c revision 1c9d778a0410cdbf516eed7d61acf214ce92067a
8f1a4a6c8c0f098e5253c03eafe50aead6e8873cChristian Maeder NSS Responder
2b4130336e941b7d01c78a6da55449a4c6eca609Till Mossakowski Copyright (C) Simo Sorce <ssorce@redhat.com> 2008
2b4130336e941b7d01c78a6da55449a4c6eca609Till Mossakowski This program is free software; you can redistribute it and/or modify
2b4130336e941b7d01c78a6da55449a4c6eca609Till Mossakowski it under the terms of the GNU General Public License as published by
2b4130336e941b7d01c78a6da55449a4c6eca609Till Mossakowski the Free Software Foundation; either version 3 of the License, or
59d823de481014f68b8b024474bffac150b56e1eWiebke Herding (at your option) any later version.
e4e1509ff358e739fddf1483ad39467e0e1becc2Christian Maeder This program is distributed in the hope that it will be useful,
53d399c20374a99bd95db1f9b5b93980cbf6a984Christian Maeder but WITHOUT ANY WARRANTY; without even the implied warranty of
e4e1509ff358e739fddf1483ad39467e0e1becc2Christian Maeder MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
310532f8a7a1a1f1b6c25c67b7c340abc0889335Christian Maeder GNU General Public License for more details.
e4e1509ff358e739fddf1483ad39467e0e1becc2Christian Maeder You should have received a copy of the GNU General Public License
e4e1509ff358e739fddf1483ad39467e0e1becc2Christian Maeder along with this program. If not, see <http://www.gnu.org/licenses/>.
856bdbffc895793cc5739dbb862323944cb76fdbChristian Maederstatic int nss_cmd_send_error(struct nss_cmd_ctx *cmdctx, int err)
856bdbffc895793cc5739dbb862323944cb76fdbChristian Maeder /* create response packet */
414ffa281d82f05a2d742c702f8e06b0cb05b229Christian Maeder ret = sss_packet_grow(packet, 2*sizeof(uint32_t));
414ffa281d82f05a2d742c702f8e06b0cb05b229Christian Maeder ((uint32_t *)body)[0] = 0; /* num results */
53d399c20374a99bd95db1f9b5b93980cbf6a984Christian Maederstatic int nss_cmd_send_empty(struct nss_cmd_ctx *cmdctx)
b1f52a36d45c5031c462291e263cec114975add1Wiebke Herding /* create response packet */
310532f8a7a1a1f1b6c25c67b7c340abc0889335Christian Maeder sss_packet_set_error(cctx->creq->out, EOK);
310532f8a7a1a1f1b6c25c67b7c340abc0889335Christian Maederint nss_cmd_done(struct nss_cmd_ctx *cmdctx, int ret)
310532f8a7a1a1f1b6c25c67b7c340abc0889335Christian Maeder /* all fine, just return here */
if (ret) {
return EFAULT;
case EAGAIN:
case EFAULT:
return EFAULT;
if (ret) {
return EFAULT;
return EOK;
if (!entry) {
return ENOMEM;
return EOK;
struct setent_ctx {
const char *domain)
char *copy;
return NULL;
goto done;
goto done;
p = copy;
goto done;
goto done;
username);
if (uid == 0) {
goto done;
uid);
goto done;
domain);
goto done;
goto done;
goto done;
goto done;
done:
return res;
const char *name,
const char *user_shell;
user_shell));
bool filter_users,
int *count)
const char *name;
const char *gecos;
const char *homedir;
const char *shell;
bool packet_initialized = false;
int ncret;
num = 0;
for (i = 0; i < *count; i++) {
if (filter_users) {
if (!packet_initialized) {
packet_initialized = true;
num = 0;
goto done;
if (add_domain) {
num = 0;
goto done;
delim += t;
s1 += t;
num++;
done:
*count = i;
return EOK;
int ret;
return EFAULT;
if (ret) {
return ret;
return EOK;
int req_type,
const char *opt_name,
void *pvt)
bool off_band_update = false;
return ENOENT;
SYSDB_LAST_UPDATE, 0);
if (cacheExpire == 0) {
SYSDB_CACHE_EXPIRE, 0);
midpoint_refresh = 0;
opt_name));
off_band_update = true;
return EOK;
if (off_band_update) {
if (!req) {
if (!req) {
goto error;
if(!cb_ctx) {
goto error;
return EAGAIN;
return EOK;
return EOK;
char *err_msg;
&err_msg);
int ret;
while (dom) {
if (!dom) break;
return ENOENT;
return EIO;
return EIO;
return ENOENT;
return ret;
if (dom) continue;
return ENOENT;
dctx);
return ret;
return EOK;
return ENOENT;
int ret;
if (err_maj) {
goto done;
goto done;
done:
if (ret) {
const char *rawname;
char *domname;
int ret;
if (!cmdctx) {
return ENOMEM;
if (!dctx) {
goto done;
goto done;
goto done;
goto done;
if (domname) {
goto done;
done:
int ret;
while (dom) {
return ENOENT;
return EIO;
return EIO;
return ENOENT;
return ret;
return ENOENT;
dctx);
return ret;
return EOK;
return ENOENT;
int ret;
if (err_maj) {
goto done;
goto done;
done:
if (ret) {
int ret;
if (!cmdctx) {
return ENOMEM;
if (!dctx) {
goto done;
goto done;
goto done;
done:
if (!cmdctx) {
return ENOMEM;
if (!req) {
goto done;
done:
if (!req) {
return NULL;
goto error;
goto error;
return NULL;
return req;
goto error;
if (!step_ctx) {
goto error;
return req;
return req;
void *pvt);
while (dom) {
if (!dom) break;
return EIO;
if (!dpreq) {
if(!cb_ctx) {
return ENOMEM;
return EAGAIN;
return ENOMEM;
if (!te) {
return EAGAIN;
return EOK;
void *pvt)
int ret;
if (err_maj) {
return EOK;
if (!cmdctx) {
return ENOMEM;
if (!req) {
return EIO;
return EOK;
int ret;
return EINVAL;
return ret;
return EOK;
none:
return ret;
int ret;
return ret;
done:
return EOK;
#define GID_ROFFSET 0
bool filter_groups,
int *count)
const char *name;
if (add_domain) {
delim = 0;
dom_len = 0;
num = 0;
goto done;
rsize = 0;
for (i = 0; i < *count; i++) {
rsize = 0;
if (filter_groups) {
num = 0;
goto done;
if (add_domain) {
num = 0;
goto done;
rsize += t;
delim += t;
nsize += t;
num = 0;
goto done;
rsize = 0;
if (el) {
memnum = 0;
num = 0;
goto done;
if (add_domain) {
num = 0;
goto done;
delim += t;
nsize += t;
num = 0;
goto done;
memnum++;
if (memnum) {
num++;
done:
*count = i;
if (num == 0) {
return ENOENT;
return EOK;
int ret;
return EFAULT;
if (ret) {
return ret;
return EOK;
int ret;
while (dom) {
if (!dom) break;
return ENOENT;
return EIO;
return EIO;
return ENOENT;
return ret;
if (dom) continue;
return ENOENT;
dctx);
return ret;
return EOK;
return ENOENT;
int ret;
if (err_maj) {
goto done;
goto done;
done:
if (ret) {
const char *rawname;
char *domname;
int ret;
if (!cmdctx) {
return ENOMEM;
if (!dctx) {
goto done;
goto done;
goto done;
goto done;
if (domname) {
goto done;
done:
int ret;
while (dom) {
return ENOENT;
return EIO;
return EIO;
return ENOENT;
return ret;
return ENOENT;
dctx);
return ret;
return EOK;
return ENOENT;
int ret;
if (err_maj) {
goto done;
goto done;
done:
if (ret) {
int ret;
if (!cmdctx) {
return ENOMEM;
if (!dctx) {
goto done;
goto done;
goto done;
done:
if (!cmdctx) {
return ENOMEM;
if (!req) {
goto done;
done:
if (!req) {
return NULL;
goto error;
goto error;
return NULL;
return req;
goto error;
if (!step_ctx) {
goto error;
return req;
return req;
void *pvt);
while (dom) {
if (!dom) break;
return EIO;
if (!dpreq) {
if(!cb_ctx) {
return ENOMEM;
return EAGAIN;
return ENOMEM;
if (!te) {
return EAGAIN;
return EOK;
void *pvt)
int ret;
if (err_maj) {
return EOK;
none:
return ret;
int ret;
return EINVAL;
return ret;
return EOK;
if (!cmdctx) {
return ENOMEM;
if (!req) {
return EIO;
return EOK;
int ret;
return ret;
done:
return EOK;
int skipped = 0;
const char *posix;
return ENOENT;
return ret;
bindex = 0;
for (i = 0; i < num; i++) {
if (!gid) {
skipped++;
return EFAULT;
bindex++;
return EOK;
int ret;
return EFAULT;
if (ret) {
return ret;
return EOK;
int ret;
while (dom) {
if (!dom) break;
return ENOENT;
return EIO;
return EIO;
return ret;
if (dom) continue;
return ENOENT;
dctx);
return ret;
return ENOENT;
int ret;
if (err_maj) {
goto done;
goto done;
done:
if (ret) {
const char *rawname;
char *domname;
int ret;
if (!cmdctx) {
return ENOMEM;
if (!dctx) {
goto done;
goto done;
goto done;
goto done;
if (domname) {
goto done;
done:
return nss_cli_protocol_version;
return nss_cmds;
return EINVAL;