summaryrefslogtreecommitdiffstats
path: root/src/responder
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2012-09-21 18:30:30 +0200
committerJakub Hrozek <jhrozek@redhat.com>2012-10-01 21:45:21 +0200
commit1542b85f13d72329685bdd97aa879c36d11f81be (patch)
treef8623dd7d926741197ec488d5a5ff047c57e2222 /src/responder
parent00516601e579f2ae4a287332966860cb0af152f9 (diff)
downloadsssd-1542b85f13d72329685bdd97aa879c36d11f81be.tar.gz
sssd-1542b85f13d72329685bdd97aa879c36d11f81be.tar.xz
sssd-1542b85f13d72329685bdd97aa879c36d11f81be.zip
Add new option default_domain_suffix
Diffstat (limited to 'src/responder')
-rw-r--r--src/responder/autofs/autofssrv_cmd.c3
-rw-r--r--src/responder/common/negcache.c10
-rw-r--r--src/responder/common/responder.h3
-rw-r--r--src/responder/common/responder_common.c10
-rw-r--r--src/responder/nss/nsssrv_cmd.c18
-rw-r--r--src/responder/nss/nsssrv_netgroup.c3
-rw-r--r--src/responder/nss/nsssrv_services.c5
-rw-r--r--src/responder/pam/pamsrv_cmd.c31
-rw-r--r--src/responder/ssh/sshsrv_cmd.c3
-rw-r--r--src/responder/sudo/sudosrv_query.c3
10 files changed, 65 insertions, 24 deletions
diff --git a/src/responder/autofs/autofssrv_cmd.c b/src/responder/autofs/autofssrv_cmd.c
index 4dfa94e40..3af4a8468 100644
--- a/src/responder/autofs/autofssrv_cmd.c
+++ b/src/responder/autofs/autofssrv_cmd.c
@@ -374,7 +374,8 @@ setautomntent_send(TALLOC_CTX *mem_ctx,
dctx->cmd_ctx = state->cmdctx;
state->dctx = dctx;
- ret = sss_parse_name_for_domains(state, client->rctx->domains, rawname,
+ ret = sss_parse_name_for_domains(state, client->rctx->domains,
+ client->rctx->default_domain, rawname,
&domname, &state->mapname);
if (ret != EOK) {
DEBUG(SSSDBG_FATAL_FAILURE,
diff --git a/src/responder/common/negcache.c b/src/responder/common/negcache.c
index b59b1f341..5be1ea688 100644
--- a/src/responder/common/negcache.c
+++ b/src/responder/common/negcache.c
@@ -596,7 +596,9 @@ errno_t sss_ncache_prepopulate(struct sss_nc_ctx *ncache,
filter_set = true;
for (i = 0; (filter_list && filter_list[i]); i++) {
- ret = sss_parse_name_for_domains(tmpctx, domain_list, filter_list[i],
+ ret = sss_parse_name_for_domains(tmpctx, domain_list,
+ rctx->default_domain,
+ filter_list[i],
&domainname, &name);
if (ret != EOK) {
DEBUG(1, ("Invalid name in filterUsers list: [%s] (%d)\n",
@@ -641,7 +643,8 @@ errno_t sss_ncache_prepopulate(struct sss_nc_ctx *ncache,
else if (ret != EOK) goto done;
for (i = 0; (filter_list && filter_list[i]); i++) {
- ret = sss_parse_name_for_domains(tmpctx, domain_list, filter_list[i],
+ ret = sss_parse_name_for_domains(tmpctx, domain_list,
+ rctx->default_domain, filter_list[i],
&domainname, &name);
if (ret != EOK) {
DEBUG(1, ("Invalid name in filterUsers list: [%s] (%d)\n",
@@ -738,7 +741,8 @@ errno_t sss_ncache_prepopulate(struct sss_nc_ctx *ncache,
else if (ret != EOK) goto done;
for (i = 0; (filter_list && filter_list[i]); i++) {
- ret = sss_parse_name_for_domains(tmpctx, domain_list, filter_list[i],
+ ret = sss_parse_name_for_domains(tmpctx, domain_list,
+ rctx->default_domain, filter_list[i],
&domainname, &name);
if (ret != EOK) {
DEBUG(1, ("Invalid name in filterGroups list: [%s] (%d)\n",
diff --git a/src/responder/common/responder.h b/src/responder/common/responder.h
index c09262d1b..5bab0d3c3 100644
--- a/src/responder/common/responder.h
+++ b/src/responder/common/responder.h
@@ -101,6 +101,8 @@ struct resp_ctx {
size_t allowed_uids_count;
uid_t *allowed_uids;
+ char *default_domain;
+
void *pvt_ctx;
};
@@ -160,6 +162,7 @@ int sss_parse_name(TALLOC_CTX *memctx,
int sss_parse_name_for_domains(TALLOC_CTX *memctx,
struct sss_domain_info *domains,
+ const char *default_domain,
const char *orig, char **domain, char **name);
int sss_dp_get_domain_conn(struct resp_ctx *rctx, const char *domain,
diff --git a/src/responder/common/responder_common.c b/src/responder/common/responder_common.c
index 37a08d948..2f8cd84d4 100644
--- a/src/responder/common/responder_common.c
+++ b/src/responder/common/responder_common.c
@@ -783,6 +783,16 @@ int sss_process_init(TALLOC_CTX *mem_ctx,
return ret;
}
+ ret = confdb_get_string(rctx->cdb, rctx, CONFDB_MONITOR_CONF_ENTRY,
+ CONFDB_MONITOR_DEFAULT_DOMAIN, NULL,
+ &rctx->default_domain);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_OP_FAILURE,
+ ("Cannnot get the default domain [%d]: %s\n",
+ ret, strerror(ret)));
+ return ret;
+ }
+
ret = sss_monitor_init(rctx, rctx->ev, monitor_intf,
svc_name, svc_version, rctx,
&rctx->mon_conn);
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 64fd7a587..370c3d299 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -806,7 +806,8 @@ static int nss_cmd_getpwnam(struct cli_ctx *cctx)
rawname = (const char *)body;
domname = NULL;
- ret = sss_parse_name_for_domains(cmdctx, cctx->rctx->domains, rawname,
+ ret = sss_parse_name_for_domains(cmdctx, cctx->rctx->domains,
+ cctx->rctx->default_domain, rawname,
&domname, &cmdctx->name);
if (ret == EAGAIN) {
req = sss_dp_get_domains_send(cctx->rctx, cctx->rctx, true, domname);
@@ -878,7 +879,8 @@ static void nss_cmd_getpwnam_cb(struct tevent_req *req)
goto done;
}
- ret = sss_parse_name_for_domains(cmdctx, cctx->rctx->domains, rawname,
+ ret = sss_parse_name_for_domains(cmdctx, cctx->rctx->domains,
+ cctx->rctx->default_domain, rawname,
&domname, &cmdctx->name);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("Invalid name received [%s]\n", rawname));
@@ -2293,7 +2295,8 @@ static int nss_cmd_getgrnam(struct cli_ctx *cctx)
rawname = (const char *)body;
domname = NULL;
- ret = sss_parse_name_for_domains(cmdctx, cctx->rctx->domains, rawname,
+ ret = sss_parse_name_for_domains(cmdctx, cctx->rctx->domains,
+ cctx->rctx->default_domain, rawname,
&domname, &cmdctx->name);
if (ret == EAGAIN) {
req = sss_dp_get_domains_send(cctx->rctx, cctx->rctx, true, domname);
@@ -2365,7 +2368,8 @@ static void nss_cmd_getgrnam_cb(struct tevent_req *req)
goto done;
}
- ret = sss_parse_name_for_domains(cmdctx, cctx->rctx->domains, rawname,
+ ret = sss_parse_name_for_domains(cmdctx, cctx->rctx->domains,
+ cctx->rctx->default_domain, rawname,
&domname, &cmdctx->name);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("Invalid name received [%s]\n", rawname));
@@ -3423,7 +3427,8 @@ static int nss_cmd_initgroups(struct cli_ctx *cctx)
rawname = (const char *)body;
domname = NULL;
- ret = sss_parse_name_for_domains(cmdctx, cctx->rctx->domains, rawname,
+ ret = sss_parse_name_for_domains(cmdctx, cctx->rctx->domains,
+ cctx->rctx->default_domain, rawname,
&domname, &cmdctx->name);
if (ret == EAGAIN) {
req = sss_dp_get_domains_send(cctx->rctx, cctx->rctx, true, domname);
@@ -3495,7 +3500,8 @@ static void nss_cmd_initgroups_cb(struct tevent_req *req)
goto done;
}
- ret = sss_parse_name_for_domains(cmdctx, cctx->rctx->domains, rawname,
+ ret = sss_parse_name_for_domains(cmdctx, cctx->rctx->domains,
+ cctx->rctx->default_domain, rawname,
&domname, &cmdctx->name);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("Invalid name received [%s]\n", rawname));
diff --git a/src/responder/nss/nsssrv_netgroup.c b/src/responder/nss/nsssrv_netgroup.c
index 774d182bd..ae993fac6 100644
--- a/src/responder/nss/nsssrv_netgroup.c
+++ b/src/responder/nss/nsssrv_netgroup.c
@@ -197,7 +197,8 @@ static struct tevent_req *setnetgrent_send(TALLOC_CTX *mem_ctx,
dctx = state->dctx;
dctx->cmdctx = state->cmdctx;
- ret = sss_parse_name_for_domains(state, client->rctx->domains, rawname,
+ ret = sss_parse_name_for_domains(state, client->rctx->domains,
+ client->rctx->default_domain, rawname,
&domname, &state->netgr_shortname);
if (ret != EOK) {
DEBUG(2, ("Invalid name received [%s]\n", rawname));
diff --git a/src/responder/nss/nsssrv_services.c b/src/responder/nss/nsssrv_services.c
index 880058fa8..d79323c34 100644
--- a/src/responder/nss/nsssrv_services.c
+++ b/src/responder/nss/nsssrv_services.c
@@ -780,6 +780,7 @@ done:
errno_t parse_getservbyname(TALLOC_CTX *mem_ctx,
uint8_t *body, size_t blen,
struct sss_domain_info *domains,
+ char *default_domain,
char **domain_name,
char **service_name,
char **service_protocol);
@@ -821,6 +822,7 @@ int nss_cmd_getservbyname(struct cli_ctx *cctx)
ret = parse_getservbyname(cmdctx, body, blen,
cctx->rctx->domains,
+ cctx->rctx->default_domain,
&domname,
&service_name,
&service_protocol);
@@ -871,6 +873,7 @@ done:
errno_t parse_getservbyname(TALLOC_CTX *mem_ctx,
uint8_t *body, size_t blen,
struct sss_domain_info *domains,
+ char *default_domain,
char **domain_name,
char **service_name,
char **service_protocol)
@@ -959,7 +962,7 @@ errno_t parse_getservbyname(TALLOC_CTX *mem_ctx,
}
}
- ret = sss_parse_name_for_domains(tmp_ctx, domains, rawname,
+ ret = sss_parse_name_for_domains(tmp_ctx, domains, default_domain, rawname,
&domname, &svc_name);
if (ret != EOK) {
DEBUG(SSSDBG_MINOR_FAILURE,
diff --git a/src/responder/pam/pamsrv_cmd.c b/src/responder/pam/pamsrv_cmd.c
index 07fa96ab8..2b20544d1 100644
--- a/src/responder/pam/pamsrv_cmd.c
+++ b/src/responder/pam/pamsrv_cmd.c
@@ -119,8 +119,9 @@ static int pd_set_primary_name(const struct ldb_message *msg,struct pam_data *pd
}
static int pam_parse_in_data_v2(struct sss_domain_info *domains,
- struct pam_data *pd,
- uint8_t *body, size_t blen)
+ const char *default_domain,
+ struct pam_data *pd,
+ uint8_t *body, size_t blen)
{
size_t c;
uint32_t type;
@@ -156,7 +157,8 @@ static int pam_parse_in_data_v2(struct sss_domain_info *domains,
ret = extract_string(&pam_user, size, body, blen, &c);
if (ret != EOK) return ret;
- ret = sss_parse_name_for_domains(pd, domains, pam_user,
+ ret = sss_parse_name_for_domains(pd, domains,
+ default_domain, pam_user,
&pd->domain, &pd->user);
if (ret != EOK) return ret;
break;
@@ -209,12 +211,13 @@ static int pam_parse_in_data_v2(struct sss_domain_info *domains,
}
static int pam_parse_in_data_v3(struct sss_domain_info *domains,
- struct pam_data *pd,
- uint8_t *body, size_t blen)
+ const char *default_domain,
+ struct pam_data *pd,
+ uint8_t *body, size_t blen)
{
int ret;
- ret = pam_parse_in_data_v2(domains, pd, body, blen);
+ ret = pam_parse_in_data_v2(domains, default_domain, pd, body, blen);
if (ret != EOK) {
DEBUG(1, ("pam_parse_in_data_v2 failed.\n"));
return ret;
@@ -229,6 +232,7 @@ static int pam_parse_in_data_v3(struct sss_domain_info *domains,
}
static int pam_parse_in_data(struct sss_domain_info *domains,
+ const char *default_domain,
struct pam_data *pd,
uint8_t *body, size_t blen)
{
@@ -244,7 +248,8 @@ static int pam_parse_in_data(struct sss_domain_info *domains,
for (start = end; end < last; end++) if (body[end] == '\0') break;
if (body[end++] != '\0') return EINVAL;
- ret = sss_parse_name_for_domains(pd, domains, (char *)&body[start], &pd->domain, &pd->user);
+ ret = sss_parse_name_for_domains(pd, domains, default_domain,
+ (char *)&body[start], &pd->domain, &pd->user);
if (ret != EOK) return ret;
for (start = end; end < last; end++) if (body[end] == '\0') break;
@@ -997,13 +1002,19 @@ errno_t pam_forwarder_parse_data(struct cli_ctx *cctx, struct pam_data *pd)
switch (cctx->cli_protocol_version->version) {
case 1:
- ret = pam_parse_in_data(cctx->rctx->domains, pd, body, blen);
+ ret = pam_parse_in_data(cctx->rctx->domains,
+ cctx->rctx->default_domain, pd,
+ body, blen);
break;
case 2:
- ret = pam_parse_in_data_v2(cctx->rctx->domains, pd, body, blen);
+ ret = pam_parse_in_data_v2(cctx->rctx->domains,
+ cctx->rctx->default_domain, pd,
+ body, blen);
break;
case 3:
- ret = pam_parse_in_data_v3(cctx->rctx->domains, pd, body, blen);
+ ret = pam_parse_in_data_v3(cctx->rctx->domains,
+ cctx->rctx->default_domain, pd,
+ body, blen);
break;
default:
DEBUG(1, ("Illegal protocol version [%d].\n",
diff --git a/src/responder/ssh/sshsrv_cmd.c b/src/responder/ssh/sshsrv_cmd.c
index 82a1f9016..6c10967e2 100644
--- a/src/responder/ssh/sshsrv_cmd.c
+++ b/src/responder/ssh/sshsrv_cmd.c
@@ -701,7 +701,8 @@ ssh_cmd_parse_request(struct ssh_cmd_ctx *cmd_ctx)
}
c += name_len;
- ret = sss_parse_name_for_domains(cmd_ctx, cctx->rctx->domains, name,
+ ret = sss_parse_name_for_domains(cmd_ctx, cctx->rctx->domains,
+ cctx->rctx->default_domain,name,
&cmd_ctx->domname, &cmd_ctx->name);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("Invalid name received [%s]\n", name));
diff --git a/src/responder/sudo/sudosrv_query.c b/src/responder/sudo/sudosrv_query.c
index 7ba80e2ac..824f682c6 100644
--- a/src/responder/sudo/sudosrv_query.c
+++ b/src/responder/sudo/sudosrv_query.c
@@ -312,7 +312,8 @@ errno_t sudosrv_parse_query(TALLOC_CTX *mem_ctx,
/* parse username */
- ret = sss_parse_name_for_domains(tmp_ctx, rctx->domains, rawname,
+ ret = sss_parse_name_for_domains(tmp_ctx, rctx->domains,
+ rctx->default_domain, rawname,
&domainname, &username);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE, ("Invalid name received [%s]\n", rawname));