2017-05-17 10:57:12 +00:00
|
|
|
diff -upr opencryptoki-3.7.0.orig/usr/lib/pkcs11/api/shrd_mem.c.in opencryptoki-3.7.0/usr/lib/pkcs11/api/shrd_mem.c.in
|
|
|
|
--- opencryptoki-3.7.0.orig/usr/lib/pkcs11/api/shrd_mem.c.in 2017-05-17 15:13:54.711536688 +0530
|
|
|
|
+++ opencryptoki-3.7.0/usr/lib/pkcs11/api/shrd_mem.c.in 2017-05-17 15:22:27.758655055 +0530
|
|
|
|
@@ -56,9 +56,6 @@ attach_shared_memory() {
|
2016-05-03 08:33:37 +00:00
|
|
|
int shmid;
|
|
|
|
char *shmp;
|
|
|
|
struct stat statbuf;
|
|
|
|
- struct group *grp;
|
|
|
|
- struct passwd *pw, *epw;
|
|
|
|
- uid_t uid, euid;
|
|
|
|
|
|
|
|
#if !(MMAP)
|
|
|
|
// Really should fstat the tok_path, since it will be the actual
|
2017-05-17 10:57:12 +00:00
|
|
|
@@ -70,37 +67,6 @@ attach_shared_memory() {
|
2012-02-27 12:14:18 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-08-27 13:21:08 +00:00
|
|
|
- uid = getuid();
|
|
|
|
- euid = geteuid();
|
|
|
|
- // only check group membership if not root user
|
|
|
|
- if (uid != 0 && euid != 0) {
|
|
|
|
- int i, member=0;
|
|
|
|
- grp = getgrnam("pkcs11");
|
|
|
|
- if (!grp) {
|
|
|
|
- // group pkcs11 not known to the system
|
|
|
|
- return NULL;
|
|
|
|
- }
|
|
|
|
- pw = getpwuid(uid);
|
|
|
|
- epw = getpwuid(euid);
|
|
|
|
- for (i=0; grp->gr_mem[i]; i++) {
|
|
|
|
- if (pw) {
|
|
|
|
- if (!strncmp(pw->pw_name, grp->gr_mem[i],strlen(pw->pw_name))) {
|
|
|
|
- member = 1;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (epw) {
|
|
|
|
- if (!strncmp(epw->pw_name, grp->gr_mem[i],strlen(epw->pw_name))) {
|
|
|
|
- member = 1;
|
2017-05-17 10:57:12 +00:00
|
|
|
- break;
|
2015-08-27 13:21:08 +00:00
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (!member) {
|
|
|
|
- return NULL;
|
|
|
|
- }
|
2012-02-27 12:14:18 +00:00
|
|
|
- }
|
2017-05-17 10:57:12 +00:00
|
|
|
-
|
2012-02-27 12:14:18 +00:00
|
|
|
Anchor->shm_tok = ftok(TOK_PATH,'b');
|
|
|
|
|
|
|
|
// Get the shared memory id.
|