Browse Source

l/scute: Patched to fix location of gpg-agent socket.

slackware-14.2
Damien Goutte-Gattat 6 years ago
parent
commit
57fed3f221
  1. 103
      l/scute/scute-1.5.0-fix-socket-location.diff
  2. 3
      l/scute/scute.SlackBuild

103
l/scute/scute-1.5.0-fix-socket-location.diff

@ -0,0 +1,103 @@
diff --git a/src/agent.c b/src/agent.c
index 75d4933..ef5c72a 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -255,7 +255,7 @@ agent_connect (assuan_context_t *ctx_r)
/* First check whether we can connect at the standard
socket. */
- sockname = make_filename (default_homedir (), "S.gpg-agent", NULL);
+ sockname = make_filename (socketdir (), "S.gpg-agent", NULL);
if (! sockname)
return gpg_error_from_errno (errno);
diff --git a/src/get-path.c b/src/get-path.c
index 0abd863..03097ca 100644
--- a/src/get-path.c
+++ b/src/get-path.c
@@ -44,6 +44,9 @@
#include <windows.h>
#include <shlobj.h>
#include <io.h>
+#else
+#include <sys/stat.h>
+#include <unistd.h>
#endif
#include "support.h"
@@ -440,6 +443,58 @@ default_homedir (void)
return dir;
}
+#ifdef HAVE_W32_SYSTEM
+#define socketdir default_homedir
+#else
+
+static int
+check_socketdir (const char *dir)
+{
+ struct stat st;
+
+ if (stat (dir, &st) == -1)
+ return 0;
+ if (!S_ISDIR (st.st_mode))
+ return 0;
+ if (st.st_uid != getuid ())
+ return 0;
+ if (st.st_mode & (S_IRWXG|S_IRWXO))
+ return 0;
+
+ return 1;
+}
+
+const char *
+socketdir (void)
+{
+ static char buffer[255];
+ char *infostr, *dir = NULL;
+
+ if ((infostr = getenv ("GNUPGHOME")))
+ /* FIXME: We should also check for a directory under [/var]/run. */
+ dir = infostr;
+ else
+ {
+ static const char *prefixes[] = { "/run", "/var/run", NULL };
+ int i;
+
+ for (i = 0; !dir && prefixes[i]; i++)
+ {
+ snprintf (buffer, sizeof buffer, "%s/user/%u/gnupg",
+ prefixes[i], getuid ());
+ if (check_socketdir (buffer))
+ dir = buffer;
+ }
+
+ if (!dir)
+ dir = GNUPG_DEFAULT_HOMEDIR;
+ }
+
+ return dir;
+}
+
+#endif /*!HAVE_W32_SYSTEM*/
+
/* Construct a filename from the NULL terminated list of parts. Tilde
expansion is done here. */
diff --git a/src/support.h b/src/support.h
index 3356224..6726947 100644
--- a/src/support.h
+++ b/src/support.h
@@ -90,10 +90,11 @@ const char *get_gpg_agent_path (void);
should be parsed later. */
const char *default_homedir (void);
+const char *socketdir (void);
+
/* Construct a filename from the NULL terminated list of parts. Tilde
expansion is done here. */
char *make_filename (const char *first_part, ...);
-
#endif /* !SUPPORT_H */

3
l/scute/scute.SlackBuild

@ -29,7 +29,7 @@ NAMESRC=${NAMESRC:-scute}
VERSION=${VERSION:-1.5.0}
ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION.tar.bz2}
WGET=${WGET:-ftp://ftp.gnupg.org/gcrypt/scute/$ARCHIVE}
GITREV=${GITREV:-94eeb2d}
GITREV=${GITREV:-e4bcc78}
# Build infos
NAMEPKG=${NAMEPKG:-scute}
@ -92,6 +92,7 @@ cd $TMP
echo "Building $ARCHIVE..."
tar xf $CWD/$ARCHIVE
cd $NAME
patch -p 1 < $CWD/scute-1.5.0-fix-socket-location.diff
CFLAGS=$CPUOPT \
CXXFLAGS=$CPUOPT \
./configure \

Loading…
Cancel
Save