diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-07-19 17:39:23 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-07-19 17:39:23 +0200 |
commit | 8557d14f65212faceb3e7223818b34b8869a0470 (patch) | |
tree | 77979da96009cd84c850db60a1300b9956fe8587 /lib | |
parent | 7a765b65b739c38ea1e3cfc136c92d2fb5ed4fa7 (diff) | |
parent | 4447bd96b90ce4bfca793d482f9dcbd98e6579a5 (diff) | |
download | samba-8557d14f65212faceb3e7223818b34b8869a0470.tar.gz samba-8557d14f65212faceb3e7223818b34b8869a0470.tar.bz2 samba-8557d14f65212faceb3e7223818b34b8869a0470.zip |
Merge branch 'master' of git://git.samba.org/samba
Diffstat (limited to 'lib')
-rw-r--r-- | lib/replace/libreplace.m4 | 1 | ||||
-rw-r--r-- | lib/replace/replace.h | 4 | ||||
-rw-r--r-- | lib/util/genrand.c | 3 | ||||
-rw-r--r-- | lib/util/tests/genrand.c | 2 | ||||
-rw-r--r-- | lib/util/util_file.c | 1 |
5 files changed, 10 insertions, 1 deletions
diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4 index 2d90d9c7e8..a3a26ef43e 100644 --- a/lib/replace/libreplace.m4 +++ b/lib/replace/libreplace.m4 @@ -103,6 +103,7 @@ AC_CHECK_HEADERS(sys/time.h time.h) AC_CHECK_HEADERS(stdarg.h vararg.h) AC_CHECK_HEADERS(sys/mount.h mntent.h) AC_CHECK_HEADERS(stropts.h) +AC_CHECK_HEADERS(unix.h) AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror) AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename) diff --git a/lib/replace/replace.h b/lib/replace/replace.h index fe1f732acb..2db6aa1226 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -258,6 +258,10 @@ char *rep_realpath(const char *path, char *resolved_path); int rep_lchown(const char *fname,uid_t uid,gid_t gid); #endif +#ifdef HAVE_UNIX_H +#include <unix.h> +#endif + #ifndef HAVE_SETLINEBUF #define setlinebuf rep_setlinebuf void rep_setlinebuf(FILE *); diff --git a/lib/util/genrand.c b/lib/util/genrand.c index cd1823a9a0..c51f9384b8 100644 --- a/lib/util/genrand.c +++ b/lib/util/genrand.c @@ -294,6 +294,7 @@ _PUBLIC_ uint32_t generate_random(void) _PUBLIC_ bool check_password_quality(const char *s) { int has_digit=0, has_capital=0, has_lower=0, has_special=0, has_high=0; + char* reals = s; while (*s) { if (isdigit((unsigned char)*s)) { has_digit |= 1; @@ -310,7 +311,7 @@ _PUBLIC_ bool check_password_quality(const char *s) } return ((has_digit + has_lower + has_capital + has_special) >= 3 - || (has_high > strlen(s)/2)); + || (has_high > strlen(reals)/2)); } /** diff --git a/lib/util/tests/genrand.c b/lib/util/tests/genrand.c index 5fe229c089..20a20ac7fa 100644 --- a/lib/util/tests/genrand.c +++ b/lib/util/tests/genrand.c @@ -40,6 +40,8 @@ static bool test_check_password_quality(struct torture_context *tctx) torture_assert(tctx, !check_password_quality("aaaaaaaaaaaa"), "same char password"); torture_assert(tctx, !check_password_quality("BLA"), "multiple upcases password"); torture_assert(tctx, !check_password_quality("123"), "digits only"); + torture_assert(tctx, !check_password_quality("matthiéu"), "not enough high symbols"); + torture_assert(tctx, check_password_quality("abcdééàçè"), "valid"); torture_assert(tctx, check_password_quality("A2e"), "valid"); torture_assert(tctx, check_password_quality("BA2eLi443"), "valid"); return true; diff --git a/lib/util/util_file.c b/lib/util/util_file.c index 0275e78c54..7466004e5c 100644 --- a/lib/util/util_file.c +++ b/lib/util/util_file.c @@ -380,6 +380,7 @@ _PUBLIC_ bool file_save(const char *fname, const void *packet, size_t length) return false; } if (write(fd, packet, length) != (size_t)length) { + close(fd); return false; } close(fd); |