summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb_services.c
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2016-05-25 23:00:59 +0200
committerJakub Hrozek <jhrozek@redhat.com>2016-05-31 13:07:02 +0200
commit49d84c926b00ba1368372cdec255bceb58d66f43 (patch)
treec8bfeb778ebf55009204da5fabf49f11f12eb117 /src/db/sysdb_services.c
parent7b9a4a89cb92a0281d73a2c2e79f5eeb317e1149 (diff)
downloadsssd-49d84c926b00ba1368372cdec255bceb58d66f43.tar.gz
sssd-49d84c926b00ba1368372cdec255bceb58d66f43.tar.xz
sssd-49d84c926b00ba1368372cdec255bceb58d66f43.zip
sysdb: add sysdb_{add,replace,delete}_ulong()
As the add_ulong() convenience can add, replace or remove a unsigned long according to the operation received as its argument, some confusion can easily happen due to its misleading name. In order to improve the explicitness of our code, let's introduce sysdb_add_ulong(), sysdb_replace_ulong() and sysdb_delete_ulong(). These new functions are basically wrappers of add_ulong() (now sysdb_ldb_msg_ulong_helper()), calling it using the proper flag according to each function. Any code previously using add_ulong() is now adapted to use these brand new functions. Related: https://fedorahosted.org/sssd/ticket/1656 Signed-off-by: Fabiano FidĂȘncio <fabiano@fidencio.org> Reviewed-by: Petr Cech <pcech@redhat.com>
Diffstat (limited to 'src/db/sysdb_services.c')
-rw-r--r--src/db/sysdb_services.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/db/sysdb_services.c b/src/db/sysdb_services.c
index 20c88b724..8118fef00 100644
--- a/src/db/sysdb_services.c
+++ b/src/db/sysdb_services.c
@@ -468,8 +468,7 @@ sysdb_svc_add(TALLOC_CTX *mem_ctx,
if (ret != EOK) goto done;
/* Set the port number */
- ret = add_ulong(msg, LDB_FLAG_MOD_ADD,
- SYSDB_SVC_PORT, port);
+ ret = sysdb_add_ulong(msg, SYSDB_SVC_PORT, port);
if (ret != EOK) goto done;
/* If this service has any aliases, include them */
@@ -506,8 +505,7 @@ sysdb_svc_add(TALLOC_CTX *mem_ctx,
}
/* creation time */
- ret = add_ulong(msg, LDB_FLAG_MOD_ADD, SYSDB_CREATE_TIME,
- (unsigned long)time(NULL));
+ ret = sysdb_add_ulong(msg, SYSDB_CREATE_TIME, (unsigned long)time(NULL));
if (ret) goto done;
lret = ldb_add(domain->sysdb->ldb, msg);
@@ -551,8 +549,7 @@ sysdb_svc_update(struct sysdb_ctx *sysdb,
msg->dn = dn;
/* Update the port */
- ret = add_ulong(msg, SYSDB_MOD_REP,
- SYSDB_SVC_PORT, port);
+ ret = sysdb_replace_ulong(msg, SYSDB_SVC_PORT, port);
if (ret != EOK) goto done;
if (aliases && aliases[0]) {