summaryrefslogtreecommitdiffstats
path: root/src/schema.c
blob: cee39f9742569f3cbaf68e4814455f14fda18efc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif

#include <dirsrv/slapi-plugin.h>
#include "schema.h"

/* Replace this with a cache of dynamically-read data that gets refreshed if
 * it's more than X seconds old. */
PRBool
schema_supports_domain(const char *domain)
{
	if (strcmp(domain, ".local") == 0) {
		return PR_TRUE;
	}
	return PR_FALSE;
}

void
schema_get(const char *domain, const char *map,
	   char **base, int *scope, char **key, char **format)
{
	*base = NULL;
	*scope = 0;
	*key = NULL;
	*format = NULL;
	if (strcmp(domain, ".local") != 0) {
		return;
	}
	if (strcmp(map, "passwd.byname") == 0) {
		*base = strdup("dc=boston,dc=redhat,dc=com");
		*scope = LDAP_SCOPE_SUBTREE;
		*key = strdup("uid");
		*format = strdup("${uid}:${gecos}");
	}
	if (strcmp(map, "passwd.bynumber") == 0) {
		*base = strdup("dc=boston,dc=redhat,dc=com");
		*scope = LDAP_SCOPE_SUBTREE;
		*key = strdup("uidNumber");
		*format = strdup("${uid}:${gecos}");
	}
	return;
}