summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2011-04-19 14:51:12 -0400
committerStephen Gallagher <sgallagh@redhat.com>2011-04-19 14:56:30 -0400
commit44c90f21cfd661ef07e74002ae01481a69c22d98 (patch)
tree425adba8316d34f11af6ce4728f66e248bda42a5 /src
parent361b29ff4cc0eac948074cb0f54fdc7bd556a1b6 (diff)
downloadsssd-44c90f21cfd661ef07e74002ae01481a69c22d98.tar.gz
sssd-44c90f21cfd661ef07e74002ae01481a69c22d98.tar.xz
sssd-44c90f21cfd661ef07e74002ae01481a69c22d98.zip
Add value of the last USN to server configuration
Related: https://fedorahosted.org/sssd/ticket/734
Diffstat (limited to 'src')
-rw-r--r--src/providers/ldap/sdap.c15
-rw-r--r--src/providers/ldap/sdap.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/src/providers/ldap/sdap.c b/src/providers/ldap/sdap.c
index 7734904ee..b2d3e8c78 100644
--- a/src/providers/ldap/sdap.c
+++ b/src/providers/ldap/sdap.c
@@ -590,6 +590,7 @@ int sdap_get_server_opts_from_rootdse(TALLOC_CTX *memctx,
const char *last_usn_name;
const char *last_usn_value;
const char *entry_usn_name;
+ char *endptr = NULL;
int ret;
int i;
@@ -629,6 +630,13 @@ int sdap_get_server_opts_from_rootdse(TALLOC_CTX *memctx,
opts->gen_map[SDAP_AT_ENTRY_USN].opt_name));
} else {
so->supports_usn = true;
+ so->last_usn = strtoul(last_usn_value, &endptr, 10);
+ if (endptr != NULL && (*endptr != '\0' || endptr == last_usn_value)) {
+ DEBUG(3, ("USN is not valid (value: %s)\n", last_usn_value));
+ so->last_usn = 0;
+ } else {
+ DEBUG(9, ("USN value: %s (int: %lu)\n", last_usn_value, so->last_usn));
+ }
}
}
} else {
@@ -644,6 +652,13 @@ int sdap_get_server_opts_from_rootdse(TALLOC_CTX *memctx,
opts->gen_map[SDAP_AT_ENTRY_USN].name =
talloc_strdup(opts->gen_map, usn_attrs[i].entry_name);
so->supports_usn = true;
+ so->last_usn = strtoul(last_usn_value, &endptr, 10);
+ if (endptr != NULL && (*endptr != '\0' || endptr == last_usn_value)) {
+ DEBUG(3, ("USN is not valid (value: %s)\n", last_usn_value));
+ so->last_usn = 0;
+ } else {
+ DEBUG(9, ("USN value: %s (int: %lu)\n", last_usn_value, so->last_usn));
+ }
last_usn_name = usn_attrs[i].last_name;
break;
}
diff --git a/src/providers/ldap/sdap.h b/src/providers/ldap/sdap.h
index 01a00d90c..fce95accc 100644
--- a/src/providers/ldap/sdap.h
+++ b/src/providers/ldap/sdap.h
@@ -295,6 +295,7 @@ struct sdap_options {
struct sdap_server_opts {
char *server_id;
bool supports_usn;
+ unsigned long last_usn;
char *max_user_value;
char *max_group_value;
};