summaryrefslogtreecommitdiffstats
path: root/src/schema.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/schema.c')
-rw-r--r--src/schema.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/schema.c b/src/schema.c
new file mode 100644
index 0000000..cee39f9
--- /dev/null
+++ b/src/schema.c
@@ -0,0 +1,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;
+}