diff options
author | Simo Sorce <ssorce@redhat.com> | 2009-03-05 17:24:18 -0500 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-03-05 17:55:31 -0500 |
commit | 0ae3745711f4c856cf36f4aca07310586f930e1d (patch) | |
tree | 75bf8615f743f3c731d3b428989cfd27cc1da5e9 /server/db | |
parent | 0f7963cc85592dc07fca07f2e801956bf204ec33 (diff) | |
download | sssd-0ae3745711f4c856cf36f4aca07310586f930e1d.tar.gz sssd-0ae3745711f4c856cf36f4aca07310586f930e1d.tar.xz sssd-0ae3745711f4c856cf36f4aca07310586f930e1d.zip |
Remove _PW_ and _GR_ from SYSDB_ defines
Also unify SYSDB_PW_NAME and SYSDB_GR_NAME in SYSDB_NAME and make it "name"
Diffstat (limited to 'server/db')
-rw-r--r-- | server/db/sysdb.h | 51 | ||||
-rw-r--r-- | server/db/sysdb_ops.c | 52 | ||||
-rw-r--r-- | server/db/sysdb_private.h | 3 | ||||
-rw-r--r-- | server/db/sysdb_search.c | 2 |
4 files changed, 52 insertions, 56 deletions
diff --git a/server/db/sysdb.h b/server/db/sysdb.h index 1302cdd..80a446f 100644 --- a/server/db/sysdb.h +++ b/server/db/sysdb.h @@ -36,24 +36,21 @@ #define SYSDB_USER_CLASS "user" #define SYSDB_GROUP_CLASS "group" +#define SYSDB_NAME "name" + #define SYSDB_NEXTID "nextID" #define SYSDB_UIDNUM "uidNumber" #define SYSDB_GIDNUM "gidNumber" #define SYSDB_CREATE_TIME "createTimestamp" -#define SYSDB_PW_NAME "uid" -#define SYSDB_PW_PWD "userPassword" -#define SYSDB_PW_UIDNUM "uidNumber" -#define SYSDB_PW_GIDNUM "gidNumber" -#define SYSDB_PW_FULLNAME "fullName" -#define SYSDB_PW_HOMEDIR "homeDirectory" -#define SYSDB_PW_SHELL "loginShell" -#define SYSDB_PW_MEMBEROF "memberOf" -#define SYSDB_PW_DISABLED "disabled" - -#define SYSDB_GR_NAME "gid" -#define SYSDB_GR_GIDNUM "gidNumber" -#define SYSDB_GR_MEMBER "member" +#define SYSDB_PWD "userPassword" +#define SYSDB_FULLNAME "fullName" +#define SYSDB_HOMEDIR "homeDirectory" +#define SYSDB_SHELL "loginShell" +#define SYSDB_MEMBEROF "memberOf" +#define SYSDB_DISABLED "disabled" + +#define SYSDB_MEMBER "member" #define SYSDB_LEGACY_MEMBER "memberUid" #define SYSDB_USER_ATTR_DEFAULTGROUP "defaultGroup" @@ -71,24 +68,24 @@ #define SYSDB_NEXTID_FILTER "("SYSDB_NEXTID"=*)" -#define SYSDB_PWNAM_FILTER "(&(objectclass="SYSDB_USER_CLASS")("SYSDB_PW_NAME"=%s))" -#define SYSDB_PWUID_FILTER "(&(objectclass="SYSDB_USER_CLASS")("SYSDB_PW_UIDNUM"=%lu))" +#define SYSDB_PWNAM_FILTER "(&(objectclass="SYSDB_USER_CLASS")("SYSDB_NAME"=%s))" +#define SYSDB_PWUID_FILTER "(&(objectclass="SYSDB_USER_CLASS")("SYSDB_UIDNUM"=%lu))" #define SYSDB_PWENT_FILTER "(objectclass="SYSDB_USER_CLASS")" -#define SYSDB_GRNAM_FILTER "(&(objectclass="SYSDB_GROUP_CLASS")("SYSDB_GR_NAME"=%s))" -#define SYSDB_GRNA2_FILTER "(&(objectclass="SYSDB_USER_CLASS")("SYSDB_PW_MEMBEROF"=%s))" -#define SYSDB_GRGID_FILTER "(&(objectclass="SYSDB_GROUP_CLASS")("SYSDB_GR_GIDNUM"=%lu))" +#define SYSDB_GRNAM_FILTER "(&(objectclass="SYSDB_GROUP_CLASS")("SYSDB_NAME"=%s))" +#define SYSDB_GRNA2_FILTER "(&(objectclass="SYSDB_USER_CLASS")("SYSDB_MEMBEROF"=%s))" +#define SYSDB_GRGID_FILTER "(&(objectclass="SYSDB_GROUP_CLASS")("SYSDB_GIDNUM"=%lu))" #define SYSDB_GRENT_FILTER "(objectclass="SYSDB_GROUP_CLASS")" -#define SYSDB_INITGR_FILTER "(&(objectclass="SYSDB_GROUP_CLASS")("SYSDB_GR_GIDNUM"=*))" +#define SYSDB_INITGR_FILTER "(&(objectclass="SYSDB_GROUP_CLASS")("SYSDB_GIDNUM"=*))" #define SYSDB_INITGR_LEGACY_FILTER "(&(objectclass="SYSDB_GROUP_CLASS")("SYSDB_LEGACY_MEMBER"=%s))" #define SYSDB_GETCACHED_FILTER "(&(objectclass="SYSDB_USER_CLASS")("SYSDB_USER_ATTR_LAST_LOGIN">=%llu))" -#define SYSDB_PW_ATTRS {SYSDB_PW_NAME, SYSDB_PW_UIDNUM, \ - SYSDB_PW_GIDNUM, SYSDB_PW_FULLNAME, \ - SYSDB_PW_HOMEDIR, SYSDB_PW_SHELL, \ +#define SYSDB_PW_ATTRS {SYSDB_NAME, SYSDB_UIDNUM, \ + SYSDB_GIDNUM, SYSDB_FULLNAME, \ + SYSDB_HOMEDIR, SYSDB_SHELL, \ SYSDB_LAST_UPDATE, \ NULL} #define SYSDB_USER_ATTRS {SYSDB_USER_ATTR_DEFAULTGROUP, \ @@ -103,18 +100,18 @@ SYSDB_USER_ATTR_USERPIC, \ SYSDB_LAST_UPDATE, \ NULL} -#define SYSDB_GRNAM_ATTRS {SYSDB_GR_NAME, SYSDB_GR_GIDNUM, \ +#define SYSDB_GRNAM_ATTRS {SYSDB_NAME, SYSDB_GIDNUM, \ SYSDB_LAST_UPDATE, SYSDB_LEGACY_MEMBER, \ NULL} -#define SYSDB_GRPW_ATTRS {SYSDB_PW_NAME, SYSDB_LAST_UPDATE, \ +#define SYSDB_GRPW_ATTRS {SYSDB_NAME, SYSDB_LAST_UPDATE, \ NULL} #define SYSDB_INITGR_ATTR "memberof" -#define SYSDB_INITGR_ATTRS {SYSDB_GR_GIDNUM, SYSDB_LAST_UPDATE, \ +#define SYSDB_INITGR_ATTRS {SYSDB_GIDNUM, SYSDB_LAST_UPDATE, \ NULL} -#define SYSDB_TMPL_USER SYSDB_PW_NAME"=%s,"SYSDB_TMPL_USER_BASE -#define SYSDB_TMPL_GROUP SYSDB_GR_NAME"=%s,"SYSDB_TMPL_GROUP_BASE +#define SYSDB_TMPL_USER SYSDB_NAME"=%s,"SYSDB_TMPL_USER_BASE +#define SYSDB_TMPL_GROUP SYSDB_NAME"=%s,"SYSDB_TMPL_GROUP_BASE struct confdb_ctx; struct sysdb_ctx; diff --git a/server/db/sysdb_ops.c b/server/db/sysdb_ops.c index 1f53498..d2084d9 100644 --- a/server/db/sysdb_ops.c +++ b/server/db/sysdb_ops.c @@ -141,14 +141,14 @@ int sysdb_add_group_member(struct sysdb_req *sysreq, if(msg == NULL) return ENOMEM; msg->dn = group_dn; - ret = ldb_msg_add_empty(msg, SYSDB_GR_MEMBER, + ret = ldb_msg_add_empty(msg, SYSDB_MEMBER, LDB_FLAG_MOD_ADD, NULL); if (ret != LDB_SUCCESS) return ENOMEM; dn = ldb_dn_get_linearized(member_dn); if (!dn) return EINVAL; - ret = ldb_msg_add_fmt(msg, SYSDB_GR_MEMBER, "%s", dn); + ret = ldb_msg_add_fmt(msg, SYSDB_MEMBER, "%s", dn); if (ret != LDB_SUCCESS) return EINVAL; ret = ldb_build_mod_req(&req, ctx->ldb, cbctx, msg, @@ -195,14 +195,14 @@ int sysdb_remove_group_member(struct sysdb_req *sysreq, if(msg == NULL) return ENOMEM; msg->dn = group_dn; - ret = ldb_msg_add_empty(msg, SYSDB_GR_MEMBER, + ret = ldb_msg_add_empty(msg, SYSDB_MEMBER, LDB_FLAG_MOD_DELETE, NULL); if (ret != LDB_SUCCESS) return ENOMEM; dn = ldb_dn_get_linearized(member_dn); if (!dn) return EINVAL; - ret = ldb_msg_add_fmt(msg, SYSDB_GR_MEMBER, "%s", dn); + ret = ldb_msg_add_fmt(msg, SYSDB_MEMBER, "%s", dn); if (ret != LDB_SUCCESS) return EINVAL; ret = ldb_build_mod_req(&req, ctx->ldb, cbctx, msg, @@ -350,7 +350,7 @@ int sysdb_delete_user_by_uid(struct sysdb_req *sysreq, const char *domain, uid_t uid, sysdb_callback_t fn, void *pvt) { - static const char *attrs[] = { SYSDB_PW_NAME, SYSDB_PW_UIDNUM, NULL }; + static const char *attrs[] = { SYSDB_NAME, SYSDB_UIDNUM, NULL }; struct delete_ctx *del_ctx; struct sysdb_ctx *ctx; struct ldb_dn *base_dn; @@ -405,7 +405,7 @@ int sysdb_delete_group_by_gid(struct sysdb_req *sysreq, const char *domain, gid_t gid, sysdb_callback_t fn, void *pvt) { - static const char *attrs[] = { SYSDB_GR_NAME, SYSDB_GR_GIDNUM, NULL }; + static const char *attrs[] = { SYSDB_NAME, SYSDB_GIDNUM, NULL }; struct delete_ctx *del_ctx; struct sysdb_ctx *ctx; struct ldb_dn *base_dn; @@ -860,7 +860,7 @@ static int user_add_call(struct user_add_ctx *user_ctx) ret = add_string(msg, flags, "objectClass", SYSDB_USER_CLASS); if (ret != LDB_SUCCESS) return ENOMEM; - ret = add_string(msg, flags, SYSDB_PW_NAME, user_ctx->name); + ret = add_string(msg, flags, SYSDB_NAME, user_ctx->name); if (ret != LDB_SUCCESS) return ENOMEM; if (user_ctx->uid) { @@ -882,17 +882,17 @@ static int user_add_call(struct user_add_ctx *user_ctx) } if (user_ctx->gecos && *user_ctx->gecos) { - ret = add_string(msg, flags, SYSDB_PW_FULLNAME, user_ctx->gecos); + ret = add_string(msg, flags, SYSDB_FULLNAME, user_ctx->gecos); if (ret != LDB_SUCCESS) return ENOMEM; } if (user_ctx->homedir && *user_ctx->homedir) { - ret = add_string(msg, flags, SYSDB_PW_HOMEDIR, user_ctx->homedir); + ret = add_string(msg, flags, SYSDB_HOMEDIR, user_ctx->homedir); if (ret != LDB_SUCCESS) return ENOMEM; } if (user_ctx->shell && *user_ctx->shell) { - ret = add_string(msg, flags, SYSDB_PW_SHELL, user_ctx->shell); + ret = add_string(msg, flags, SYSDB_SHELL, user_ctx->shell); if (ret != LDB_SUCCESS) return ENOMEM; } @@ -997,7 +997,7 @@ static int group_add_call(struct group_add_ctx *group_ctx) ret = add_string(msg, flags, "objectClass", SYSDB_GROUP_CLASS); if (ret != LDB_SUCCESS) return ENOMEM; - ret = add_string(msg, flags, SYSDB_GR_NAME, group_ctx->name); + ret = add_string(msg, flags, SYSDB_NAME, group_ctx->name); if (ret != LDB_SUCCESS) return ENOMEM; if (group_ctx->gid) { @@ -1061,7 +1061,7 @@ int sysdb_legacy_store_user(struct sysdb_req *sysreq, const char *homedir, const char *shell, sysdb_callback_t fn, void *pvt) { - static const char *attrs[] = { SYSDB_PW_NAME, NULL }; + static const char *attrs[] = { SYSDB_NAME, NULL }; struct legacy_user_ctx *user_ctx; struct sysdb_ctx *ctx; struct ldb_request *req; @@ -1192,7 +1192,7 @@ static int legacy_user_callback(struct ldb_request *req, return LDB_ERR_OPERATIONS_ERROR; } - ret = add_string(msg, flags, SYSDB_PW_NAME, user_ctx->name); + ret = add_string(msg, flags, SYSDB_NAME, user_ctx->name); if (ret != LDB_SUCCESS) { return_error(cbctx, ENOMEM); return LDB_ERR_OPERATIONS_ERROR; @@ -1200,9 +1200,9 @@ static int legacy_user_callback(struct ldb_request *req, } if (user_ctx->pwd && *user_ctx->pwd) { - ret = add_string(msg, flags, SYSDB_PW_PWD, user_ctx->pwd); + ret = add_string(msg, flags, SYSDB_PWD, user_ctx->pwd); } else { - ret = ldb_msg_add_empty(msg, SYSDB_PW_PWD, + ret = ldb_msg_add_empty(msg, SYSDB_PWD, LDB_FLAG_MOD_DELETE, NULL); } if (ret != LDB_SUCCESS) { @@ -1211,7 +1211,7 @@ static int legacy_user_callback(struct ldb_request *req, } if (user_ctx->uid) { - ret = add_ulong(msg, flags, SYSDB_PW_UIDNUM, + ret = add_ulong(msg, flags, SYSDB_UIDNUM, (unsigned long)(user_ctx->uid)); if (ret != LDB_SUCCESS) { return_error(cbctx, ENOMEM); @@ -1224,7 +1224,7 @@ static int legacy_user_callback(struct ldb_request *req, } if (user_ctx->gid) { - ret = add_ulong(msg, flags, SYSDB_PW_GIDNUM, + ret = add_ulong(msg, flags, SYSDB_GIDNUM, (unsigned long)(user_ctx->gid)); if (ret != LDB_SUCCESS) { return_error(cbctx, ENOMEM); @@ -1237,9 +1237,9 @@ static int legacy_user_callback(struct ldb_request *req, } if (user_ctx->gecos && *user_ctx->gecos) { - ret = add_string(msg, flags, SYSDB_PW_FULLNAME, user_ctx->gecos); + ret = add_string(msg, flags, SYSDB_FULLNAME, user_ctx->gecos); } else { - ret = ldb_msg_add_empty(msg, SYSDB_PW_FULLNAME, + ret = ldb_msg_add_empty(msg, SYSDB_FULLNAME, LDB_FLAG_MOD_DELETE, NULL); } if (ret != LDB_SUCCESS) { @@ -1248,9 +1248,9 @@ static int legacy_user_callback(struct ldb_request *req, } if (user_ctx->homedir && *user_ctx->homedir) { - ret = add_string(msg, flags, SYSDB_PW_HOMEDIR, user_ctx->homedir); + ret = add_string(msg, flags, SYSDB_HOMEDIR, user_ctx->homedir); } else { - ret = ldb_msg_add_empty(msg, SYSDB_PW_HOMEDIR, + ret = ldb_msg_add_empty(msg, SYSDB_HOMEDIR, LDB_FLAG_MOD_DELETE, NULL); } if (ret != LDB_SUCCESS) { @@ -1259,9 +1259,9 @@ static int legacy_user_callback(struct ldb_request *req, } if (user_ctx->shell && *user_ctx->shell) { - ret = add_string(msg, flags, SYSDB_PW_SHELL, user_ctx->shell); + ret = add_string(msg, flags, SYSDB_SHELL, user_ctx->shell); } else { - ret = ldb_msg_add_empty(msg, SYSDB_PW_SHELL, + ret = ldb_msg_add_empty(msg, SYSDB_SHELL, LDB_FLAG_MOD_DELETE, NULL); } if (ret != LDB_SUCCESS) { @@ -1329,7 +1329,7 @@ int sysdb_legacy_store_group(struct sysdb_req *sysreq, const char **members, sysdb_callback_t fn, void *pvt) { - static const char *attrs[] = { SYSDB_GR_NAME, NULL }; + static const char *attrs[] = { SYSDB_NAME, NULL }; struct legacy_group_ctx *group_ctx; struct sysdb_ctx *ctx; struct ldb_request *req; @@ -1456,7 +1456,7 @@ static int legacy_group_callback(struct ldb_request *req, return LDB_ERR_OPERATIONS_ERROR; } - ret = add_string(msg, flags, SYSDB_GR_NAME, group_ctx->name); + ret = add_string(msg, flags, SYSDB_NAME, group_ctx->name); if (ret != LDB_SUCCESS) { return_error(cbctx, ENOMEM); return LDB_ERR_OPERATIONS_ERROR; @@ -1464,7 +1464,7 @@ static int legacy_group_callback(struct ldb_request *req, } if (group_ctx->gid) { - ret = add_ulong(msg, flags, SYSDB_GR_GIDNUM, + ret = add_ulong(msg, flags, SYSDB_GIDNUM, (unsigned long)(group_ctx->gid)); if (ret != LDB_SUCCESS) { return_error(cbctx, ENOMEM); diff --git a/server/db/sysdb_private.h b/server/db/sysdb_private.h index 012d397..a4e83e0 100644 --- a/server/db/sysdb_private.h +++ b/server/db/sysdb_private.h @@ -40,8 +40,7 @@ "@IDXATTR: member\n" \ "@IDXATTR: memberof\n" \ "@IDXATTR: memberuid\n" \ - "@IDXATTR: uid\n" \ - "@IDXATTR: gid\n" \ + "@IDXATTR: name\n" \ "@IDXATTR: uidNumber\n" \ "@IDXATTR: gidNumber\n" \ "@IDXATTR: lastUpdate\n" \ diff --git a/server/db/sysdb_search.c b/server/db/sysdb_search.c index 8b14221..24ee5cf 100644 --- a/server/db/sysdb_search.c +++ b/server/db/sysdb_search.c @@ -579,7 +579,7 @@ static void initgr_mem_legacy(struct sysdb_search_ctx *sctx) return request_ldberror(sctx, LDB_ERR_OPERATIONS_ERROR); } - userid = ldb_msg_find_attr_as_string(res->msgs[0], SYSDB_PW_NAME, NULL); + userid = ldb_msg_find_attr_as_string(res->msgs[0], SYSDB_NAME, NULL); if (!userid) { return request_ldberror(sctx, LDB_ERR_OPERATIONS_ERROR); } |