summaryrefslogtreecommitdiffstats
path: root/kdm/backend/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'kdm/backend/util.c')
-rw-r--r--kdm/backend/util.c15
1 files changed, 15 insertions, 0 deletions
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 <string.h>
@@ -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 )
{