$OpenBSD: patch-panels_user-accounts_um-user_c,v 1.3 2012/09/28 09:34:33 ajacoutot Exp $
--- panels/user-accounts/um-user.c.orig	Mon Sep 24 17:39:34 2012
+++ panels/user-accounts/um-user.c	Fri Sep 28 10:32:20 2012
@@ -19,7 +19,11 @@
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */
 
+#if defined __OpenBSD__
+#define _BSD_SOURCE
+#else
 #define _XOPEN_SOURCE
+#endif
 
 #include "config.h"
 
@@ -27,6 +31,9 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#if defined __OpenBSD__ /* for bcrypt_gensalt() */
+#include <pwd.h>
+#endif
 #include <unistd.h>
 
 #include <glib.h>
@@ -808,6 +815,7 @@ salt_char (GRand *rand)
 static gchar *
 make_crypted (const gchar *plain)
 {
+#if ! defined __OpenBSD__
         GString *salt;
         gchar *result;
         GRand *rand;
@@ -827,6 +835,18 @@ make_crypted (const gchar *plain)
 
         g_string_free (salt, TRUE);
         g_rand_free (rand);
+#else
+	gchar *result, *salt;
+	gchar buffer[_PASSWORD_LEN];
+
+	/*
+	 * XXX output a "blowfish,6" encrypted password whatever
+	 * localcipher value is defined in login.conf(5).
+	 */
+	strlcpy(buffer, bcrypt_gensalt(6), _PASSWORD_LEN);
+	salt = buffer;
+	result = g_strdup (crypt (plain, salt));
+#endif
 
         return result;
 }
