winbindd: Fill in num_entries where available
authorVolker Lendecke <vl@samba.org>
Sat, 3 Apr 2010 12:16:19 +0000 (14:16 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 19 Apr 2010 12:27:18 +0000 (14:27 +0200)
The server implementation of WINBINDD_LIST_USERS, WINBINDD_LIST_GROUPS and
WINBINDD_LIST_TRUSTDOM knows the number of entries returned.

Bump up the version number so that a newer lib does not rely on something an
older winbind does not do.

nsswitch/winbind_struct_protocol.h
source3/winbindd/winbindd_list_groups.c
source3/winbindd/winbindd_list_users.c
source3/winbindd/winbindd_misc.c

index 70fc477039cbbc96db691fce579250551a01e3e3..b0f99a30a50295fd641f46dd89809ec070189c33 100644 (file)
@@ -50,8 +50,9 @@ typedef char fstring[FSTRING_LEN];
  * 22: added WINBINDD_PING_DC
  * 23: added session_key to ccache_ntlm_auth response
  *     added WINBINDD_CCACHE_SAVE
+ * 24: Fill in num_entries WINBINDD_LIST_USERS and WINBINDD_LIST_GROUPS
  */
-#define WINBIND_INTERFACE_VERSION 23
+#define WINBIND_INTERFACE_VERSION 24
 
 /* Have to deal with time_t being 4 or 8 bytes due to structure alignment.
    On a 64bit Linux box, we have to support a constant structure size
index 3c9ff20b855f83efc138c911a61ef39ffd995606..7331e9da1ee665403782ccce942ca10af42c8dbf 100644 (file)
@@ -161,6 +161,7 @@ NTSTATUS winbindd_list_groups_recv(struct tevent_req *req,
        }
 
        len = 0;
+       response->data.num_entries = 0;
        for (i=0; i<state->num_domains; i++) {
                struct winbindd_list_groups_domstate *d = &state->domains[i];
 
@@ -171,6 +172,7 @@ NTSTATUS winbindd_list_groups_recv(struct tevent_req *req,
                                             True);
                        len += strlen(name)+1;
                }
+               response->data.num_entries += d->groups.num_principals;
        }
 
        result = talloc_array(response, char, len+1);
index 19232b7b11c16a010638cf807e67c94af679e3b5..124e71b039a6b8d3329081ecd655328bf2cdd5e5 100644 (file)
@@ -161,6 +161,7 @@ NTSTATUS winbindd_list_users_recv(struct tevent_req *req,
        }
 
        len = 0;
+       response->data.num_entries = 0;
        for (i=0; i<state->num_domains; i++) {
                struct winbindd_list_users_domstate *d = &state->domains[i];
 
@@ -171,6 +172,7 @@ NTSTATUS winbindd_list_users_recv(struct tevent_req *req,
                                             True);
                        len += strlen(name)+1;
                }
+               response->data.num_entries += d->users.num_userinfos;
        }
 
        result = talloc_array(response, char, len+1);
index ac8f1a7dfdaee3aea11fddc10a24ecf92e3fbae9..e6be28079d2c3c1f8feee564e75255d9f9851efd 100644 (file)
@@ -130,6 +130,8 @@ void winbindd_list_trusted_domains(struct winbindd_cli_state *state)
                        is_online ? "Online" : "Offline" );
        }
 
+       state->response->data.num_entries = num_domains;
+
        extra_data_len = strlen(extra_data);
        if (extra_data_len > 0) {