shithub: tlsclient

Download patch

ref: 13b4ffb9da011aadac40ddd35b47e7b914d1775b
parent: bf70c2f9d9e10fa5eb226ace7dbbfb998dd7c3be
author: Jacob Moody <moody@posixcafe.org>
date: Fri Jul 21 04:47:06 EDT 2023

add a default TLSCLIENT_ASKPASS for mount helper

--- a/mount.c
+++ b/mount.c
@@ -26,6 +26,7 @@
 static char *port = NULL;
 static char *user = NULL;
 static char *authbox = NULL;
+static char *askpass = "/usr/bin/env systemd-ask-password";
 
 static void
 appendarg(char *s)
@@ -60,6 +61,9 @@
 	} else if(strcmp(key, "auth") == 0){
 		authbox = strdup(val);
 		return;
+	} else if(strcmp(key, "askpass") == 0){
+		askpass = strdup(val);
+		return;
 	} else if(strcmp(key, "user") == 0){
 		user = strdup(val);
 		/* passthrough as well */
@@ -182,6 +186,7 @@
 		errx(EINVAL, "a port option must be given");
 	if(user == NULL && (user = getenv("USER")) == NULL)
 		errx(EINVAL, "user option not given and count not infer");
+	setenv("TLSCLIENT_ASKPASS", askpass, 1);
 	flattenoptions(options, sizeof options);
 
 	appendarg("tlsclient");