}
/* let the pam opt take precedence over the pam_winbind.conf option */
- for (i=0; i<ctx->argc; i++) {
+ for (i = 0; i < ctx->argc; i++) {
+ const char *p = strchr(ctx->argv[i], '=');
+ if (p != NULL) {
+ size_t len = p - ctx->argv[i];
+ char name[len + 1];
- if ((strncmp(ctx->argv[i], item, strlen(item)) == 0)) {
- const char *p;
+ memcpy(name, ctx->argv[i], len);
+ name[len] = 0;
- if ((p = strchr(ctx->argv[i], '=')) == NULL) {
- _pam_log(ctx, LOG_INFO,
- "no \"=\" delimiter for \"%s\" found\n",
- item);
- goto out;
+ if (strcmp(name, item) != 0) {
+ continue;
}
_pam_log_debug(ctx, LOG_INFO,
- "PAM config: %s '%s'\n", item, p+1);
+ "PAM config: %s '%s'\n",
+ item, p + 1);
return p + 1;
}
+ if (strcmp(ctx->argv[i], item) == 0) {
+ _pam_log(ctx, LOG_INFO,
+ "no \"=\" delimiter for \"%s\" found\n",
+ item);
+ goto out;
+ }
}
if (ctx->dict) {
const char *item,
int config_flag)
{
- int i, parm_opt = -1;
-
- if (!(ctx->ctrl & config_flag)) {
- goto out;
- }
-
- /* let the pam opt take precedence over the pam_winbind.conf option */
- for (i = 0; i < ctx->argc; i++) {
+ const char *value;
- if ((strncmp(ctx->argv[i], item, strlen(item)) == 0)) {
- const char *p;
-
- if ((p = strchr(ctx->argv[i], '=')) == NULL) {
- _pam_log(ctx, LOG_INFO,
- "no \"=\" delimiter for \"%s\" found\n",
- item);
- goto out;
- }
- parm_opt = atoi(p + 1);
- _pam_log_debug(ctx, LOG_INFO,
- "PAM config: %s '%d'\n",
- item, parm_opt);
- return parm_opt;
- }
+ value = get_conf_item_string(ctx, item, config_flag);
+ if (value == NULL) {
+ return -1;
}
- if (ctx->dict) {
- char *key = NULL;
-
- key = talloc_asprintf(ctx, "global:%s", item);
- if (!key) {
- goto out;
- }
-
- parm_opt = tiniparser_getint(ctx->dict, key, -1);
- TALLOC_FREE(key);
-
- _pam_log_debug(ctx, LOG_INFO,
- "CONFIG file: %s '%d'\n",
- item, parm_opt);
- }
-out:
- return parm_opt;
+ return atoi(value);
}
static const char *get_krb5_cc_type_from_config(struct pwb_context *ctx)