1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
--- usr/lib/common/utility.c.orig 2022-04-25 11:04:51 UTC
+++ usr/lib/common/utility.c
@@ -21,6 +21,7 @@
#include <errno.h>
#include <pwd.h>
#include <grp.h>
+#include <fcntl.h>
#include <pthread.h>
#include <openssl/evp.h>
@@ -40,6 +41,22 @@
#include <sys/file.h>
#include <syslog.h>
+#ifndef LOCK_SH
+#define LOCK_SH 1
+#endif
+
+#ifndef LOCK_EX
+#define LOCK_EX 2
+#endif
+
+#ifndef LOCK_NB
+#define LOCK_NB 4
+#endif
+
+#ifndef LOCK_UN
+#define LOCK_UN 8
+#endif
+
CK_RV CreateXProcLock(char *tokname, STDLL_TokData_t *tokdata)
{
char lockfile[PATH_MAX];
@@ -82,7 +99,7 @@ CK_RV CreateXProcLock(char *tokname, STDLL_TokData_t *
lockdir, strerror(errno));
goto err;
}
- grp = getgrnam("pkcs11");
+ grp = getgrnam(PKCS11GROUP);
if (grp == NULL) {
fprintf(stderr, "getgrname(pkcs11): %s", strerror(errno));
goto err;
@@ -122,7 +139,7 @@ CK_RV CreateXProcLock(char *tokname, STDLL_TokData_t *
goto err;
}
- grp = getgrnam("pkcs11");
+ grp = getgrnam(PKCS11GROUP);
if (grp != NULL) {
if (fchown(tokdata->spinxplfd, -1, grp->gr_gid) == -1) {
OCK_SYSLOG(LOG_ERR,
|