summaryrefslogtreecommitdiff
path: root/usr/src/cmd/idmap/idmapd/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/idmap/idmapd/server.c')
-rw-r--r--usr/src/cmd/idmap/idmapd/server.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/usr/src/cmd/idmap/idmapd/server.c b/usr/src/cmd/idmap/idmapd/server.c
index 8c26069a9f..59d53a2a98 100644
--- a/usr/src/cmd/idmap/idmapd/server.c
+++ b/usr/src/cmd/idmap/idmapd/server.c
@@ -560,7 +560,6 @@ idmap_list_mappings_1_svc(int64_t lastrowid, uint64_t limit, int32_t flag,
time_t curtime;
(void) memset(result, 0, sizeof (*result));
- lbuf[0] = rbuf[0] = 0;
/* Current time */
errno = 0;
@@ -588,6 +587,8 @@ idmap_list_mappings_1_svc(int64_t lastrowid, uint64_t limit, int32_t flag,
if (limit > 0)
(void) snprintf(lbuf, sizeof (lbuf),
"LIMIT %" PRIu64, limit + 1ULL);
+ else
+ lbuf[0] = '\0';
(void) snprintf(rbuf, sizeof (rbuf), "rowid > %" PRIu64, lastrowid);
@@ -704,7 +705,6 @@ idmap_list_namerules_1_svc(idmap_namerule rule, uint64_t lastrowid,
{
sqlite *db = NULL;
- char w2ubuf[15], u2wbuf[15];
char lbuf[30], rbuf[30];
char *sql = NULL;
char *expr = NULL;
@@ -712,7 +712,6 @@ idmap_list_namerules_1_svc(idmap_namerule rule, uint64_t lastrowid,
idmap_retcode retcode;
(void) memset(result, 0, sizeof (*result));
- lbuf[0] = rbuf[0] = 0;
result->retcode = validate_rule(&rule);
if (result->retcode != IDMAP_SUCCESS)
@@ -727,22 +726,6 @@ idmap_list_namerules_1_svc(idmap_namerule rule, uint64_t lastrowid,
if (result->retcode != IDMAP_SUCCESS)
goto out;
- result->retcode = IDMAP_ERR_INTERNAL;
-
- w2ubuf[0] = u2wbuf[0] = 0;
- if (rule.direction == IDMAP_DIRECTION_BI) {
- (void) snprintf(w2ubuf, sizeof (w2ubuf), "AND w2u_order > 0");
- (void) snprintf(u2wbuf, sizeof (u2wbuf), "AND u2w_order > 0");
- } else if (rule.direction == IDMAP_DIRECTION_W2U) {
- (void) snprintf(w2ubuf, sizeof (w2ubuf), "AND w2u_order > 0");
- (void) snprintf(u2wbuf, sizeof (u2wbuf),
- "AND (u2w_order = 0 OR u2w_order ISNULL)");
- } else if (rule.direction == IDMAP_DIRECTION_U2W) {
- (void) snprintf(w2ubuf, sizeof (w2ubuf),
- "AND (w2u_order = 0 OR w2u_order ISNULL)");
- (void) snprintf(u2wbuf, sizeof (u2wbuf), "AND u2w_order > 0");
- }
-
result->retcode = gen_sql_expr_from_rule(&rule, &expr);
if (result->retcode != IDMAP_SUCCESS)
goto out;
@@ -753,6 +736,8 @@ idmap_list_namerules_1_svc(idmap_namerule rule, uint64_t lastrowid,
if (limit > 0)
(void) snprintf(lbuf, sizeof (lbuf),
"LIMIT %" PRIu64, limit + 1ULL);
+ else
+ lbuf[0] = '\0';
(void) snprintf(rbuf, sizeof (rbuf), "rowid > %" PRIu64, lastrowid);
@@ -763,8 +748,8 @@ idmap_list_namerules_1_svc(idmap_namerule rule, uint64_t lastrowid,
sql = sqlite_mprintf("SELECT rowid, is_user, is_wuser, windomain, "
"winname_display, is_nt4, unixname, w2u_order, u2w_order "
"FROM namerules WHERE "
- " %s %s %s %s %s;",
- rbuf, expr, w2ubuf, u2wbuf, lbuf);
+ " %s %s %s;",
+ rbuf, expr, lbuf);
if (sql == NULL) {
result->retcode = IDMAP_ERR_MEMORY;