summaryrefslogtreecommitdiffstats
path: root/src/responder
diff options
context:
space:
mode:
Diffstat (limited to 'src/responder')
-rw-r--r--src/responder/nss/nsssrv.c4
-rw-r--r--src/responder/nss/nsssrv.h1
-rw-r--r--src/responder/nss/nsssrv_cmd.c44
3 files changed, 34 insertions, 15 deletions
diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c
index dde2e95ef..cb0acfe13 100644
--- a/src/responder/nss/nsssrv.c
+++ b/src/responder/nss/nsssrv.c
@@ -188,6 +188,10 @@ static int nss_get_config(struct nss_ctx *nctx,
&nctx->allowed_shells);
if (ret != EOK && ret != ENOENT) goto done;
+ ret = confdb_get_string_as_list(cdb, nctx, CONFDB_NSS_CONF_ENTRY,
+ CONFDB_NSS_VETOED_SHELL,
+ &nctx->vetoed_shells);
+ if (ret != EOK && ret != ENOENT) goto done;
ret = nss_get_etc_shells(nctx, &nctx->etc_shells);
if (ret != EOK) goto done;
diff --git a/src/responder/nss/nsssrv.h b/src/responder/nss/nsssrv.h
index f9aff5669..01a2810cd 100644
--- a/src/responder/nss/nsssrv.h
+++ b/src/responder/nss/nsssrv.h
@@ -60,6 +60,7 @@ struct nss_ctx {
char *override_homedir;
char **allowed_shells;
+ char **vetoed_shells;
char **etc_shells;
char *shell_fallback;
};
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index aa1b471d5..2aa7a9126 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -314,26 +314,40 @@ static const char *get_shell_override(TALLOC_CTX *mem_ctx,
user_shell = ldb_msg_find_attr_as_string(msg, SYSDB_SHELL, NULL);
if (!user_shell) return NULL;
- if (!nctx->allowed_shells) return talloc_strdup(mem_ctx, user_shell);
-
- for (i=0; nctx->etc_shells[i]; i++) {
- if (strcmp(user_shell, nctx->etc_shells[i]) == 0) {
- DEBUG(9, ("Shell %s found in /etc/shells\n",
- nctx->etc_shells[i]));
- break;
+ if (!nctx->allowed_shells && !nctx->vetoed_shells) return talloc_strdup(mem_ctx, user_shell);
+
+ if (nctx->vetoed_shells) {
+ for (i=0; nctx->vetoed_shells[i]; i++) {
+ if (strcmp(nctx->vetoed_shells[i], user_shell) == 0) {
+ DEBUG(5, ("The shell '%s' is vetoed. "
+ "Using fallback\n", user_shell));
+ return talloc_strdup(mem_ctx, nctx->shell_fallback);
+ }
}
}
- if (nctx->etc_shells[i]) {
- DEBUG(9, ("Using original shell '%s'\n", user_shell));
- return talloc_strdup(mem_ctx, user_shell);
+ if (nctx->etc_shells) {
+ for (i=0; nctx->etc_shells[i]; i++) {
+ if (strcmp(user_shell, nctx->etc_shells[i]) == 0) {
+ DEBUG(9, ("Shell %s found in /etc/shells\n",
+ nctx->etc_shells[i]));
+ break;
+ }
+ }
+
+ if (nctx->etc_shells[i]) {
+ DEBUG(9, ("Using original shell '%s'\n", user_shell));
+ return talloc_strdup(mem_ctx, user_shell);
+ }
}
- for (i=0; nctx->allowed_shells[i]; i++) {
- if (strcmp(nctx->allowed_shells[i], user_shell) == 0) {
- DEBUG(5, ("The shell '%s' is allowed but does not exist. "
- "Using fallback\n", user_shell));
- return talloc_strdup(mem_ctx, nctx->shell_fallback);
+ if (nctx->allowed_shells) {
+ for (i=0; nctx->allowed_shells[i]; i++) {
+ if (strcmp(nctx->allowed_shells[i], user_shell) == 0) {
+ DEBUG(5, ("The shell '%s' is allowed but does not exist. "
+ "Using fallback\n", user_shell));
+ return talloc_strdup(mem_ctx, nctx->shell_fallback);
+ }
}
}