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 | |
parent | 0f7963cc85592dc07fca07f2e801956bf204ec33 (diff) | |
download | sssd-0ae3745711f4c856cf36f4aca07310586f930e1d.tar.gz sssd-0ae3745711f4c856cf36f4aca07310586f930e1d.tar.bz2 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')
-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 | ||||
-rw-r--r-- | server/infopipe/infopipe_users.c | 4 | ||||
-rw-r--r-- | server/responder/nss/nsssrv_cmd.c | 20 | ||||
-rw-r--r-- | server/responder/pam/pam_LOCAL_domain.c | 14 | ||||
-rw-r--r-- | server/tests/sysdb-tests.c | 14 |
8 files changed, 78 insertions, 82 deletions
diff --git a/server/db/sysdb.h b/server/db/sysdb.h index 1302cddb..80a446fa 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 1f53498c..d2084d90 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 012d3977..a4e83e0a 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 8b14221d..24ee5cf1 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); } diff --git a/server/infopipe/infopipe_users.c b/server/infopipe/infopipe_users.c index 52082092..a1b22e3b 100644 --- a/server/infopipe/infopipe_users.c +++ b/server/infopipe/infopipe_users.c @@ -71,7 +71,7 @@ static void infp_users_get_cached_callback(void *ptr, for (i = 0; i < res->count; i++) { username = talloc_strdup(infp_getcached_req, ldb_msg_find_attr_as_string(res->msgs[i], - SYSDB_PW_NAME, + SYSDB_NAME, NULL)); if (username != NULL) { dbret = dbus_message_iter_append_basic(&array_iter, @@ -1466,7 +1466,7 @@ int infp_users_set_uid(DBusMessage *message, struct sbus_conn_ctx *sconn) ret = ENOMEM; goto error; } - sysdb_attrs_add_long(infp_setuid_req->uid_attr, SYSDB_PW_UIDNUM, arg_uid); + sysdb_attrs_add_long(infp_setuid_req->uid_attr, SYSDB_UIDNUM, arg_uid); ret = sysdb_transaction(infp_setuid_req, infp_setuid_req->infp_req->infp->sysdb, infp_do_user_set_uid, infp_setuid_req); diff --git a/server/responder/nss/nsssrv_cmd.c b/server/responder/nss/nsssrv_cmd.c index 94f92319..46af6d50 100644 --- a/server/responder/nss/nsssrv_cmd.c +++ b/server/responder/nss/nsssrv_cmd.c @@ -192,12 +192,12 @@ static int fill_pwent(struct sss_packet *packet, for (i = 0; i < count; i++) { msg = msgs[i]; - name = ldb_msg_find_attr_as_string(msg, SYSDB_PW_NAME, NULL); - fullname = ldb_msg_find_attr_as_string(msg, SYSDB_PW_FULLNAME, NULL); - homedir = ldb_msg_find_attr_as_string(msg, SYSDB_PW_HOMEDIR, NULL); - shell = ldb_msg_find_attr_as_string(msg, SYSDB_PW_SHELL, NULL); - uid = ldb_msg_find_attr_as_uint64(msg, SYSDB_PW_UIDNUM, 0); - gid = ldb_msg_find_attr_as_uint64(msg, SYSDB_PW_GIDNUM, 0); + name = ldb_msg_find_attr_as_string(msg, SYSDB_NAME, NULL); + fullname = ldb_msg_find_attr_as_string(msg, SYSDB_FULLNAME, NULL); + homedir = ldb_msg_find_attr_as_string(msg, SYSDB_HOMEDIR, NULL); + shell = ldb_msg_find_attr_as_string(msg, SYSDB_SHELL, NULL); + uid = ldb_msg_find_attr_as_uint64(msg, SYSDB_UIDNUM, 0); + gid = ldb_msg_find_attr_as_uint64(msg, SYSDB_GIDNUM, 0); if (!name || !fullname || !homedir || !shell || !uid || !gid) { DEBUG(1, ("Incomplete user object for %s[%llu]! Skipping\n", @@ -1092,8 +1092,8 @@ static int fill_grent(struct sss_packet *packet, if (get_group) { /* find group name/gid */ - name = ldb_msg_find_attr_as_string(msg, SYSDB_GR_NAME, NULL); - gid = ldb_msg_find_attr_as_uint64(msg, SYSDB_GR_GIDNUM, 0); + name = ldb_msg_find_attr_as_string(msg, SYSDB_NAME, NULL); + gid = ldb_msg_find_attr_as_uint64(msg, SYSDB_GIDNUM, 0); if (!name || !gid) { DEBUG(1, ("Incomplete group object for %s[%llu]! Aborting\n", name?name:"<NULL>", (unsigned long long int)gid)); @@ -1150,7 +1150,7 @@ static int fill_grent(struct sss_packet *packet, continue; } - name = ldb_msg_find_attr_as_string(msg, SYSDB_PW_NAME, NULL); + name = ldb_msg_find_attr_as_string(msg, SYSDB_NAME, NULL); if (!name) { /* last member of previous group found, or error. @@ -2018,7 +2018,7 @@ static void nss_cmd_initgr_callback(void *ptr, int status, sss_packet_get_body(cctx->creq->out, &body, &blen); for (i = 0; i < num; i++) { - gid = ldb_msg_find_attr_as_uint64(res->msgs[i], SYSDB_GR_GIDNUM, 0); + gid = ldb_msg_find_attr_as_uint64(res->msgs[i], SYSDB_GIDNUM, 0); if (!gid) { DEBUG(1, ("Incomplete group object for initgroups! Aborting\n")); sss_packet_set_error(cctx->creq->out, EIO); diff --git a/server/responder/pam/pam_LOCAL_domain.c b/server/responder/pam/pam_LOCAL_domain.c index 4671eb9b..b1a459b9 100644 --- a/server/responder/pam/pam_LOCAL_domain.c +++ b/server/responder/pam/pam_LOCAL_domain.c @@ -211,7 +211,7 @@ static void do_pam_acct_mgmt(struct LOCAL_request *lreq) const char *disabled=NULL; disabled = ldb_msg_find_attr_as_string(lreq->res->msgs[0], - SYSDB_PW_DISABLED, NULL); + SYSDB_DISABLED, NULL); if (disabled != NULL && strncasecmp(disabled, "false",5)!=0 && strncasecmp(disabled, "no",2)!=0 ) { @@ -249,7 +249,7 @@ static void do_pam_chauthtok(struct LOCAL_request *lreq) NULL_CHECK_OR_JUMP(lreq->mod_attrs, ("sysdb_new_attrs failed.\n"), lreq->error, ENOMEM, done); - ret = sysdb_attrs_add_string(lreq->mod_attrs, SYSDB_PW_PWD, new_hash); + ret = sysdb_attrs_add_string(lreq->mod_attrs, SYSDB_PWD, new_hash); NEQ_CHECK_OR_JUMP(ret, EOK, ("sysdb_attrs_add_string failed.\n"), lreq->error, ret, done); @@ -298,7 +298,7 @@ static void pam_handler_callback(void *pvt, int ldb_status, goto done; } - username = ldb_msg_find_attr_as_string(res->msgs[0], SYSDB_PW_NAME, NULL); + username = ldb_msg_find_attr_as_string(res->msgs[0], SYSDB_NAME, NULL); if (strcmp(username, lreq->pd->user) != 0) { DEBUG(1, ("Expected username [%s] get [%s].\n", lreq->pd->user, username)); lreq->error = EINVAL; @@ -321,7 +321,7 @@ static void pam_handler_callback(void *pvt, int ldb_status, lreq->error, ret, done); memset(lreq->pd->authtok, 0, lreq->pd->authtok_size); - password = ldb_msg_find_attr_as_string(res->msgs[0], SYSDB_PW_PWD, NULL); + password = ldb_msg_find_attr_as_string(res->msgs[0], SYSDB_PWD, NULL); NULL_CHECK_OR_JUMP(password, ("No password stored.\n"), lreq->error, ret, done); DEBUG(4, ("user: [%s], password hash: [%s]\n", username, password)); @@ -385,9 +385,9 @@ int LOCAL_pam_handler(struct cli_ctx *cctx, pam_dp_callback_t callback, int ret; struct LOCAL_request *lreq=NULL; - static const char *attrs[] = {SYSDB_PW_NAME, - SYSDB_PW_PWD, - SYSDB_PW_DISABLED, + static const char *attrs[] = {SYSDB_NAME, + SYSDB_PWD, + SYSDB_DISABLED, SYSDB_USER_ATTR_LAST_LOGIN, "lastPasswordChange", "accountExpires", diff --git a/server/tests/sysdb-tests.c b/server/tests/sysdb-tests.c index decf6b33..fce14477 100644 --- a/server/tests/sysdb-tests.c +++ b/server/tests/sysdb-tests.c @@ -371,7 +371,7 @@ START_TEST (test_sysdb_get_local_group) struct sysdb_test_ctx *test_ctx; struct ldb_result *res; struct ldb_dn *base_group_dn; - const char *attrs[] = { SYSDB_GR_NAME, SYSDB_GR_GIDNUM, NULL }; + const char *attrs[] = { SYSDB_NAME, SYSDB_GIDNUM, NULL }; const char *name; char *expected_group; gid_t test_gid; @@ -412,7 +412,7 @@ START_TEST (test_sysdb_get_local_group) return; } - name = ldb_msg_find_attr_as_string(res->msgs[0], SYSDB_GR_NAME, NULL); + name = ldb_msg_find_attr_as_string(res->msgs[0], SYSDB_NAME, NULL); fail_unless(strcmp(name, expected_group) == 0, "Returned group name was %s, expecting %s", name, expected_group); @@ -436,7 +436,7 @@ START_TEST (test_sysdb_get_local_group) return; } - test_gid = ldb_msg_find_attr_as_uint64(res->msgs[0], SYSDB_GR_GIDNUM, 0); + test_gid = ldb_msg_find_attr_as_uint64(res->msgs[0], SYSDB_GIDNUM, 0); fail_unless(test_gid == _i, "Returned group id was %lu, expecting %lu", test_gid, _i); @@ -562,7 +562,7 @@ START_TEST (test_sysdb_add_invalid_member) struct ldb_dn *group_dn; struct ldb_result *res; struct ldb_message_element *el; - const char *group_attrs[] = { SYSDB_GR_MEMBER, NULL }; + const char *group_attrs[] = { SYSDB_MEMBER, NULL }; /* Setup */ ret = setup_sysdb_tests(&test_ctx); @@ -573,7 +573,7 @@ START_TEST (test_sysdb_add_invalid_member) group_name = talloc_asprintf(test_ctx, "testgroup%d", _i); group = talloc_asprintf(test_ctx, - SYSDB_GR_NAME"=%s,"SYSDB_TMPL_GROUP_BASE, + SYSDB_NAME"=%s,"SYSDB_TMPL_GROUP_BASE, group_name, "LOCAL"); fail_if(group == NULL, "Could not allocate group dn"); @@ -591,7 +591,7 @@ START_TEST (test_sysdb_add_invalid_member) /* Verify that the member wasn't added anyway */ member = talloc_asprintf(test_ctx, - SYSDB_PW_NAME"=%s,"SYSDB_TMPL_USER_BASE, + SYSDB_NAME"=%s,"SYSDB_TMPL_USER_BASE, username, "LOCAL"); fail_if(member == NULL, "Could not allocate member dn"); @@ -618,7 +618,7 @@ START_TEST (test_sysdb_add_invalid_member) /* Check the members for the requested user */ found_group = i = 0; - el = ldb_msg_find_element(res->msgs[0], SYSDB_GR_MEMBER); + el = ldb_msg_find_element(res->msgs[0], SYSDB_MEMBER); if (el && el->num_values > 0) { while (i < el->num_values && !found_group) { struct ldb_val v = el->values[i]; |