openbsd-ports/x11/gnome/controlcenter/patches/patch-panels_user-accounts_um-user_c
2012-03-29 06:57:02 +00:00

53 lines
1.3 KiB
Plaintext

$OpenBSD: patch-panels_user-accounts_um-user_c,v 1.2 2012/03/29 06:57:03 ajacoutot Exp $
--- panels/user-accounts/um-user.c.orig Tue Feb 14 11:13:17 2012
+++ panels/user-accounts/um-user.c Wed Mar 28 10:25:04 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>
@@ -924,6 +931,7 @@ salt_char (GRand *rand)
static gchar *
make_crypted (const gchar *plain)
{
+#if ! defined __OpenBSD__
GString *salt;
gchar *result;
GRand *rand;
@@ -943,6 +951,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;
}