summaryrefslogtreecommitdiff
path: root/security/opencryptoki/files/patch-usr-lib-pkcs11-common-utility.c
blob: f8ddb5bb768286097eb63f533ac19c80fa2e8c6e (plain) (blame)
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
--- usr/lib/pkcs11/common/utility.c.orig	2016-04-29 17:26:46 UTC
+++ usr/lib/pkcs11/common/utility.c
@@ -275,9 +275,28 @@
              legal action under this Agreement more than one year after
              the cause of action arose. Each party waives its rights to
              a jury trial in any resulting litigation. 
+*/
 
+#include <fcntl.h>
 
-*/
+#ifdef __sun
+#define	LOCK_EX	F_LOCK
+#define	LOCK_UN	F_ULOCK
+#define	flock(fd, func)	lockf(fd, func, 0)
+#endif
+
+#ifndef	LOCK_SH
+#define	LOCK_SH	1	/* shared lock */
+#endif
+#ifndef	LOCK_EX
+#define	LOCK_EX	2	/* exclusive lock */
+#endif
+#ifndef	LOCK_NB
+#define	LOCK_NB	4	/* don't block when locking */
+#endif
+#ifndef	LOCK_UN
+#define	LOCK_UN	8	/* unlock */
+#endif
 
 /* (C) COPYRIGHT International Business Machines Corp. 2001,2002          */
 
@@ -587,7 +606,7 @@ CK_RV CreateXProcLock(void)
 					goto err;
 				}
 
-				grp = getgrnam("pkcs11");
+				grp = getgrnam(PKCS11GROUP);
 				if (grp != NULL) {
 					if (fchown(spinxplfd, -1, grp->gr_gid)
 					    == -1) {
@@ -1131,7 +1150,7 @@ CK_RV check_user_and_group()
 	 * when forked). So we need to get the group information.
 	 * Really need to take the uid and map it to a name.
 	 */
-	grp = getgrnam("pkcs11");
+	grp = getgrnam(PKCS11GROUP);
 	if (grp == NULL) {
 		OCK_SYSLOG(LOG_ERR, "getgrnam() failed: %s\n", strerror(errno));
 		goto error;