s4-idmap: Add mapping using uidNumber and gidNumber like idmap_ad
[samba.git] / source4 / winbind / wb_cmd_list_groups.c
index 37fe94a5de3baca67db76dd73e433d6f0ecdb55a..db256761d32beb76ec2fa47247e524968bbfaec1 100644 (file)
@@ -137,7 +137,8 @@ static void cmd_list_groups_recv_group_list(struct composite_context *ctx)
 
        /* If NTSTATUS is neither OK nor MORE_ENTRIES, something broke */
        if (!NT_STATUS_IS_OK(status) &&
-           !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) {
+           !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES) &&
+           !NT_STATUS_EQUAL(status, NT_STATUS_NO_MORE_ENTRIES)) {
                composite_error(state->ctx, status);
                return;
        }
@@ -154,9 +155,11 @@ static void cmd_list_groups_recv_group_list(struct composite_context *ctx)
        /* If the status is OK, we're finished, there's no more groups.
         * So we'll trim off the trailing ',' and are done.*/
        if (NT_STATUS_IS_OK(status)) {
-               int str_len = strlen(state->result);
+               size_t str_len = strlen(state->result);
                DEBUG(5, ("list_GroupList_recv returned NT_STATUS_OK\n"));
-               state->result[str_len - 1] = '\0';
+               if (str_len > 0) {
+                       state->result[str_len - 1] = '\0';
+               }
                composite_done(state->ctx);
                return;
        }