summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/nsswitch/wbinfo.c34
-rw-r--r--source3/nsswitch/winbindd.c1
-rw-r--r--source3/nsswitch/winbindd_misc.c29
-rw-r--r--source3/nsswitch/winbindd_nss.h2
-rw-r--r--source3/nsswitch/winbindd_proto.h1
5 files changed, 67 insertions, 0 deletions
diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c
index 5a46f7d56e..32a3c95113 100644
--- a/source3/nsswitch/wbinfo.c
+++ b/source3/nsswitch/wbinfo.c
@@ -157,6 +157,31 @@ static BOOL wbinfo_list_domains(void)
return True;
}
+
+/* show sequence numbers */
+static BOOL wbinfo_show_sequence(void)
+{
+ struct winbindd_response response;
+ fstring name;
+
+ ZERO_STRUCT(response);
+
+ /* Send request */
+ if (winbindd_request(WINBINDD_SHOW_SEQUENCE, NULL, &response) !=
+ NSS_STATUS_SUCCESS) {
+ return False;
+ }
+
+ /* Display response */
+ if (response.extra_data) {
+ char *extra_data = (char *)response.extra_data;
+ printf("%s", extra_data);
+ SAFE_FREE(response.extra_data);
+ }
+
+ return True;
+}
+
/* Check trust account password */
static BOOL wbinfo_check_secret(void)
@@ -539,6 +564,7 @@ static void usage(void)
printf("\t-r user\t\t\tget user groups\n");
printf("\t-a user%%password\tauthenticate user\n");
printf("\t-p 'ping' winbindd to see if it is alive\n");
+ printf("\t--sequence\t\tshow sequence numbers of all domains\n");
}
/* Main program */
@@ -556,6 +582,7 @@ int main(int argc, char **argv)
static char *string_arg;
static int int_arg;
BOOL got_command = False;
+ enum {OPT_SEQUENCE=1};
struct poptOption long_options[] = {
@@ -571,6 +598,7 @@ int main(int argc, char **argv)
{ "sid-to-gid", 'Y', POPT_ARG_STRING, &string_arg, 'Y' },
{ "check-secret", 't', POPT_ARG_NONE, 0, 't' },
{ "trusted-domains", 'm', POPT_ARG_NONE, 0, 'm' },
+ { "sequence", OPT_SEQUENCE, POPT_ARG_NONE, 0, OPT_SEQUENCE },
{ "user-groups", 'r', POPT_ARG_STRING, &string_arg, 'r' },
{ "authenticate", 'a', POPT_ARG_STRING, &string_arg, 'a' },
{ "set-auth-user", 0, POPT_ARG_STRING, &string_arg, OPT_SET_AUTH_USER },
@@ -689,6 +717,12 @@ int main(int argc, char **argv)
return 1;
}
break;
+ case OPT_SEQUENCE:
+ if (!wbinfo_show_sequence()) {
+ printf("Could not show sequence numbers\n");
+ return 1;
+ }
+ break;
case 'r':
if (!wbinfo_get_usergroups(string_arg)) {
printf("Could not get groups for user %s\n",
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c
index fe6c331187..debe7f716f 100644
--- a/source3/nsswitch/winbindd.c
+++ b/source3/nsswitch/winbindd.c
@@ -230,6 +230,7 @@ static struct dispatch_table dispatch_table[] = {
{ WINBINDD_LIST_USERS, winbindd_list_users, "LIST_USERS" },
{ WINBINDD_LIST_GROUPS, winbindd_list_groups, "LIST_GROUPS" },
{ WINBINDD_LIST_TRUSTDOM, winbindd_list_trusted_domains, "LIST_TRUSTDOM" },
+ { WINBINDD_SHOW_SEQUENCE, winbindd_show_sequence, "SHOW_SEQUENCE" },
/* SID related functions */
diff --git a/source3/nsswitch/winbindd_misc.c b/source3/nsswitch/winbindd_misc.c
index 448af3ac95..8b22b87c3d 100644
--- a/source3/nsswitch/winbindd_misc.c
+++ b/source3/nsswitch/winbindd_misc.c
@@ -145,6 +145,35 @@ enum winbindd_result winbindd_list_trusted_domains(struct winbindd_cli_state
return WINBINDD_OK;
}
+
+enum winbindd_result winbindd_show_sequence(struct winbindd_cli_state *state)
+{
+ struct winbindd_domain *domain;
+ char *extra_data = NULL;
+
+ DEBUG(3, ("[%5d]: show sequence\n", state->pid));
+
+ extra_data = strdup("");
+
+ /* this makes for a very simple data format, and is easily parsable as well
+ if that is ever needed */
+ for (domain = domain_list(); domain; domain = domain->next) {
+ char *s;
+
+ domain->methods->sequence_number(domain, &domain->sequence_number);
+
+ asprintf(&s,"%s%s : %u\n", extra_data,
+ domain->name, (unsigned)domain->sequence_number);
+ free(extra_data);
+ extra_data = s;
+ }
+
+ state->response.extra_data = extra_data;
+ state->response.length += strlen(extra_data);
+
+ return WINBINDD_OK;
+}
+
enum winbindd_result winbindd_ping(struct winbindd_cli_state
*state)
{
diff --git a/source3/nsswitch/winbindd_nss.h b/source3/nsswitch/winbindd_nss.h
index 76a2406ae9..7a0926a035 100644
--- a/source3/nsswitch/winbindd_nss.h
+++ b/source3/nsswitch/winbindd_nss.h
@@ -92,6 +92,8 @@ enum winbindd_cmd {
WINBINDD_INFO, /* Various bit of info. Currently just tidbits */
WINBINDD_DOMAIN_NAME, /* The domain this winbind server is a member of (lp_workgroup()) */
+ WINBINDD_SHOW_SEQUENCE, /* display sequence numbers of domains */
+
/* Placeholder for end of cmd list */
WINBINDD_NUM_CMDS
diff --git a/source3/nsswitch/winbindd_proto.h b/source3/nsswitch/winbindd_proto.h
index 4c355d11b0..58e42eeab8 100644
--- a/source3/nsswitch/winbindd_proto.h
+++ b/source3/nsswitch/winbindd_proto.h
@@ -69,6 +69,7 @@ void winbindd_idmap_status(void);
enum winbindd_result winbindd_check_machine_acct(struct winbindd_cli_state *state);
enum winbindd_result winbindd_list_trusted_domains(struct winbindd_cli_state
*state);
+enum winbindd_result winbindd_show_sequence(struct winbindd_cli_state *state);
enum winbindd_result winbindd_ping(struct winbindd_cli_state
*state);
enum winbindd_result winbindd_info(struct winbindd_cli_state *state);