Do not rely on hardcoded path to systemd-ask-password.
authorMichał Górny <mgorny@gentoo.org>
Tue, 30 Jul 2013 08:00:26 +0000 (10:00 +0200)
committerJeff Layton <jlayton@samba.org>
Tue, 30 Jul 2013 11:21:50 +0000 (07:21 -0400)
Relying on hardcoded /bin/systemd-ask-password path breaks systemd that
install systemd-ask-password in /usr/bin. Since both paths are supposed
to be in ${PATH} and popen() passes the command to shell, just pass
'systemd-ask-password' and let the shell find it.

Fixes: https://bugzilla.samba.org/show_bug.cgi?id=10054
Signed-off-by: Michał Górny <mgorny@gentoo.org>
mount.cifs.c

index e76beeea80dd40120501a9db966fca61436c6574..7206dcb8a5cfdf3dc8a6b1cc8ea8e71543b3aca5 100644 (file)
@@ -1626,7 +1626,7 @@ drop_child_privs(void)
 }
 
 /*
- * If systemd is running and /bin/systemd-ask-password --
+ * If systemd is running and systemd-ask-password --
  * is available, then use that else fallback on getpass(..)
  *
  * Returns: @input or NULL on error
@@ -1649,7 +1649,7 @@ get_password(const char *prompt, char *input, int capacity)
                FILE *ask_pass_fp = NULL;
 
                cmd = ret = NULL;
-               if (asprintf(&cmd, "/bin/systemd-ask-password \"%s\"", prompt) >= 0) {
+               if (asprintf(&cmd, "systemd-ask-password \"%s\"", prompt) >= 0) {
                        ask_pass_fp = popen (cmd, "re");
                        free (cmd);
                }