From 04491e79dafde97824baa2cdb19e19dbf14d980a Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Mon, 7 May 2012 17:13:21 +0200 Subject: sudo ldap provider: add sdap_sudo_set_usn() --- src/providers/ldap/sdap_sudo.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/providers') diff --git a/src/providers/ldap/sdap_sudo.c b/src/providers/ldap/sdap_sudo.c index 8ce33a08..72ed3b63 100644 --- a/src/providers/ldap/sdap_sudo.c +++ b/src/providers/ldap/sdap_sudo.c @@ -163,6 +163,28 @@ int sdap_sudo_setup_periodical_full_refresh(struct sdap_id_ctx *id_ctx) return EOK; } +static void sdap_sudo_set_usn(struct sdap_server_opts *srv_opts, char *usn) +{ + unsigned int usn_number; + char *endptr = NULL; + + if (srv_opts != NULL && usn != NULL) { + talloc_zfree(srv_opts->max_sudo_value); + srv_opts->max_sudo_value = talloc_steal(srv_opts, usn); + + usn_number = strtoul(usn, &endptr, 10); + if ((endptr == NULL || (*endptr == '\0' && endptr != usn)) + && (usn_number > srv_opts->last_usn)) { + srv_opts->last_usn = usn_number; + } + + DEBUG(SSSDBG_FUNC_DATA, ("SUDO higher USN value: [%s]\n", + srv_opts->max_sudo_value)); + } else { + DEBUG(SSSDBG_TRACE_FUNC, ("srv_opts is NULL\n")); + } +} + static void sdap_sudo_reply(struct tevent_req *req) { struct be_req *be_req = NULL; -- cgit