$OpenBSD: patch-base_password_py,v 1.6 2017/06/15 14:40:37 ajacoutot Exp $
Index: base/password.py
--- base/password.py.orig
+++ base/password.py
@@ -23,6 +23,7 @@ import os
 import getpass
 import time
 import string
+import platform
 
 from . import utils, tui
 from .g import *
@@ -55,6 +56,7 @@ AUTH_TYPES ={'mepis':'su',
              'gos':'sudo',
              'boss':'su',
              'lfs':'su',
+             'openbsd':'su',
              }
 
 
@@ -86,10 +88,13 @@ def get_distro_name():
         name.close()
 
     if not os_name:
-       name = os.popen("cat /etc/issue | awk '{print $1}' | head -n 1")
+       name = os.popen("cat /etc/issue 2>/dev/null | awk '{print $1}' | head -n 1")
        os_name = name.read().strip()
        name.close()
 
+    if not os_name:
+        os_name = platform.system()
+
     os_name = os_name.lower()
     if "redhatenterprise" in os_name:
         os_name = 'rhel'
@@ -315,7 +320,11 @@ class Password(object):
 
     def __get_password_utils(self):
         if self.__authType == "su":
-            AuthType, AuthCmd = 'su', 'su -c "%s"'
+            # in this context, `-c' refers to the BSD login class
+            if sys.platform.startswith('openbsd'):
+                AuthType, AuthCmd = 'su', 'su root -c "%s"'
+            else:
+                AuthType, AuthCmd = 'su', 'su -c "%s"'
         else:
             AuthType, AuthCmd = 'sudo', 'sudo %s'
 
@@ -327,7 +336,11 @@ class Password(object):
         if self.__authType == "sudo":
             AuthType, AuthCmd = 'sudo', 'sudo %s'
         else:
-            AuthType, AuthCmd  = 'su', 'su -c "%s"'
+            # in this context, `-c' refers to the BSD login class
+            if sys.platform.startswith('openbsd'):
+                AuthType, AuthCmd = 'su', 'su root -c "%s"'
+            else:
+                AuthType, AuthCmd  = 'su', 'su -c "%s"'
         '''
         if utils.which('kdesu'):
             AuthType, AuthCmd = 'kdesu', 'kdesu -- %s'
