summaryrefslogtreecommitdiffstats
path: root/server/tools/tools_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/tools/tools_util.c')
-rw-r--r--server/tools/tools_util.c98
1 files changed, 0 insertions, 98 deletions
diff --git a/server/tools/tools_util.c b/server/tools/tools_util.c
index daf9b41f4..a3669001f 100644
--- a/server/tools/tools_util.c
+++ b/server/tools/tools_util.c
@@ -28,104 +28,6 @@
#include "db/sysdb.h"
#include "tools/tools_util.h"
-/* Even in LOCAL database, we must enforce MPG. That means enforcing the following rules:
- *
- * 1. Users and groups must share the same name space. There can never be
- * a real group that has the same name of a real user.
- * 2. Users and Groups must share the same ID space a group can never have
- * a gidNumber that is numerically equal to a uidNumber Otherwise the
- * user MPG will conflict with said group.
- */
-
-struct ucheck {
- bool done;
- bool dup;
- int error;
-};
-
-void check_unique_callback(void *ptr, int error, struct ldb_result *res)
-{
- struct ucheck *data = talloc_get_type(ptr, struct ucheck);
-
- data->done = true;
-
- if (error) {
- data->error = error;
- }
-
- if (res->count != 0) {
- data->dup = true;
- }
-}
-
-int check_user_name_unique(struct tools_ctx *ctx, const char *name)
-{
- struct ucheck *data;
- int ret = EOK;
-
- data = talloc_zero(NULL, struct ucheck);
- if (!data) return ENOMEM;
-
- ret = sysdb_getgrnam(data, ctx->sysdb,
- "LOCAL", name, false,
- check_unique_callback, data);
- if (ret != EOK) {
- DEBUG(1, ("sysdb_getgrnam failed: %d\n", ret));
- goto done;
- }
-
- while (!data->done) {
- tevent_loop_once(ctx->ev);
- }
-
- if (data->error) {
- ret = data->error;
- goto done;
- }
-
- if (data->dup) {
- ret = EEXIST;
- }
-
-done:
- talloc_free(data);
- return ret;
-}
-
-int check_group_name_unique(struct tools_ctx *ctx, const char *name)
-{
- struct ucheck *data;
- int ret;
-
- data = talloc_zero(NULL, struct ucheck);
- if (!data) return ENOMEM;
-
- ret = sysdb_getpwnam(data, ctx->sysdb,
- "LOCAL", name, false,
- check_unique_callback, data);
- if (ret != EOK) {
- DEBUG(1, ("sysdb_getgrnam failed: %d\n", ret));
- goto done;
- }
-
- while (!data->done) {
- tevent_loop_once(ctx->ev);
- }
-
- if (data->error) {
- ret = data->error;
- goto done;
- }
-
- if (data->dup) {
- ret = EEXIST;
- }
-
-done:
- talloc_free(data);
- return ret;
-}
-
int setup_db(struct tools_ctx **tools_ctx)
{
TALLOC_CTX *tmp_ctx;