return strdup_to(ret, p);
}
-bool looks_like_hashed_password(const char *s) {
- /* Returns false if the specified string is certainly not a hashed UNIX password. crypt(5) lists
- * various hashing methods. We only reject (return false) strings which are documented to have
- * different meanings.
- *
- * In particular, we allow locked passwords, i.e. strings starting with "!", including just "!",
- * i.e. the locked empty password. See also fc58c0c7bf7e4f525b916e3e5be0de2307fef04e.
- */
- if (!s)
- return false;
-
- s += strspn(s, "!"); /* Skip (possibly duplicated) locking prefix */
-
- return !STR_IN_SET(s, "x", "*");
-}
-
int test_password_one(const char *hashed_password, const char *password) {
_cleanup_(erase_and_freep) void *cd_data = NULL;
int cd_size = 0;
return false;
}
+
+bool looks_like_hashed_password(const char *s) {
+ /* Returns false if the specified string is certainly not a hashed UNIX password. crypt(5) lists
+ * various hashing methods. We only reject (return false) strings which are documented to have
+ * different meanings.
+ *
+ * In particular, we allow locked passwords, i.e. strings starting with "!", including just "!",
+ * i.e. the locked empty password. See also fc58c0c7bf7e4f525b916e3e5be0de2307fef04e.
+ */
+ if (!s)
+ return false;
+
+ s += strspn(s, "!"); /* Skip (possibly duplicated) locking prefix */
+
+ return !STR_IN_SET(s, "x", "*");
+}
static inline int hash_password(const char *password, char **ret) {
return hash_password_full(password, NULL, NULL, ret);
}
-bool looks_like_hashed_password(const char *s);
int test_password_one(const char *hashed_password, const char *password);
int test_password_many(char **hashed_password, const char *password);
+bool looks_like_hashed_password(const char *s);