URI:
       add back support for reading the password from the tty using readpassphrase - susmb - fork from usmb 20130204: mount SMB/CIFS shares via FUSE
  HTML git clone git://git.codemadness.org/susmb
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit eb8f06e5e0f3dfc37d223025c6a43c99b963c2ef
   DIR parent dfdccace2be9448be27d3b6b3f07997e35fe8968
  HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Sun, 22 Feb 2026 13:55:52 +0100
       
       add back support for reading the password from the tty using readpassphrase
       
       Requested for the OpenBSD port.
       
       readpassphrase is available in the libbsd compat layer for Linux.
       
       Diffstat:
         M susmb.1                             |       5 +++--
         M susmb.c                             |      24 +++++++++++++++++++-----
       
       2 files changed, 22 insertions(+), 7 deletions(-)
       ---
   DIR diff --git a/susmb.1 b/susmb.1
       @@ -1,4 +1,4 @@
       -.Dd March 5, 2025
       +.Dd February 22, 2026
        .Dt SUSMB 1
        .Os
        .Sh NAME
       @@ -18,8 +18,9 @@
        .Ar URI
        is in the format: smb://domain\\someuser@192.168.1.1/Storage
        .Pp
       -The password should be specified with the environment variable
       +The password can be specified with the environment variable
        .Ev SMB_PASS .
       +If the variable is not set then the password is read from the tty.
        .Sh DESCRIPTION
        .Nm
        mounts SMB and CIFS shares through FUSE, including Samba shares and
   DIR diff --git a/susmb.c b/susmb.c
       @@ -55,7 +55,10 @@
        
        /* use libbsd stdlib.h for arc4random() */
        #ifdef __linux__
       +#include <bsd/readpassphrase.h>
        #include <bsd/stdlib.h>
       +#else
       +#include <readpassphrase.h>
        #endif
        
        #ifndef __OpenBSD__
       @@ -1227,6 +1230,7 @@ main(int argc, char **argv)
                struct passwd *pw;
                char *tmp, *p;
                char **fuse_argv;
       +        char passbuf[1024];
                int fuse_argc;
                int ch, ret = 1;
                long l;
       @@ -1285,10 +1289,6 @@ main(int argc, char **argv)
                if (opt_privdrop && (opt_uid == 0 || opt_gid == 0))
                        usage();
        
       -        /* password is read from enviroment variable.
       -           It is assumed the environment is secure */
       -        if ((tmp = getenv("SMB_PASS")) != NULL)
       -                opt_password = xstrdup(tmp);
        
                /* options were succesfully parsed */
                if (ch == '?' || ch == ':') {
       @@ -1314,7 +1314,7 @@ main(int argc, char **argv)
        
                /* password in userinfo field is not allowed */
                if (strchr(u.userinfo, ':')) {
       -                fprintf(stderr, "password must be specified via $SMB_PASS\n\n");
       +                fprintf(stderr, "password must be specified via $SMB_PASS or from the tty\n\n");
                        usage();
                }
        
       @@ -1334,6 +1334,20 @@ main(int argc, char **argv)
        
                opt_mountpoint = xstrdup(argv[1]);
        
       +        /* password is read from enviroment variable.
       +           It is assumed the environment is secure */
       +        if ((tmp = getenv("SMB_PASS")) != NULL) {
       +                opt_password = xstrdup(tmp);
       +        } else {
       +                /* otherwise read from the tty */
       +                if (readpassphrase("Password: ", passbuf, sizeof(passbuf),
       +                    RPP_REQUIRE_TTY) == NULL)
       +                        errx(1, "unable to read passphrase");
       +                /* copy password this is also later cleared after use */
       +                opt_password = xstrdup(passbuf);
       +                explicit_bzero(passbuf, sizeof(passbuf));
       +        }
       +
                if (opt_mountpoint == NULL || opt_mountpoint[0] == '\0' ||
                    opt_server == NULL || opt_server[0] == '\0' ||
                    opt_share == NULL || opt_share[0] == '\0' ||