summaryrefslogtreecommitdiff
path: root/src/providers
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2010-11-23 17:43:23 +0100
committerStephen Gallagher <sgallagh@redhat.com>2010-12-06 09:30:13 -0500
commit39875788b552ed157e68156e64e95dda5dc6aa43 (patch)
treec782c26c61e765ba2793c8d750aad04ec6231001 /src/providers
parentf414e7061d600a656c6773fd4e5e87dd561fae16 (diff)
downloadsssd-39875788b552ed157e68156e64e95dda5dc6aa43.tar.gz
sssd-39875788b552ed157e68156e64e95dda5dc6aa43.tar.bz2
sssd-39875788b552ed157e68156e64e95dda5dc6aa43.zip
Make string_to_shadowpw_days() public
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/ldap/ldap_auth.c33
-rw-r--r--src/providers/ldap/ldap_common.c34
-rw-r--r--src/providers/ldap/ldap_common.h2
3 files changed, 36 insertions, 33 deletions
diff --git a/src/providers/ldap/ldap_auth.c b/src/providers/ldap/ldap_auth.c
index 57a549d8..5a85fe91 100644
--- a/src/providers/ldap/ldap_auth.c
+++ b/src/providers/ldap/ldap_auth.c
@@ -232,39 +232,6 @@ static errno_t check_pwexpire_ldap(struct pam_data *pd,
return EOK;
}
-static errno_t string_to_shadowpw_days(const char *s, long *d)
-{
- long l;
- char *endptr;
-
- if (s == NULL || *s == '\0') {
- *d = -1;
- return EOK;
- }
-
- errno = 0;
- l = strtol(s, &endptr, 10);
- if (errno != 0) {
- DEBUG(1, ("strtol failed [%d][%s].\n", errno, strerror(errno)));
- return errno;
- }
-
- if (*endptr != '\0') {
- DEBUG(1, ("Input string [%s] is invalid.\n", s));
- return EINVAL;
- }
-
- if (*d < -1) {
- DEBUG(1, ("Input string contains not allowed negative value [%d].\n",
- *d));
- return EINVAL;
- }
-
- *d = l;
-
- return EOK;
-}
-
static errno_t find_password_expiration_attributes(TALLOC_CTX *mem_ctx,
const struct ldb_message *msg,
struct dp_option *opts,
diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c
index aa0bac64..d9d44c89 100644
--- a/src/providers/ldap/ldap_common.c
+++ b/src/providers/ldap/ldap_common.c
@@ -738,3 +738,37 @@ done:
talloc_zfree(tmp_ctx);
return ret;
}
+
+errno_t string_to_shadowpw_days(const char *s, long *d)
+{
+ long l;
+ char *endptr;
+
+ if (s == NULL || *s == '\0') {
+ *d = -1;
+ return EOK;
+ }
+
+ errno = 0;
+ l = strtol(s, &endptr, 10);
+ if (errno != 0) {
+ DEBUG(1, ("strtol failed [%d][%s].\n", errno, strerror(errno)));
+ return errno;
+ }
+
+ if (*endptr != '\0') {
+ DEBUG(1, ("Input string [%s] is invalid.\n", s));
+ return EINVAL;
+ }
+
+ if (*d < -1) {
+ DEBUG(1, ("Input string contains not allowed negative value [%d].\n",
+ *d));
+ return EINVAL;
+ }
+
+ *d = l;
+
+ return EOK;
+}
+
diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h
index 5c298d1b..d24a9839 100644
--- a/src/providers/ldap/ldap_common.h
+++ b/src/providers/ldap/ldap_common.h
@@ -143,4 +143,6 @@ int netgroup_get_recv(struct tevent_req *req, int *dp_error_out);
/* setup child logging */
int setup_child(struct sdap_id_ctx *ctx);
+
+errno_t string_to_shadowpw_days(const char *s, long *d);
#endif /* _LDAP_COMMON_H_ */