From 0a9caa3b3716846c944b76795b182caa4050e63a Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 21 Apr 2010 19:01:33 +0000 Subject: Backport of SVN r1097263 to fix Solaris compilation with [CVE-2010-0436] git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1117290 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdm/backend/util.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'kdm/backend/util.c') diff --git a/kdm/backend/util.c b/kdm/backend/util.c index c3e9a520c..b980862f1 100644 --- a/kdm/backend/util.c +++ b/kdm/backend/util.c @@ -35,6 +35,7 @@ from the copyright holder. */ #include "dm.h" +#include "dm_auth.h" #include "dm_error.h" #include @@ -519,6 +520,20 @@ mTime( const char *fn ) return st.st_mtime; } +void +randomStr( char *s ) +{ + static const char letters[] = + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + unsigned i, rn = secureRandom(); + + for (i = 0; i < 6; i++) { + *s++ = letters[rn % 62]; + rn /= 62; + } + *s = 0; +} + static int StrNChrCnt( const char *s, int slen, char c ) { -- cgit v1.2.1